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
 
Do you want to change the Unit that is casting the ability,or the unit that the caster is choosing to change?
 
I don't understand your distinction. The two units to which you refer would be one and the same.
 
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.
 
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.
 
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.
 
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.
 
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
 
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 []).
 
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.
 
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 The Helper:
    News portal has been retired. Main page of site goes to Headline News forum now
  • The Helper The Helper:
    I am working on getting access to the old news portal under a different URL for those that would rather use that for news before we get a different news view.
  • Ghan Ghan:
    Easily done
    +1
  • The Helper The Helper:
    https://www.thehelper.net/pages/news/ is a link to the old news portal - i will integrate it into the interface somewhere when i figure it out
  • Ghan Ghan:
    Need to try something
  • Ghan Ghan:
    Hopefully this won't cause problems.
  • Ghan Ghan:
    Hmm
  • Ghan Ghan:
    I have converted the Headline News forum to an Article type forum. It will now show the top 20 threads with more detail of each thread.
  • Ghan Ghan:
    See how we like that.
  • The Helper The Helper:
    I do not see a way to go past the 1st page of posts on the forum though
  • The Helper The Helper:
    It is OK though for the main page to open up on the forum in the view it was before. As long as the portal has its own URL so it can be viewed that way I do want to try it as a regular forum view for a while
  • Ghan Ghan:
    Yeah I'm not sure what the deal is with the pagination.
  • Ghan Ghan:
    It SHOULD be there so I think it might just be an artifact of having an older style.
  • Ghan Ghan:
    I switched it to a "Standard" article forum. This will show the thread list like normal, but the threads themselves will have the first post set up above the rest of the "comments"
  • The Helper The Helper:
    I don't really get that article forum but I think it is because I have never really seen it used on a multi post thread
  • Ghan Ghan:
    RpNation makes more use of it right now as an example: https://www.rpnation.com/news/
  • The Helper The Helper:
  • The Helper The Helper:
    What do you think Tom?
  • tom_mai78101 tom_mai78101:
    I will have to get used to this.
  • tom_mai78101 tom_mai78101:
    The latest news feed looks good
  • The Helper The Helper:
    I would like to see it again like Ghan had it the first time with pagination though - without the pagination that view will not work but with pagination it just might...
  • The Helper The Helper:
    This drink recipe I have had more than a few times back in the day! Mind Eraser https://www.thehelper.net/threads/cocktail-mind-eraser.194720/

      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