Home   Help Search Login Register  

Author Topic: Steal Flag Gain 1 Point  (Read 1741 times)

0 Members and 1 Guest are viewing this topic.

Mike

  • Guest
Steal Flag Gain 1 Point
« on: 22 Oct 2002, 09:19:42 »
ok what I want to do is pretty much what the regular CTF maps do.. take a flag then it switches the enemy flag to your flag. your team gains a point.. a message comes up..
heres what I got, and it doesnt work much:

Script1 steal west flag:

_player = _this select 0

_player addaction ["Take Flag", "stealwflag.sqs"]

exit


the stealwflag.sqs:

wflag setflagtexture "rus_vlajka.pac

exit


I have 2 triggers activating this for the player that enters on each team on each flag.. 4 triggers.. I changed the appropriate names and added a condition to make sure you cant steal your own flag. But my problem is it A) wont switch the flag :( B) wont add a counter for score C) need to show score

because I dont know how.. this is my first ctf map

All that I get so far is the Take Flag message that comes up.. it doesnt do anything when u click it.. you can hit it more than once.. any help?
« Last Edit: 22 Oct 2002, 09:26:30 by Mike »

Pope_Zog

  • Guest
Re:Steal Flag Gain 1 Point
« Reply #1 on: 23 Oct 2002, 19:30:46 »
Let's assume you have 3 flags. At the start of the game, flag 1 belongs to West, flag 2 belongs to noone, and flag 3 belongs to East. The second flag is set to be owned by resistance so that the other sides can take it. I'm not sure if you'll have to set resistance friendly to none in your mission setup for it to work 100%.

In your "init.sqs" (or "init" trigger), put the following:
score_west = 0; score_east = 0;

Create three flags: Flag1, Flag2, and Flag3.
In the "init" string for Flag1 put: this setFlagTexture "usa_vlajka.pac"; this setFlagSide west
In the "init" string for Flag2 put: this setFlagTexture "white.pac"; this setFlagSide resistance
In the "init" string for Flag3 put: this setFlagTexture "rus_vlajka.pac"; this setFlagSide east

Create three triggers to detect the capture of a flag:
Trigger 1:
Size: 0 by 0
Activate: Repeatedly
Activated by: None
Condition: flagOwner Flag1 != objNull
Activation: [Flag1] exec "flagswitch.sqs";

Trigger 2:
Size: 0 by 0
Activate: Repeatedly
Activated by: None
Condition: flagOwner Flag2 != objNull
Activation: [Flag2] exec "flagswitch.sqs";

Trigger 3:
Size: 0 by 0
Activate: Repeatedly
Activated by: None
Condition: flagOwner Flag3 != objNull
Activation: [Flag3] exec "flagswitch.sqs";

Create the script "flagswitch.sqs":
Code: [Select]
; Begin script
_flag = _this select 0
_side = side flagOwner _flag

; Change the flag's side.
_flag setFlagSide _side

; Change the flag's texture and award a point. Show a message as well.
?(_side == west) : _flag setFlagTexture "usa_vlajka.pac"; score_west = score_west + 1; titleText [ format[ "%1 captured a flag for west!\nWest: %2 - East: %3", name flagOwner _flag, score_west, score_east], "PLAIN DOWN"];
?(_side == east) : _flag setFlagTexture "rus_vlajka.pac"; score_east = score_east + 1; titleText [ format[ "%1 captured a flag for east!\nWest: %2 - East: %3", name flagOwner _flag, score_west, score_east], "PLAIN DOWN"];

; Set the owner to noone - its side has changed.
_flag setFlagOwner objNull

; End script.

Happy scripting :)

Pope Zog
« Last Edit: 23 Oct 2002, 21:04:42 by Pope Zog »

Mike

  • Guest
Re:Steal Flag Gain 1 Point
« Reply #2 on: 24 Oct 2002, 01:30:46 »
I deleted the stuff I tried on my own and put in all the info u have up there exept I only used 2 flags.. nothing is working for me.. I suppose I need a trigger to activate an addaction and removeaction for each player inside the radius near flag.. but Im not sure how to A) make the Take Flag message come up then Leave after the player is not in a 3 radius of the flag.. and B) how to make the Take Flag message only come up for the player that is near the flag..

Im using 2 flags.. Id like the flag to change or even better to be able to steal it and bring it home.. ? Btw thanks for the info so far..
« Last Edit: 24 Oct 2002, 02:06:53 by Mike »

Pope_Zog

  • Guest
Re:Steal Flag Gain 1 Point
« Reply #3 on: 24 Oct 2002, 11:50:12 »
You don't need to use addAction to be able to take the flag. The trick is the command setFlagSide. If you've set a flag's side to West and a West player tries to take it - it won't work. Only a side that is not West can take a flag that is West. For the other sides the command appears automagically.

To steal the flag and bring it home... this is the Good'ol Capture the Flag. Read Backoff's fine CTF tutorial, it's got everything you're looking for :)

Good luck with your mission,

Pope Zog

Mike

  • Guest
Re:Steal Flag Gain 1 Point
« Reply #4 on: 24 Oct 2002, 19:40:53 »
 :cheers: