| 06-14-2004, 02:06 AM | #1 |
In my new campaign, there are two main character heroes: Arrianna Ryvern and Falar Gallant. Both of them have 3 different character classes which level up individually (gain XP seperately) so you have to practice at all of em. Anyhow, in the trigger I have all three hero versions of each hero (they have diff model and move sets) already on the map, as neutral passive. The trigger works, but I don't know how I can transfer the buffs from unit A to unit B. Also I have access to WEU if that helps. Any help with this would really be appreciated the long trigger is as follows: Change hero Events Unit - A unit Uses an item Conditions Actions If (All Conditions are True) then do (Then Actions) else do (Else Actions) If - Conditions And - All (Conditions) are true Conditions (Item-type of (Item being manipulated)) Equal to One-Shot Blunderbus (Hero manipulating item) Equal to Falar Then - Actions Set Falarpoint = (Position of Falar) Unit - Move Falar instantly to (Center of ffighter <gen>) Unit - Change ownership of Falar to Neutral Passive and Change color Unit - Move Falar Gallant (Gun) 0005 <gen> instantly to Falarpoint Hero - Give (Item carried by Falar in slot 1) to Falar Gallant (Gun) 0005 <gen> Hero - Give (Item carried by Falar in slot 2) to Falar Gallant (Gun) 0005 <gen> Hero - Give (Item carried by Falar in slot 3) to Falar Gallant (Gun) 0005 <gen> Hero - Give (Item carried by Falar in slot 4) to Falar Gallant (Gun) 0005 <gen> Hero - Give (Item carried by Falar in slot 5) to Falar Gallant (Gun) 0005 <gen> Hero - Give (Item carried by Falar in slot 6) to Falar Gallant (Gun) 0005 <gen> Unit - Set life of Falar Gallant (Gun) 0005 <gen> to (Life of Falar) Unit - Set mana of Falar Gallant (Gun) 0005 <gen> to (Mana of Falar) Item - Remove (Item carried by Falar Gallant (Gun) 0005 <gen> of type One-Shot Blunderbus) Item - Remove (Item carried by Falar Gallant (Gun) 0005 <gen> of type Stave) Item - Remove (Item carried by Falar Gallant (Gun) 0005 <gen> of type Axe and Hammer) Hero - Create Stave and give it to Falar Gallant (Gun) 0005 <gen> Hero - Create Axe and Hammer and give it to Falar Gallant (Gun) 0005 <gen> Item - Remove (Item carried by Falar in slot 1) Item - Remove (Item carried by Falar in slot 2) Item - Remove (Item carried by Falar in slot 3) Item - Remove (Item carried by Falar in slot 4) Item - Remove (Item carried by Falar in slot 5) Item - Remove (Item carried by Falar in slot 6) Set Falar = Falar Gallant (Gun) 0005 <gen> Unit - Change ownership of Falar to Player 1 (Red) and Change color Else - Actions Do nothing If (All Conditions are True) then do (Then Actions) else do (Else Actions) If - Conditions And - All (Conditions) are true Conditions (Item-type of (Item being manipulated)) Equal to Stave (Hero manipulating item) Equal to Falar Then - Actions Set Falarpoint = (Position of Falar) Unit - Move Falar instantly to (Center of ffighter <gen>) Unit - Change ownership of Falar to Neutral Passive and Change color Unit - Move Falar Gallant (Stave) 0006 <gen> instantly to Falarpoint Hero - Give (Item carried by Falar in slot 1) to Falar Gallant (Stave) 0006 <gen> Hero - Give (Item carried by Falar in slot 2) to Falar Gallant (Stave) 0006 <gen> Hero - Give (Item carried by Falar in slot 3) to Falar Gallant (Stave) 0006 <gen> Hero - Give (Item carried by Falar in slot 4) to Falar Gallant (Stave) 0006 <gen> Hero - Give (Item carried by Falar in slot 5) to Falar Gallant (Stave) 0006 <gen> Hero - Give (Item carried by Falar in slot 6) to Falar Gallant (Stave) 0006 <gen> Unit - Set life of Falar Gallant (Stave) 0006 <gen> to (Life of Falar) Unit - Set mana of Falar Gallant (Stave) 0006 <gen> to (Mana of Falar) Item - Remove (Item carried by Falar Gallant (Stave) 0006 <gen> of type Stave) Item - Remove (Item carried by Falar Gallant (Stave) 0006 <gen> of type Axe and Hammer) Item - Remove (Item carried by Falar Gallant (Stave) 0006 <gen> of type One-Shot Blunderbus) Hero - Create Axe and Hammer and give it to Falar Gallant (Stave) 0006 <gen> Hero - Create One-Shot Blunderbus and give it to Falar Gallant (Stave) 0006 <gen> Item - Remove (Item carried by Falar in slot 1) Item - Remove (Item carried by Falar in slot 2) Item - Remove (Item carried by Falar in slot 3) Item - Remove (Item carried by Falar in slot 4) Item - Remove (Item carried by Falar in slot 5) Item - Remove (Item carried by Falar in slot 6) Set Falar = Falar Gallant (Stave) 0006 <gen> Unit - Change ownership of Falar to Player 1 (Red) and Change color Else - Actions Do nothing If (All Conditions are True) then do (Then Actions) else do (Else Actions) If - Conditions And - All (Conditions) are true Conditions (Item-type of (Item being manipulated)) Equal to Axe and Hammer (Hero manipulating item) Equal to Falar Then - Actions Set Falarpoint = (Position of Falar) Unit - Move Falar instantly to (Center of ffighter <gen>) Unit - Change ownership of Falar to Neutral Passive and Change color Unit - Move Falar Gallant (Axe and Hammer) 0004 <gen> instantly to Falarpoint Hero - Give (Item carried by Falar in slot 1) to Falar Gallant (Axe and Hammer) 0004 <gen> Hero - Give (Item carried by Falar in slot 2) to Falar Gallant (Axe and Hammer) 0004 <gen> Hero - Give (Item carried by Falar in slot 3) to Falar Gallant (Axe and Hammer) 0004 <gen> Hero - Give (Item carried by Falar in slot 4) to Falar Gallant (Axe and Hammer) 0004 <gen> Hero - Give (Item carried by Falar in slot 5) to Falar Gallant (Axe and Hammer) 0004 <gen> Hero - Give (Item carried by Falar in slot 6) to Falar Gallant (Axe and Hammer) 0004 <gen> Unit - Set life of Falar Gallant (Axe and Hammer) 0004 <gen> to (Life of Falar) Unit - Set mana of Falar Gallant (Axe and Hammer) 0004 <gen> to (Mana of Falar) Item - Remove (Item carried by Falar Gallant (Axe and Hammer) 0004 <gen> of type Stave) Item - Remove (Item carried by Falar Gallant (Axe and Hammer) 0004 <gen> of type Axe and Hammer) Item - Remove (Item carried by Falar Gallant (Axe and Hammer) 0004 <gen> of type One-Shot Blunderbus) Hero - Create Stave and give it to Falar Gallant (Axe and Hammer) 0004 <gen> Hero - Create One-Shot Blunderbus and give it to Falar Gallant (Axe and Hammer) 0004 <gen> Item - Remove (Item carried by Falar in slot 1) Item - Remove (Item carried by Falar in slot 2) Item - Remove (Item carried by Falar in slot 3) Item - Remove (Item carried by Falar in slot 4) Item - Remove (Item carried by Falar in slot 5) Item - Remove (Item carried by Falar in slot 6) Set Falar = Falar Gallant (Axe and Hammer) 0004 <gen> Unit - Change ownership of Falar to Player 1 (Red) and Change color Else - Actions Do nothing If (All Conditions are True) then do (Then Actions) else do (Else Actions) If - Conditions And - All (Conditions) are true Conditions (Item-type of (Item being manipulated)) Equal to Bow (Hero manipulating item) Equal to Arrianna Then - Actions Set ArriPoint = (Position of Arrianna) Set ChangingArrianna = Arrianna Ryvern (Bow) 0007 <gen> Unit - Move Arrianna instantly to (Center of aruneblade <gen>) Unit - Change ownership of Arrianna to Neutral Passive and Change color Unit - Move ChangingArrianna instantly to ArriPoint Hero - Give (Item carried by Arrianna in slot 1) to ChangingArrianna Hero - Give (Item carried by Arrianna in slot 2) to ChangingArrianna Hero - Give (Item carried by Arrianna in slot 3) to ChangingArrianna Hero - Give (Item carried by Arrianna in slot 4) to ChangingArrianna Hero - Give (Item carried by Arrianna in slot 5) to ChangingArrianna Hero - Give (Item carried by Arrianna in slot 6) to ChangingArrianna Unit - Set life of ChangingArrianna to (Life of Arrianna) Unit - Set mana of ChangingArrianna to (Mana of Arrianna) Item - Remove (Item carried by ChangingArrianna of type Bow) Item - Remove (Item carried by ChangingArrianna of type Runeblade) Item - Remove (Item carried by ChangingArrianna of type Moonscythe) Hero - Create Runeblade and give it to ChangingArrianna Hero - Create Moonscythe and give it to ChangingArrianna Item - Remove (Item carried by Falar in slot 1) Item - Remove (Item carried by Falar in slot 2) Item - Remove (Item carried by Falar in slot 3) Item - Remove (Item carried by Falar in slot 4) Item - Remove (Item carried by Falar in slot 5) Item - Remove (Item carried by Falar in slot 6) Set Arrianna = ChangingArrianna Unit - Change ownership of Arrianna to Player 1 (Red) and Change color Else - Actions Do nothing If (All Conditions are True) then do (Then Actions) else do (Else Actions) If - Conditions And - All (Conditions) are true Conditions (Item-type of (Item being manipulated)) Equal to Runeblade (Hero manipulating item) Equal to Arrianna Then - Actions Set ArriPoint = (Position of Arrianna) Set ChangingArrianna = Arrianna Ryvern (Runeblade) 0009 <gen> Unit - Move Arrianna instantly to (Center of aruneblade <gen>) Unit - Change ownership of Arrianna to Neutral Passive and Change color Unit - Move ChangingArrianna instantly to ArriPoint Hero - Give (Item carried by Arrianna in slot 1) to ChangingArrianna Hero - Give (Item carried by Arrianna in slot 2) to ChangingArrianna Hero - Give (Item carried by Arrianna in slot 3) to ChangingArrianna Hero - Give (Item carried by Arrianna in slot 4) to ChangingArrianna Hero - Give (Item carried by Arrianna in slot 5) to ChangingArrianna Hero - Give (Item carried by Arrianna in slot 6) to ChangingArrianna Unit - Set life of ChangingArrianna to (Life of Arrianna) Unit - Set mana of ChangingArrianna to (Mana of Arrianna) Item - Remove (Item carried by ChangingArrianna of type Bow) Item - Remove (Item carried by ChangingArrianna of type Runeblade) Item - Remove (Item carried by ChangingArrianna of type Moonscythe) Hero - Create Bow and give it to ChangingArrianna Hero - Create Moonscythe and give it to ChangingArrianna Item - Remove (Item carried by Falar in slot 1) Item - Remove (Item carried by Falar in slot 2) Item - Remove (Item carried by Falar in slot 3) Item - Remove (Item carried by Falar in slot 4) Item - Remove (Item carried by Falar in slot 5) Item - Remove (Item carried by Falar in slot 6) Set Arrianna = ChangingArrianna Unit - Change ownership of Arrianna to Player 1 (Red) and Change color Else - Actions Do nothing If (All Conditions are True) then do (Then Actions) else do (Else Actions) If - Conditions And - All (Conditions) are true Conditions (Item-type of (Item being manipulated)) Equal to Moonscythe (Hero manipulating item) Equal to Arrianna Then - Actions Set ArriPoint = (Position of Arrianna) Set ChangingArrianna = Arrianna Ryvern (Moonscythe) 0008 <gen> Unit - Move Arrianna instantly to (Center of aruneblade <gen>) Unit - Change ownership of Arrianna to Neutral Passive and Change color Unit - Move ChangingArrianna instantly to ArriPoint Hero - Give (Item carried by Arrianna in slot 1) to ChangingArrianna Hero - Give (Item carried by Arrianna in slot 2) to ChangingArrianna Hero - Give (Item carried by Arrianna in slot 3) to ChangingArrianna Hero - Give (Item carried by Arrianna in slot 4) to ChangingArrianna Hero - Give (Item carried by Arrianna in slot 5) to ChangingArrianna Hero - Give (Item carried by Arrianna in slot 6) to ChangingArrianna Unit - Set life of ChangingArrianna to (Life of Arrianna) Unit - Set mana of ChangingArrianna to (Mana of Arrianna) Item - Remove (Item carried by ChangingArrianna of type Bow) Item - Remove (Item carried by ChangingArrianna of type Runeblade) Item - Remove (Item carried by ChangingArrianna of type Moonscythe) Hero - Create Runeblade and give it to ChangingArrianna Hero - Create Bow and give it to ChangingArrianna Item - Remove (Item carried by Falar in slot 1) Item - Remove (Item carried by Falar in slot 2) Item - Remove (Item carried by Falar in slot 3) Item - Remove (Item carried by Falar in slot 4) Item - Remove (Item carried by Falar in slot 5) Item - Remove (Item carried by Falar in slot 6) Set Arrianna = ChangingArrianna Unit - Change ownership of Arrianna to Player 1 (Red) and Change color Else - Actions Do nothing A few of the things in here (the item-remove thing) is unnescessary, and is disabled in the editor (with the little gear symbol next to it) because of it so don't mention it to me :-D |
| 06-14-2004, 06:32 AM | #2 |
Well, I haven't read your code, so let me know if this answer isn't acceptable and I will read through it, but... You can't directly add buffs to a hero. The reason being that the buff is nothing in itself, it merely represents the effect of an ability that is currently affecting the hero. Removing buffs is possible in order to end the effect of an ability before its duration expires. An example use would be entering an inn... you wouldn't want to come out and still be poisoned. So the only way to add a buff is by using an ability on a hero. For example, if you want a hero to have the stun buff, you need to cast Firebolt (or some such spell) on him that will stun him. If you're doing a thing where a hero can switch forms... for instance, turn into a dragon... and want the hero to retain all buffs from his previous form--look into using the Demon Hunter's Metamorphosis ability as a base. Oh, and one thing I just thought of. You can pass negative buffs to enemy units and positive buffs to friendly units by using the Mentalist's Spell Steal ability. But obviously, that has it's limitations (I don't think you could transfer a poison effect, such as one caused by Shadow Strike). |
| 06-14-2004, 09:44 AM | #3 |
Well, in theory the spellbreaker's spell steal would be the only way, but it has some limitations (like you cannot target undispellable spells, you cannot choose the target the spell will go to...). An easier solution would be to cast the same spells that are cast on the heores at the same time on their other versions. Of course, casting spells that target your hero on his other versions is easy, whenever the hero is target of spell, give the spell being cast to a dummy caster and order him to cast it on other versions of the hero. The problem comes with AoE spells where you would have to check if the hero is in range (or if he got the buff when the spell was cast). |
| 06-14-2004, 12:31 PM | #4 |
Okay one winged, first of all lets introduce you to the "For each interger A" triggers. Instead of doing "Give item in slot 1 of XXXX to YYYY" repeated 6 times, just use: Code:
For each integer between 1 and 6 do:
Give item in Slot (Integer A) of XXXX to YYYYYAs for your question itself, why not use the "Chaos" abilities to switch from one unit to the next (though i hear Robo-goblin set to permanent morph is less buggy for this). Instead of all that mess of triggers, you'd just need to give the morphing unit the appropriate custom "Chaos" ability. |
| 06-19-2004, 03:39 AM | #5 | |
Quote:
Alright, first, I said I already knew the item thing was unnescessary and it has already been changed... second, the three heroes that change in the game change classes and gain XP in them seperately, so I have to track each seperate hero. they aren't changing to new units, they switch between hero forms based on their equipped item. For example, Falar Gallant can equip a gun, an axe+hammer combo, and a stave, and that changes him into a gunner, fighter, and warpriest class (which are custom models). I have to move all buffs from hero A to hero B. So far I can't see any possible way to use metamorphosis for the hero switch, cuz it doesn't track things like XP and wat abilities you've learned. Everything for the hero switch system I made works, except the buffs. The spell steal thing seems like a good idea but... if spell steal does it there is a way to do it with Jass... can anyone come up with a custom script for this if not a trigger? Also can any advanced world editor do this (such as WEU)? Oh, and tank commanders is pretty cool, BTW, good job :D |
| 06-19-2004, 08:03 AM | #6 |
Well, without JASS, I would say your best bet would remain to cast any buffing spell that is cast on your heroes on their alternate versions as well. That way, when you switch the class, your new hero will already have the buff on him, and the remaining duration of the buff will be the same. |
| 06-19-2004, 05:11 PM | #7 |
Apologies, but that block of triggers are so big and clunky, I didn't bother to read through it. I haven't tested this, but the "replace unit" triggers MAY carry buffs over. I mean it's worth a try right? |
| 06-19-2004, 06:15 PM | #8 |
It's worth a try, unless I tell you, speaking from my own experience, that it doesn't. Besides, the "replace unit" doesn't work exactly the way OneWinged4ngel would want it to work, because it basicaly creates a new unit every time. A trigger that uses dummy casters to cast buff spells on the hero's alternate versions every time the version of the hero in use is affected by those buff spells isn't so bad. It's some if-then-else work (checking for every possible buff ability so you know which to cast on the alternate versions of the hero), but that shouldn't be hard for you, seeing the amount of code you have created already. For AoE spells, you can easily check if the hero was affected by them simply by checking if he has the buff right after the "starts the effect of an ability" happens, while for targeting spells, all you need to check is if the hero was the target. And, if you find a way to move buffs from unit to unit in jass, then that's even better. |
| 06-19-2004, 07:43 PM | #9 |
use the chaos ability it transfers buffs. You can see its usage in the campaigns. |
| 06-20-2004, 12:15 AM | #10 | |
Quote:
Well, see, I want to transfer the buffs onto an already existing unit, NOT create a new one...... |
| 06-26-2004, 08:13 PM | #11 |
Hmmm, no one knows? Well, about the casting everything that is cast on the hero idea... how would I do that? I'm especially confused how one would go about detecting aoe and so forth... |
| 06-26-2004, 08:21 PM | #12 | |
Quote:
chaos ability doesn't create new one, it replaces. you can have different ability and models for the unit, but the stats and its inventory will stay to same. |
| 06-27-2004, 03:11 AM | #13 | |
Quote:
Yeah but it doesn't take over abilities learned and such... they change back and forth between the hero types, including mid battle, so it has to be fluid. And it is, the way I have the trigger (now) it instantly changes them and makes a little special effect to make it look good and then makes them your primary selected unit again... so it's just as convenient as using metamorphosis. It just doesn't take buffs... |
| 07-03-2004, 04:39 PM | #14 |
...bump ... |
| 07-03-2004, 05:46 PM | #15 | |
Quote:
Well, you would have a "unit starts the effect of an ability" event and then an if-then-else cluster that determines what to do based on the spell cast: if it's a target unit buffing spell (like storm bolt), then you just check if the target is one of the heroes, if it's an instant AoE buffing ability (like howl of terror) then you check if the heroes have the buff (not 100%, because the unit can have the buff from before and is not actually in range when the spell is cast again; an alternative is checking if the unit is in range of the spell with a real comparison (distance between units)). When you find the spell that was cast and see if the heroes were affected, then all you have to do is create dummy casters, give them the spell that was cast, and order them to cast it on the alternative versions of that hero that was affected. If you have but a few buffing spells in your map, then it's just a few if-then-elses whenever a spell is cast, but if you have more of them, then I suggest arranging them in groups (single target, target point AoE, around the caster AoE) and storing them in variables, so that the "check which spell was cast" code is a bit cleaner and has instead of a whole bunch of if-then-elses just a loop for each spell-category that checks all spells stored in a ability-array. Essentialy, that would do the same as an if-then-else for each individual spell, but the code is a lot cleaner. |
