Scripting Question


(LaggingTom) #1

Okay, so I need a script that will trigger “on” when someone is inside of it, and “off” when they leave or get killed. Any suggestions on how I could do this?


(nUllSkillZ) #2

Entity: trigger_multiple


(Ifurita) #3

func_timer targeting a trigger_multiple. Here’s what I used in Decerto (based on Gerbil’s Patrol Points work) to check if anyone is inside an arena:


// Func_timer
arena1_manager
{
	spawn
	{
	}

	trigger arena1_tm_update
	{
		trigger arena1_tm check
	}
}

// Script_Multiple
arena1_tm
{
	spawn
	{
	}

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

	trigger check
	{
		// General arena control
		trigger self incheck
		trigger self outcheck

		accum 3 set 0			// Reset PP trigger flag
	}

	trigger incheck
	{
		accum 3 abort_if_not_equal 1	// Only continue if inside trigger
	}

	trigger outcheck
	{
		accum 3 abort_if_not_equal 0	// Only continue if inside trigger
		globalaccum 1 abort_if_not_equal 0 // Check to see if anyone is in the staging area 1

		trigger arena1_north_activator startup // resets arena if no one is inside
	}
}


(FireFly) #4

You can also check out the the tank / truck in the goldrush.map file and have a look at how the entities are set up.
The tank and truck works the same way: when an allie enters the trigger the tank moves, when he leaves the trigger the tank stops…


(LaggingTom) #5

Thanks guys, just what I needed :slight_smile: