• 🏆 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!

[JASS] Jass help

Status
Not open for further replies.
Level 3
Joined
Mar 27, 2007
Messages
23
I dont understand what im doing wrong in this script if someone could take a look at it and help me out i would appreciate it

JASS:
function Trig_Nuclear_strike_Conditions takes nothing returns boolean
    if ( not ( GetIssuedOrderIdBJ() == OrderId("clusterrockets") ) ) then
        return false
    endif
    return true
endfunction

function Trig_Nuclear_strike_Actions takes nothing returns nothing
    set effect Nuclear_Stike == AddSpecialEffect
    call PlayThematicMusicBJ( "war3mapImported\\Nuke.wav" )
    call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_035" )
    call AddSpecialEffectLoc(effect "Abilities\\Spells\\NightElf\\TrueshotAura\\TrueshotAura.mdl" GetOrderPointLoc)
    call TriggerSleepAction( 2 )
    call DestroyEffect( Nuclear_Target )
    set effect Nuclear_Strike = null
endfunction

//===========================================================================
function InitTrig_Nuclear_strike takes nothing returns nothing
    set gg_trg_Nuclear_strike = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Nuclear_strike, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
    call TriggerAddCondition( gg_trg_Nuclear_strike, Condition( function Trig_Nuclear_strike_Conditions ) )
    call TriggerAddAction( gg_trg_Nuclear_strike, function Trig_Nuclear_strike_Actions )
endfunction

Thanks:infl_thumbs_up:
 
Level 11
Joined
Oct 13, 2005
Messages
233
I dont understand what im doing wrong in this script if someone could take a look at it and help me out i would appreciate it

JASS:
function Trig_Nuclear_strike_Conditions takes nothing returns boolean
    if ( not ( GetIssuedOrderIdBJ() == OrderId("clusterrockets") ) ) then
        return false
    endif
    return true
endfunction

function Trig_Nuclear_strike_Actions takes nothing returns nothing
 local effect Nuclear_Stike
    call PlayThematicMusicBJ( "war3mapImported\\Nuke.wav" )
    call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_035" )
    set Nuclear_Strike = AddSpecialEffectLoc("Abilities\\Spells\\NightElf\\TrueshotAura\\TrueshotAura.mdl" GetOrderPointLoc)
    call TriggerSleepAction( 2 )
    call DestroyEffect( Nuclear_Target )
    set Nuclear_Strike = null
endfunction

//===========================================================================
function InitTrig_Nuclear_strike takes nothing returns nothing
    set gg_trg_Nuclear_strike = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Nuclear_strike, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
    call TriggerAddCondition( gg_trg_Nuclear_strike, Condition( function Trig_Nuclear_strike_Conditions ) )
    call TriggerAddAction( gg_trg_Nuclear_strike, function Trig_Nuclear_strike_Actions )
endfunction

Thanks:infl_thumbs_up:

That should pretty much fix things up. You need to declare a local variable with the word 'local' then a type, then the name. You can then on the same line set it equal to something with a single equal sign or just set it to values later on.
 
Level 3
Joined
Mar 27, 2007
Messages
23
Ok i got it working but how would i go about making it so if multiple units cast the same spell it will corectly destroy all the effects from the trigger and not leave them there and no way to destroy them? here is the code i have now

JASS:
function Trig_Nuclear_strike_Conditions takes nothing returns boolean
    if ( not ( GetIssuedOrderIdBJ() == OrderId("clusterrockets") ) ) then
        return false
    endif
    return true
endfunction

function Trig_Nuclear_strike_Actions takes nothing returns nothing
    local effect udg_Nuclear_Stike
    call PlayThematicMusicBJ( "war3mapImported\\Nuke.wav" )
    call DisplayTextToForce( GetPlayersAll(), "TRIGSTR_035" )
    call AddSpecialEffectLoc( "Abilities\\Spells\\NightElf\\TrueshotAura\\TrueshotAura.mdl", GetOrderPointLoc())
    call TriggerSleepAction( 2 )
    call DestroyEffect( udg_Nuclear_Strike )
    call TriggerSleepAction( 0.20 )
    set udg_Nuclear_Strike = null
endfunction

//===========================================================================
function InitTrig_Nuclear_strike takes nothing returns nothing
    set gg_trg_Nuclear_strike = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Nuclear_strike, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
    call TriggerAddCondition( gg_trg_Nuclear_strike, Condition( function Trig_Nuclear_strike_Conditions ) )
    call TriggerAddAction( gg_trg_Nuclear_strike, function Trig_Nuclear_strike_Actions )
endfunction
 
Level 10
Joined
Nov 10, 2004
Messages
351
why do you call them udg_?
Anyways, the effect will be destroyed no matter how many times you cast it, as you are using a local variable.
Why are you using the event Issued order instead of spell effect?
Also, your condition should look like this instead:
JASS:
function Trig_Nuclear_strike_Conditions takes nothing returns boolean
    return GetIssuedOrderId() == OrderId("clusterrockets")
endfunction
 
Level 11
Joined
Jul 12, 2005
Messages
764
Here you go:
-You didn't store the effect to the variable
-Less efficient condition (as Diablo wrote)
-It leaked
JASS:
function Trig_Nuclear_strike_Conditions takes nothing returns boolean
    return GetIssuedOrderId() == OrderId("clusterrockets")
endfunction
function Trig_Nuclear_strike_Actions takes nothing returns nothing
    local effect Nuclear_Stike
    local location l = GetOrderPointLoc()
    call PlayThematicMusicBJ("war3mapImported\\Nuke.wav")
    call DisplayTextToForce(GetPlayersAll(), "TRIGSTR_035")
    set Nuclear_Stike = AddSpecialEffectLoc( "Abilities\\Spells\\NightElf\\TrueshotAura\\TrueshotAura.mdl", l)
    call TriggerSleepAction(2)
    call DestroyEffect(Nuclear_Strike)
    call RemoveLocation(l)
    set l = null
    set Nuclear_Strike = null
endfunction
//===========================================================================
function InitTrig_Nuclear_strike takes nothing returns nothing
    set gg_trg_Nuclear_strike = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Nuclear_strike, EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER )
    call TriggerAddCondition( gg_trg_Nuclear_strike, Condition( function Trig_Nuclear_strike_Conditions ) )
    call TriggerAddAction( gg_trg_Nuclear_strike, function Trig_Nuclear_strike_Actions )
endfunction
 
Level 3
Joined
Mar 27, 2007
Messages
23
Thanks alot but it still wont work in the trigger editor it says it wants names for nuclear_strike
JASS:
call DestroyEffect(Nuclear_Strike)

Comes up with the error "Expected a name"

and

JASS:
set Nuclear_Strike = null

"Expected a variable name"


Alright nevermind i figured it out looked at my script and realized i spelt Nuclear-strike wrong XD thx for the help
 
Last edited:
Status
Not open for further replies.
Top