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

Readding non-hero abilities with Triggers after ...

Status
Not open for further replies.
Level 6
Joined
Apr 27, 2006
Messages
186
I hope the length of this doesn't scare people away :p.

In the map that I am currently making there are multiple heros that have abilities where they change their forms (usually using morphing abilities like "bear form", but sometimes using the gamecache to store entir heros). I also have multiple abilities that are added to the hero as quest rewards and other abilities (i.e. 8% evasion added to a hero that completes a quest).
My problem is this. I have a way to move abilities to morphed units that aren't hero abilities, but it involves many if conditions and events. Here is one of my triggers for this.

Change Form Equipment Maintain
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Change Form
Actions
Wait 0.10 seconds
Set ChangedFormer = (Random unit from (Units in (Playable map area) matching (((((Matching unit) is an illusion) Equal to False) and ((Owner of (Matching unit)) Equal to (Owner of (Triggering unit)))) and ((((Unit-type of (Matching unit)) Equal to Elvish Ancient (Heavy Form))
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Deity for CarrierHawk[(Player number of (Owner of (Triggering unit)))]) Equal to 1
Then - Actions
Unit - Add Ares Damage Bonus (+15) to Hero[(Player number of (Owner of (Triggering unit)))]
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Deity for CarrierHawk[(Player number of (Owner of (Triggering unit)))]) Equal to 2
Then - Actions
Unit - Add Artemis Agility Bonus (+8 Agility) to Hero[(Player number of (Owner of (Triggering unit)))]
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Deity for CarrierHawk[(Player number of (Owner of (Triggering unit)))]) Equal to 3
Then - Actions
Unit - Add Asclepsius Life Steal to Hero[(Player number of (Owner of (Triggering unit)))]
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Deity for CarrierHawk[(Player number of (Owner of (Triggering unit)))]) Equal to 4
Then - Actions
Unit - Add Athena Intelligence Bonus (+8 Intelligence) to Hero[(Player number of (Owner of (Triggering unit)))]
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Deity for CarrierHawk[(Player number of (Owner of (Triggering unit)))]) Equal to 5
Then - Actions
Unit - Add Chronos Attack Speed Bonus to Hero[(Player number of (Owner of (Triggering unit)))]
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Deity for CarrierHawk[(Player number of (Owner of (Triggering unit)))]) Equal to 6
Then - Actions
Unit - Add Cleaving Attack (Eris) to Hero[(Player number of (Owner of (Triggering unit)))]
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Deity for CarrierHawk[(Player number of (Owner of (Triggering unit)))]) Equal to 7
Then - Actions
Unit - Add Gaia Life Bonus to Hero[(Player number of (Owner of (Triggering unit)))]
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Deity for CarrierHawk[(Player number of (Owner of (Triggering unit)))]) Equal to 8
Then - Actions
Unit - Add Mercury Move Speed Bonus to Hero[(Player number of (Owner of (Triggering unit)))]
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Deity for CarrierHawk[(Player number of (Owner of (Triggering unit)))]) Equal to 9
Then - Actions
Unit - Add Moirae Critical to Hero[(Player number of (Owner of (Triggering unit)))]
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Deity for CarrierHawk[(Player number of (Owner of (Triggering unit)))]) Equal to 10
Then - Actions
Unit - Add Poseidon All Stat Bonus to Hero[(Player number of (Owner of (Triggering unit)))]
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Level of Deity for CarrierHawk[(Player number of (Owner of (Triggering unit)))]) Equal to 11
Then - Actions
Unit - Add Zeus Strength Bonus to Hero[(Player number of (Owner of (Triggering unit)))]
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
WeaponTypeOfEquipedWeapon[(Player number of (Owner of (Triggering unit)))] Equal to Stone Helm
Then - Actions
Unit - Add Helm Armor Bonus to Hero[(Player number of (Owner of (Triggering unit)))]
Unit - Add Helm Strength Bonus 1 to Hero[(Player number of (Owner of (Triggering unit)))]
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
WeaponTypeOfEquipedWeapon[(Player number of (Owner of (Triggering unit)))] Equal to Bronze Helm
Then - Actions
Unit - Add Helm Armor Bonus to Hero[(Player number of (Owner of (Triggering unit)))]
Unit - Set level of Helm Armor Bonus for Hero[(Player number of (Owner of (Triggering unit)))] to 2
Unit - Add Helm Strength Bonus 2 to Hero[(Player number of (Owner of (Triggering unit)))]
Unit - Add Helm Life Bonus 1 to Hero[(Player number of (Owner of (Triggering unit)))]
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
WeaponTypeOfEquipedWeapon[(Player number of (Owner of (Triggering unit)))] Equal to Iron Helm
Then - Actions
Unit - Add Helm Armor Bonus to Hero[(Player number of (Owner of (Triggering unit)))]
Unit - Set level of Helm Armor Bonus for Hero[(Player number of (Owner of (Triggering unit)))] to 3
Unit - Add Helm Strength Bonus 3 to Hero[(Player number of (Owner of (Triggering unit)))]
Unit - Add Helm Life Bonus 2 to Hero[(Player number of (Owner of (Triggering unit)))]
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
WeaponTypeOfEquipedWeapon[(Player number of (Owner of (Triggering unit)))] Equal to Steel Helm
Then - Actions
Unit - Add Helm Armor Bonus to Hero[(Player number of (Owner of (Triggering unit)))]
Unit - Set level of Helm Armor Bonus for Hero[(Player number of (Owner of (Triggering unit)))] to 4
Unit - Add Helm Strength Bonus 4 to Hero[(Player number of (Owner of (Triggering unit)))]
Unit - Add Helm Life Bonus 3 to Hero[(Player number of (Owner of (Triggering unit)))]
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
WeaponTypeOfEquipedWeapon[(Player number of (Owner of (Triggering unit)))] Equal to Myhtril Helm
Then - Actions
Unit - Add Helm Armor Bonus to Hero[(Player number of (Owner of (Triggering unit)))]
Unit - Set level of Helm Armor Bonus for Hero[(Player number of (Owner of (Triggering unit)))] to 5
Unit - Add Helm Strength Bonus 5 to Hero[(Player number of (Owner of (Triggering unit)))]
Unit - Add Helm Life Bonus 4 to Hero[(Player number of (Owner of (Triggering unit)))]
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
WeaponTypeOfEquipedWeapon[(Player number of (Owner of (Triggering unit)))] Equal to Light Plate
Then - Actions
Unit - Add Heavy Armor HP Bonus 1 to Hero[(Player number of (Owner of (Triggering unit)))]
Unit - Add Heavy Armor Armor Bonus to Hero[(Player number of (Owner of (Triggering unit)))]
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
WeaponTypeOfEquipedWeapon[(Player number of (Owner of (Triggering unit)))] Equal to Half Plate
Then - Actions
Unit - Add Heavy Armor HP Bonus 2 to Hero[(Player number of (Owner of (Triggering unit)))]
Unit - Add Heavy Armor Armor Bonus to Hero[(Player number of (Owner of (Triggering unit)))]
Unit - Set level of Heavy Armor Armor Bonus for Hero[(Player number of (Owner of (Triggering unit)))] to 2
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
WeaponTypeOfEquipedWeapon[(Player number of (Owner of (Triggering unit)))] Equal to Scale Mail
Then - Actions
Unit - Add Heavy Armor HP Bonus 3 to Hero[(Player number of (Owner of (Triggering unit)))]
Unit - Add Heavy Armor Armor Bonus to Hero[(Player number of (Owner of (Triggering unit)))]
Unit - Set level of Heavy Armor Armor Bonus for Hero[(Player number of (Owner of (Triggering unit)))] to 3
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
WeaponTypeOfEquipedWeapon[(Player number of (Owner of (Triggering unit)))] Equal to Splint Mail
Then - Actions
Unit - Add Heavy Armor HP Bonus 4 to Hero[(Player number of (Owner of (Triggering unit)))]
Unit - Add Heavy Armor Armor Bonus to Hero[(Player number of (Owner of (Triggering unit)))]
Unit - Set level of Heavy Armor Armor Bonus for Hero[(Player number of (Owner of (Triggering unit)))] to 4
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Item-type of (Item being manipulated)) Equal to Full Plate
Then - Actions
Unit - Add Heavy Armor HP Bonus 5 to Hero[(Player number of (Owner of (Triggering unit)))]
Unit - Add Heavy Armor Armor Bonus to Hero[(Player number of (Owner of (Triggering unit)))]
Unit - Set level of Heavy Armor Armor Bonus for Hero[(Player number of (Owner of (Triggering unit)))] to 5
Else - Actions

I'm wondering if there's a way to detect non hero abilities and store them in an array, then transfer them onto another hero without having to check for all of them. I.e. A hero has 8% evasion (a unit ability added to the hero with triggers)and 10% critical (a unit ability added to the hero with triggers). If you have 100 abilities that are added to heros in the game, and you don't want to individually check to see which ones your hero has (all you want to do is move those 2 abilities to the morphed into unit) what would you do?
 
Level 6
Joined
Apr 27, 2006
Messages
186
I'm not sure what you mean by that because technically as far as I know all abilities are permanent until removed with a trigger, and morphing doesnt change the hero as far as I know, but instead replaces it, finally I have units with morph abilities that when they use the morph, the other unit is created with a trigger, and the old one is stored in the game cache and removed.

So there's no better system than the one I've got?
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
Tis still around in JASS, anyways :p

JASS:
native UnitMakeAbilityPermanent takes unit whichUnit, boolean permanent, integer abilityId returns boolean

Call it with

Custom Script: call UnitMakeAbilityPermanent( myUnit, true, myAbil )

(note that you have to change myUnit to a unit, and myAbil to the abilty's 4-digit rawcode)
 
Status
Not open for further replies.
Top