Special effect problem

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
What exactly is this line?

JASS:
real1=real1+90


I'm assuming you want

JASS:
set real1 = real1 + 90


You also forgot a ")" here:

JASS:
local location point2 = PolarProjectionBJ(point1,200,real1+35
 

PurgeandFire

zxcvmkgdfg
Reaction score
509
Yes, here is it fully syntax error free:
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())
    local location point1 = GetUnitLoc(GetTriggerUnit())
    local location point2 = PolarProjectionBJ(point1,300,real1+35)
    set real1 = real1 + 90
    call AddSpecialEffectLoc("Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl",point2)
    set 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


Some notes:
  • Local declerations must ALWAYS be on top of the code
  • If you want to set a local variable, use set LOCALVARNAME = VALUE
  • When using functions, you must use a ( symbol for inputing arguments, and a ) to close the arguments. It is like a box to contain the arguments
  • JASS is case sensitive so everything needs to be spelled correctly and have proper punctuation and capitalization

Remember these and you should be getting less syntax errors. :p
 

Kazuga

Let the game begin...
Reaction score
110
But if locals has to be on top allways, how should I do this code?
JASS:
local real real1 = GetUnitFacing(GetTriggerUnit())
local location point1 = GetUnitLoc(GetTriggerUnit())
set real1 = real1 + 215
local location point2 = PolarProjectionBJ(point1,300,real1)
set real1 = real1 + 35
local location point3 = PolarProjectionBJ(point1,200,real1)
set real1 = real1 + 35
local location point4 = PolarProjectionBJ(point1,200,real1)

call AdSpecialEffectLocBJ(point2,"Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl")
call AdSpecialEffectLocBJ(point3,"Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl")
call AdSpecialEffectLocBJ(point4,"Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl")

I want to create a special effect at the diffrent locations behind the triggering unit.
 

AdamGriffith

You can change this now in User CP.
Reaction score
69
He means declaring the local.
You can use:
JASS:
    set ...

Anywhere but you must place:
JASS:
local real Real1

At the top of your actions.
 

Kazuga

Let the game begin...
Reaction score
110
Ye I know that, what I wonder is how I would create three special effects at polar offsets with diffrent angles from the trigger unit point..

Edit: Ok I solved that problem (on my own wohoo^^)
However I don't get the call pause action to work...
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())
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)


call AddSpecialEffectLocBJ(point2,"Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl")
call AddSpecialEffectLocBJ(point3,"Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl")
call AddSpecialEffectLocBJ(point4,"Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl")
call PauseUnit takes unit (GetTriggerUnit()), boolean flag returns nothing
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
When you look at function list, don't copy what it says

JASS:
call PauseUnit takes unit whichunit, boolean flag returns nothing
//i.e. whichunit is argument 1, flag is argument 2

//And it is called like so
//So, first argument must be something that is a unit (or returns a unit, like GetTriggerUnit ())
//Second argument must be a boolean (or something that returns a boolean (such as GetWidgetLife (whichunit) > 700)
call PauseUnit (GetTriggerUnit (), false)


@Adam: Boolean is either true or false (and pause is neither :p)
 

Flare

Stops copies me!
Reaction score
662
All functions that take arguments require a name for the argument (how else do you refer to the arguments in custom functions?)

(taken from JASScraft)
Watch how the unit (denoted by whichunit) is used in the function call
JASS:
function PauseUnitBJ takes boolean pause, unit whichUnit returns nothing
//See that the arguments are given names by which they are referred.
//And the function call here uses those taken values and uses them as arguments.
//But you have to give a legitimate argument (if you had a boolean var called pause, that'd be legit. otherwise, no)
    call PauseUnit(whichUnit, pause)
endfunction

(don't use a stupid BJ like that, I just needed a good example of the argument names)
 

Kazuga

Let the game begin...
Reaction score
110
Aha, so the function list show what I should write, and not how it should look. Then I understand^^ However, for some reason the unit is moved to the center of the map... I don't recall any moving action in my trigger?
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())
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)


call AddSpecialEffectLocBJ(point2,"Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl")
call AddSpecialEffectLocBJ(point3,"Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl")
call AddSpecialEffectLocBJ(point4,"Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl")
call PauseUnit (GetTriggerUnit(), true)
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


Edit:
Also, I tried to write out the creat unit at loc function however I still don't quite get what to write..
JASS:
 

Flare

Stops copies me!
Reaction score
662
JASS:
native CreateUnitAtLoc takes player id, integer unitid, location whichLocation, real face returns unit


That only creates 1 unit at a time though (there is the CreateNUnitsAtLoc, but that's a BJ which just loops the CreateUnitAtLoc function and returns the units in a unit group)

So, that would be
JASS:
call CreateUnitAtLoc (Player (0), 'hpea', Location (0, 0), 270)

That will create a peasant for player 1 at centre of playable map area, facing 270 degrees (I'm too lazy to clear the leak and such :p)

As regards the unit being moved... is there any other triggers which would be causing it?
 

Kazuga

Let the game begin...
Reaction score
110
Hm, can't get it to work if you want to create the unit for the owner of the triggering unit... Also for some reason a unit variable doesn't want to work...
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())
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 = GetTriggerUnit()


call AddSpecialEffectLocBJ(point2,"Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl")
call AddSpecialEffectLocBJ(point3,"Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl")
call AddSpecialEffectLocBJ(point4,"Abilities\\Spells\\Undead\\AnimateDead\\AnimateDeadTarget.mdl")
call PauseUnit (GetTriggerUnit(), true)
call CreateUnitAtLoc (Player(GetOwningPlayer(Unit)),'h000',(point1),0)
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
Ah must have missed that^^
Well I solved the "unit get's moved to the center of map" problem, it was caused by the blink ability. Aperently pausing a unit at the same time as he blink an error occurs and your moved to the center of the map..
Anyway, I can't get the action where I create a unit for the owner of the triggering unit to work... It works if I set a custom player value but it doesn't work if I put OwnerOfUnit in front of it...
JASS:
call CreateUnitAtLoc (Player(0),'h000',(point1),0)

Also what should the action for a lightning creation look like?
JASS:
call AddLightningLoc ,point2,point1
 

Larcenist

REP: Respect, Envy, Prosperity?
Reaction score
211
JASS:
call AddLightningLoc(LightningRawCode, SourcePoint, TargetPoint)


To get the Raw code of the lightning, just convert GUI triggers to find them all.
 

Kazuga

Let the game begin...
Reaction score
110
Ah thanks, so that's what it should look like^^
Next step might be a little advanced for me but I must try:rolleyes:

I have successfully created a wait action and a timer, however I have no idea how to proceed. I will sort of need a new event in the allready trigger.. Every time the timer ends, a unit should be moved a short bit. (Sliding function?)
 

T.s.e

Wish I was old and a little sentimental
Reaction score
133
JASS:
call TimerStart( YourTimer, 0.03, true, function Slide)

Calls the Slide function every 0.03 seconds.
 

Kazuga

Let the game begin...
Reaction score
110
Hm recieved the error "Undefined function Slide"
JASS:
call TimerStart (SlideTimer,0.03,true, function Slide)

Also, do I create a new function list that will be runned every time the timer runs or...? Sorry but I'm complete new to this^^
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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