• 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.

Imported JASS triggered spell wont work!!!

Status
Not open for further replies.
Level 5
Joined
May 27, 2007
Messages
144
I have imported a spell (Web-Demo made by Av3n from this site) I have follawed instructions step by step. The Spell dont works right only a first part works right. The Spell deosnt make my hero invisible and doesnt increase his life points regeneration. Here is the JASS trigger:
JASS:
constant function CreateWeb_id takes nothing returns integer
    return 'A01N'
endfunction

constant function CreateWeb_aurabuff takes nothing returns integer
    return 'A01L'
endfunction

constant function CreateWeb_permhide takes nothing returns integer
    return 'A01M'
endfunction

constant function CreateWeb_regen takes nothing returns integer
    return 'A01J'
endfunction

constant function CreateWeb_lasttime takes nothing returns real
    return 30.00
endfunction

constant function CreateWeb_ltx takes nothing returns boolean
    return true
endfunction

constant function CreateWeb_ltadd takes nothing returns real
    return 0.00
endfunction

function CreateWeb_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A01N'
endfunction

function CreateWeb_Actions takes nothing returns nothing
    local unit c = GetSpellAbilityUnit()
    local integer l = GetUnitAbilityLevel(c,'A01N')
    local real check = 0.00
    local real limit = CreateWeb_lasttime() - 1.00
    local real add = CreateWeb_ltadd()*I2R(l)
    call UnitAddAbility(c,'A01M')
    call UnitAddAbility(c,'A01J')
    if CreateWeb_ltx() == true then
        set limit = limit*I2R(l)
    endif
    set limit = limit+add
    loop
        exitwhen check > limit
        if UnitHasBuffBJ(c,'A01L') == true then
            call UnitAddAbility(c,'A01M)
            call SetUnitAbilityLevel(c,'A01M,l)
            call UnitAddAbility(c,'A01J)
            call SetUnitAbilityLevel(c,'A01J',l)
        else
            call UnitRemoveAbility(c,'A01M')
            call UnitRemoveAbility(c,'A01J')
        endif
        call TriggerSleepAction(0.90)
        set check = check + 0.90
    endloop
    call UnitRemoveAbility(c,'A01M')
    call UnitRemoveAbility(c,'A01J')
    set c = null
endfunction

function InitTrig_Create_Web takes nothing returns nothing
    set gg_trg_Create_Web = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Create_Web, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Create_Web, Condition( function CreateWeb_Conditions ) )
    call TriggerAddAction( gg_trg_Create_Web, function CreateWeb_Actions )
endfunction
PLS HELP
 
Level 5
Joined
May 27, 2007
Messages
144
i have replaced the "rawcodes" but it didnt work so i replaced whole codes and now it works but not complet

Here is Jass code without rewriting the code
JASS:
constant function CreateWeb_id takes nothing returns integer
    return 'A01N' //Create Web spell id based on Healing Ward
endfunction

constant function CreateWeb_aurabuff takes nothing returns integer
    return 'A01L' //Web's aura buff
endfunction

constant function CreateWeb_permhide takes nothing returns integer
    return 'A01M' //Web Permenant Invisiblity id
endfunction

constant function CreateWeb_regen takes nothing returns integer
    return 'A01J' //Web Regeneration id
endfunction

constant function CreateWeb_lasttime takes nothing returns real
    return 30.00 //How long does Web lasts for. Should match the Duration fields of Create Web
endfunction

constant function CreateWeb_ltx takes nothing returns boolean
    return true //Multiply the last time counter? If so it should match the fields of Create Web
endfunction

constant function CreateWeb_ltadd takes nothing returns real
    return 0.00 //Add the value to the last time counter? Note: Multiplies by level
endfunction

function CreateWeb_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == CreateWeb_id()
endfunction

function CreateWeb_Actions takes nothing returns nothing
    local unit c = GetSpellAbilityUnit()
    local integer l = GetUnitAbilityLevel(c,CreateWeb_id())
    local real check = 0.00
    local real limit = CreateWeb_lasttime() - 1.00
    local real add = CreateWeb_ltadd()*I2R(l)
    call UnitAddAbility(c,CreateWeb_permhide())
    call UnitAddAbility(c,CreateWeb_regen())
    if CreateWeb_ltx() == true then
        set limit = limit*I2R(l)
    endif
    set limit = limit+add
    loop
        exitwhen check > limit
        if UnitHasBuffBJ(c,CreateWeb_aurabuff()) == true then
            call UnitAddAbility(c,CreateWeb_permhide())
            call SetUnitAbilityLevel(c,CreateWeb_permhide(),l)
            call UnitAddAbility(c,CreateWeb_regen())
            call SetUnitAbilityLevel(c,CreateWeb_regen(),l)
        else
            call UnitRemoveAbility(c,CreateWeb_permhide())
            call UnitRemoveAbility(c,CreateWeb_regen())
        endif
        call TriggerSleepAction(0.90)
        set check = check + 0.90
    endloop
    call UnitRemoveAbility(c,CreateWeb_permhide())
    call UnitRemoveAbility(c,CreateWeb_regen())
    set c = null
endfunction

function InitTrig_Create_Web takes nothing returns nothing
    set gg_trg_Create_Web = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Create_Web, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Create_Web, Condition( function CreateWeb_Conditions ) )
    call TriggerAddAction( gg_trg_Create_Web, function CreateWeb_Actions )
endfunction
 
Last edited:
Level 11
Joined
Jul 20, 2004
Messages
2,760
Lawl, this is simply hilarious. I find it stupid might I add, especially since you SHOULDN"T have changed the rawcode function calls with the value they return (it's practically useless work). You also made some fatal mistakes. Never change anything else but the rawcode when you know nothing about JASS.

Anyway, let's check the initial code. It seems to be perfectly fine, so make sure you have all the auxiliary abilities required by the spell into your map. Elsewhere, you will realize that even by missing one ability you may not get the full effect. How you do that? Simple. You check in the spell's initial map for all the spells mentioned by the rawcode functions. If all of them are present into your map (probably under a different rawcode), change the function's rawcode accordingly.

Also, perhaps it would be wise to check my tutorial if you haven't done so already!

-Mihai
 
Status
Not open for further replies.
Top