Special effect problem

T.s.e

Wish I was old and a little sentimental
Reaction score
133
Did you make a function called Slide above the function where you call TimerStart()?
 

Kazuga

Let the game begin...
Reaction score
110
No...? It should be in the beginning of the code?
JASS:
scope Lightnings

private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'AEfk'
endfunction
//Here?
private function Actions takes nothing returns nothing
local real real1 = GetUnitFacing(GetTriggerUnit())
local location point1 = GetUnitLoc(GetTriggerUnit())
local location point2 = PolarProjectionBJ(point1,300,real1+145)
local location point3 = PolarProjectionBJ(point1,300,real1+180)
local location point4 = PolarProjectionBJ(point1,300,real1+215)
local unit Unit = GetTriggerUnit()
local timer SlideTimer
local lightning lightning1
local lightning lightning2
local lightning lightning3
local real realD1
local real realD2

call TriggerSleepAction (0.1)
call AddSpecialEffectLocBJ(point2,"Abilities\\Weapons\\Bolt\\BoltImpact.mdl")
call AddSpecialEffectLocBJ(point3,"Abilities\\Weapons\\Bolt\\BoltImpact.mdl")
call AddSpecialEffectLocBJ(point4,"Abilities\\Weapons\\Bolt\\BoltImpact.mdl")
call PauseUnit (GetTriggerUnit(), true)
call AddLightningLoc ("CLPB", point2,point1)
//set lightning1 (GetLastCreatedLightningBJ)
call AddLightningLoc ("CLPB", point3,point1)
call AddLightningLoc ("CLPB", point4,point1)
call TriggerSleepAction (1.00)
call DestroyLightning (lightning1)
call CreateUnitAtLoc (GetOwningPlayer(GetTriggerUnit()),'h000',(point1),0)
call PauseUnit (GetTriggerUnit(), false)
call TimerStart (SlideTimer,0.03,true, function Slide)
//loop 
//    exitwhen realD1 > realD2
//    set point1 = (GetTriggerUnitLoc())
//    endloop
endfunction


//===========================================================================
public function InitTrig takes nothing returns nothing
 local trigger trig = CreateTrigger()
 call TriggerRegisterAnyUnitEventBJ(trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
 call TriggerAddCondition (trig, Condition (function Conditions ) )
 call TriggerAddAction (trig, function Actions )
endfunction

endscope
 

Kazuga

Let the game begin...
Reaction score
110
Don't know why but I got an error ingame with red text when I tried it with this code...
JASS:
scope Lightnings
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'AEfk'
endfunction
private function Slide takes nothing returns nothing
local location point5 = GetUnitLoc(GetTriggerUnit())
call AddSpecialEffectLocBJ(point5,"Abilities\\Weapons\\Bolt\\BoltImpact.mdl")
endfunction
private function Actions takes nothing returns nothing
local real real1 = GetUnitFacing(GetTriggerUnit())
local location point1 = GetUnitLoc(GetTriggerUnit())
local location point2 = PolarProjectionBJ(point1,300,real1+145)
local location point3 = PolarProjectionBJ(point1,300,real1+180)
local location point4 = PolarProjectionBJ(point1,300,real1+215)
local unit Unit = GetTriggerUnit()
local timer SlideTimer
local lightning lightning1
local lightning lightning2
local lightning lightning3
local real realD1
local real realD2

call TriggerSleepAction (0.1)
call AddSpecialEffectLocBJ(point2,"Abilities\\Weapons\\Bolt\\BoltImpact.mdl")
call AddSpecialEffectLocBJ(point3,"Abilities\\Weapons\\Bolt\\BoltImpact.mdl")
call AddSpecialEffectLocBJ(point4,"Abilities\\Weapons\\Bolt\\BoltImpact.mdl")
call PauseUnit (GetTriggerUnit(), true)
call AddLightningLoc ("CLPB", point2,point1)
//set lightning1 (GetLastCreatedLightningBJ)
call AddLightningLoc ("CLPB", point3,point1)
call AddLightningLoc ("CLPB", point4,point1)
call TriggerSleepAction (1.00)
call DestroyLightning (lightning1)
call CreateUnitAtLoc (GetOwningPlayer(GetTriggerUnit()),'h000',(point1),0)
call PauseUnit (GetTriggerUnit(), false)
call TimerStart (SlideTimer,1.00,true, function Slide)
//loop 
//    exitwhen realD1 > realD2
//    set point1 = (GetTriggerUnitLoc())
//    endloop
endfunction


//===========================================================================
public function InitTrig takes nothing returns nothing
 local trigger trig = CreateTrigger()
 call TriggerRegisterAnyUnitEventBJ(trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
 call TriggerAddCondition (trig, Condition (function Conditions ) )
 call TriggerAddAction (trig, function Actions )
endfunction

endscope
 

Kazuga

Let the game begin...
Reaction score
110
Hm yes but now when I removed that I got a new error
"Uninitialized variable "Slide Timer" used in Lightnings___Actions()"
 

Kazuga

Let the game begin...
Reaction score
110
Ah thanks^^
However for some reason the timer thing doesn't work, the slide functioned isn't runed for some reason... Also is the timer repeating?

I really apriciate that there are so many people here who are willing to take their time to help the one next to them^^
 

Flare

Stops copies me!
Reaction score
662
1) Your timer is repeating
2) You aren't moving the unit in Slide, you are just getting it's location :rolleyes:
3) 1 second is a huge frequency for sliding (bring it down to about 0.04)
4) If you want to check if a function is being called, do something like this:
JASS:
call BJDebugMsg ("This part works")

It's very useful for helping to identify bugs in your code.
 

Kazuga

Let the game begin...
Reaction score
110
I'm not seting any unit point?
JASS:
private function Slide takes nothing returns nothing
local location point5 = GetUnitLoc(GetTriggerUnit())
call AddSpecialEffectLocBJ(point5,"Abilities\\Weapons\\Bolt\\BoltImpact.mdl")
endfunction

No special effect is created..
And yes I know it should be alot less than 1 second but I'm just trying to make it work atm^^

Edit:
Tested your debug message, apperently the timer do work but it is the special effect that doesn't for some reason...
 

Flare

Stops copies me!
Reaction score
662
Assign GetTriggerUnit () to a global variable (use a global block rather than a udg_ variable) in your primary actions. Then:
set point5 = GetUnitLoc (globalunitvar)

I don't think you can pass GetTriggerUnit () to a timer callback without globals/some form of attachment

By global block I mean this (if you didn't know already)
JASS:
globals
unit globalunitvar
real globalrealvar
integer globalintvar
group globalgroupvar
endglobals

//You may want to shorten the names though
 

Kazuga

Let the game begin...
Reaction score
110
Ok so locals only works within that function, and globals works all over that trigger or over all triggers?
This should work or? He doesn't accept when I set the dummy as last created unit though...
JASS:
scope Lightnings
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'AEfk'
endfunction
private function Slide takes nothing returns nothing
local location temp1 = GetUnitLoc(GetTriggerUnit())
local location temp2 = PolarProjectionBJ(temp1,50,0)

call SetUnitPositionLoc(dummy(),temp2)
call BJDebugMsg ("This part also works wohoo")
endfunction
private function Actions takes nothing returns nothing
local real real1 = GetUnitFacing(GetTriggerUnit())
local location point1 = GetUnitLoc(GetTriggerUnit())
local location point2 = PolarProjectionBJ(point1,300,real1+145)
local location point3 = PolarProjectionBJ(point1,300,real1+180)
local location point4 = PolarProjectionBJ(point1,300,real1+215)
local unit Unit = GetTriggerUnit()
local timer SlideTimer = CreateTimer()
local real realD1
local real realD2
globals
unit dummy
unit caster
endglobals

call BJDebugMsg ("This part works")
call TriggerSleepAction (0.1)
call AddSpecialEffectLocBJ(point2,"Abilities\\Weapons\\Bolt\\BoltImpact.mdl")
call AddSpecialEffectLocBJ(point3,"Abilities\\Weapons\\Bolt\\BoltImpact.mdl")
call AddSpecialEffectLocBJ(point4,"Abilities\\Weapons\\Bolt\\BoltImpact.mdl")
call PauseUnit (GetTriggerUnit(), true)
call AddLightningLoc ("CLPB", point2,point1)
call AddLightningLoc ("CLPB", point3,point1)
call AddLightningLoc ("CLPB", point4,point1)
call TriggerSleepAction (1.00)
call CreateUnitAtLoc (GetOwningPlayer(GetTriggerUnit()),'h000',(point1),0)
call set dummy (GetLastCreatedUnit)
call PauseUnit (GetTriggerUnit(), false)
call TimerStart (SlideTimer,3.00,true, function Slide)
//loop 
//    exitwhen realD1 > realD2
//    set point1 = (GetTriggerUnitLoc())
//    endloop
endfunction


//===========================================================================
public function InitTrig takes nothing returns nothing
 local trigger trig = CreateTrigger()
 call TriggerRegisterAnyUnitEventBJ(trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
 call TriggerAddCondition (trig, Condition (function Conditions ) )
 call TriggerAddAction (trig, function Actions )
endfunction

endscope
 

Flare

Stops copies me!
Reaction score
662
yes, that is vJASS.

your global block needs to be ABOVE everything else. JASS reads functions from bottom to top, so as far as it is concerned, you dont have a global variable called dummy to assign.

EDIT:
JASS:
dummy()

Why are those brackets there? You aren't calling a function, you aren't doing any math that would require brackets. You're not doing anything that would require brackets beside dummy.
 

AdamGriffith

You can change this now in User CP.
Reaction score
69
Blah, stick to the normal world editor for me! (Y)
Good ol' old fashioned coding for me :p
 

Kazuga

Let the game begin...
Reaction score
110
Yey the dummy is moving^^ But now I need it to be moved towards the unit you targeted with the spell, however there is alot of errors in the code atm...
For some reason jass variabes doesn't like me^^
JASS:
scope Lightnings
globals
unit dummy
unit caster
unit target
location targetloc
endglobals
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'AEfk'
endfunction

private function Slide takes nothing returns nothing
local location temp1 = GetUnitLoc(dummy)
local location temp2 = PolarProjectionBJ(temp1,50,0)
local location temp3 = GetUnitLoc(target)
local real angle

targetloc = GetUnitLoc(target)    //this
set udg_angle = AngleBetweenPoints(temp1,temp3) //this
call SetUnitPositionLoc(dummy,temp2)
call BJDebugMsg ("This part also works wohoo")
endfunction
private function Actions takes nothing returns nothing
local real real1 = GetUnitFacing(GetTriggerUnit())
local location point1 = GetUnitLoc(GetTriggerUnit())
local location point2 = PolarProjectionBJ(point1,300,real1+145)
local location point3 = PolarProjectionBJ(point1,300,real1+180)
local location point4 = PolarProjectionBJ(point1,300,real1+215)
local unit Unit = GetTriggerUnit()
local timer SlideTimer = CreateTimer()
local real realD1
local real realD2

set udg_target = (GetSpellTargetUnit) // and this
call BJDebugMsg ("This part works")
call TriggerSleepAction (0.1)
call AddSpecialEffectLocBJ(point2,"Abilities\\Weapons\\Bolt\\BoltImpact.mdl")
call AddSpecialEffectLocBJ(point3,"Abilities\\Weapons\\Bolt\\BoltImpact.mdl")
call AddSpecialEffectLocBJ(point4,"Abilities\\Weapons\\Bolt\\BoltImpact.mdl")
call PauseUnit (GetTriggerUnit(), true)
call AddLightningLoc ("CLPB", point2,point1)
call AddLightningLoc ("CLPB", point3,point1)
call AddLightningLoc ("CLPB", point4,point1)
call TriggerSleepAction (1.00)
set dummy = CreateUnitAtLoc (GetOwningPlayer(GetTriggerUnit()),'h000',(point1),0)
call PauseUnit (GetTriggerUnit(), false)
call TimerStart (SlideTimer,0.05,true, function Slide)
endfunction


//===========================================================================
public function InitTrig takes nothing returns nothing
 local trigger trig = CreateTrigger()
 call TriggerRegisterAnyUnitEventBJ(trig, EVENT_PLAYER_UNIT_SPELL_EFFECT )
 call TriggerAddCondition (trig, Condition (function Conditions ) )
 call TriggerAddAction (trig, function Actions )
endfunction

endscope
 
General chit-chat
Help Users

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top