Home   Help Search Login Register  

Author Topic: AND THE WINNER IS...  (Read 1560 times)

0 Members and 1 Guest are viewing this topic.

Offline Mitrokhin

  • Members
  • *
    • T2003 MOD
AND THE WINNER IS...
« on: 22 Oct 2002, 19:51:17 »
How do i get a trigger or summit at the end of a match 4 instance a deathmatch or race at the end i would like 2 b able 2 see the player who won and hav THEIR UNIQUE name on the screen e.g and CYBERPUNK is the winner!

cyberpunk
http://loc-doc.the-net.net/t2003
T2003 MOD WEBSITE NOW OPEN

Pope_Zog

  • Guest
Re:AND THE WINNER IS...
« Reply #1 on: 23 Oct 2002, 21:25:09 »
You could try something like this:
Code: [Select]
; Script: highest_score.sqs
; Find the player with the highest score and display this.
; If two players have the highest score, the first that
; is found is announced as the winner.

; Create an array that contains all the players. Yes, you will have to change this.
_players = [Player2, Player3, ... , PlayerN]
_highest = Player1
_counter = count _players

#loop
; Decrement the counter.
_counter = _counter - 1

; Exit the loop if the array has been traversed.
?(_counter < 0) : goto "done"

; If the player at the current array index has a higher
; score than the previously highest player, set him as
; the highest.
?(score _highest < score _players select _counter) : _highest = _players select _counter

goto "loop"

#done

; When you get here, the variable _highest will be the
; player with the highest score. Zoom in on him, elevate
; him to a godly state, blow him up, your choice really...
titleText[format["%1 is the winner!", name _highest], "PLAIN"]

exit

Run it when the mission is over.

Pope Zog

Offline Mitrokhin

  • Members
  • *
    • T2003 MOD
Re:AND THE WINNER IS...
« Reply #2 on: 24 Oct 2002, 09:16:57 »
k cheerz m8 but if i took my example ofa race would it stll work there. e.g when i get to te end point i hav a trigger or sumthing that executes a sort ofoutr with hatever THAT players name is.??

cyberpunk
http://loc-doc.the-net.net/t2003
T2003 MOD WEBSITE NOW OPEN

Pope_Zog

  • Guest
Re:AND THE WINNER IS...
« Reply #3 on: 24 Oct 2002, 11:41:42 »
Pope Zog finally gets the idea into his thick skull and gives an 'ah' of dull comprehension.

For a race you'd have a trigger covering the finishing line. Set it to activate by whatever side the players are, not repeat, the condition set to this. In the On Activation field put:
thislist exec "displaywinner.sqs"

And the "displaywinner.sqs" script would look something like:
Code: [Select]
_winner = _this select 0;
titleText[format["%1 is the winner!", name _winner], "PLAIN"];
exit

You could of course set the camera to focus on the winner - or whatever - in the script.

Pope Zog