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.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1

      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