Home   Help Search Login Register  

Author Topic: Flag Return  (Read 2054 times)

0 Members and 2 Guests are viewing this topic.

Dave OFPL

  • Guest
Flag Return
« on: 23 Aug 2002, 01:53:44 »
Ive built a CTF and want after 3 minutes the flag to return to the pole if the carrier dies.  How do I do this?

Ive made a TDM I get the game to end when one side reaches the set score. How do I get the system to state the winner when the time runs out?

Thanks DaVe

Offline 14th_Hoot

  • Members
  • *
  • You domove getpos away from me!
Re:Flag Return
« Reply #1 on: 23 Aug 2002, 03:41:25 »
Ok, here's the triggers and scripts...I will only show the one for the east dead, just duplicate and change stuff for the west:

1) create a trigger, size 0, 0, 0, repeatadly, activation none. In the text block put EFlaglost, just so you can find it later. In the condition field put:

((not isnull flagowner vlajkaRus) AND (not alive flagOwner vlajkaRus))

and in the on activation put:

[] exec "eflaglost.sqs"

Now, put the below in a file called eflaglost.sqs and place it in your user/mission folder:

; This script is run whenever the person who was carrying the flag is killed.
; Pause for a number of seconds to give people time to get the flag back.
; This pause *must* be shorter than the respawn time defined in 'description.ext'
; otherwise the carrier will respawn *with* the flag.
~120
 
; This check is made to see if anyone picked up the flag from the corpse of the
; player who was carrying it previously.
? ((not isNull flagOwner vlajkaRus) AND (alive flagOwner vlajkaRus)) : goto "Done"
 
; If the flag is still lying around after the interval has passed then it
; should be moved back to the flag pole.
FlagTaken = False
vlajkaRus setFlagOwner objNull
FlagBearer = objNull
#Done
exit


I have set the delay at 120 seconds, and even though the author says it must be shorter than respawn, I have NOT seen a problem with extending the time.

This all assumes you are using the flagnames for the US and Russian flags.

Hopefully you can see how to add another trigger and .sqs file to do the same for the West side; another trigger named wflaglost, another script called wflaglost, change the script stuff to US flag, etc. etc.

Hoot out! 8)
What..me worry?

Dave OFPL

  • Guest
Re:Flag Return
« Reply #2 on: 23 Aug 2002, 14:46:18 »
Thanks Very Much
« Last Edit: 23 Aug 2002, 20:13:40 by Dave OFPL »

Tactician

  • Guest
Re:Flag Return
« Reply #3 on: 24 Aug 2002, 07:45:58 »
Alternatively, you could do this with a trigger only.  Create a trigger like this:

Radius 0,0
Activated by Nobody Repeatedly
Timeout [160,160,160]
Condition: !isNull (flagOwner flagname) AND !alive (flagOwner flagname)
Activation: flagname setFlagOwner objNull

The "Timeout" part means the trigger will activate if the condition is true for the set number of seconds.  If anything breaks the condition (like someone picking up the flag), it will reset the timer.