• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] Call Jass Trigger Help

Status
Not open for further replies.
Level 7
Joined
Nov 4, 2006
Messages
153
Hi, I've just started trying to learn vJASS and need help.

What I'm trying to do is convert my map into vJass slowly just so I can get practice. I have a GUI trigger that every so often, it runs other triggers. One of these triggers, I'm trying to turn into vJass.


  • Events
    • Every .05 seconds of game time
  • Conditions
  • Actions
    • // Unit1 is defined in another trigger & its custom value too
    • Set int1 = Custom value of Unit1
    • Set int2 = PlayerNumber of Unit1
    • Run Immolation trigger


Now what the Immolation trigger did was pick a group of units around a predefined point and increase a Real[#] -- # = the custom value of the unit.


scope spellImmolationJass initializer Int

private function Range takes integer c returns real
return 1000.00 + 0.*I2R(c-1)
endfunction

private function PickUnit takes unit u returns boolean
return (IsUnitEnemy(u, GetOwningPlayer(u)) and (GetWidgetLife(u) > 0) and (IsUnitType(u, UNIT_TYPE_SAPPER) == false)
endfunction
// END SETUP
globals
private group targs
private boolexpr b
endglobals

private function PickUnit takes nothing returns boolean
return Targets(GetFilterUnit())
endfunction

private function addFire takes nothing returns nothing
targIndex = GetUnitUserData(GetEnumUnit())
if(udg_condDPSTimer[targIndex] < 0.00) then
set udg_condDPSDamage[targIndex] = udg_playerDummyDamager[playerOwner]
set udg_condDPSEffect[targIndex] = udg_condDPSEffect[0]
endif
set udg_condDPSDamage[GetUnitUserData(GetEnumUnit())] = ( udg_condDPSDamage[GetUnitUserData(GetEnumUnit())] + ( 3.00 + ( 0.15 * I2R(( udg_countImmolator[udg_t_int2] - 1 )) ) ) )
set udg_condDPSTimer[GetUnitUserData(GetEnumUnit())] = ( udg_condDPSTimer[GetUnitUserData(GetEnumUnit())] + 1.00 )
endfunction
// CONDITIONS
private function Conditions takes nothing returns boolean
return ((udg_countImmolator[udg_t_int2] > 0) and (udg_spellImmolator_CD[udg_t_int] < 0.00))
endfunction
// ACTIONS
private function Actions takes nothing returns nothing
local integer playerOwner = udg_t_int2
local integer index = udg_t_int
local integer targIndex = 0
local integer c = udg_countImmolator[playerOwner]
local real x = GetLocationX(udg_attackerPosition[index])
local real y = GetLocationY(udg_attackerPosition[index])
call GroupEnumUnitsInRange(targs, x, y, Range(c), conds)

ForGroup(targs, addFire)

set udg_spellImmolator_CD[index] = udg_spellImmolator_CD[0]

set targs = null
endfunction

//===========================================================================
public function Init takes nothing returns nothing
local trigger spellImmolationJassTrg = CreateTrigger()
call TriggerAddCondition(spellImmolationJassTrg, Condition(function Conditions)
call TriggerAddAction(spellImmolationJassTrg, function Actions )

//set globals
set b = Condition(function PickUnit)
endfunction

endscope


Please correct me if that seems wrong. Anyways, how do I call the created trigger using GUI/custom script (I don't want to convert the timer trigger to vJass yet.) Or is there a better way to do this?
 
Status
Not open for further replies.
Top