Custom Patrol Points

The best and quickest support by a group of top-notch editing specialists, guaranteed!

Moderator: Forum Guards

Custom Patrol Points

Postby SimonDenton » Fri Apr 20, 12 11:34 am

I am making great progress in my mod thanks to your help!

For an idea I really like, I thought of having custom pratrol points which randomly select a subsequent patrol point and a value for wait time. This may seem large in scope but I see it as a simple application of replacing a variable with sub variables.

Firstly, for randomly selected NextPatrol I do this:
var() name subPoint1;
var() name subPoint2;
var() name subPoint3;

I would enter the appropriate values of the other patrol points within mapping. Now in scripted pawn it searches for NextPatrol. This can still happen, all we are doing is we are changing the name of NextPatrol to the name of one of the three subPoint variables

Code: Select all
//=============================================================================
// PatrolPoint.
//=============================================================================
class SummerPatrolPoint extends SummerNavigationPoint;



var() name Nextpatrol; // This will be replaced by one of the sub points
var() name subPoint1;
var() name subPoint2;
var() name subPoint3;
var() float pausetime; //This will be replaced bu one of the sub times
var() float subTime1;
var() float subTime2;
var() float subTime3;

var    vector lookdir;
var() name PatrolAnim;
var() sound PatrolSound;
var() byte numAnims;
var int   AnimCount;
var PatrolPoint NextPatrolPoint;



function PreBeginPlay()
{
   local PatrolPoint CurPoint;
   local float subPointRand;
   local float subWaitTimeRand;

   lookdir = 200 * vector(Rotation);

   //==================================
   //Randomise the next patrol point

   subPointRand = FRand();

   if(subPointRand < 0.33)
   {
   log("");
   Nextpatrol = subPoint1;
   }

   if(subPointRand < 0.33)
   {
   Nextpatrol = subPoint2;
   }

   else
   Nextpatrol = subPoint3;

   //==================================
   //Randomise the waiting time

   subWaitTimeRand = FRand();

   if(subWaitTimeRand < 0.33)
   {
   pausetime = subTime1;
   }

   if(subWaitTimeRand < 0.66)
   {
   pausetime =subTime2;
   }

   else
   pausetime =subTime1;
   

   //find the patrol point with the tag specified by Nextpatrol
   NextPatrolPoint = None;
   if (NextPatrol != '')
   {
      foreach AllActors(class 'SummerEngine.SummerPatrolPoint', CurPoint, Nextpatrol)
      {
         if (CurPoint != self)
         {
            NextPatrolPoint = CurPoint;
            break;
         }
      }
   }
   
   Super.PreBeginPlay();
}
// DEUS_EX STM -- end changes

defaultproperties
{
    bDirectional=True
    Texture=Texture'S_Patrol'
    SoundVolume=128
}






defaultproperties
{
    bDirectional=True
    Texture=Texture'Engine.S_Patrol'
    SoundVolume=128
}



The error is Error, Call to 'AllActors': type mismatch in parameter 2 regarding foreach AllActors(class 'SummerEngine.SummerPatrolPoint', CurPoint, Nextpatrol).

If I just leave it as PatrolPoint then it will look for invalid destinations.

If we can take care of this, we can apply the same technique to random wait times!

Thanks :)
Last edited by SimonDenton on Wed May 16, 12 1:37 pm, edited 2 times in total.
SimonDenton
Wannabe
 
Posts: 117
Joined: Sun Oct 03, 10 12:06 pm

Postby SimonDenton » Wed May 16, 12 1:38 pm

Updated with proper code. I forgot that it needs to search for another SummerPatrolPoint :D
SimonDenton
Wannabe
 
Posts: 117
Joined: Sun Oct 03, 10 12:06 pm

Postby RedDynasty » Wed May 16, 12 1:43 pm

Maybe u need to extend it to the normal patrolpoint and not the navigationpoint?
Image
Your not a gamer until you played this.
User avatar
RedDynasty
Wannabe
 
Posts: 130
Joined: Sun Apr 01, 12 8:12 pm
Location: Portugal

Postby SimonDenton » Wed May 16, 12 2:14 pm

Thanks for the reply RedDynasty!

This code includes all of the DX PatrolPoint code along with my custom additions so there is no need to extend Patrol Point. I just did it and compiled it with the same error showing up.
SimonDenton
Wannabe
 
Posts: 117
Joined: Sun Oct 03, 10 12:06 pm

Postby RedDynasty » Wed May 16, 12 2:23 pm

hmm i dont know much on coding so i cant help much, poor or other people might be able to help you.
Im guessing it must be a incorrect word in the code or function.
Image
Your not a gamer until you played this.
User avatar
RedDynasty
Wannabe
 
Posts: 130
Joined: Sun Apr 01, 12 8:12 pm
Location: Portugal


Return to Editing issues

Who is online

Users browsing this forum: No registered users and 20 guests
cron