My first JASS Spell

ReVolver

Mega Super Ultra Cool Member
Reaction score
608
I was on msn with xxxconanxxx and he taught me alot of stuff about JASS and showed me how everything worked and I made this spell.

Code:
function Trig_Ghost_Conditions takes nothing returns boolean
    return( GetSpellAbilityId() == 'AUan' )
endfunction

function Trig_Ghost_Actions takes nothing returns nothing
  local unit u=GetTriggerUnit()
  local location l=GetUnitLoc(u)
  local unit d

    call SetUnitAnimation (u,"death")
    call CreateUnitAtLoc (Player(0),'hpea',l,0) 
    set d=GetLastCreatedUnit()
    call IssueTargetOrder(d,"attack",u)

  call RemoveLocation(l)
  set l=null
  set u=null
  set d=null
endfunction

//===========================================================================
function InitTrig_Ghost takes nothing returns nothing
    set gg_trg_Ghost = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Ghost, EVENT_PLAYER_UNIT_SPELL_CAST )
    call TriggerAddCondition(gg_trg_Ghost, Condition(function Trig_Ghost_Conditions))
    call TriggerAddAction(gg_trg_Ghost, function Trig_Ghost_Actions)
endfunction

Its a basic spell but I least I had the gut to make it in JASS. :D
 

AceHart

Your Friendly Neighborhood Admin
Reaction score
1,497
> local location l = GetUnitLoc(u)
> local unit d
> call CreateUnitAtLoc (Player(0),'hpea',l,0)
> set d=GetLastCreatedUnit()

set bj_lastCreatedUnit = CreateUnit(Player(0), 'hpea', GetUnitX(u), GetUnitY(u), bj_UNIT_FACING)


This created unit also never dies? This looks like it might be a dummy unit?


Anyway, nice try :D
 
P

Persen

Guest
Yes, nice for a first one, but this would probably be better...
Just so you learn :D

Code:
  local unit u=GetTriggerUnit()
  local location l=GetUnitLoc(u)
  local unit d = CreateUnit(Player(0), 'hpea', GetUnitX(u), GetUnitY(u), 270.00)
  call SetUnitAnimation (u,"death")
  call IssueTargetOrder(d,"attack",u)
  call RemoveLocation(l)
  set l=null
  set u=null
  set d=null
 

phyrex1an

Staff Member and irregular helper
Reaction score
446
Persen may I ask why you still have the location if that function? :p

Anyway, the optimization of those functions is far better that I did in the begining of my jass carrier ^^
There isn't many traces of gui left. Gj.

But why do you want a peasant to attack you :confused:
 

XXXconanXXX

Cocktails anyone?
Reaction score
284
phyrex1an said:
But why do you want a peasant to attack you?

It's not really anything. Just a dummy to learn to clean up the trash GUI leaves behind.

phyrex1an said:
There isn't many traces of gui left. Gj.

That's the point. ;)

Simply a learning tool.

Ace ~ It's okay, I know you still love me. <3
 

ReVolver

Mega Super Ultra Cool Member
Reaction score
608
Like what xxxconanxxx said...

Im just learning how to convert (Ugly) GUI to (Perfect) JASS.

Thanks for the extra tip but please don't go into advance JASS on me. Im just want to learn the basics firsts, before goin advance or knowing about it. <3
 
General chit-chat
Help Users

      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