Help in Ability

MaaxeEvid

New Member
Reaction score
8
Well, im trying to make a ability, only for testing my knowledge in handles, the following ability its a Storm Bolt, wich poisons the target.

but when i try to run my map, it justs close the WE,:( dont give any errors, just close and shows a message , worldeditor.exe need to be closed blablabla, + REP for the helps wich resolve my prob !:cool:

JASS:
function Trig_Storm_Bolt_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A000'
endfunction

function Storm_Poison takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local integer i = GetHandleInt(t, "level")
    local unit u = GetHandleUnit(t, "caster") 
    local unit target = GetHandleUnit(t, "vitima")
    local real dur = GetHandleReal(t, "dur")
    local real upd = GetHandleReal(t, "upd")
    if upd < dur then
        loop
            set upd = upd + 0.5
            exitwhen upd = dur
            call UnitDamageTarget (u, target, 15*i, true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_POISON, null)
        endloop
    else
        call FlushHandleLocals(t)
    endif
    set u = null
    set target = null
    set t = null
    call DestroyTimer(t) 
endfunction   

function Trig_Storm_Bolt_Actions takes nothing returns nothing
    local unit caster = GetTriggerUnit()
    local unit target = GetSpellTargetUnit()
    local real tx = GetUnitX(target)
    local real ty = GetUnitY(target)
    local integer level = GetUnitAbilityLevel(caster, 'A000')
    local timer t = CreateTimer()
    local real duration = 7
    local real update = 0.5
    call DestroyEffect(AddSpecialEffect("Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl", tx, ty)
    call SetHandleInt (t, "level", level)
    call SetHandleHandle (t, "caster", caster)
    call SetHandleHandle (t, "vitima", target)
    call SetHandleReal (t, "dur", duration)
    call SetHandleReal (t, "upd", update)
    call TimerStart(t, update, true, function Storm_Poison)
    set caster = null
    set target = null
    set t = null
endfunction

//===========================================================================
function InitTrig_Storm_Bolt takes nothing returns nothing
    set gg_trg_Storm_Bolt = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Storm_Bolt, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Storm_Bolt, Condition( function Trig_Storm_Bolt_Conditions ) )
    call TriggerAddAction( gg_trg_Storm_Bolt, function Trig_Storm_Bolt_Actions )
    call Preload ("Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl")
endfunction
 

Hero

─║╣ero─
Reaction score
250
The only way it would do that when you press Test Map
Would be if you didn't import KaTTana's Handle System correctly

Did you make a global variable for it?
Did you edit the part of the code that to the name of your game cache?
Are there any repeated functions in your map?
 
1

1337JASSer

Guest
I can't actually find the problem...

There are some possibilities though:

1) Do you have the handle system in your map's header?
2) Are the handle functions you called in the system?
3) Try to change the "vitima" part for the target to "target" instead and see if that works.
4)
JASS:
    native UnitDamageTarget            takes unit whichUnit, widget target, real amount, boolean attack, boolean ranged, attacktype attackType, damagetype damageType, weapontype weaponType returns boolean


You nulled the weapontype part, try to enter an actual weapontype instead such as:


Or something like that.

I am pretty sure that only booleans take nulls, and they take true or false as well. ;)
 

Hero

─║╣ero─
Reaction score
250
OH wait..I think I see some problem

I don't think your suppose to null the variable t which is your timer in the

function Trig_Storm_Bolt_Actions takes nothing returns nothing
 
1

1337JASSer

Guest
Ah... Yes, I see it as well. You need not null your variables that are being transferred because you cannot actually transfer a nulled variable because it would be moved as "nothing" which obviously caused a syntax when tested. Null target and the timer in the second function instead.... Remember that "DestroyTimer(t)" should be before the null otherwise you are destroying nothing and I think it may leave a leak. ;)
 

Hero

─║╣ero─
Reaction score
250
Also before you Destroy a timer make sure you PAUSE it first....it can still run if it de-syncs
 

MaaxeEvid

New Member
Reaction score
8
well, i found the problem, its with the Handle System, i need to change the LocalVars() with 1 udg variable of type Game Cache, but i dont know how to do it correctly, just return udg_GameCache, its correct?
 

SFilip

Gone but not forgotten
Reaction score
634
> correct
Partially.
You need to define that GameCache variable in the variable editor and you need to set it on Map Initialization.
Custom Script: set udg_GameCache = InitGameCache("jasslocalvars.w3v")
 

MaaxeEvid

New Member
Reaction score
8
well for dont create a new thread, i will post my other question here

i have a 90% read trigger, i only have problems, with the Pick Every Unit in 500 of caster , and order it to attack him...look the trigger below

JASS:
function Trig_Provoke_Conditions takes nothing returns boolean
    return GetSpellAbilityId() == 'A02M'
endfunction

function ProvokeId takes nothing returns integer
    return 'A02M'
endfunction

function ProvokeAtk takes nothing returns nothing
    local timer t = GetExpiredTimer()
    local unit c = GetHandleUnit(t, "caster")
    local group g = GetHandleGroup(t, "grupo")
    local real upd = GetHandleReal(t, "dur")+0.5
    if upd < 5 then
        call SetHandleReal(t,"dur", upd)
        ????????????????????????????????????
        else
        call DestroyGroup(g)
        call PauseTimer(t)
        call DestroyTimer(t)
        call FlushHandleLocals(t)
    endif
    set c = null
    set g = null
    set t = null
endfunction

function Provoke_Filter takes nothing returns boolean
    return IsPlayerEnemy(GetOwningPlayer(GetTriggerUnit()), GetOwningPlayer(GetFilterUnit()))      
endfunction

function Trig_Provoke_Actions takes nothing returns nothing
    local unit c = GetTriggerUnit()
    local group g = CreateGroup()
    local timer t = CreateTimer()
    local boolexpr b = Condition(function Provoke_Filter)
    local real tpmB = 0.5
    call GroupEnumUnitsInRange(g, GetUnitX(c),GetUnitY(c), 500, b)
    call SetHandleHandle (t, "caster", c)
    call SetHandleHandle (t, "grupo", g)
    call SetHandleReal (t, "dur", tpmB)
    call TimerStart(t, tpmB, TRUE, function ProvokeAtk )
    call DestroyGroup(g)
    call DestroyBoolExpr(b)
    set b = null
    set c = null
    set g = null
    set t = null
endfunction

//===========================================================================
function InitTrig_Provoke takes nothing returns nothing
    set gg_trg_Provoke = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Provoke, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Provoke, Condition( function Trig_Provoke_Conditions ) )
    call TriggerAddAction( gg_trg_Provoke, function Trig_Provoke_Actions )
endfunction


well, i dunno how can i do this, i created the group "g", add the units to it(dunno if i do correctly) then i wish to the "picked unitss" attack the caster "c"...need help in that function ^^
 

Doom-Angel

Jass User (Just started using NewGen)
Reaction score
167
if u wish picked units to attack caster then u need to use ForGroup which makes the loop for group:
if i remember right it's like this:
JASS:
call ForGroup(Group,function) 
//u need to make a function for these actions and in this function u could use picked units

i hope it's clear enough :p
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top