• 💀 Happy Halloween! 💀 It's time to vote for the best terrain! Check out the entries to Hive's HD Terrain Contest #2 - Vampire Folklore.❗️Poll closes on November 14, 2023. 🔗Click here to cast your vote!
  • 🏆 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!
  • 🏆 HD Level Design Contest #1 is OPEN! Contestants must create a maze with at least one entry point, and at least one exit point. The map should be made in HD mode, and should not be openable in SD. Only custom models from Hive's HD model and texture sections are allowed. The only exceptions are DNC models and omnilights. This is mainly a visual and design oriented contest, not technical. The UI and video walkthrough rules are there to give everyone an equal shot at victory by standardizing how viewers see the terrain. 🔗Click here to enter!

[JASS] Need help with custom script

Status
Not open for further replies.
Level 2
Joined
Jan 25, 2011
Messages
25
Hey guys

I need help with a Jass code in Gui custome script.

  • Custom script: call UnitMakeAbilityPermanentBJ(GetSpellAbilityUnit(), true, 'A017')
When i want to enable the trigger i get an error:

Invalid argument type (integer) in the next code line. I never get this error before.
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
You are passing variables in wrong order to function UnitMakeAbilityPermanentBJ since it takes:
function UnitMakeAbilityPermanentBJ takes boolean permanent, integer abilityId, unit whichUnit returns boolean

The order you were using fits for function UnitMakeAbilityPermanent - native.
However, do not use BJ, so leave the order of passing variables and change the function used. Egzample:

  • Custom script: set udg_i = 'A017'
  • Custom script: UnitMakeAbilityPermanent (GetSpellAbilityUnit(), true, udg_i)
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,156
JASS:
native UnitMakeAbilityPermanent takes unit whichUnit,boolean permanent,integer abilityId returns boolean
function UnitMakeAbilityPermanentBJ takes boolean permanent,integer abilityId,unit whichUnit returns boolean
    return UnitMakeAbilityPermanent(whichUnit, permanent, abilityId)
endfunction

Thus fixed version...
  • Custom script: call UnitMakeAbilityPermanent(GetSpellAbilityUnit(), true, 'A017')
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,156
None of you actually gave him corrected code.

Garfield1337, you told him how to make the correction without showing why or what the correction is.
Spinnaker, at the time I posted your code would have thrown a syntax error (was incorrect). You also use a variable for some reason which is not what he was asking.
 

Bannar

Code Reviewer
Level 26
Joined
Mar 19, 2008
Messages
3,140
None of you actually gave him corrected code.

Spinnaker, at the time I posted your code would have thrown a syntax error (was incorrect). You also use a variable for some reason which is not what he was asking.

!st sentence: wrong, we both did, sorry DSG dont lie.
Yeah, I've forgotten about ')' and Garfield mentioned it first, before you've even posted, it was corrected immidiately tho. However, eveyone can make mistakes and dont judge by it.
I just used to setting variables for such things, and thats nothing wrong with that.

Again, dont lie, you posted after two people gave answers and saying that any of them wasn't proper speaks that you do this only for reputation.
 
Status
Not open for further replies.
Top