OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: SFG on 18 Apr 2003, 20:26:41
-
Hi, I have 2 teams, i'd like when west shoots east, west gets a point via titletext. They keep adding up to a certain score, and then that side wins. IT MUST work for 1.46. Thanks
-
hmm, was gonna say eventhandlers.. but then it doesn't support 1.46..
i would do it for like "if west player dies" then add one score to east. Of course this would be all kinds of death, friendly fire, crashing with cars..
-
Thats fine.. do you have the code?
-
i have some code i did.. but it was back in my beginners time..
i did a script for each soldier like:
w1.sqs
w2.sqs
(west1 and west2) and it looked like this:
#start
?(not(alive e1)) : goto "killed";
~0.1
goto "start";
#killed
PublicVariable "Westlife"
Westlife = westlife + 1
PublicVariable "Westlife"
~30
goto "start"
just a lot of typing and stuff ;)
-
The following link may help
http://www.ofpec.com/yabbse/index.php?board=7;action=display;threadid=8627 (http://www.ofpec.com/yabbse/index.php?board=7;action=display;threadid=8627)
-
init.sqs snippet:
WestScore = 0
EastScore = 0
(side player) exec "deathcount.sqs"
[] exec "showscore.sqs"
deathcount.sqs:
_pside = _this
#start
@!alive player
?(_pside == WEST): EastScore = EastScore + 1; publicVariable "EastScore"
?(_pside == EAST): WestScore = WestScore + 1; publicVariable "WestScore"
@alive player
goto "start"
showscore.sqs:
#start
~.1
_wscore = WestScore
_escore = EastScore
@WestScore != _wscore OR EastScore != _escore
titleText [format["West: %1 East: %2",WestScore,EastScore],"PLAIN DOWN"]
goto "start"
Properties of this system:
- Death is tracked by the player locally
- New score is reported by player to all clients on death
- Every time score is added, titleText shows new score
- AI will not count towards score
- No server intervention required
Disclaimer:
- I haven't tried any of the above code myself
- Simultaneous death of two or more players on same side could possibly stack publicVariables for unpredictable results (i.e. multi-crew vehicle death)
-
Umm.. I meant the above snippet for the "Death counter" topic but got confused. Is a score-on-death system acceptable for your needs?