Special effect problem

Kazuga

Let the game begin...
Reaction score
110
Ok I got this small problem once again^^ I must have coded wrong but I don't know how to fix it.. The error only says "Syntax error"=/
JASS:
scope Lightnings
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'AEbl'
endfunction
private function Actions takes nothing returns nothing
    call AddSpecialEffectLocBJ(( 0 , 0), "Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl" )
    call CreateNUnitsAtLoc( 1, 'hfoo', Player(0), PolarProjectionBJ(0,0), 256, 0), bj_UNIT_FACING )
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

Any help would be mostly apriciated:thup:
Thanks on beforehand, have a nice continiued evening^^
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
Change

JASS:
"Abilities\Spells\Undead\AnimateDead\AnimateDeadTarget.mdl"


to

JASS:
"Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl"


You can also use

 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
Oh yeah it should.

Though one thing about JASS is that it's faster than GUI if you make it like that. Avoid BJs, that's the first key to success. In your function list you can search for the BJs and see what they call, then work your way around it. PolarProjectionBJ for example:
JASS:
px = GetLocationX(Source) + Distance * Cos(Angle * bj_DEGTORAD)
py = GetLocationY(Source) + Distance * Sin(Angle * bj_DEGTORAD)

return Location(px, py)



o_O Different answers... who is right? ;p
It's so going to be me!

My excuse is that I refrain from using BJs D:
 

Kazuga

Let the game begin...
Reaction score
110
That actually made it much more complicated.. I'm not very good with Sin and cos. Why is bj:s bad? (Was converted into it from gui)
 

Knight7770

Hippopotomonstrosesquiped aliophobia
Reaction score
187
Why is bj:s bad? (Was converted into it from gui)
From what I gather, it's because they're made crappily, and all they do is call other functions. Which is bad.
 

AdamGriffith

You can change this now in User CP.
Reaction score
69
A BJ refers to a function in Blizzard.j

Taken from Blizzard.j:
JASS:
//===========================================================================
function PolarProjectionBJ takes location source, real dist, real angle returns location
    local real x = GetLocationX(source) + dist * Cos(angle * bj_DEGTORAD)
    local real y = GetLocationY(source) + dist * Sin(angle * bj_DEGTORAD)
    return Location(x, y)
endfunction


So when you use the function PolarProjectionBJ is calls this function and returns you a point as shown above.

Basically, if you put that straight into your code, it is faster than the game searching for this BJ function.
(I hope I have explainded it right).
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
BJs call natives, and the more function calls a code has got the slower it'll get.

Also try to use X and Y values rather than locations, XY are faster than locations too.

Instead of using GetUnitLoc() just do:

JASS:
local unit Unit = GetTriggerUnit()
local real x = GetUnitX(Unit)
local real y = GetUnity(Unit)
local unit Unit2 = CreateUnit(GetOwningPlayer(Unit), 'hfoo', x, y, 0)


And you successfully created a unit on top of Unit, without even creating a location that has to be removed and nulled.
 

Kazuga

Let the game begin...
Reaction score
110
Ah, finally something I do understand^^ Ok thanks, great explenation about the BJ:s btw:thup:
 

AdamGriffith

You can change this now in User CP.
Reaction score
69

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
You're supposed to null locals that extends handles, examples are units, locations, groups, timers etc.
 

Kazuga

Let the game begin...
Reaction score
110
I'm sorry for the massive amounts of questions^^
How do you set a pont with polar offset and then use it for example creating an special effect there?
 

Kazuga

Let the game begin...
Reaction score
110
Hehe I allways forgot about those^^
However, how do you add values to integers and reals? Also is this the correct way to write out the angle value in a polar offset?
JASS:
scope Lightnings
private function Conditions takes nothing returns boolean
return GetSpellAbilityId() == 'AEbl'
endfunction
private function Actions takes nothing returns nothing
local real real1 = GetUnitFacing(GetTriggerUnit())
real1=real1+90
local location point1 = GetUnitLoc(GetTriggerUnit())
local location point2 = PolarProjectionBJ(point1,300,real1+35)
call AddSpecialEffectLocBJ(point2,"Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl")
local location point1 = GetUnitLocGetTriggerUnit())
local location point2 = PolarProjectionBJ(point1,200,real1+35
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.

      The Helper Discord

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top