• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] A Little Help 2

Status
Not open for further replies.
Level 6
Joined
Nov 15, 2010
Messages
112
How I wanna make this trigger:

JASS:
function Hellfire_Actions takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local real f = GetUnitFacing(u)
    local player p = GetTriggerPlayer()
    //-------------------------------
    local real xx
    local real yy
    local integer i = 1
    local unit d
  
    loop
        exitwhen i > 15
        set xx = x + (50 * i) * Cos(f * bj_DEGTORAD)
        set yy = y + (50 * i) * Sin(f * bj_DEGTORAD)
        set d = CreateUnit( p, 'h000', xx , yy , 0 )
        call UnitAddAbility(d, 'AHtc')
        call UnitApplyTimedLife(d, 'BTLF', 1.50)
        call IssueImmediateOrder(d, "thunderclap")
        set i = i + 1
    endloop

    set u = null
    set d = null
    set p = null
endfunction

function Hellfire_Condition takes nothing returns boolean
    return GetSpellAbilityId() == 'ANbf'
endfunction 

function InitTrig_Hellfire takes nothing returns nothing
    local trigger t = CreateTrigger()
    call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_UNIT_SPELL_EFFECT )
    call TriggerAddCondition( t, Condition( function Hellfire_Condition ) )
    call TriggerAddAction( t, function Hellfire_Actions )
endfunction

with library???
 
Level 29
Joined
Mar 10, 2009
Messages
5,016
--->
JASS:
library HellFire
function Hellfire_Actions takes unit u, player p returns nothing
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local real f = GetUnitFacing(u)
    //-------------------------------
    local real xx
    local real yy
    local integer i = 1
    local unit d
  
    loop
        exitwhen i > 15
        set xx = x + (50 * i) * Cos(f * bj_DEGTORAD)
        set yy = y + (50 * i) * Sin(f * bj_DEGTORAD)
        set d = CreateUnit( p, 'h000', xx , yy , 0 )
        call UnitAddAbility(d, 'AHtc')
        call UnitApplyTimedLife(d, 'BTLF', 1.50)
        call IssueImmediateOrder(d, "thunderclap")
        set i = i + 1
    endloop
    set d = null
endfunction
endlibrary
 
Level 6
Joined
Nov 15, 2010
Messages
112
how about:

[JASS=]
function Hellfire_Condition takes nothing returns boolean
return GetSpellAbilityID() = 'ANbf'
endfunction[/code]
where to put it in library JASS???

and [JASS=]library Hellfire[/code]

this must be like [JASS=]library Hellfire Initializer Init[/code]

right?????

edit: and how about [JASS=] globals
endglobals[/code]???

1 more, when i try to use mckill code, the trigger become disabled
 
Last edited:
Level 29
Joined
Mar 10, 2009
Messages
5,016
the code I give can can be used via GUI/JASS alike...
so you dont need the condition, but you should change the 'AHtc', 'h000', and "thunderclap" if needed...

sample;
  • Untitled Trigger 004
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to ABILITY_ID
    • Actions
      • Custom script: call Hellfire_Actions(GetTriggerUnit(), GetTriggerPlayer())
this >>> library Hellfire Initializer Init, should be this >>> library Hellfire initializer Init

you may setup globals like this...

JASS:
library HellFire

globals
    private integer DUMMY_ID = 'h000'
    private integer DUMMY_SPELL_ID = 'AHtc'
    private string ORDER_ID = "thunderclap" //better to use integer
endglobals

function Hellfire_Actions takes unit u, player p returns nothing
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local real f = GetUnitFacing(u)
    //-------------------------------
    local real xx
    local real yy
    local integer i = 1
    local unit d
  
    loop
        exitwhen i > 15
        set xx = x + (50 * i) * Cos(f * bj_DEGTORAD)
        set yy = y + (50 * i) * Sin(f * bj_DEGTORAD)
        set d = CreateUnit( p, DUMMY_ID, xx , yy , 0 )
        call UnitAddAbility(d, DUMMY_SPELL_ID)
        call UnitApplyTimedLife(d, 'BTLF', 1.50)
        call IssueImmediateOrder(d, ORDER_ID)
            set i = i + 1
        endloop
    set d = null
endfunction

endlibrary
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
This will cut down the amount of calculations:

JASS:
function Hellfire_Actions takes unit u, player p returns nothing
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local real f = GetUnitFacing(u) * bj_DEGTORAD
    //-------------------------------
    local real dx = 50 * Cos(f)
    local real dy = 50 * Sin(f)
    local integer i = 1
    local unit d
  
    loop
        exitwhen i > 15
        set x = x + dx
        set y = y + dy
        set d = CreateUnit(p, DUMMY_ID, x , y , 0)
        call UnitAddAbility(d, DUMMY_SPELL_ID)
        call UnitApplyTimedLife(d, 'BTLF', 1.50)
        call IssueImmediateOrder(d, ORDER_ID)
        set i = i + 1
    endloop
    set d = null
endfunction
 
Level 6
Joined
Nov 15, 2010
Messages
112
JASS:
globals
    private integer DUMMY_ID = 'h000'
    private integer DUMMY_SPELL_ID = 'AHtc'
    private string ORDER_ID = "thunderclap" //better to use integer
endglobals

so this is called setup...right it??

edit: wtf 4 my war 3...this message is really annoying:
 

Attachments

  • Script Errors.jpg
    Script Errors.jpg
    128.1 KB · Views: 88
Last edited:
Status
Not open for further replies.
Top