- Joined
- Jul 29, 2008
- Messages
- 30
A few times its been asked how to make devour a multi unit ability, I asked it as well and got several suggestions and help on different parts of scripting an gui triggers. I just wanted to say thanks for the help here and I believe I have found a solution that just might work. I'm looking for reviews on the mechanics of this.
First of all the devour ability is not used at all. Instead a copy of charm with its tooltip and button picture changed to devour. Tone down its range to a small amount so that when used a unit will be close enough to be "loaded" as in transport loaded.
See where I'm going? Add the cargo and load abilities to the unit change the cargo to whatever size desired, then make a trigger that causes a unit who uses the charm ability to load the targeted unit. Also set the units custom value to -2.
In a completely seperate trigger detect a unit changing ownership event. First check the custom value to see if it is -1. This is to see if the unit is changing ownership back to its original team. Else if it is -2 set the custom value of the unit to the player index of its previous owner.
In a seperate trigger detect unit is loaded onto transport. The unit is now in so add it to a unit group called stomach or similar. Set a variable to its custom value then change its custom value to -1. Change its ownership back to the value you saved in a var so that you now have an enemy unit inside the cargo of a friendly unit. Now wait whatever time you wish and order the transporting unit to unload the loaded unit. You could just skip that part if you wish if you want them permanently devoured until the unit dies.
Now in the final trigger do a every 2 seconds or similar event and pick every unit in the stomach unit group and deal damage to them.
I havn't fully tested this yet. Only pieces and parts, but what do you think? Will it work?
First of all the devour ability is not used at all. Instead a copy of charm with its tooltip and button picture changed to devour. Tone down its range to a small amount so that when used a unit will be close enough to be "loaded" as in transport loaded.
See where I'm going? Add the cargo and load abilities to the unit change the cargo to whatever size desired, then make a trigger that causes a unit who uses the charm ability to load the targeted unit. Also set the units custom value to -2.
In a completely seperate trigger detect a unit changing ownership event. First check the custom value to see if it is -1. This is to see if the unit is changing ownership back to its original team. Else if it is -2 set the custom value of the unit to the player index of its previous owner.
In a seperate trigger detect unit is loaded onto transport. The unit is now in so add it to a unit group called stomach or similar. Set a variable to its custom value then change its custom value to -1. Change its ownership back to the value you saved in a var so that you now have an enemy unit inside the cargo of a friendly unit. Now wait whatever time you wish and order the transporting unit to unload the loaded unit. You could just skip that part if you wish if you want them permanently devoured until the unit dies.
Now in the final trigger do a every 2 seconds or similar event and pick every unit in the stomach unit group and deal damage to them.
I havn't fully tested this yet. Only pieces and parts, but what do you think? Will it work?