timer shooter


(nikita) #1

as much as 1 of the most basics how do u make a shooter>rocket shot after 30 seconds
the shooter is been activated by panal/button
i searched yet didnt find my answer anyone help

also tryed func_timer didnt work so well


(carnage) #2

set ur button to activate a section of your script

wait 30000
alertentity “the scriptname of your shooter”


(nikita) #3

i will try it ty :slight_smile: will it work 1 shot per 30 seconds
i want only 1 per 30


(Loffy) #4

Yes, it should work. 30000 = 30 sec.

I would do it like this:

  1. Make a button. Give it the key ‘target’ and the value ‘tst_shooter’.

  2. Insert a target_script_trigger. Give it the following keys/values:
    Key ‘scriptname’ and value ‘tst_shooter’.
    Key ‘targetname’ and value ‘tst_shooter’.
    Key ‘target’ and the value ‘action’.

  3. Insert a shooter:
    Key ‘scriptname’ and the value 'nameofshooterentity ’
    Key ‘targetname’ and the value 'nameofshooterentity ’

  4. Write a script, something like this:


game_manager
{
	spawn
	{
		//Accums
		accum 1 set 0 // Shooter is active? 0 = No. 1 = Yes.
	} // End spawn
}  // End game_manager bracket.

tst_shooter // The scriptname of the target_script_trigger
{
	spawn
	{
		wait 50 // This is just something I put in because many others do it.
	}

// Inside the target_script_trigger there is a key ‘target’ with the value ‘action’.
// This is the script for that.
   trigger action
	{
		accum 1 abort_if_equal 1 // Will abort script if shooter is active (i.e. 1 = Yes).
		accum 1 set 1 // Accum 1 is temporarely set to 1.
		alertentity nameofshooterentity // BOOOM!
		wait 30000 // approximately 30 seconds.
		accum 1 set 0 // Accum 1 is restored to its original value.
// It is now possible to fire the shooter again.
	}
}



(nikita) #5

thank you


(Loffy) #6

you’re welcome! Now, go and make some killer good maps!
:slight_smile:


(mazdaplz) #7

i’d like to set this right for posterity, i got the biggest headache tryin to make this work and it’s because you need a global accum for the active shooter


(C) #8

… or move the line:

accum 1 set 0 // Shooter is active? 0 = No. 1 = Yes.

into the spawn event-handler code of the tst_shooter…
Only the tst_shooter entity needs to know if the shooter is allready active or not…


(TOk) #9

Use target delay to delay trigger …

It’s a bizare sentences …