HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

[help] game mode

07-28-2008, 04:33 AM#1
argggghh
how to make game mode ?

example player 1 type

-20

the game will end after someone reach 20 kill

and we can type other such as -30, -40 , etc

and the winner screen will freeze and show message : win (quit game)

the other will get message : lose (quit game)

thanks a lot
07-28-2008, 04:08 PM#2
Themerion
This thread should cover what you need:

http://www.wc3campaigns.net/showthread.php?t=81210
07-28-2008, 11:01 PM#3
crayz
Trigger:
Set Kills
Collapse Events
Player - Player 1 (Red) types a chat message containing -kills as A substring
Conditions
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
x Equal to 0
Collapse Then - Actions
-------- Set the amount of lives (x) to whatever red has after -kills --------
Set x = (Integer((Substring((Entered chat string), 8, (Length of (Entered chat string))))))
Game - Display to (All players) the text: (The amount of kills to win has been set to + (String(x)))
Collapse Else - Actions
Game - Display to Player Group - Player 1 (Red) the text: ERROR: The amount o...

If you read the link that Themerion gave you, you will learn about variables, if you don't know about them already.

In the code I posted above, you will need to create a variable 'x', or whatever you want to call it. It basically just stores any integer data, where in our case it stores the amount of kills which are needed to win.

You should create an array variable, each array stores the amount of kills each player in-game has. You can run a check using if/then/else every time a player kills a unit, to see whether or not that player has reached x kills (amount of kills needed to win, set by red). If the player didn't reach the total kills, then just add +1 to the players kill count variable.
07-29-2008, 03:47 AM#4
argggghh
thanks for that helpful post

:)
07-29-2008, 06:06 AM#5
Veev
I'm pretty sure someone can type -kills asdf and your trigger will break. So what I mean is, you need to check if they actually entered integers... Try and find a different way, like a Dialog Menu or something.
07-29-2008, 07:36 AM#6
TEC_Ghost
Quote:
Originally Posted by Veev
I'm pretty sure someone can type -kills asdf and your trigger will break. So what I mean is, you need to check if they actually entered integers... Try and find a different way, like a Dialog Menu or something.

If they try to type in characters it defaults to 0. And with that 0 error check it'll be fine.
07-29-2008, 07:38 AM#7
darkwulfv
Actually, it wouldn't. x would have to BE 0 for this to work, otherwise it would always error. (look)
07-29-2008, 07:47 AM#8
TEC_Ghost
Ya it needs to be if X != (NotEqual to) 0
07-29-2008, 07:52 AM#9
crayz
Quote:
Originally Posted by darkwulfv
Actually, it wouldn't. x would have to BE 0 for this to work, otherwise it would always error. (look)

By default, udg's are initialized as 0.
So it would work, until player 1 sets the amount :)
07-29-2008, 09:17 AM#10
TEC_Ghost
No he's saying that the If is wrong. If X = 0 it runs the script ELSE it Errors out.
Needs to be If X != 0 then Run, Else Error out.
07-29-2008, 09:18 AM#11
darkwulfv
No, I was wrong. It keeps it from running more than once, since x would be set to something. "x" would start as 0 and then be used once. After that, it would cause an error.
07-29-2008, 03:26 PM#12
argggghh
how to make it not error ??

thanks all
07-29-2008, 05:32 PM#13
crayz
Quote:
Originally Posted by argggghh
how to make it not error ??

thanks all

Here you go, tested & working

Trigger:
Set Kills
Collapse Events
Player - Player 1 (Red) types a chat message containing -kills as A substring
Conditions
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
x Equal to 0
Collapse Then - Actions
-------- Set the amount of lives (x) to whatever red has after -kills --------
Set x = (Integer((Substring((Entered chat string), 8, (Length of (Entered chat string))))))
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
x Equal to 0
Collapse Then - Actions
Game - Display to Player Group - Player 1 (Red) the text: ERROR: You must specify a number!
Collapse Else - Actions
Game - Display to (All players) the text: (The amount of kills to win has been set to + (String(x)))
Collapse Else - Actions
Game - Display to Player Group - Player 1 (Red) the text: ERROR: The amount of kills has already been set!

Also, my first trigger does work, red can type -kills sdfsadfs as many times as he/she wants & x would stay as 0. Therefore, once red does type -kills 20 (or any other number), it would actually set x as that number.

This one makes that more user friendly :)
07-29-2008, 10:16 PM#14
argggghh
Quote:
Originally Posted by crayz
Here you go, tested & working

Trigger:
Set Kills
Collapse Events
Player - Player 1 (Red) types a chat message containing -kills as A substring
Conditions
Collapse Actions
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
x Equal to 0
Collapse Then - Actions
-------- Set the amount of lives (x) to whatever red has after -kills --------
Set x = (Integer((Substring((Entered chat string), 8, (Length of (Entered chat string))))))
Collapse If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Collapse If - Conditions
x Equal to 0
Collapse Then - Actions
Game - Display to Player Group - Player 1 (Red) the text: ERROR: You must specify a number!
Collapse Else - Actions
Game - Display to (All players) the text: (The amount of kills to win has been set to + (String(x)))
Collapse Else - Actions
Game - Display to Player Group - Player 1 (Red) the text: ERROR: The amount of kills has already been set!

Also, my first trigger does work, red can type -kills sdfsadfs as many times as he/she wants & x would stay as 0. Therefore, once red does type -kills 20 (or any other number), it would actually set x as that number.

This one makes that more user friendly :)

I will test it

thanks