Some jass questions

Kazuga

Let the game begin...
Reaction score
110
"I don't see what diffrence that would make=/ Also he thinks that it's a real value for some reason..."
The idea was to be able to pass the struct unit to the Effect function, then use it from there because I thought there was a wait in Effect (which would've fucked up the MUI, unless the function took a second unit argument)
With "he" I ment the world editor :p.

Hm no diffrence... The functions still isn't called =/
JASS:
library HAILInit requires HAIL
//! runtextmacro HAIL_CreateProperty ("Data", "integer", "")
endlibrary
scope Lightnings initializer Lightning

globals
group z
private constant integer raw = 'A001'
real damage = 200
unit unitx = GetTriggerUnit()
endglobals
private struct TestStruct
unit dummy
unit target
real tx
real ty
timer SlideTimer
unit caster
endstruct

private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == raw
endfunction
function Trig_Lightnings_FilterCondition takes nothing returns boolean
    
    return GetWidgetLife( GetFilterUnit() ) > 0.405 and IsUnitEnemy( GetFilterUnit(), GetOwningPlayer( unitx ) ) == true
    
endfunction
function Trig_Lightnings_Func001A takes nothing returns nothing
    call BJDebugMsg("damage1")
    call UnitDamageTarget(unitx, GetEnumUnit(), damage,true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_UNIVERSAL, WEAPON_TYPE_WHOKNOWS)
    call BJDebugMsg("damage")
   endfunction

private function Effect takes real myX, real myY, unit Target returns nothing
    local real x
    local real y
    local real x2
    local real y2
    local real real1 = 0
    local unit dummy
    
    
    set x  = myX + 300 * Cos((45)  * bj_DEGTORAD)
    set y  = myY + 300 * Sin((45)  * bj_DEGTORAD)
    set x2 = myX + 300 * Cos((315) * bj_DEGTORAD)
    set y2 = myY + 300 * Sin((315) * bj_DEGTORAD)
    
    call TimedLightning ("CLPB", x2, y2, 0, myX, myY, 0, 2., true, 1, 0)
    call TimedLightning ("CLPB", x, y, 0, myX, myY, 0, 2., true, 1, 0)

    set x  = myX + 300 * Cos((125)  * bj_DEGTORAD)
    set y  = myY + 300 * Sin((125)  * bj_DEGTORAD)
    set x2 = myX + 300 * Cos((225) * bj_DEGTORAD)
    set y2 = myY + 300 * Sin((225) * bj_DEGTORAD)
    
    call TimedLightning ("CLPB", x2, y2, 0, myX, myY, 0, 2., true, 1, 0)
    call TimedLightning ("CLPB", x, y, 0, myX, myY, 0, 2., true, 1, 0)

    call PauseUnit(Target,false)

    set z = GetUnitsInRangeOfLocMatching(500, GetUnitLoc(GetTriggerUnit()), Condition(function Trig_Lightnings_FilterCondition))
    call ForGroup( z, function Trig_Lightnings_Func001A )
  call AddSpecialEffect("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl",myX,myY)  
endfunction



private function Slide takes nothing returns nothing
local TestStruct data = GetData (GetExpiredTimer ())
local real x = GetUnitX(data.dummy)
local real y = GetUnitY(data.dummy)
local real newX
local real newY
local real angle
local real distance
local real real1=45
local real x2 
local real y2 



set data.tx    = GetUnitX(data.target)
set data.ty    = GetUnitY(data.target)
set angle = Atan2(data.ty-y,data.tx-x)
set newX  = x + 10 *Cos(angle)
set newY  = y + 10 *Sin(angle)

call SetUnitPosition(data.dummy,newX,newY)
set distance=SquareRoot( (x-data.tx)*(x-data.tx) + (y-data.ty)*(y-data.ty) )
if distance < 20 then
    call PauseTimer (data.SlideTimer)
    call ResetData (data.SlideTimer)
    call DestroyTimer (data.SlideTimer)
    call PauseUnit (data.target,true)
    call RemoveUnit(data.dummy)
    call data.destroy ()
    set data.caster = unitx
    call Effect( data.tx, data.ty, data.target)

endif
endfunction


private function Actions takes nothing returns nothing
local TestStruct data = TestStruct.create ()
local unit Unit                    = GetTriggerUnit()
local real real1                   = GetUnitFacing(GetTriggerUnit())

local real x = GetUnitX(GetTriggerUnit())
local real y = GetUnitY(GetTriggerUnit())

local real x2 = x + 300 * Cos((real1+145)*bj_DEGTORAD)
local real y2 = y + 300 * Sin((real1+145)*bj_DEGTORAD)

local real x3 = x + 300 * Cos((real1+180)*bj_DEGTORAD)
local real y3 = y + 300 * Sin((real1+180)*bj_DEGTORAD)

local real x4 = x + 300 * Cos((real1+215)*bj_DEGTORAD)
local real y4 = y + 300 * Sin((real1+215)*bj_DEGTORAD)
local effect special1

set data.SlideTimer = CreateTimer()
set data.target = (GetSpellTargetUnit())
set special1 = AddSpecialEffect("Abilities\\Spells\\NightElf\\Starfall\\StarfallCaster.mdl",x,y)
call TriggerSleepAction (0.1)
call AddSpecialEffect("Abilities\\Weapons\\Bolt\\BoltImpact.mdl",x2,y2)
call AddSpecialEffect("Abilities\\Weapons\\Bolt\\BoltImpact.mdl",x3,y3)
call AddSpecialEffect("Abilities\\Weapons\\Bolt\\BoltImpact.mdl",x4,y4)
call AddSpecialEffect("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl",x,y)
call PauseUnit (Unit, true)

call TimedLightning ("CLPB", x, y, 0, x2, y2, 0, 2., true, 1, 0)
call TimedLightning ("CLPB", x, y, 0, x3, y3, 0, 2., true, 1, 0)
call TimedLightning ("CLPB", x, y, 0, x4, y4, 0, 2., true, 1, 0)


call TriggerSleepAction (1)
call DestroyEffect(special1)
set data.dummy = CreateUnit (GetOwningPlayer(Unit),'h001',x,y,0)
call SetUnitPathing(data.dummy, false )
call PauseUnit (Unit, false)
call TimerStart (data.SlideTimer,0.05,true, function Slide)
call SetData (data.SlideTimer, data)
set Unit = null

endfunction


//===========================================================================

private function SafeFilt takes nothing returns boolean
return true
endfunction
private function Lightning takes nothing returns nothing
 local trigger trig = CreateTrigger()
local integer i = 0
loop
    exitwhen i > 15
    call TriggerRegisterPlayerUnitEvent(trig,Player(i),EVENT_PLAYER_UNIT_SPELL_EFFECT,Condition(function SafeFilt))
    set i = i + 1
endloop
 call TriggerAddCondition (trig, Condition (function Conditions ) )
 call TriggerAddAction (trig, function Actions )
 set trig = null
 endfunction

endscope
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
JASS:
    call data.destroy ()
    set data.caster = unitx
    call Effect( data.tx, data.ty, data.target)


This is in your slide trigger, you're destroying the struct before calling the functions etc. Change it to the following:

JASS:
    set data.caster = unitx
    call Effect( data.tx, data.ty, data.target)
    call data.destroy ()
 

Kazuga

Let the game begin...
Reaction score
110
Flare, the unitx variable needs to be instalized (ye I know I suck at spelling^^).
JASS:

function Trig_Lightnings_FilterCondition takes nothing returns boolean
    call BJDebugMsg("filter")
    return GetWidgetLife( GetFilterUnit() ) > 0.405 and IsUnitEnemy( GetFilterUnit(), GetOwningPlayer( unitx ) ) == true
    
endfunction

Message isn't seen =/

Lacenist, fixed what you pointed out. No diffrence though =/

Current code:
JASS:
library HAILInit requires HAIL
//! runtextmacro HAIL_CreateProperty ("Data", "integer", "")
endlibrary
scope Lightnings initializer Lightning

globals
group z
private constant integer raw = 'A001'
real damage = 200
unit unitx = GetTriggerUnit()
endglobals
private struct TestStruct
unit dummy
unit target
real tx
real ty
timer SlideTimer
unit caster
endstruct

private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == raw
endfunction
function Trig_Lightnings_FilterCondition takes nothing returns boolean
    call BJDebugMsg("filter")
    return GetWidgetLife( GetFilterUnit() ) > 0.405 and IsUnitEnemy( GetFilterUnit(), GetOwningPlayer( unitx ) ) == true
    
endfunction
function Trig_Lightnings_Func001A takes nothing returns nothing
    call BJDebugMsg("damage1")
    call UnitDamageTarget(unitx, GetEnumUnit(), damage,true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_UNIVERSAL, WEAPON_TYPE_WHOKNOWS)
    call BJDebugMsg("damage")
   endfunction

private function Effect takes real myX, real myY, unit Target returns nothing
    local real x
    local real y
    local real x2
    local real y2
    local real real1 = 0
    local unit dummy
    
    
    set x  = myX + 300 * Cos((45)  * bj_DEGTORAD)
    set y  = myY + 300 * Sin((45)  * bj_DEGTORAD)
    set x2 = myX + 300 * Cos((315) * bj_DEGTORAD)
    set y2 = myY + 300 * Sin((315) * bj_DEGTORAD)
    
    call TimedLightning ("CLPB", x2, y2, 0, myX, myY, 0, 2., true, 1, 0)
    call TimedLightning ("CLPB", x, y, 0, myX, myY, 0, 2., true, 1, 0)

    set x  = myX + 300 * Cos((125)  * bj_DEGTORAD)
    set y  = myY + 300 * Sin((125)  * bj_DEGTORAD)
    set x2 = myX + 300 * Cos((225) * bj_DEGTORAD)
    set y2 = myY + 300 * Sin((225) * bj_DEGTORAD)
    
    call TimedLightning ("CLPB", x2, y2, 0, myX, myY, 0, 2., true, 1, 0)
    call TimedLightning ("CLPB", x, y, 0, myX, myY, 0, 2., true, 1, 0)

    call PauseUnit(Target,false)

    set z = GetUnitsInRangeOfLocMatching(500, GetUnitLoc(GetTriggerUnit()), Condition(function Trig_Lightnings_FilterCondition))
    call ForGroup( z, function Trig_Lightnings_Func001A )
  call AddSpecialEffect("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl",myX,myY)  
endfunction



private function Slide takes nothing returns nothing
local TestStruct data = GetData (GetExpiredTimer ())
local real x = GetUnitX(data.dummy)
local real y = GetUnitY(data.dummy)
local real newX
local real newY
local real angle
local real distance
local real real1=45
local real x2 
local real y2 



set data.tx    = GetUnitX(data.target)
set data.ty    = GetUnitY(data.target)
set angle = Atan2(data.ty-y,data.tx-x)
set newX  = x + 10 *Cos(angle)
set newY  = y + 10 *Sin(angle)

call SetUnitPosition(data.dummy,newX,newY)
set distance=SquareRoot( (x-data.tx)*(x-data.tx) + (y-data.ty)*(y-data.ty) )
if distance < 20 then
    call PauseTimer (data.SlideTimer)
    call ResetData (data.SlideTimer)
    call DestroyTimer (data.SlideTimer)
    call PauseUnit (data.target,true)
    call RemoveUnit(data.dummy)
    set data.caster = unitx
    call Effect( data.tx, data.ty, data.target)
    call data.destroy ()
endif
endfunction


private function Actions takes nothing returns nothing
local TestStruct data = TestStruct.create ()
local unit Unit                    = GetTriggerUnit()
local real real1                   = GetUnitFacing(GetTriggerUnit())

local real x = GetUnitX(GetTriggerUnit())
local real y = GetUnitY(GetTriggerUnit())

local real x2 = x + 300 * Cos((real1+145)*bj_DEGTORAD)
local real y2 = y + 300 * Sin((real1+145)*bj_DEGTORAD)

local real x3 = x + 300 * Cos((real1+180)*bj_DEGTORAD)
local real y3 = y + 300 * Sin((real1+180)*bj_DEGTORAD)

local real x4 = x + 300 * Cos((real1+215)*bj_DEGTORAD)
local real y4 = y + 300 * Sin((real1+215)*bj_DEGTORAD)
local effect special1

set data.SlideTimer = CreateTimer()
set data.target = (GetSpellTargetUnit())
set special1 = AddSpecialEffect("Abilities\\Spells\\NightElf\\Starfall\\StarfallCaster.mdl",x,y)
call TriggerSleepAction (0.1)
call AddSpecialEffect("Abilities\\Weapons\\Bolt\\BoltImpact.mdl",x2,y2)
call AddSpecialEffect("Abilities\\Weapons\\Bolt\\BoltImpact.mdl",x3,y3)
call AddSpecialEffect("Abilities\\Weapons\\Bolt\\BoltImpact.mdl",x4,y4)
call AddSpecialEffect("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl",x,y)
call PauseUnit (Unit, true)

call TimedLightning ("CLPB", x, y, 0, x2, y2, 0, 2., true, 1, 0)
call TimedLightning ("CLPB", x, y, 0, x3, y3, 0, 2., true, 1, 0)
call TimedLightning ("CLPB", x, y, 0, x4, y4, 0, 2., true, 1, 0)


call TriggerSleepAction (1)
call DestroyEffect(special1)
set data.dummy = CreateUnit (GetOwningPlayer(Unit),'h001',x,y,0)
call SetUnitPathing(data.dummy, false )
call PauseUnit (Unit, false)
call TimerStart (data.SlideTimer,0.05,true, function Slide)
call SetData (data.SlideTimer, data)
set Unit = null

endfunction


//===========================================================================

private function SafeFilt takes nothing returns boolean
return true
endfunction
private function Lightning takes nothing returns nothing
 local trigger trig = CreateTrigger()
local integer i = 0
loop
    exitwhen i > 15
    call TriggerRegisterPlayerUnitEvent(trig,Player(i),EVENT_PLAYER_UNIT_SPELL_EFFECT,Condition(function SafeFilt))
    set i = i + 1
endloop
 call TriggerAddCondition (trig, Condition (function Conditions ) )
 call TriggerAddAction (trig, function Actions )
 set trig = null
 endfunction

endscope
 

Kazuga

Let the game begin...
Reaction score
110
Wohoo the function is called^^ However it's called sort of 10+ times at once when it should only be called one time... Also the damage isn't dealt =/

Whole code
JASS:
library HAILInit requires HAIL
//! runtextmacro HAIL_CreateProperty ("Data", "integer", "")
endlibrary
scope Lightnings initializer Lightning

globals
group z
private constant integer raw = 'A001'
real damage = 200
unit unitx = GetTriggerUnit()
endglobals
private struct TestStruct
unit dummy
unit target
real tx
real ty
timer SlideTimer
unit caster
endstruct

private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == raw
endfunction
function Trig_Lightnings_FilterCondition takes nothing returns boolean
    call BJDebugMsg("filter")
    return GetWidgetLife( GetFilterUnit() ) > 0.405 and IsUnitEnemy( GetFilterUnit(), GetOwningPlayer( unitx ) ) == true
    
endfunction
function Trig_Lightnings_Func001A takes nothing returns nothing
    call BJDebugMsg("damage1")
    call UnitDamageTarget(unitx, GetEnumUnit(), damage,true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_UNIVERSAL, WEAPON_TYPE_WHOKNOWS)
    call BJDebugMsg("damage")
   endfunction

private function Effect takes real myX, real myY, unit Target returns nothing
    local real x
    local real y
    local real x2
    local real y2
    local real real1 = 0
    local unit dummy
    local location temp = GetUnitLoc(Target)
    
    set x  = myX + 300 * Cos((45)  * bj_DEGTORAD)
    set y  = myY + 300 * Sin((45)  * bj_DEGTORAD)
    set x2 = myX + 300 * Cos((315) * bj_DEGTORAD)
    set y2 = myY + 300 * Sin((315) * bj_DEGTORAD)
    
    call TimedLightning ("CLPB", x2, y2, 0, myX, myY, 0, 2., true, 1, 0)
    call TimedLightning ("CLPB", x, y, 0, myX, myY, 0, 2., true, 1, 0)

    set x  = myX + 300 * Cos((125)  * bj_DEGTORAD)
    set y  = myY + 300 * Sin((125)  * bj_DEGTORAD)
    set x2 = myX + 300 * Cos((225) * bj_DEGTORAD)
    set y2 = myY + 300 * Sin((225) * bj_DEGTORAD)
    
    call TimedLightning ("CLPB", x2, y2, 0, myX, myY, 0, 2., true, 1, 0)
    call TimedLightning ("CLPB", x, y, 0, myX, myY, 0, 2., true, 1, 0)

    call PauseUnit(Target,false)
    set z = GetUnitsInRangeOfLocMatching(500, temp, Condition (function Trig_Lightnings_FilterCondition))
    call ForGroup( z, (function Trig_Lightnings_Func001A ))
    call RemoveLocation (temp)
  call AddSpecialEffect("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl",myX,myY)  
endfunction



private function Slide takes nothing returns nothing
local TestStruct data = GetData (GetExpiredTimer ())
local real x = GetUnitX(data.dummy)
local real y = GetUnitY(data.dummy)
local real newX
local real newY
local real angle
local real distance
local real real1=45
local real x2 
local real y2 



set data.tx    = GetUnitX(data.target)
set data.ty    = GetUnitY(data.target)
set angle = Atan2(data.ty-y,data.tx-x)
set newX  = x + 10 *Cos(angle)
set newY  = y + 10 *Sin(angle)

call SetUnitPosition(data.dummy,newX,newY)
set distance=SquareRoot( (x-data.tx)*(x-data.tx) + (y-data.ty)*(y-data.ty) )
if distance < 20 then
    call PauseTimer (data.SlideTimer)
    call ResetData (data.SlideTimer)
    call DestroyTimer (data.SlideTimer)
    call PauseUnit (data.target,true)
    call RemoveUnit(data.dummy)
    set data.caster = unitx
    call Effect( data.tx, data.ty, data.target)
    call data.destroy ()
endif
endfunction


private function Actions takes nothing returns nothing
local TestStruct data = TestStruct.create ()
local unit Unit                    = GetTriggerUnit()
local real real1                   = GetUnitFacing(GetTriggerUnit())

local real x = GetUnitX(GetTriggerUnit())
local real y = GetUnitY(GetTriggerUnit())

local real x2 = x + 300 * Cos((real1+145)*bj_DEGTORAD)
local real y2 = y + 300 * Sin((real1+145)*bj_DEGTORAD)

local real x3 = x + 300 * Cos((real1+180)*bj_DEGTORAD)
local real y3 = y + 300 * Sin((real1+180)*bj_DEGTORAD)

local real x4 = x + 300 * Cos((real1+215)*bj_DEGTORAD)
local real y4 = y + 300 * Sin((real1+215)*bj_DEGTORAD)
local effect special1

set data.SlideTimer = CreateTimer()
set data.target = (GetSpellTargetUnit())
set special1 = AddSpecialEffect("Abilities\\Spells\\NightElf\\Starfall\\StarfallCaster.mdl",x,y)
call TriggerSleepAction (0.1)
call AddSpecialEffect("Abilities\\Weapons\\Bolt\\BoltImpact.mdl",x2,y2)
call AddSpecialEffect("Abilities\\Weapons\\Bolt\\BoltImpact.mdl",x3,y3)
call AddSpecialEffect("Abilities\\Weapons\\Bolt\\BoltImpact.mdl",x4,y4)
call AddSpecialEffect("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl",x,y)
call PauseUnit (Unit, true)

call TimedLightning ("CLPB", x, y, 0, x2, y2, 0, 2., true, 1, 0)
call TimedLightning ("CLPB", x, y, 0, x3, y3, 0, 2., true, 1, 0)
call TimedLightning ("CLPB", x, y, 0, x4, y4, 0, 2., true, 1, 0)


call TriggerSleepAction (1)
call DestroyEffect(special1)
set data.dummy = CreateUnit (GetOwningPlayer(Unit),'h001',x,y,0)
call SetUnitPathing(data.dummy, false )
call PauseUnit (Unit, false)
call TimerStart (data.SlideTimer,0.05,true, function Slide)
call SetData (data.SlideTimer, data)
set Unit = null

endfunction


//===========================================================================

private function SafeFilt takes nothing returns boolean
return true
endfunction
private function Lightning takes nothing returns nothing
 local trigger trig = CreateTrigger()
local integer i = 0
loop
    exitwhen i > 15
    call TriggerRegisterPlayerUnitEvent(trig,Player(i),EVENT_PLAYER_UNIT_SPELL_EFFECT,Condition(function SafeFilt))
    set i = i + 1
endloop
 call TriggerAddCondition (trig, Condition (function Conditions ) )
 call TriggerAddAction (trig, function Actions )
 set trig = null
 endfunction

endscope
JASS:
 

Flare

Stops copies me!
Reaction score
662
JASS:
globals
group z
private constant integer raw = 'A001'
real damage = 200
unit unitx = GetTriggerUnit()
endglobals


Remove that ' = 200' (and the ' = GetTriggerUnit()') and set damage before calling Effect, and see if it works.

However it's called sort of 10+ times at once when it should only be called one time...

Perhaps there is 10 units in the group?
 

Kazuga

Let the game begin...
Reaction score
110
Remove that ' = 200' (and the ' = GetTriggerUnit()')
Globals has to be instialized, otherwise they won't work =/

Perhaps there is 10 units in the group?
Yep... Why does it call the amount of units in the unit group? Also it counted one of my own units next to it wich means that the condition doesn't work either...

Edit:
>the 200 is right there, but the "unitx" is false, there is no Triggering unit when the globals are declared ; )
What should I set it to then?
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
JASS:
globals
    unitx = null
endglobals


That should do it maybe? Then set it to data.caster when you're using it.

Edit: This:

JASS:
    set data.caster = unitx


Should be this:

JASS:
    set unitx = data.caster
 

Kazuga

Let the game begin...
Reaction score
110
No diffrence...

Edit:
Whole code
JASS:
library HAILInit requires HAIL
//! runtextmacro HAIL_CreateProperty ("Data", "integer", "")
endlibrary
scope Lightnings initializer Lightning

globals
group z
private constant integer raw = 'A001'
real damage = 200
unit unitx = null
endglobals
private struct TestStruct
unit dummy
unit target
real tx
real ty
timer SlideTimer
unit caster
endstruct

private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == raw
endfunction
function Trig_Lightnings_FilterCondition takes nothing returns boolean
    call BJDebugMsg("filter")
    return GetWidgetLife( GetFilterUnit() ) > 0.405 and IsUnitEnemy( GetFilterUnit(), GetOwningPlayer( unitx ) ) == true
    
endfunction
function Trig_Lightnings_Func001A takes nothing returns nothing
    call BJDebugMsg("damage1")
    call UnitDamageTarget(unitx, GetEnumUnit(), damage,true, false, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_UNIVERSAL, WEAPON_TYPE_WHOKNOWS)
    call BJDebugMsg("damage")
   endfunction

private function Effect takes real myX, real myY, unit Target returns nothing
    local real x
    local real y
    local real x2
    local real y2
    local real real1 = 0
    local unit dummy
    local location temp = GetUnitLoc(Target)
    
    set x  = myX + 300 * Cos((45)  * bj_DEGTORAD)
    set y  = myY + 300 * Sin((45)  * bj_DEGTORAD)
    set x2 = myX + 300 * Cos((315) * bj_DEGTORAD)
    set y2 = myY + 300 * Sin((315) * bj_DEGTORAD)
    
    call TimedLightning ("CLPB", x2, y2, 0, myX, myY, 0, 2., true, 1, 0)
    call TimedLightning ("CLPB", x, y, 0, myX, myY, 0, 2., true, 1, 0)

    set x  = myX + 300 * Cos((125)  * bj_DEGTORAD)
    set y  = myY + 300 * Sin((125)  * bj_DEGTORAD)
    set x2 = myX + 300 * Cos((225) * bj_DEGTORAD)
    set y2 = myY + 300 * Sin((225) * bj_DEGTORAD)
    
    call TimedLightning ("CLPB", x2, y2, 0, myX, myY, 0, 2., true, 1, 0)
    call TimedLightning ("CLPB", x, y, 0, myX, myY, 0, 2., true, 1, 0)

    call PauseUnit(Target,false)
    set z = GetUnitsInRangeOfLocMatching(500, temp, Condition (function Trig_Lightnings_FilterCondition))
    call ForGroup( z, (function Trig_Lightnings_Func001A ))
    call RemoveLocation (temp)
  call AddSpecialEffect("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl",myX,myY)  
endfunction



private function Slide takes nothing returns nothing
local TestStruct data = GetData (GetExpiredTimer ())
local real x = GetUnitX(data.dummy)
local real y = GetUnitY(data.dummy)
local real newX
local real newY
local real angle
local real distance
local real real1=45
local real x2 
local real y2 



set data.tx    = GetUnitX(data.target)
set data.ty    = GetUnitY(data.target)
set angle = Atan2(data.ty-y,data.tx-x)
set newX  = x + 10 *Cos(angle)
set newY  = y + 10 *Sin(angle)

call SetUnitPosition(data.dummy,newX,newY)
set distance=SquareRoot( (x-data.tx)*(x-data.tx) + (y-data.ty)*(y-data.ty) )
if distance < 20 then
    call PauseTimer (data.SlideTimer)
    call ResetData (data.SlideTimer)
    call DestroyTimer (data.SlideTimer)
    call PauseUnit (data.target,true)
    call RemoveUnit(data.dummy)
    set unitx = data.caster
    call Effect( data.tx, data.ty, data.target)
    call data.destroy ()
endif
endfunction


private function Actions takes nothing returns nothing
local TestStruct data = TestStruct.create ()
local unit Unit                    = GetTriggerUnit()
local real real1                   = GetUnitFacing(GetTriggerUnit())

local real x = GetUnitX(GetTriggerUnit())
local real y = GetUnitY(GetTriggerUnit())

local real x2 = x + 300 * Cos((real1+145)*bj_DEGTORAD)
local real y2 = y + 300 * Sin((real1+145)*bj_DEGTORAD)

local real x3 = x + 300 * Cos((real1+180)*bj_DEGTORAD)
local real y3 = y + 300 * Sin((real1+180)*bj_DEGTORAD)

local real x4 = x + 300 * Cos((real1+215)*bj_DEGTORAD)
local real y4 = y + 300 * Sin((real1+215)*bj_DEGTORAD)
local effect special1

set data.SlideTimer = CreateTimer()
set data.target = (GetSpellTargetUnit())
set special1 = AddSpecialEffect("Abilities\\Spells\\NightElf\\Starfall\\StarfallCaster.mdl",x,y)
call TriggerSleepAction (0.1)
call AddSpecialEffect("Abilities\\Weapons\\Bolt\\BoltImpact.mdl",x2,y2)
call AddSpecialEffect("Abilities\\Weapons\\Bolt\\BoltImpact.mdl",x3,y3)
call AddSpecialEffect("Abilities\\Weapons\\Bolt\\BoltImpact.mdl",x4,y4)
call AddSpecialEffect("Abilities\\Spells\\Other\\Monsoon\\MonsoonBoltTarget.mdl",x,y)
call PauseUnit (Unit, true)

call TimedLightning ("CLPB", x, y, 0, x2, y2, 0, 2., true, 1, 0)
call TimedLightning ("CLPB", x, y, 0, x3, y3, 0, 2., true, 1, 0)
call TimedLightning ("CLPB", x, y, 0, x4, y4, 0, 2., true, 1, 0)


call TriggerSleepAction (1)
call DestroyEffect(special1)
set data.dummy = CreateUnit (GetOwningPlayer(Unit),'h001',x,y,0)
call SetUnitPathing(data.dummy, false )
call PauseUnit (Unit, false)
call TimerStart (data.SlideTimer,0.05,true, function Slide)
call SetData (data.SlideTimer, data)
set Unit = null

endfunction


//===========================================================================

private function SafeFilt takes nothing returns boolean
return true
endfunction
private function Lightning takes nothing returns nothing
 local trigger trig = CreateTrigger()
local integer i = 0
loop
    exitwhen i > 15
    call TriggerRegisterPlayerUnitEvent(trig,Player(i),EVENT_PLAYER_UNIT_SPELL_EFFECT,Condition(function SafeFilt))
    set i = i + 1
endloop
 call TriggerAddCondition (trig, Condition (function Conditions ) )
 call TriggerAddAction (trig, function Actions )
 set trig = null
 endfunction

endscope
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
Of course it's called for each unit in the group, you're using ForGroup(). I do not know why no damage is dealt, and it shouldn't add friendly units into the group.

Care attaching your map so I can have a look?
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
Ok found your problem.

unitx is returning null since you forgot to set "data.caster = Unit" in your Actions function.
 

Flare

Stops copies me!
Reaction score
662
Globals has to be instialized, otherwise they won't work =/

They don't have to be given an initial value when declared, they just have to be given a value before you use them.

@Serra: Hmmm, I thought you couldn't initialize globals in the global block unless they were constant (maybe I'm thinking of arrays...)
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +1
  • V-SNES V-SNES:
    Happy Friday!
    +1

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top