Patrol Points (PPs), what they are and how they work


(nUllSkillZ) #21

Thanks.

Thought that only eight accum’s can be used in the whole script.
Is this restriction only valid for one entity script block?
Meaning that it is possible to use eight accum’s in the first entity script block + another eight in the next entity script block + …

:banghead:

Hmm, still call me a nOOb.


(G0-Gerbil) #22

Yup, 8 per script block, which in this case is plenty.
I think somewhere it claims you have 16 per block, but I’m pretty sure it’s only 8.
Oh and you have 8 globalaccum as well.


(G0-Gerbil) #23

Doing a slightly bigger rewrite than originally intended.
Reason being I was using a few trigger_if_equal calls in my PP script.
While a nice neat solution, it does have the rather large drawback that it makes renaming the script a pain in the arse.
Why?
Because trigger_if_equal cannot use ‘self’ as a legitimate script_block, so it requires the name.
This means if you rename the script block you have to go through and change it in the trigger_if_equals too.
So am replacing them with normal trigger calls and abort_if checks, which all use ‘self’. So renaming or adding multiple PPs in the script is as simple as copying the script and changing it’s object name.


(G0-Gerbil) #24

OK updated, with two sample maps, the icon graphics, shader file and a tutorial in it (detailing both basic and advanced patrol points):

http://theburrow.fragland.net/tutorials/downloads/patrolpoints.zip <- 250k approx

What’s new?

More flexibility in setting up the PP and more callbacks allowing you to react to important PP triggered events.
Here’s the vanilla script - before you run away screaming note it’s only the top few routines (in the ‘user customisable’ section) that you need even remotely concern yourself with:


///////////////////////////////////////////////////////////////////////////////////////////////////////////
<name>
{
	/////////////////////////////
	// User modifiable scripts //
	/////////////////////////////

	////////////////////////////////////////////////////////////////
	// Things to do when this object spawns. Is called from normal spawn{}
	// and already has a delay built in so no need for a wait line
	trigger pp_spawn
	{
	}

	////////////////////////////////////////////////////////////////
	// How long you must be in the PP to enable it (in seconds)
	// Note this is MEANT to use same accum as trigger disabletime
	trigger enabletime
	{
		accum 2 set 15
	}
	////////////////////////////////////////////////////////////////
	// How long the PP must be unattended for to disable (in seconds)
	// Note this is MEANT to use same accum as trigger enabletime
	trigger disabletime
	{
		accum 2 set 15
	}
	////////////////////////////////////////////////////////////////
	// Whether 'keep alive' is enabled [0 = disabled, 1 = enabled]
	trigger keepalive
	{
		accum 4 set 1
	}
	////////////////////////////////////////////////////////////////
	// Number of times PP can be used [-1 = infinite, 0 = never, >0 = number of times]
	trigger reusable
	{
		accum 5 set -1
	}

	////////////////////////////////////////////////////////////////
	// This is where you put anything you want to happen when the PP is enabled
	trigger enable
	{
	}
	////////////////////////////////////////////////////////////////
	// This is where you put anything you want to happen when the PP is disabled
	// Usually you'd cancel whatever happened when the PP was enabled
	trigger disable
	{
	}

	////////////////////////////////////////////////////////////////
	// This is where you put anything you want to happen when the PP is first entered
	trigger firstentered
	{
	}
	////////////////////////////////////////////////////////////////
	// This is where you put anything you want to happen when there is only
	// five seconds until the patrol point is enabled
	trigger enablein5
	{
	}
	////////////////////////////////////////////////////////////////
	// This is where you put anything you want to happen each second as
	// the patrol point is being enabled
	trigger tick
	{
	}

	////////////////////////////////////////////////////////////////
	// This is where you put anything you want to happen when the PP will disable in 10 seconds
	// If your PP is only active for a short period of time (20 seconds or less for example) then
	// you'll probably want to leave this section empty
	trigger disablein10
	{
	}

	////////////////////////////////////////////////////////////////
	// This is called after 'disable' for the last use of the patrol point
	// Only relevant if you have given it a limited number of uses
	trigger nomoreuses
	{
	}

	////////////////////////////
	// Non-modifiable scripts //
	////////////////////////////

	// Called when object is spawned
	spawn
	{
		accum 1 set 0		// PP state: [0 = disabled, 1 = enabled]
		trigger self enabletime	// (accum 2) Timer:
					//	When PP state = 0 then is time remaining until PP is enabled
					//	When PP state = 1 then is time remaining until PP is disabled
		accum 3 set 0		// PP trigger state: [0 = not used, 1 = used]
		trigger self keepalive  // (accum 4) PP 'keep alive' option: [0 = disabled, 1 = enabled] 
		trigger self reusable	// (accum 5) Reusable option [-1 = infinite, 0 = never, >0 = number of times]
		accum 6 set 0		// Previous PP trigger state. Used to determine if countdown has just started:
					//	[0 = not used, 1 = used]

		wait 200		// Pause
		trigger self pp_spawn	// Calls user defined spawn function
	}

	// Called when player is inside PP trigger
	trigger in
	{
		accum 3 set 1		// Mark as used this time
	}

	// Called once a second to see if PP trigger is in use
	// Used to control whether PP should be activated, deactivated, or kept alive
	trigger check
	{
		// General PP control
		trigger self incheck
		trigger self outcheck

		// Store state of PP trigger flag
		trigger self storestate0
		trigger self storestate1

		accum 3 set 0			// Reset PP trigger flag
	}

	trigger storestate0
	{
		accum 3 abort_if_not_equal 0	// Only continue if flag is appropriate value
		accum 6 set 0			// Copy state into accum 6
	}

	trigger storestate1
	{
		accum 3 abort_if_not_equal 1	// Only continue if flag is appropriate value
		accum 6 set 1			// Copy state into accum 6
	}

	trigger incheck
	{
		accum 3 abort_if_not_equal 1	// Only continue if inside trigger
		accum 2 inc -1			// Count down time remaining until something happens

		// Process depending on whether PP is enabled or not?
		trigger self inenabledcheck
		trigger self indisabledcheck
	}

	trigger outcheck
	{
		accum 3 abort_if_not_equal 0	// Only continue if inside trigger

		// Process depending on whether PP is enabled or not?
		trigger self outenabledcheck
		trigger self outdisabledcheck
	}

	trigger inenabledcheck
	{
		accum 1 abort_if_not_equal 1		// Only continue if  PP is enabled
		trigger self inenabledkeepalive		// React if using keep alive
		trigger self inenablednokeepalive	// React if not using keep alive

	}

	trigger inenabledkeepalive
	{
		accum 4 abort_if_not_equal 1	// Only continue if using 'keep alive'
		trigger self disabletime	// Reset timer
	}

	trigger inenablednokeepalive
	{
		accum 4 abort_if_not_equal 0	// Only continue if not using 'keep alive'

		trigger self 10remainingcheck	// Call '10 seconds remaining' event check

		accum 2 abort_if_greater_than 0	// Continue only if PP has been enabled for full time
		trigger self disableevent	// Sets off the disabling of the PP
	}

	trigger indisabledcheck
	{
		accum 1 abort_if_not_equal 0	// Only continue if PP is disabled
		accum 5 abort_if_equal 0	// Only continue if PP can be used again

		trigger self FirstEnteredCheck	// Call 'first entered' check
		trigger self EnableIn5Check	// Call '5 seconds to enable' check

		trigger self tick		// Cause a tick event every second as PP is getting enabled
		accum 2 abort_if_greater_than 0	// Continue only if PP trigger has been used for long enough
		accum 1 set 1			// Mark PP as in use now
		trigger self disabletime	// Reset counter for time to disable
		trigger self enable		// Enable whatever effect this PP has
		accum 5 abort_if_less_than 1	// Only continue if there is a positive amount of uses left
		accum 5 inc -1			// Count down number of times can be used
	}

	trigger outenabledcheck
	{
		accum 1 abort_if_not_equal 1	// Only continue if PP is enabled
		accum 2 inc -1			// Decrement PP timer

		trigger self 10remainingcheck	// Call '10 seconds remaining' event check

		accum 2 abort_if_greater_than 0	// Stop if timer is greater than 0
		trigger self disableevent	// Sets off the disabling of the PP
	}

	trigger outdisabledcheck
	{
		accum 1 abort_if_not_equal 0	// Only continue if PP is disabled
		trigger self enabletime		// Reset timer
	}

	trigger FirstEnteredCheck
	{
		accum 6 abort_if_not_equal 0	// Only continue if first time entered
		trigger self firstentered	// Do 'first entered' event
	}

	trigger EnableIn5Check
	{
		accum 2 abort_if_not_equal 5	// Only continue if 5 seconds remaining until enable
		trigger self enablein5		// Do '5 seconds to enable' event
	}

	trigger 10remainingcheck
	{
		accum 2 abort_if_not_equal 10	// Only continue if 10 seconds remaining until disable
		trigger self disablein10	// Do '10 seconds remaining' event
	}

	trigger disableevent
	{
		accum 1 set 0			// Mark PP as not in use now
		trigger self enabletime		// Reset counter for time to enable
		trigger self disable		// Disable whatever effect this PP has
		accum 5 abort_if_not_equal 0	// Only continue if PP cannot be used any more times
		trigger self nomoreuses		// Reacts to no more PP uses
	}
}


(G0-Gerbil) #25

Now it uses only 3 accum’s instead of 5.

BTW it uses 6 now, not 5 :slight_smile:
I’d probably recommend you stick with the latest script rather than re-write it, if only for clarity’s sake.
Setting an accum to 1 or 0 to enable and disable a feature is a lot more intuitive than having a bitset / bitreset alternative.


(nUllSkillZ) #26

Thank you very much for making the patrol_points “prefab” available. :clap:

I’ve just tried to make a little map with patrol points with your “old” description / script-file.
Unfortunately it hasn’t worked. So I must have made a mistake.
/me nOOb
I will take a look for the new description / script-file tomorrow.

EDIT:
That’s great. Great work.
Five pages of instructions / tutorial + textures + map-file + shader-file.
Unbelievable.

EDIT2:
Ooops, 16 pages of instructions / tutorial.


(fidel castro) #27

hi gerbil,

nice work

@nullskillz: thx for the info.

fidel


(G0-Gerbil) #28

Just hope all the crap I wrote made sense :slight_smile:


(Pukedukem) #29

I actually thought of something like patrol points before. I was thinking it should be used in a future game to set up a multiplayer round to play more like a single player round.
Never thought something like that could be done in wolfET. Nice work

Pukedukem


(G0-Gerbil) #30

I was thinking it should be used in a future game to set up a multiplayer round to play more like a single player round.
Note sure I follow you - care to explain?
Always interested in new ideas :slight_smile:


(Pukedukem) #31

you know how when you go through a one player game. Enemy’s are setup in different areas and are not free roaming the whole level like a usally multiplayer map. With patrol points I think you could restrict a players area of movement so that people have to stay with in certain areas, to keep the single player feel. Some what like if when the allies capture a room the axis they fragged to get there spawn ahead to where the allies are heading to next. Also wouldnt be on a big server im talking small groups playing. Maybe patrol points isnt the way to go with this, now that I put more thought into it. I think my idea would be a mess in wolfET with allot of spawn points. wouldnt have any AI complaints just true human error. Remember its just an idea.