Dialog, unit, and Multiple selection Issue

scubazoo

Member
Reaction score
1
Hi,

I am trying to make a trigger by which a unit may use an ability and upon doing so, a dialog box appears. This is all the ability does. The Dialog has three buttons. When one of the buttons is pushed, the unit is removed and replaced with a new unit, as selected by the dialog button. However, I am not sure how to implement this and make it so only the unit who casted the ability will be replaced, and not all of the other units selected by the player.

Thanks
 

-OverpoweR-

Member
Reaction score
13
Do you want to change the Unit that is casting the ability,or the unit that the caster is choosing to change?
 

scubazoo

Member
Reaction score
1
I don't understand your distinction. The two units to which you refer would be one and the same.
 

scubazoo

Member
Reaction score
1
I guess I should give an example:

Suppose the player has four units selected. Four heroes(amount doesn't matter, but more than one). One of the heroes has just leveled up and is granted an ability. The player clicks this ability, while still having all four heroes selected. A dialog appears. The player clicks a dialog button. This dialog button is the form of evolution of the hero who used the ability. That hero is replaced with the new hero form. Meanwhile, the player has selected the other three heroes, and the new hero.
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
The only unit you need to be concerned about is the unit that first casts the ability, so save that unit into a variable. When the button is clicked, all you have to do is channge the unit saved in the variable.

Alternatively, you could use a spellbook with 3 different permanent morphing abilities.

P.S. Don't double-post, i.e. making 2 posts in the same thread within 24 hours of each other. Use the Edit button, the one with the scissors icon.
 

scubazoo

Member
Reaction score
1
How do i save the unit to a variable?

The spellbook sounds interesting too, but for now I think I'd like to do it the first way you mentioned.

Thanks

I have giving the unit a custom value, but then when another player uses a similar ability, there becomes a mess and the units get mixed up.
 

Vibon

New Member
Reaction score
1
Click the big X at your topmenu, then press the green x to create a new
variable.
Variable Name: SaveUnit (or whatelse you wanna call it).
Variable Type: Unit

then make a trigger like this:
Untitled Trigger 002
Events
Unit - A unit Is attacked
Conditions
Actions
Set SaveUnit = (Attacked unit)
- THIS IS JUST AN EXSAMPLE OF HOW YOU CAN DO IT.
 

scubazoo

Member
Reaction score
1
Yes, thank you. I have used a variable and it worked. Only problem is this: Suppose two players have units which match the condition. Will they both be stored as the temp variable? This would be a problem because then if one player clicks the dialog after using the ability, while another player is simultaneously doing the same thing, the units will get mixed up? How do I specify the units?

Edit: How can I store each unit to its own variable to be recalled later, and not get mixed up between players who have similar units?

Thanks for the help so far
 

KaerfNomekop

Swim, fishies. Swim through the veil of steel.
Reaction score
613
You can make the variable an array, by checking the box with the label Array in the Variable Editor. Then, when saving the unit variable, use (Player Number of (Owner of (Triggering Unit))) as the index (the part in square brackets []).
 

Vibon

New Member
Reaction score
1
If i remember correctly, with this trigger, it saves the unit for the player:
SaveUnit
Events
Unit - A unit Is attacked
Conditions
Actions
Set SaveUnit[(Player number of (Owner of (Triggering unit)))] = (Attacked unit)
Game - Display to (Player group((Owner of SaveUnit[(Player number of (Owner of (Attacked unit)))]))) the text: Text to attacked Unit...

It saves the unit, in the variable array for the player number of the attacked unit. In this case, it saves the attacked unit, and adds it to variable array [1]. If Player blue was attacked, it will save it to variable array [2]
Player 1 red = Player number 1
Player 2 blue = Player number 2
and so on...

I hope it makes sense for you, if not, please tell me.
 

scubazoo

Member
Reaction score
1
Wow, thank you vibon, I'll try that. I should give rep to all of you by the way. How do I give rep?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top