Saturday, April 21, 2012

set variables through chat messages?

hey. Is there an easy way to use the


Code:
Player - Player 1 (Red) types a chat message containing *** as An exact match

to set variables? for example:


Code:
Events
Player - Player 1 (Red) types a chat message containing 3 as An exact match
Conditions
Actions
Set integer = 3

that would be sweet, and i think its do-able because ive seen maps where one can choose from 1-99 lives etc.

pwease answer :)|||sure, here is an example.


Code:
Melee Initialization
Events
Player - Player 1 (Red) types a chat message containing <Empty String> as A substring
Conditions
Actions
Set chatnumber = (Entered chat string)
Set Number = (Integer(chatnumber))

The event detects, any chat (keep in mind with any I mean anything that is written, so you might want to toy around with that)

The first variable is a string variable, to save what has been written, the second is an integer variable, that converts the string to an actual number.|||Quote:






View Post

sure, here is an example.


Code:
Melee Initialization
Events
Player - Player 1 (Red) types a chat message containing <Empty String> as A substring
Conditions
Actions
Set chatnumber = (Entered chat string)
Set Number = (Integer(chatnumber))

The event detects, any chat (keep in mind with any I mean anything that is written, so you might want to toy around with that)

The first variable is a string variable, to save what has been written, the second is an integer variable, that converts the string to an actual number.




hmmm. im afraid im not fully getting it. here's what i made:


Code:
Untitled Trigger 001
Events
Player - Player 1 (Red) types a chat message containing -L1 as A substring
Player - Player 1 (Red) types a chat message containing -L2 as A substring
Player - Player 1 (Red) types a chat message containing -L3 as A substring
Conditions
Actions
Set stringvariable = (Entered chat string)
Set numbervariable = (Integer(stringvariable))
Game - Display to (All players) the text: (String(stringvariable))

but all this displays is 0, when -L1/2/3 has been entered

edit:

okay, i sort of fixed it...


Code:
Untitled Trigger 001
Events
Player - Player 1 (Red) types a chat message containing 1 as A substring
Player - Player 1 (Red) types a chat message containing 2 as A substring
Player - Player 1 (Red) types a chat message containing 3 as A substring
Conditions
Actions
Set stringvariable = (Entered chat string)
Set integervariable = (Integer(stringvariable))
Game - Display to (All players) the text: (String(integervariable))

but i still need to add an event for each possible number typed. is there no way to like detect any integer chat message? also, this way only numbers can be detected, not -L<number>

im not making myself very clear am i? xD|||If you are trying to allow people to type an amount of lives between 1 and 99 via a chat string, you can use the following code, or something alike.


Code:
Melee Initialization
Events
Player - Player 1 (Red) types a chat message containing <Empty String> as A substring
Conditions
Actions
Set Chatnumber = (Entered chat string)
Set number = (Integer(Chatnumber))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
number Greater than 0
number Less than 100
Then - Actions
Game - Display to (All players) the text: (You typed to set the amount of lives to: + (String(number)))
Else - Actions
Game - Display to (All players) the text: You did not type an...

Explaination:

The event detects if the player has typed anything.

The string is than loaded into a string variable, which is called "Chatnumber" in this case, you can assign your own name to it off course.

The second action, then puts the typed string (that is loaded into the string variable) into a integer variable (a whole number variable).

Then comes the If/then/else action.

The condition checks if the integer value is between 1 (greater than 0) 99 (less than 100).

The then happens when the typed string is between 1 and 99, you can add your actions in there you would like to use to set those lives for that player.

The else, basically informs the player that he/she did not press any value between 1 and 99.

Hope this is clear enough.

Hero limiting problem

Okay. So I just started learning how to mess with the triggers and stuff to get my map up and running. However my map involves a LOT of heroes, like about 8 for each player.

Now I've got a bug that, since they're all custom heroes, a few of them completely custom, the default Melee map command
Code:
Melee Game - Limit Heroes to 1 per Hero-type (for all players)

for limiting heroes does absolutely nothing to my new, custom heroes.

I've looked around the trigger editor and played with stuff, but nothing seems to work.



Also, I've got a small leaderboard problem I cant seem to get fixed. The counter wont go up past 2.
Code:
Set Kills[(Player number of (Owner of (Killing unit)))] = ((Player number of (Owner of (Killing unit))) + 1)
Leaderboard - Change the value for (Owner of (Killing unit)) in (Last created leaderboard) to Kills[(Player number of (Owner of (Killing unit)))]
Leaderboard - Sort (Last created leaderboard) by Value in Descending order

Any and all help would be greatly appreciated.

|||As far as your counter goes, cause you are player one, and that will stay the same, it will automatically, say that if the trigger runs player 1 = 1 + 1 = 2.


Code:
Set Kills = Kills + 1

Thats what you will need|||Quote:






View Post

As far as your counter goes, cause you are player one, and that will stay the same, it will automatically, say that if the trigger runs player 1 = 1 + 1 = 2.


Code:
Set Kills = Kills + 1

Thats what you will need




How exactly would I go about doing that? When I try and mess with the Set Variable = X + (X+1) it wants me to fill in an index, which makes this not work.



Like I said, I'm sort of new to figuring this stuff out. I've played with the thing for about 3 hours now on this one piece of script and it's driving me insane.|||Quote:






View Post

How exactly would I go about doing that? When I try and mess with the Set Variable = X + (X+1) it wants me to fill in an index, which makes this not work.



Like I said, I'm sort of new to figuring this stuff out. I've played with the thing for about 3 hours now on this one piece of script and it's driving me insane.




Example.

X default is 0

so X = 0 is what we start with.

in a trigger the following is presented.

X = X + 1

This action is being ran 3 times.

That would look like the following.

X = 0 + 1 = 1

X = 1 + 1 = 2

X = 2 + 1 = 3

So after running this trigger 3 times, X will give 3 as the outcome.

That is how my action in the first post is counted, by the editor, every time the event is being activated, and the actions are being executed.

for more explanation about variables, I'd suggest you read a tutorial about variables.|||Well I know how a variable would function and stuff, and what you're saying makes perfect sense.

MY problem is getting there, making the trigger say that ;P

Need only 1 skill point per 2 levels for the hero

Hello,

I'm making a map where the heroes (under normal conditions) gain to much attributes to fill all the levels, so what I want is that you only get 1 attribute per 2 levels.

Now I had a trigger that when

(EVENT:) a unit gains a level

then the

(ACTION:) Substract 1 skill point



Now I do not know what Condition is needed,

or if I'm thinking this all the wrong way.

I was searching in the Gameplay Constants, but that did not help me. (was hoping there was a Hero skill point per level thingy)



The maximum hero level is quite high (100)

Thanks in advance.|||If I understand you would want to write a code through triggers, that will substract one skill point every 2 levels, so you basically have 1 skill point every 2 levels.

Is so you can use a sorta alike example I wrote below here.


Code:
your trigger name
Events
Unit - A unit Gains a level
Conditions
Actions
Set Integervariable = ((your hero <gen>) mod 2)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Integervariable Equal to 0
Then - Actions
Hero - Modify unspent skill points of Paladin 0021 <gen>: Subtract 1 points
Else - Actions

Explanation:

The IntergerVariable obviously is a integer variable to store a number in.

It checks the current level of your selected hero, then it mod's it with 2, mod stands for Modulo.

If you want to know more about Modulo, I'd suggest opening up a wikipedia page.

then a condition is set to check if the variable you just declared is equal to 0 or not, if it is, it will subtract 1 skill point, else it will do nothing and thus add a skill point.

A list of the modulo.

level2: (2 mod 2 = 0) 1 point is subtracted

level3: (3 mod 2 = 1) nothing happens

leve4: (2 mod 2 = 0) 1 point is subtracted

level5: (3 mod 2 = 1) nothing happens

etc

This can be used on any level, it will always output 0 or 1.

So there you go.|||Great thanks man, that's really useful!

Need help with Dummy in WE

Hello , First of all thanks for taking the time to read this . I have been looking on forums and google and mostly ppl talked about it but not the way i needed .

My problem is that i made the dummy and the trigger and its working when i manually cast the spell with my tower . But when i put the same spell , i manually casted with , autocast , it doesnt trigger my dummy anymore.

I use Searing arrows base for my frost nova modified spell dunno if thats the problem , if so what spell should i base off when i try to make a dummy

Event:

unit - a units starts the effect of an ability

Condition:

Ability being cast equal "spell of my tower"

Action:

create dummy

expiration

order cast spell



Also i was wondering if anyone knew if its possible to make chain lightning autocast or would i have to make another dummy thing.

Im working on my own 2 player td and i gotta say the tower is some job >.>



Cheers|||GUI doesn't have an condition to detect autocast, so it's not possible to make this able with GUI (the normal triggers you can use), you will need to learn JASS for it, to be able to get this off the floor.|||really so without autocast would their be way to make a tower do chain lightning . Or i really need jass language?

Cuz i guess i can learn it .|||You could try to replace the projectile art in the F6 editor.

For JASS tutorials, have a look at http://www.wc3c.net/tutorials.php?f=650|||k thx ill do some reading|||Well i found it ...finaly...

For those who like me where seeking how to do those kind of tower. here is your answer :



No JASS needed |||Good self solve, ill close this thread then.

Camera Trigger

How do I create a trigger that sets the camera just behind and barely above the unit, much like World of WarCraft?|||Just place a camera in the editor on the desired angle, double click on the camera, and you'll have all the information you ever wanted to have about the camera specifications.

you can then apply that camera through a camera trigger.

and then lock the camera to the desired unit.|||There are threads all over the net concerning 3rd person camera triggers.

You should learn a lot if you take the time to read some of them.

Item making question.

Hello , i was making some items for my hero's in my td cuz its a mix im trying out and i was wondering if anyone knew how to make items that merge like in dota.|||Triggering is the key.|||I never played dota, so you will need to a be a bit more explanatory, for me to understand what your trying to create.|||Okay well ill try my best.

There is 2 way the effect i want happen .

first way is that you have 2 items of required items for the merging on 3

then you get the 3rd item and the 3 items become one containing the skills of all 3 ( for the skills retained i bet that would be item creating ) . For the merging part banreality just told me trigger is the key so i guess maybe trigger ill have to check.

the second way is that u have the items needed but need to buy the recipe for them to merge|||Very simple, just check if there are items in slots from a hero through a trigger, if you need a helping hand, ill can deliver an example later today.|||Well thanks item trigger i should be able to find it ill post if i cant make it on my own from there thank you.|||Ok, this is an easy one, what you mean is similar to recipee except without the recipe part. For this i'll say you want to fill a vial of water.

Create the 5 items,

1. Empty vial

2. 1/3 full vial

3. 2/3 full vial

4. full Vial

5. Some kind of item that would fill up the vials [in this case, Water Jug]

you can make these do anything you really want, aura's, really anything, but make sure they only have 1 charge if their a charged item.


Code:
Unit - A unit Acquires an item

((Hero manipulating item) Water Jug) Equal to True
((Hero manipulating item) has an item of type Empy Vial) Equal to True

Item - Remove (Item carried by (Hero manipulating item) of Empty Vial)
Item - Remove (Item carried by (Hero manipulating item) of Jug of Water)
Item - Create 1/3 Full Vial at (Position of (Hero manipulating item))
Special Effect - Create a special effect at (Center of (Playable map area)) using Abilities\Spells\Human\Resurrect\ResurrectTarget.mdl
Hero - Give (Last created item) to (Hero manipulating item)
Wait 2.00 seconds
Special Effect - Destroy (Last created special effect)
Do nothing

this is a very simple version of this code, you can set it up so you use the vial on a unit, such as a "fountain of Water" but this trigger is used untill you fill up the water|||Thank you very nice i shall test out and learn this =]

Leveling Ability/trigger help

Ok, i'm making an ability where you use the ability on a ground point and trigger's make 2 lava spawns with activated immolation and tell them to move to this point, they dissapear when they hit that point, but i do not know how to set it up so their's more and stronger lava spawns when you level the ability, here's my current two triggers


Code:
Unit - A unit Begins casting an ability

(Ability being cast) Equal to Fire Storm NEWEST

Set Firestormpointmove = (Target point of ability being cast)
Set Firestormcasterpoint = (Position of (Casting unit))
Wait 0.05 seconds
Unit - Create 1 Lava Spawn (Level 1) for (Owner of (Casting unit)) at Firestormcasterpoint facing Default building facing degrees
Set FirestormMovingFire[1] = (Last created unit)
Wait 0.01 seconds
Unit - Order (Last created unit) to Move To Firestormpointmove
Unit - Create 1 Lava Spawn (Level 1) for (Owner of (Casting unit)) at Firestormcasterpoint facing Default building facing degrees
Set FirestormMovingFire[2] = (Last created unit)
Wait 0.01 seconds
Unit - Order (Last created unit) to Move To Firestormpointmove

One above for creating the units and ordering them to move


Code:
Unit - A unit Is issued an order targeting a point

Or - Any (Conditions) are true
Conditions
FirestormMovingFire[1] Equal to (Ordered unit)
FirestormMovingFire[2] Equal to (Ordered unit)
FirestormMovingFire[3] Equal to (Ordered unit)
FirestormMovingFire[4] Equal to (Ordered unit)
FirestormMovingFire[5] Equal to (Ordered unit)

Wait 4.00 seconds
Unit - Kill (Ordered unit)

and thats the one to kill them when they arrive at the point.

also: the cast range is 600 and the lava spawn move speed is 260|||If you want timing that is accurate to fractions of a second, Wait commands won't work well. You'll need to use timers or periodic time events.

Anyway, instead of creating a unit type variable named "Lava Dude (level 1)", Lava Dude (level 2), etc., you could create an array, where Lava_Dude[1] is the first level, and Lava_Dude[2] is the second level, etc.. Then, when you spawn your unit, you can do it like "create Lava_Dude[Level of ability being cast]", and that will automatically pick the one you want as the ability's level increases.

You could also do the same thing with the amount of units that are being created. "Create (level of ability being cast) units...".|||Quote:






View Post

If you want timing that is accurate to fractions of a second, Wait commands won't work well. You'll need to use timers or periodic time events.

Anyway, instead of creating a unit type variable named "Lava Dude (level 1)", Lava Dude (level 2), etc., you could create an array, where Lava_Dude[1] is the first level, and Lava_Dude[2] is the second level, etc.. Then, when you spawn your unit, you can do it like "create Lava_Dude[Level of ability being cast]", and that will automatically pick the one you want as the ability's level increases.

You could also do the same thing with the amount of units that are being created. "Create (level of ability being cast) units...".




Thank you, I'll have to try and test it, actually I really didn't know you could like sync the variables and triggers to that extent...but I've really only recently started using variables [I used to have long and pointless triggers that were shortened dramatically by variables.|||Quote:






View Post

If you want timing that is accurate to fractions of a second, Wait commands won't work well. You'll need to use timers or periodic time events.




Actually, the way i've changed it, when the lava guys get to the point, they have about 1 second of free time before they dissapear inless i do the maximun cast range [800]

How would i make it so the range i cast it is how long the lava guys would last?|||Again, if the range increases with the ability's level, you could use that number to determine the amount of time till expiration. To do that, you could either make a variable array, such as Life_Time[], and use that in a similar manner as I described earlier, or you could do some math, like ((level of ability being cast) x 0.5) seconds.

Either way, I think it will be a lot easier if you were to simply add an expiration timer to each unit right after it is created. That way it will be automatically killed after the specified duration, and you can avoid having to fool with that second trigger.