• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Variables

Status
Not open for further replies.
Level 7
Joined
May 16, 2004
Messages
355
Alright I need some help for a mode I'm making for my map. It is similar to the Deathmatch mode in dota except that instead of using up all the heroes you enter a command such as: -deathmatch (#). In this I want the variable to be filled by the number they place inside the brackets but I can't find a way to do it. Any help is appreciated.
 
Level 6
Joined
Feb 15, 2005
Messages
183
I think you have to use a string conversion to interger. so i think it would be somthing like.

Event - Player enters (-deathmatch )+(X) as a substring
" " " 2 " "
ect....
Action -
For each (integer A) from 1 to (X) so (actions)
IF/THEN/ELSE
IF: entered chat string equal to (-deathmatch )+(String(Integer A)))
THEN
Set DeathmatchVariable = (Integer A)

That works, I tested it. Since its a pretty complicated trigger ill step by step it for you.
The "event" is a "Player chat event" with a CONCENTRATE string. the first part of the concentrate string is (-deathmatch ). the second part is (1). You will need to make as many events as you want your max variable to be. There is a space after death match, so when you type it, it will look like -deathmatch 1.

Next is actions. First action is a "For each integer A do multiple". You want it to be form 1 to X (where x is the max number of deathmatch you can have.
After that, you want to add an "IF/THEN/ELSE" action into the loop action. With condition "entered chat string equal to (-deathmatch )+(String(Integer A)))". Then you simply set a variable = to ineger A and there you have it. All that does is give you a number predicated on what they type. You will have to figure out what to do with that number in a different trigger.
 
Level 6
Joined
Feb 15, 2005
Messages
183
yeah see, i didn't undersand the substring format, with the string,#,#. What are those 2 values after the first string value?

EDIT: ooooo I get it now, wow that is really nice. I really wish that blizzard would include the values in their triggers. I know some functions they do, in grey text at the bottom of the window, but they didn't realy give a good example for the substring. so the 2 values after the comma's are the character #. Like the phrase "Dogs bark" if i just wanted the word "bark" i would say "Dogs bark, 6,9". Is that correct?
 
Level 7
Joined
Jul 30, 2004
Messages
451
Draqz said:
yeah see, i didn't undersand the substring format, with the string,#,#. What are those 2 values after the first string value?

EDIT: ooooo I get it now, wow that is really nice. I really wish that blizzard would include the values in their triggers. I know some functions they do, in grey text at the bottom of the window, but they didn't realy give a good example for the substring. so the 2 values after the comma's are the character #. Like the phrase "Dogs bark" if i just wanted the word "bark" i would say "Dogs bark, 6,9". Is that correct?

yes
 
Level 7
Joined
May 16, 2004
Messages
355
Yeah okay, what you wrote is what I was hoping I could do. For the X in the Loop function I just place an X? Well frig when I put in my stuff for the loop how the hell do I put the max to be the number that they entered? I can't find any function that allows me to.
 
Level 6
Joined
Feb 15, 2005
Messages
183
no no, X is the max number that they CAN chose. so like if you only have 5 heroes in your game, then the max would be 5. like, there is no -deathmatch 6. so, X is just whatever you want it to be really. I only use X as an example because it could be whatever you want it to be.

however, if you understood raptor's suggestion, i would recomend using that instead, much cleaner and more efficient, no loops.
 
Level 12
Joined
Jul 2, 2004
Messages
471
Event:
Player - Player 1 (Red) types a chat message containing -deathmatch as A substring

Action:
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Integer((Substring((Entered chat string), 13, 13)))) Less than or equal to X
Then - Actions
Set YourInteger = (Integer((Substring((Entered chat string), 13, 13))))
Else - Actions
Set YourInteger = 0

X is the maximum number

This trigger is short and easy, its should work for you :D
 
Level 7
Joined
May 16, 2004
Messages
355
Ha I was so confused, but then I reread what the raptor guy posted, so I have -deathmatch as a substring then I get it the pick out the substring that is between 13 and 14? since that is where they would place the number? then I can set that as the variable? Okay well thx guys, I will implement it soon.
 
Status
Not open for further replies.
Top