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
  • 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

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top