Raikiri Spell JASS help and more :(

mrpwn

New Member
Reaction score
0
hey everyone i am very new here and i want to map and code for war3 frozen throne just needed a little help with spells
so this one is for kakashi and i wanted him to lighting bolt a target and instantly move to him with thunder clap so far he fires a lighting bolt and thunder claps but stops after that no moving to a target.
(as a side note if any one has a better way(cooler) of doing this please let me know i want to learn, in addition if anyone can help me find a tutorial for a spell damage = X stat X level that would be awesome and really help me out)

function Trig_Main_Actions takes nothing returns nothing
call DisplayTextToForce( GetPlayersAll(), "NAruto Test Map" )
endfunction


function Trig_Raikiri_Conditions takes nothing returns boolean
if ( not ( GetSpellAbilityId() == 'A001' ) ) then
return false
endif
return true
endfunction

function Trig_Raikiri_Actions takes nothing returns nothing
call AddSpecialEffectLocBJ( GetUnitLoc(GetTriggerUnit()), "Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl" )
call ExplodeUnitBJ( GetTriggerUnit() )
call SetUnitPositionLoc( GetTriggerUnit(), OffsetLocation(GetSpellTargetLoc(), 0, 0) )
call UnitDamagePointLoc( GetTriggerUnit(), 0, 500, GetUnitLoc(GetTriggerUnit()), 100, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_NORMAL )
endfunction


//===========================================================================
function InitTrig_Main takes nothing returns nothing
set gg_trg_Main = CreateTrigger( )
call TriggerAddAction( gg_trg_Main, function Trig_Main_Actions )
endfunction
 

Dameon

"All the power in the world resides in the eyes"
Reaction score
127
you have no event, you dont add the condition function, you blow up the unit that casts the ability. You can do all this in gui, maybe you should try that first then move to jass once you get a better handle on how the triggers work, after you make a trigger in gui go to edit and chose convert to custom text to see how it is set up in jass, it is the fastest way to learn.
 

afisakov

You can change this now in User CP.
Reaction score
37
I have a trigger similar to this on one of the maps I am working on so I posted what I hope is enough of the code for you to replicate it.
This moves the caster next to the target and deals ( (agi+50) x ability level) damage. to all enemies in an area.
I also included the globals you will have to declare and the Init trig lines to make it activate. This SHOULD be leakless, though my apologies if I forgot something.

FYI, never use "call UnitDamagePointLoc", when you do you surrender all control over which targets you hit. ie you will end up damaging allies as well as enemies and yourself. I doubt that is your intention.

Daemon's suggestion about doing this in GUI would probably be the easier way to learn, but you asked for Jass and I have the trigger so I figured why not share it.

Code:
/*  Global Variables
//*
//***************************************************************************

location tp1=null
location tp2=null
location tp3=null
trigger udg_trigger_raikiri=null
unit udg_unit01=null
group tg=null
real dx=0
...
endglobals

function Trig_raikiri_Conditions takes nothing returns boolean
    return (GetSpellAbilityId()=='A001')
endfunction

function trigenemy takes nothing returns boolean
 return IsUnitAliveBJ(GetFilterUnit()) and IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(GetTriggerUnit()))
endfunction
function raikiri_dam takes nothing returns nothing
    call UnitDamageTargetBJ(GetTriggerUnit(),GetEnumUnit(),dx,ATTACK_TYPE_CHAOS,DAMAGE_TYPE_MAGIC)
    set tp2=GetUnitLoc(GetEnumUnit())
    call AddSpecialEffectLocBJ(tp2,"Abilities\\Spells\\Human\\ThunderClap\\ThunderClapCaster.mdl")
    call DestroyEffect(GetLastCreatedEffectBJ())
    call RemoveLocation (tp2)
endfunction

function Trig_raikiri_Actions takes nothing returns nothing
    local unit u=GetTriggerUnit()
    set udg_unit01=GetSpellTargetUnit()
    set tp1=GetUnitLoc(udg_unit01)
    set tp3=PolarProjectionBJ(tp1,80.00,GetUnitFacing(u))
    call SetUnitPositionLocFacingLocBJ(GetTriggerUnit(),tp3,tp1)
    call RemoveLocation (tp3)
    set dx=I2R((GetHeroStatBJ(bj_HEROSTAT_AGI,u,true)+50)*(GetUnitAbilityLevel(u,'A001')))
    set tg=GetUnitsInRangeOfLocMatching(300,tp1,Condition(function trigenemy))
    call ForGroupBJ(tg,function raikiri_dam)
    call DestroyGroup (tg)
    call RemoveLocation (tp1)
endfunction

//===========================================================================
function InitTrig_Main takes nothing returns nothing
    set udg_trigger_raikiri=CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ(udg_trigger_raikiri,EVENT_PLAYER_UNIT_SPELL_EFFECT)
    call TriggerAddCondition(udg_trigger_raikiri,Condition(function Trig_raikiri_Conditions))
    call TriggerAddAction(udg_trigger_raikiri,function Trig_raikiri_Actions)
...other declarations...
endfunction
 

mrpwn

New Member
Reaction score
0
i agree on the GUI but i converted it to jass in game the event was in their T_T because that's what i wanted to learn. Gotta start some where right lol. But thanks both of you guys i appreciate it. :D

also do you guys know if there is a guide that explains and defines terms for jass?
 
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