OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: Lykurgos on 15 Apr 2003, 16:28:21
-
I have made a mp mission. It is fun to play with my friends, but it is some sort of endless battle (unit respawn, vehicle respawn, ammo crates respawn, etc). I want to make a little sense in this mission by creating a death counter that counts all deaths by each side (EAST & WEST) and when certain amount of time has passed, the results will be shown and the team, that has less deaths, wins.
And the death stats will be also shown every 7 minutes.
Has anyone got an idea how this is done? ???
-
well you could use a trigger for every player using the "alive" statement, and have that trigger run a script which increments a variable everytime a player respawns
************************************************************
in the init.sqs type the following line
westcount = 0
public variable "Westcount"
***********************************************************************
then create the following trigger in the editor
Text: EndGame
Type: End #1
Condition: EndGame
OnActivation: ForceEnd
************************************************************************
Then To set it up for west do the following
1) Name every player, W1, W2, W3 etc etc
and then for each player create the following REPEATING trigger
type:none
condition: alive w1 (Where w1 is a west player)
On activation: []exec "Westcount.sqs"
the trigger would then run something similar to the following
;;westcount.sqs
westcount = westcount +1
westcount publicvariable
?westcount == 10:EndGame=True
PublicVariable "EndGame"
exit
where 10 is the total number of respawns you want to allow for West, eg 9 deaths
to set it up for east, name all the players E1, E2, E3 etc etc ,
create a script called Eastcount.sqs
type the following into the init.sqs
eastcount=0
publicvariable "Eastcount"
hope this helps
basically what happens is
everytime an east or west player respawns, a script will be run which adds 1 to the publicvariables, east or westcount
when the score is, in this case 10, the mission will end
-
Thanks a lot, but how do I show the stats every 7 minutes and in the end.
I mean something like this:
titlecut ["STATS: \n West deaths: numberofdeaths \n East deaths: numberofdeaths","PLAIN DOWN"]
-
~1 = wait 1 second
so wait 7 minutes is ~420
Type the following into the init.sqs
[]exec "Hintstatus,sqs"
and then create the following script
;;hintstatus.sqs
#Start
~420
_westkills = publicvariable "westcount"
_eastkills = publicvariable "eastcount"
hint format["West have: %1 KIA's\nEast have %2 KIA's",_westkills, _eastkills]
goto "start"
i may have the syntax slightly wrong here, i always get muddled up with quotation marks
Also u may just need to have the following script
;;hintstatus.sqs
#Start
~420
hint format["West have: %1 KIA's\nEast have %2 KIA's",westcount, eastcount]
goto "start"
so every 7 minutes you would get the following message in the hintbox
(Added values for example)
West have 6 KIA's
East have 4 KIA's
If you wanted to use the Hintstatus to both display every 7 minutes and at the end.
You could remove the ~420 and simply create another script that ececutes the hintstatus script for you
eg Counter.sqs
#start
~420
[]exec "Hintstaus.sqs"
goto "Start"
and then have the hintstatus sqs have no wait period or a ~0.01 wait period and no loop
You could then have your mission ending trigger execute the hintstatus.sqs
one more tip
If you are going to run this map on a dedivcated server
at the start of the westcount and eastcount.sqs's place the following line
?!(local Server): exit
This would make only the server have control of the westcount and eastcount variables, and would stop clients creating a different value for the variables as is often the case
hope this helps
-
Right....
I did what you told and.... it worked!!!
But the counter started at 10 per side, because the team size per team was 10 and the counter activated at "alive" statement. So I fixed the problem by putting "not alive" instead of "alive". But thanks a lot anyway; I couldnÂ't do without your help. ;)
My mission is almost ready, and itÂ's best mission that I have made so far. ThereÂ's still one * problem: The DoolittleÂ's vehicle respawn doesnÂ't work right! >:(
-
silly me forgetting about the first 10 spawns
well i would click on "Solve" for this one and start a fresh thread asking about doolitlles respawn script