Need help to with a spell.

Tholdalf

New Member
Reaction score
2
Ok so i have read some more jas tuts and now i have run into a problem.

how does i set the last created special effect to a local? and what local shall i use?

i is the local i´m trying to set to the effect.

Code:
function Trig_Greater_Bash_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A000' )
endfunction

function Trig_Greater_Bash_Actions takes nothing returns nothing
local unit a //Casting Unit//
local unit b //Targeted Unit of Ability//
local location c //Location of unit a//
local location d //Location of unit b//
local integer e //Amount moved for etch loop//
local integer f
local real g //Facing of unit eg which way b will move to//
local real h
local effect i //Special Effect//

set a=GetTriggerUnit()
set b=GetSpellTargetUnit()
set c=GetUnitLoc(a)
set d=GetUnitLoc(b)
set e=0
set g=GetUnitFacing(a)


loop
exitwhen (e>30)
  set e=e+1
  call SetUnitPositionLoc( b, PolarProjectionBJ(d, ( DistanceBetweenPoints(d, GetUnitLoc(b)) + 20.00 ), AngleBetweenPoints(c, GetUnitLoc(b))) )
  call UnitApplyTimedLifeBJ( 1, 'BTLF', GetLastCreatedUnit() )
  call TriggerSleepAction(0.01)
  call AddSpecialEffectLocBJ( GetUnitLoc((b)), "Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl" )
set i=
  endloop
 
endfunction

//===========================================================================
function InitTrig_Greater_Bash takes nothing returns nothing
    set gg_trg_Greater_Bash = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Greater_Bash, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Greater_Bash, Condition( function Trig_Greater_Bash_Conditions ) )
    call TriggerAddAction( gg_trg_Greater_Bash, function Trig_Greater_Bash_Actions )
endfunction
 

GoGo-Boy

You can change this now in User CP
Reaction score
40
A bit more optimized... but dude please do NEVER AGAIN use a,b,c,d,e,f,g as variable names.

JASS:
function Trig_Greater_Bash_Conditions takes nothing returns boolean
return ( GetSpellAbilityId() == 'A000' )
endfunction

function Trig_Greater_Bash_Actions takes nothing returns nothing
local unit a = GetTriggerUnit()
local unit b = GetSpellTargetUnit()
local location c = GetUnitLoc(a)
local location d = GetUnitLoc(b)
local integer e = 0
local integer f
local real g = GetUnitFacing(a)
local real h
local effect i 


loop
    exitwhen (e>30)
    set e=e+1
    call SetUnitPositionLoc( b, PolarProjectionBJ(d, ( DistanceBetweenPoints(d, GetUnitLoc(b)) + 20.00 ), AngleBetweenPoints(c, GetUnitLoc(b))) )    
    call UnitApplyTimedLifeBJ( 1, 'BTLF', GetLastCreatedUnit() )
    call TriggerSleepAction(0.01)
    set i = AddSpecialEffectLocBJ( GetUnitLoc((b)), "Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl" )

  endloop
 
endfunction

//===========================================================================
function InitTrig_Greater_Bash takes nothing returns nothing
    set gg_trg_Greater_Bash = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Greater_Bash, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( gg_trg_Greater_Bash, Condition( function Trig_Greater_Bash_Conditions ) )
    call TriggerAddAction( gg_trg_Greater_Bash, function Trig_Greater_Bash_Actions )
endfunction
 

Tholdalf

New Member
Reaction score
2
Ok i shall rename them emidiatly and it works + rep to both of you :p

Ok found another prob the unit moves realy slow, and it doesn´t help even if i sets the TriggerSleepAction(0.01)to something lower and if i sets the +10 to something higher he hachs alot.:confused:
 

GoGo-Boy

You can change this now in User CP
Reaction score
40
Here, have a look at this:
http://www.thehelper.net/forums/showthread.php?t=89870

TriggerSleepAction() is simple not accurate enough, you'll have to use timers and struct attachment systems like ABCT to get smooth unit movements. But before you're doing this you probably should learn some more basic JASS stuff like getting rid of BJs etc.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top