• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

help with unit bodyguard ability

Status
Not open for further replies.
Level 9
Joined
Jun 10, 2013
Messages
473
Hey I need help triggering the following passive ability

Offspring:
The Queen is followed into battle and protected by her offspring, 1 Spiderling multiplied by the queens current level will follow and protect the queen at all time should a spiderling die another will be spawned in its place after 10 seconds.
 
Level 12
Joined
May 22, 2015
Messages
1,051
Are you allowed to control the spiders? Do you need the ability to be MUI?
 
Level 9
Joined
Jun 10, 2013
Messages
473
Are you allowed to control the spiders? Do you need the ability to be MUI?
no you can't control them and mui would be nice >:D btw I got this so far but its flawed i'm sure

  • Offspring
    • Events
    • Unit - A unit Finishes reviving
    • Conditions
    • (Unit-type of (Reviving Hero)) Equal to Nerubian Queen
    • Actions
    • Set TempUnit = (Reviving Hero)
    • Set tempPlayer = (Owner of TempUnit)
    • Unit - Create (1 x (Level of TempUnit)) Nerubian Spiderling for tempPlayer at (Position of TempUnit) facing Default building facing degrees
    • Unit - Order (Last created unit) to Follow TempUnit
    • Unit - Change ownership of (Last created unit) to Player 5 (Yellow) and Retain color
    • Player - Make Player 5 (Yellow) treat tempPlayer as an Ally with shared vision
    • Set tempUnit = (Last created unit)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
    • (tempUnit is dead) Equal to True
    • Then - Actions
    • Wait 10.00 game-time seconds
    • Unit - Create 1 Nerubian Spiderling for tempPlayer at (Position of TempUnit) facing Default building facing degrees
    • Unit - Order (Last created unit) to Follow TempUnit
    • Unit - Change ownership of (Last created unit) to Player 5 (Yellow) and Retain color
    • Player - Make Player 5 (Yellow) treat tempPlayer as an Ally with shared vision
    • Else - Actions
Note:
- 1 spiderling per level follows the hero
- 2 they benefit from unit upgrades such as the armor attack upgrades (this would only be a problem if the spiderlings are not owned by the owner of the hero)
- 3 when killed they "respawn" after 10 seconds at the heroes postilion
 
Level 12
Joined
May 22, 2015
Messages
1,051
There is a neat trick that might help you out. I can't remember the exact sequence, though. It is something like:
1) Create dummy unit with locust ability.
2) Remove the locust ability via triggers.
3) Give the unit a chaos ability that turns it into the unit you want it to be.

I think that's it, but anyway, the result leaves you with units that you can't select at all. They still attack and they still get damaged and can be attacked if enemies attack move, but no one can select them. This can be important because I don't know if experience and getting gold will work if the spiders kill the enemies (unless you trigger it extensively, but that's a lot of work as well). Putting them on separate teams also reduces the amount of players you get to use on your map, so that might not be a nice solution (though maybe it is not a problem in your case).

I think there are some problems with your trigger. I would do this in more than one trigger because there are lots of potential problems if you jam it into one. It is also way harder to make it MUI with just one trigger. Instead of having an if inside this trigger, you should make a new trigger like this:
  • Events
    • Unit - A unit dies
  • Conditions
    • Unit type of (Triggering unit) Equal to Nerubian Spiderling
  • Actions
    • Wait 10.00 game-time seconds
    • Unit - Create 1 Nerubian Spiderling for tempPlayer at (Position of TempUnit) facing Default building facing degrees
    • Unit - Order (Last created unit) to Follow TempUnit
    • Unit - Change ownership of (Last created unit) to Player 5 (Yellow) and Retain color
    • Player - Make Player 5 (Yellow) treat tempPlayer as an Ally with shared vision
This won't quite work as is because you need to know which unit made the spiderling and some of the variables aren't set properly (just copied out the second part of your trigger). I think the easiest way is to use a hashtable for the spiderlings so they know which unit created them. Have you used hashtables for anything? I completely forgot how they look in GUI triggers so I don't know how to write them out.

In the end, I think you need 4 triggers:
1) A trigger when the hero learns the ability / levels up the ability - you create a new spider for them.
2) A trigger when the hero dies - you kill all the spiderlings (assuming you want to do this - you would have to stop the spiderling respawn trigger as well, I think).
3) A trigger when the hero revives - you create a new set of spiders.
4) A trigger when a spider died - you create a new spider after a 10 second delay.

It's a cool effect, but there's so many things that make an ability like this difficult to manage. I am working on something similar in my own map but there's lots of things to watch out for. As an example, in my map, you can teleport around with scrolls. The shop is also outside of the map and the only way in / out is through teleporters, so I have to make sure the summoned units don't get stuck in the shop. I'm also not sure if I should let the summoned units survive if they are far away from their master because there could be times that it would be better if they were dead and could respawn after the timer (instead of trying to walk very far to catch up). The final thing I also have to deal with is I want it to be a 30 second wait time per summon respawn and each one blocks the next so that if a second one dies while the first one is still respawning, the second one won't start respawning until the first one is complete (otherwise it won't matter as much if they all die since you will get them all back in the same amount of time, anyway). There is also, of course, the problem from when the heroes with the ability die.
 
Level 9
Joined
Jun 10, 2013
Messages
473
There is a neat trick that might help you out. I can't remember the exact sequence, though. It is something like:
1) Create dummy unit with locust ability.
2) Remove the locust ability via triggers.
3) Give the unit a chaos ability that turns it into the unit you want it to be.

I think that's it, but anyway, the result leaves you with units that you can't select at all. They still attack and they still get damaged and can be attacked if enemies attack move, but no one can select them. This can be important because I don't know if experience and getting gold will work if the spiders kill the enemies (unless you trigger it extensively, but that's a lot of work as well). Putting them on separate teams also reduces the amount of players you get to use on your map, so that might not be a nice solution (though maybe it is not a problem in your case).

I think there are some problems with your trigger. I would do this in more than one trigger because there are lots of potential problems if you jam it into one. It is also way harder to make it MUI with just one trigger. Instead of having an if inside this trigger, you should make a new trigger like this:
  • Events
    • Unit - A unit dies
  • Conditions
    • Unit type of (Triggering unit) Equal to Nerubian Spiderling
  • Actions
    • Wait 10.00 game-time seconds
    • Unit - Create 1 Nerubian Spiderling for tempPlayer at (Position of TempUnit) facing Default building facing degrees
    • Unit - Order (Last created unit) to Follow TempUnit
    • Unit - Change ownership of (Last created unit) to Player 5 (Yellow) and Retain color
    • Player - Make Player 5 (Yellow) treat tempPlayer as an Ally with shared vision
This won't quite work as is because you need to know which unit made the spiderling and some of the variables aren't set properly (just copied out the second part of your trigger). I think the easiest way is to use a hashtable for the spiderlings so they know which unit created them. Have you used hashtables for anything? I completely forgot how they look in GUI triggers so I don't know how to write them out.

In the end, I think you need 4 triggers:
1) A trigger when the hero learns the ability / levels up the ability - you create a new spider for them.
2) A trigger when the hero dies - you kill all the spiderlings (assuming you want to do this - you would have to stop the spiderling respawn trigger as well, I think).
3) A trigger when the hero revives - you create a new set of spiders.
4) A trigger when a spider died - you create a new spider after a 10 second delay.

It's a cool effect, but there's so many things that make an ability like this difficult to manage. I am working on something similar in my own map but there's lots of things to watch out for. As an example, in my map, you can teleport around with scrolls. The shop is also outside of the map and the only way in / out is through teleporters, so I have to make sure the summoned units don't get stuck in the shop. I'm also not sure if I should let the summoned units survive if they are far away from their master because there could be times that it would be better if they were dead and could respawn after the timer (instead of trying to walk very far to catch up). The final thing I also have to deal with is I want it to be a 30 second wait time per summon respawn and each one blocks the next so that if a second one dies while the first one is still respawning, the second one won't start respawning until the first one is complete (otherwise it won't matter as much if they all die since you will get them all back in the same amount of time, anyway). There is also, of course, the problem from when the heroes with the ability die.

well I guess what I have to do now is attempt mission impossible, fail horribly and report back.btw the spiderlings are also trainable in a building so if I create a new spiderling every time a spiderling dies then that would not work also the hero doesn't learn the ability "offspring" is a unit ability the hero starts with and every time the hero gains a level so does the ability

EDIT/// well I've tried and failed I've made 5 triggers ( one that gives the hero the offspring ability and steps the offspring ability's level to the hero's level)

  • Offspring 1
    • Events
    • Unit - A unit enters (Playable map area)
    • Conditions
    • (Unit-type of (Entering unit)) Equal to Nerubian Spiderling (Offspring Dummy)
    • Actions
    • Set TempUnit = (Entering unit)
    • Set AbilityAdd = (Replacing Offspring dummy)
    • Unit - Add AbilityAdd to TempUnit

  • Offspring 2
    • Events
    • Unit - A unit enters (Playable map area)
    • Conditions
    • (Unit-type of (Entering unit)) Equal to Nerubian Queen
    • Actions
    • Set AbilityAdd = Offspring ( Queen )
    • Set TempUnit = (Entering unit)
    • Unit - Add AbilityAdd to TempUnit
    • Unit - Set level of AbilityAdd for (Entering unit) to (Hero level of (Entering unit))
    • Trigger - Turn on Offspring 3 <gen>

  • Offspring 3
    • Events
    • Unit - A unit Gains a level
    • Conditions
    • (Unit-type of (Leveling Hero)) Equal to Nerubian Queen
    • Actions
    • Set AbilityAdd = Offspring ( Queen )
    • Set TempUnit = (Leveling Hero)
    • Set Player_Owner = (Owner of TempUnit)
    • Unit - Set level of AbilityAdd for TempUnit to (Hero level of TempUnit)
    • Unit - Create (1 x (Level of AbilityAdd for TempUnit)) Nerubian Spiderling (Offspring Dummy) for Player_Owner at (Position of TempUnit) facing Default building facing degrees
    • Set TempUnit2 = (Last created unit)
    • Unit - Order TempUnit2 to Follow TempUnit
  • Offspring 4
    • Events
    • Unit - A unit Dies
    • Conditions
    • (Unit-type of (Dying unit)) Equal to Nerubian Queen
    • Actions
    • Set TempUnit = (Dying unit)
    • Set tempPlayer = (Owner of TempUnit)
    • Set tempGroup1 = (Units of type Nerubian Spiderling (Offspring))
    • Unit Group - Pick every unit in tempGroup1 and do (Actions)
    • Loop - Actions
    • Unit - Kill (Picked unit)
    • Trigger - Turn off Offspring 5 <gen>
  • Offspring 5
    • Events
    • Unit - A unit Dies
    • Conditions
    • (Unit-type of (Dying unit)) Equal to Nerubian Spiderling (Offspring)
    • Actions
    • Set TempUnit = (Dying unit)
    • Set tempPlayer = (Owner of TempUnit)
    • Wait 10.00 game-time seconds
    • Unit - Create 1 Nerubian Spiderling (Offspring Dummy) for tempPlayer at (Position of TempUnit) facing Default building facing degrees
 
Last edited:
Status
Not open for further replies.
Top