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

[Solved] "Remove Ability/Buff" in jass with strings?

Status
Not open for further replies.
Level 7
Joined
Jun 14, 2009
Messages
235
I need to remove abilities and buffs with custom code, however im not exactly sure how. Im trying to make a system but you can't save abilities in hashtables so im trying to save the string of the ability, then remove ability with the ability code as a string.

In theory it would be something like "remove "udg _ability from target" but I don't have any clue for the syntax.

Sorry if this is sloppy im on my phone
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
first thing ability ids are not strings they are integers. More exact they are ascii values.
'hpea' is a peasant.

here is an easy way to remove them. one sec
  • Custom script: call UnitRemoveAbility( udg_tempUnit, udg_tempInt)
u can set the tempUnit to whatever u need it to b4 this action and set tempInt before this to the ability u want it to be.

like this
  • Actions
    • Set tempUnit = (Triggering unit)
    • Set tempInt = urAbilityArray[0]
    • Custom script: call UnitRemoveAbility( udg_tempUnit, udg_tempInt)
note: u have to store ur abilities raw code into the array.

if its in the same trigger that u use to cast it then u can use this
  • Custom script: call UnitRemoveAbility( udg_tempUnit, GetSpellAbilityId())
 
Level 7
Joined
Jun 14, 2009
Messages
235
I hate to post again, but I can't seem to set the integer to equal the ascii code. Do i set Temp_Into to convert string to integer? or how do I do this?
 
Level 29
Joined
Oct 24, 2012
Messages
6,543
I hate to post again, but I can't seem to set the integer to equal the ascii code. Do i set Temp_Into to convert string to integer? or how do I do this?

atually i think u need to use custom script for that i always forget about that in GUI.

if u use the ones i gave u with the tempInt use this
  • Custom script: set udg_tempInt = 'hpea'
change the hpea part and leave those ' in
 
Level 7
Joined
Jun 14, 2009
Messages
235
Ok testin

EDIT 1: YAY it passed the first test of working. Now I need to see if I can save the integer in a hashtable!!!

EDIT 2: YESSS thanks man!
 
Status
Not open for further replies.
Top