• 🏆 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!

Change Unit Owner (and Type) on Death

Status
Not open for further replies.
Level 3
Joined
Jun 20, 2009
Messages
42
So I've been working on a map that's kind of a hybrid of Dynasty Warriors and DOTA, and I'm having trouble with with the base capture mechanic.

I'm basically asking for two triggers here:
1) a straightforward "give control to killing player on death" trigger(which a fellow mentioned on this thread:(http://www.hiveworkshop.com/forums/triggers-scripts-269/changing-unit-ownership-85905/), but did not demonstrate).

2) a more complicated "replace with different unit for the killer's team" trigger. See, an idea I had for this map is that when a base is destroyed, it turns into an indestructible "ruin" belonging to the other team; after a short while, it turns into a full base. I've tried a few variations on this, but I've encountered some problems:
  • The "replace" action doesn't help; the replacement base is constantly displaced by the troops surrounding it to somewhere completely different.
  • The Phoenix Egg ability seems to mess with "death" triggers.

Please bear in mind that I have basically no idea how to use JASS; so if this could be done in GUI, that would be greatly appreciated.

Thanks in advance!
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,183
Hello.

Since my school starts in an hour I don't got time to give you an example for now. However I got some questions regarding your requests.

1. In your map you only got one hero per player right? and once that hero dies he will be allied with the one who killed him. What happens if Player A and Player B are allies, then player C kills player A, will player B and C be allies too?

2. It's hard to give a straight out answer to this since I don't know what a base looks like in your map. There is also more than one way to detect this.
2a. when you kill the main building the base is yours
2b. when you have destroyed every single building owned by player X spawn a new main building.
it also rise the question if you only want the main building you re-spawn for the player or if you want towers/barracks as well.

Sorry for just asking stuff but I think we need more specific info.
 
Level 24
Joined
Aug 1, 2013
Messages
4,657
Replace the "replace" action with Chaos or reversed transform.
To be more precise... remove ALL replace actions from all your maps and all maps that you download right now!

Replace action (same as wait action) should not be used until you know what happens behind the screens. There are a few actions that dont do what they say that they do, or do something more which is unwanted.

Replace is nothing more than, Remove unit + Create unit.
That means that you have a new unit and all stuff related to the first one are removed with that unit.
What you can do is put the alternative unit as alternative unit in a custom ability based of Chaos (orc unit ability).
When you give that ability to the unit, he will then transform into that alternative unit.
That way, you don't have collision problems and all data is maintained.

For the give control... I assume that you experience the problem with a dead unit that doesn't do anything because he is dead... is that right?

If so, the best thing you can do is make an alternative unit based on the first unit.
You get the unit type of the dying unit.
Then you create a new unit for player (p) of unit type (ut) and place it on location (x, y)
All values from the dying unit except the player.

When it is a hero, you also give him the proper level, update stats, give items, etc.
You even want to copy the abilities maybe but that will be part 2 of this situation.

I assume that you can continue for now with this information so...
 
Level 3
Joined
Jun 20, 2009
Messages
42
Hello Chaosy.

Let me answer your questions:
1) Players are fixed to 2 teams. In addition, one player on each team is a "'bot", and it is the 'bot's units who switch sides to the other 'bot. There are also going to be neutral creeps who can be "convinced" to join you. Though that sounds cool too(but not for this map, I think).

2) A bit of both, but really, each "base" just consists of one building(There are towers, and I might introduce auxiliary buildings, but they probably wouldn't use this mechanic).


Hi Wietlol,

I... have no idea how to use Chaos - I didn't even know what it did! I don't quite follow what you suggest I do with it, though.

I just used the "create unit for other team on location of dieing unit" and it appears to get shunted aside by the units surrounding it anyways(not quite as much as "replace", though).

I should probably explain how I tried to use Phoenix Egg: In testing, I used 3 structures: a Town Hall, a Dummy Ruin, and a Town Ruin. When the Town Hall used Egg Ability (A) to turn it into a Dummy Ruin; I would then use a Trigger to replace the Dummy Ruin with a Town Ruin belonging to the other team; the Town Ruin would use Egg Ability (B) to turn into a Town Hall after a time.

Before that, I tried using one Egg Ability to turn a Town Hall into a Town Ruin and back again. But, using a death trigger to change teams of "Triggering unit" didn't work.

In both cases, The Phoenix Egg ability prevented shunting.

Granted, it's 2am, so I might work it out tomorrow, but I think I could still use some help.

Thanks, guys.
 
Last edited:
Level 21
Joined
Mar 2, 2010
Messages
3,069
What chaos does is actually replace the activating unit with a different unit. it is used to upgrade the siege engine into the siege engine barrage and to upgrade the troll head hunter into the troll berserker. in order to use it you just need to create a custom version and place the unit you want it to change the unit into into the new unit type field and also remove the requirement. in order to use it just give it to the unit you want to replace.(it works seemlessly.)
 
Status
Not open for further replies.
Top