• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Invisibility does not work

Status
Not open for further replies.
Level 19
Joined
Nov 16, 2006
Messages
2,165
Well, I'm having a little problem with my spell here.
I checked surely everything and it still doesn't work.
I am still wrong, or it is the code. Could someone take a look on it
and tell me if it is right ? Thanks already.

Code:
function Trig_Divine_Bow_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A08A'
endfunction

function Trig_Divine_Bow_Actions takes nothing returns nothing
    local unit D = GetTriggerUnit()
    local unit L
    if (GetRandomReal(1.00, 100.00) <= 40) then
        set L = CreateUnit(GetOwningPlayer(D), 'h001', GetUnitX(D), GetUnitY(D), 0)
        call UnitApplyTimedLife(L, 'BTLF', 2) 
        call IssueTargetOrder(L, "invisbility", D)
        set L = null
    endif
    set D = null
endfunction
When this spell is casted, the unit (caster) has a 40% chance to become invisible.
~- Fl4meS
 
Level 4
Joined
Sep 20, 2005
Messages
72
code looks perfectly fine... perhaps its not the code
or maybe add your ability to your dummy caster? i would add via trigger instead of object editor
if not, it could be mana? casting point? =S
 
Level 11
Joined
Jul 12, 2005
Messages
764
Yeah, my guess is the mana of the dummy ability...
If it does not make it, increase the timed life of the dummy unit (to 3-4 seconds), maybe it does not have enough time to cast..

btw, that's how i would do this:

Code:
function Trig_Divine_Bow_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A08A' and 40 >= GetRandomInt(1,100)
endfunction

function Trig_Divine_Bow_Actions takes nothing returns nothing
    local unit D = GetTriggerUnit()
    local unit L = CreateUnit(GetOwningPlayer(D), 'h001', GetUnitX(D), GetUnitY(D), 0)
    call UnitApplyTimedLife(L, 'BTLF', 2) 
    call IssueTargetOrder(L, "invisbility", D)
    set L = null
    set D = null
endfunction
 
Level 19
Joined
Nov 16, 2006
Messages
2,165
Bah ... There has to be a key somewhere, the script is missing something ...
I tryed to create it with GUI, it works on it there ..

Edit : This GUI spell works.

Code:
Shadow Arrow
    Events
        Unit - A unit Starts the effect of an ability
    Conditions
        (Ability being cast) Equal to Shadow Arrow {Frosttouch}
        (Random integer number between 1 and 100) Less than or equal to 40
    Actions
        Custom script:   local location SAP = GetUnitLoc(GetSpellAbilityUnit())
        Custom script:   call CreateNUnitsAtLoc( 1, 'h00E', GetOwningPlayer(GetSpellAbilityUnit()), SAP, 0.00 )
        Unit - Add Invisiblity (Shadow Arrow) to (Last created unit)
        Unit - Order (Last created unit) to Human Sorceress - Invisibility (Casting unit)
        Unit - Add a 4.00 second Generic expiration timer to (Last created unit)
        Custom script:   call RemoveLocation(SAP)
        Custom script:   set SAP = null
..
Strange stuff happens..
I'll use this for now then.. If anyone knows the mistake in JASS then please tell me :)
 
Last edited:
Level 4
Joined
Sep 20, 2005
Messages
72
actually ive had this happen to me b4...
instead of using applytimelife, i waited two seconds then removed the dummy.
it fixed the problem that the unit didnt get removed but really it made no sense that applytimelife didnt work! (well, but that aint ur problem right now)

also, createunit and createnunitsatloc is different as createunit returns a unit value while createnunitsatloc returns a group i think...
so really getlastcreatedunit wont work with createunit while it would with creatnunitsatloc, which explains why ur gui would definitely work. But that still doesnt explain why the jass doesnt work. i was stumped.
eventually i just wrote my jass like u did with ur gui for that specific spell i had trouble with, just to fix it. it really makes no sense at all =S whats even more weird is that it works fine for my other spells. i dont get it =(
im rambling, n yea that probably didnt help at all =/
 
Level 4
Joined
Sep 20, 2005
Messages
72
Did you knpw that for locals in GUI you also have to create the global variable as well after the local.

-Av3n

obviously thats not true cuz Fl4meS' gui script works perfectly fine, as stated.
Plus, ur thinking of the global local trick thingy or w/e u call it. Fl4meS uses it as a true local, as one would use it in jass. frankly i dont see why ppl would even use the global local trick, but thats going off topic...
 
Status
Not open for further replies.
Top