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

[Spell] Spells added by trigger disappear if unit use robo goblin spell

Status
Not open for further replies.
Level 6
Joined
Jan 2, 2015
Messages
171
Hi, i was making a trigger that will add disabled extra spell as alternate spell when unit learns certain spell and set level of extra spell to level of learned spell. But i want this extra spell to be active when unit use alternate form (Robo Goblin Based Spell) and disabled the learned spell But after i changed my unit form to alternate form, this extra spell just disappear and wont come back when i back to original form. Is there any way to retain this spell? This extra spell is not on unit Ability List on object editor and only given to unit by trigger. So basicly, i wants to have an unit with 2 active spell while in original form then disable active spells from alternate from (extra spell) and 2 active spell while on alternate form but disabling spells from original but changing form with robo goblin will remove my alternate spell
 
Last edited:

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,199
You need to make any abilities added by triggers permanent using the appropriate action otherwise they will be lost during morphs such as avatar, metamorphosis, robogoblin, bear form etc.

There is an action along the lines of "make ability permanent for unit", what it is exactly called in GUI I do not know. After adding the abilities to the unit you need to use that on the unit for the abilities you added. The result should be that the abilites are now retained through morphs.
 
Level 13
Joined
Mar 24, 2013
Messages
1,105
I dont recall there being a GUI action for this.

It should be
Call UnitMakeAbilityPermanent(udg_yourUnit, ability id)


Edit: Here is the native, you'd set the boolean permanent to true

JASS:
native UnitMakeAbilityPermanent takes unit whichUnit, boolean permanent, integer abilityId returns boolean
 
Last edited:
Level 39
Joined
Feb 27, 2007
Messages
5,016
so, no solution for gui user like me or do u have alternate way to make it permanent?
Unless it's been added in the JNGP then no there's no way to do it in GUI. A custom script line like the following should be pretty easy though:
  • Set YOUR_UNIT_VARIABLE = (Triggering Unit)
  • Set YOUR_ABILITY_VARIABLE = <The spell you want the unit to retain>
  • Custom script: call UnitMakeAbilityPermanent(udg_YOUR_UNIT_VARIABLE, true, udg_YOUR_ABILITY_VARIABLE)
  • -------- Make sure you change the 2 above variable references to "udg_"+<the name of your variable with _ instead of spaces> --------
 
Level 6
Joined
Jan 2, 2015
Messages
171
Unless it's been added in the JNGP then no there's no way to do it in GUI. A custom script line like the following should be pretty easy though:
  • Set YOUR_UNIT_VARIABLE = (Triggering Unit)
  • Set YOUR_ABILITY_VARIABLE = <The spell you want the unit to retain>
  • Custom script: call UnitMakeAbilityPermanent(udg_YOUR_UNIT_VARIABLE, true, udg_YOUR_ABILITY_VARIABLE)
  • -------- Make sure you change the 2 above variable references to "udg_"+<the name of your variable with _ instead of spaces> --------

what is jpng?
 
Level 8
Joined
Jan 28, 2016
Messages
486
Alternatively, you can add the ability after the transformation is complete. This avoids having to make the added ability permanent with the above Jass native but you might need to add some more conditions and other checks depending on what you're after.

  • Test
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Robo-Goblin
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Tinker
        • Then - Actions
          • Unit - Add Shockwave to (Triggering unit)
        • Else - Actions
          • Unit - Remove Shockwave from (Triggering unit)
 
Level 6
Joined
Jan 2, 2015
Messages
171
Alternatively, you can add the ability after the transformation is complete. This avoids having to make the added ability permanent with the above Jass native but you might need to add some more conditions and other checks depending on what you're after.

  • Test
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Robo-Goblin
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Tinker
        • Then - Actions
          • Unit - Add Shockwave to (Triggering unit)
        • Else - Actions
          • Unit - Remove Shockwave from (Triggering unit)

Hi, i just want it to stay permanent and not removing it becuz if i remove it, it will simply reset the alternate form spell which will make the user use the morph spell and spam the alternate spell. but ill try anyone suggestion here and see if its working
 
Status
Not open for further replies.
Top