OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: SFG on 18 Apr 2003, 20:26:41

Title: Team deathmatch scoring
Post 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
Title: Re:Team deathmatch scoring
Post by: granQ on 20 Apr 2003, 22:15:25
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..
Title: Re:Team deathmatch scoring
Post by: SFG on 20 Apr 2003, 22:16:08
Thats fine.. do you have the code?
Title: Re:Team deathmatch scoring
Post by: granQ on 20 Apr 2003, 22:19:39
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:

Code: [Select]
#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 ;)
Title: Re:Team deathmatch scoring
Post by: Terox on 21 Apr 2003, 00:43:03
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)
Title: Re:Team deathmatch scoring
Post by: Tactician on 22 Apr 2003, 13:01:02
init.sqs snippet:
Code: [Select]
WestScore = 0
EastScore = 0
(side player) exec "deathcount.sqs"
[] exec "showscore.sqs"

deathcount.sqs:
Code: [Select]
_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:
Code: [Select]
#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)
Title: Re:Team deathmatch scoring
Post by: Tactician on 22 Apr 2003, 21:42:14
Umm.. I meant the above snippet for the "Death counter" topic but got confused.  Is a score-on-death system acceptable for your needs?