• 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] Jass Script Help

Status
Not open for further replies.
Level 3
Joined
Dec 14, 2008
Messages
35
No, the value remains as as percent in JASS.
Thank you for the help +rep to you =)

Here is my full spell do you think that this will work fine?
JASS:
function BarbarianRage_Actions takes nothing returns nothing
 local unit caster = GetSpellAbilityUnit()
 local integer count = 20
 local unit temp
 local group enemies = CreateGroup()
 loop
set temp = Group(enemies)
exitwhen count == 0
if IsUnitEnemy(temp, GetOwningPlayer(caster)) then
call SetUnitVertexColor(caster, 255, 0, 0, 100)
set count = count - 1
end if
if count == 0 then
call SetUnitVertexColor(caster, 255, 255, 255, 255)
end if
endloop
// comment: this is just to fix leaks in the spell
call DestroyGroup(enemies, temp)
set caster = null
set enemies = null
set temp = null
set count = null
end function
function InitTrig_BarbarianRage takes nothing returns nothing
set gg_trg_BarbarianRage = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ( gg_trg_Barbarian_Rage, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition( gg_trg_Barbarian_Rage, Condition( function Trig_Barbarian_Rage_Conditions ) )
call TriggerAddAction(gg_trigger_BarbarianRage, function BarbarianRage_Actions)
endfunction
 
Last edited:
Level 17
Joined
Jun 17, 2007
Messages
1,433
I suggest using a JASS editor such as JASSCraft or JASS NewGen. Most of your functions are within the JASS syntax. For example,

JASS:
call DestroyGroup(enemies, temp)
Should only take a single argument.
JASS:
end function
and
JASS:
end if
don't exist, it should be
JASS:
endfunction
and
JASS:
endif
I'm not actually sure what you're trying to accomplish with that spell. If all you want is a vertex colour change, it shouldn't have more than 1 function call within the actions. I can make the spell for you if elaborate on exactly what you need.
 
Level 11
Joined
Apr 6, 2008
Messages
760
JASS:
function BarbarianRage_Filter takes nothing returns boolean //boolexpr is faster then if then else in a loop :)
    local unit t = GetTriggerUnit()
    local unit u = GetFilterUnit()
    local boolean ok = GetWidgetLife(u) > .305 and IsUnitEnemy(u,GetOwningPlayer(t))
    set t = null
    set u = null
    return ok
endfunction


function BarbarianRage_Actions takes nothing returns nothing
    local unit caster = GetTriggerUnit() //faster too use trigger unit
    local integer count = 20
    local unit temp
    local group enemies = CreateGroup()
       
    call GroupEnumUnitsInRange(enemies,GetUnitX(caster),GetUnitY(caster),"aoe size",Condition(function BarbarianRage_Filter)) 
//u didnt get units in range replace "aoe size" with how big aoe u wanna pick units in.
        
    loop
        set temp = FirstofGroup(enemies)
        exitwhen count == 0 or temp == null
        call GroupRemoveUnit(enemies,temp)
        call SetUnitVertexColor(caster, 255, 0, 0, 100) //**
        set count = count - 1
    endloop

    call SetUnitVertexColor(caster, 255, 255, 255, 255) //**

    call DestroyGroup(enemies)
    set caster = null
    set enemies = null
    // set temp = null //no need to null it will be null when u exit then loop
endfunction

function InitTrig_BarbarianRage takes nothing returns nothing
local trigger trig = CreateTrigger()

call TriggerRegisterAnyUnitEventBJ(trig, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition(trig, Condition( function Trig_Barbarian_Rage_Conditions ) )

set trig = null
endfunction

//** = u dont need these the spell gonna be instant so u wont even see it :)
 
Last edited:
Level 3
Joined
Dec 14, 2008
Messages
35
JASS:
function BarbarianRage_Filter takes nothing returns boolean //boolexpr is faster then if then else in a loop :)
    local unit t = GetTriggerUnit()
    local unit u = GetFilterUnit()
    local boolean ok = GetWidgetLife(u) > .305 and IsUnitEnemy(u,GetOwningPlayer(t))
    set t = null
    set u = null
    return ok
endfunction


function BarbarianRage_Actions takes nothing returns nothing
    local unit caster = GetTriggerUnit() //faster too use trigger unit
    local integer count = 20
    local unit temp
    local group enemies = CreateGroup()
       
    call GroupEnumUnitsInRange(enemies,GetUnitX(caster),GetUnitY(caster),"aoe size",Condition(function BarbarianRage_Filter)) 
//u didnt get units in range replace "aoe size" with how big aoe u wanna pick units in.
        
    loop
        set temp = FirstofGroup(enemies)
        exitwhen count == 0 or temp == null
        call GroupRemoveUnit(enemies,temp)
        call SetUnitVertexColor(caster, 255, 0, 0, 100) //**
        set count = count - 1
    endloop

    call SetUnitVertexColor(caster, 255, 255, 255, 255) //**

    call DestroyGroup(enemies)
    set caster = null
    set enemies = null
    // set temp = null //no need to null it will be null when u exit then loop
endfunction

function InitTrig_BarbarianRage takes nothing returns nothing
local trigger trig = CreateTrigger()

call TriggerRegisterAnyUnitEventBJ(trig, EVENT_PLAYER_UNIT_SPELL_CAST )
call TriggerAddCondition(trig, Condition( function Trig_Barbarian_Rage_Conditions ) )

set trig = null
endfunction

//** = u dont need these the spell gonna be instant so u wont even see it :)

ty for corections everyone my spell is solved now =)
 
Status
Not open for further replies.
Top