Raikiri Spell JASS help and more :(

mrpwn

New Member
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"
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.
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
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.
  • tom_mai78101 tom_mai78101:
    Make sure you keep checking out my news..
    +2
  • Jesus4Lyf Jesus4Lyf:
    Man, I made this account 15 years ago? Wild. :)
  • Ghan Ghan:
    Seeing J4L is definitely a blast from the past.
  • Jesus4Lyf Jesus4Lyf:
    Oh hey Ghan! Long time. :)
    +1
  • jonas jonas:
    J4L! What has happened in your life
  • Jesus4Lyf Jesus4Lyf:
    Hmm, how to summarize... Moved to the USA and got married. Became a professional software engineer and solution lead. Learning Godot for game dev. :)
  • jonas jonas:
    So you are pursuing game dev as a hobby? What industry is your dayjob in?
  • jonas jonas:
    FAANG?
  • Jesus4Lyf Jesus4Lyf:
    Not quite FAANG, less pay for a less hours/stress. Yeah, game dev as a hobby.
  • jonas jonas:
    makes sense. Do we have a hobby game dev subforum to showcase some work?
  • Blackveiled Blackveiled:
    Happy Thursday
    +1
  • The Helper The Helper:
    Happy Thursday!
  • The Helper The Helper:
    TGIF!
  • The Helper The Helper:
    hey tom_mai please do not archive anymore news
  • Ghan Ghan:
    AMD Ryzen 7000 next week :D
    +1
  • The Helper The Helper:
    noice!
  • tom_mai78101 tom_mai78101:
    "hey tom_mai please do not archive anymore news" ----> Got it. What should we do with the "News Archive" subforum?
  • The Helper The Helper:
    I think leave it for real old news that cannot be sorted the reason we had it in the first place was a server issue that we do not have anymore. I don't want to get rid of the archive just not put anything in it for now until we figure it out more
  • The Helper The Helper:
    The side chat has nothing on the discord. it is not possible but the biggest thing on my wish list right now is a sidechat channel on the disord that hooks up to this...
  • Ghan Ghan:
    I've been selected for the Diablo IV beta.
    +1
  • Ghan Ghan:
    Woo!
    +1
  • The Helper The Helper:
    that is so cool
  • V-SNES V-SNES:
    Eh just noticed the new discord section on the side. Looks great!
    +1
  • Blackveiled Blackveiled:
    :( feels bad I can't ever get selected for any beta I sign up for. It's annoying as heck.
    +1

    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