OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: DarkCell on 06 Nov 2003, 20:27:24
-
Hey people! :)
I made a Capture and Hold the flag map it means:
West and East have to capture flags and Hold them as long as they can...but okay. now the problem :o
Everytime East or West wanna take a Flag the command "TAKE FLAG" wil be showed.
But when East wanna take the Flag West captures no Command shows up ???
So when East captured a flag or West then the opposite Team cant take it back so the game can never be won :(
HERE IS HOW MY CaptureFlag.sqs script looks like:
_flag = _this select 0
_player = flagOwner _flag
?(_flag == Flag1): _msg = "Flag 1"
?(_flag == Flag2): _msg = "Flag 2"
_player addscore 5
goto format ["%1", side _player]
goto "end"
#West
WestFlag = WestFlag + [_flag]
EastFlag = EastFlag - [_flag]
PublicVariable "WestFlag"
PublicVariable "EastFlag"
~0.5
(flagOwner _flag) setflagowner _flag
_flag setflagowner _flag
~0.5
_flag setflagtexture "usa_vlajka.pac"
_flag setflagside West
?(_flag == Flag1): "mFlag1" setMarkerColor "ColorBLUE"
?(_flag == Flag2): "mFlag2" setMarkerColor "ColorBLUE"
titletext [format["NATO forces capture %1", _msg], "PLAIN DOWN"]
goto "end"
#East
EastFlag = EastFlag + [_flag]
WestFlag = WestFlag - [_flag]
PublicVariable "WestFlag"
PublicVariable "EastFlag"
~0.5
(flagOwner _flag) setflagowner _flag
_flag setflagowner _flag
~0.5
_flag setflagtexture "rus_vlajka.pac"
_flag setflagside East
?(_flag == Flag1): "mFlag1" setMarkerColor "ColorRED"
?(_flag == Flag2): "mFlag2" setMarkerColor "ColorRED"
titletext [format["Russian forces capture %1", _msg], "PLAIN DOWN"]
goto "end"
#end
[_flag, side _player] exec "control.sqs"
Exit
Can someone Tell me if there's a problem with it?
THNX for the person who can help me MANY THANX! ;D
Greetz DarkCell :)
-
You are doing publicVariable on a variable that is an array? You can't do that.
Doolittle
-
So What do I have to change to it? How does my script has to look like? ???
-
PublicVariable "WestFlag"
PublicVariable "EastFlag"
west & east flags are arrays, download tacticians c&h tutorial
-
THNX Terox you are realy a helpfull guy :)
But I still got 1 problem...how can I add flags to this script?
I don't see anything about Flag1 flag2 and flag3
So plz tell me where in this script and what do I have to type in this script to add more flags?
DAMN! I am noob sometimes :P
Thnx for the person who can solve my Last problem with this map :)
HERE IS HOW THE SCRIPT LOOKS LIKE NOW:
_flag = _this select 0
_side = _this select 1
?(_side == WEST): goto "West"
?(_side == EAST): goto "East"
exit
#West
?!(local Server): goto "Westclient"
WestScore = WestScore + 1
WestArray = WestArray + [_flag]
EastArray = EastArray - [_flag]
PublicVariable "WestScore"
#Westclient
(flagOwner _flag) setflagowner objNull
_flag setflagowner objNull
~0.2
_flag setflagtexture "usa_vlajka.pac"
_flag setflagside WEST
goto "end"
#East
?!(local Server): goto "Eastclient"
EastScore = EastScore + 1
EastArray = EastArray + [_flag]
WestArray = WestArray - [_flag]
PublicVariable "EastScore"
#Eastclient
(flagOwner _flag) setflagowner objNull
_flag setflagowner objNull
~0.2
_flag setflagtexture "rus_vlajka.pac"
_flag setflagside EAST
goto "end"
#end
?(local Server): [_flag, _side] exec "control.sqs"
~1.5
hint format["West: %1\nEast: %2", WestScore, EastScore]
Exit
-
ok problem is fixed this case is closed! ;)
-
_flag =_this select 0 is the key,
this means that what actually executes the script is the flag, probably in its init field or in the init.sqs
eg
[Flag1] exec "cnh.sqs"
to add a flag create a new pole and call it flag4, flag5 etc etc
and then in the init.sqs add an additional line
[Flag4] exec "cnh.sqs"
[Flag5] exec "cnh.sqs"
where cnh.sqs is the name of the script