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

[Trigger] pretty simple (i hope) trigger help request

Status
Not open for further replies.
Level 9
Joined
Jan 14, 2008
Messages
366
none of the effects take place, but event and conditions look flawless...

JASS:
function Trig_barbarian_knight_crippling_strike_Copy_Conditions takes nothing returns boolean
    if ( not ( GetUnitTypeId(GetSpellAbilityUnit()) == 'H000' ) ) then
        return false
    endif
    if ( not ( GetSpellAbilityId() == 'A004' ) ) then
        return false
    endif
    return true
endfunction

function Trig_barbarian_knight_crippling_strike_Copy_Actions takes nothing returns nothing
    call SetUnitLifeBJ( GetSpellTargetUnit(), ( GetUnitStateSwap(UNIT_STATE_LIFE, GetSpellTargetUnit()) - ( I2R(GetUnitAbilityLevelSwapped('A004', GetSpellAbilityUnit())) * 50.00 ) ) )
    call AddSpecialEffectLocBJ( GetUnitLoc(GetSpellTargetUnit()), "Abilities\\Spells\\Orc\\FeralSpirit\\feralspiritdone.mdl" )
    call PlaySoundOnUnitBJ( gg_snd_MetalHeavySliceStone2, 100.00, GetSpellTargetUnit() )
    call EnableTrigger( GetTriggeringTrigger() )
endfunction

//===========================================================================
function InitTrig_barbarian_knight_crippling_strike_Copy takes nothing returns nothing
    set gg_trg_barbarian_knight_crippling_strike_Copy = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_barbarian_knight_crippling_strike_Copy, EVENT_PLAYER_UNIT_SPELL_FINISH )
    call TriggerAddCondition( gg_trg_barbarian_knight_crippling_strike_Copy, Condition( function Trig_barbarian_knight_crippling_strike_Copy_Conditions ) )
    call TriggerAddAction( gg_trg_barbarian_knight_crippling_strike_Copy, function Trig_barbarian_knight_crippling_strike_Copy_Actions )
endfunction
 
Last edited by a moderator:
Level 17
Joined
Apr 13, 2008
Messages
1,597
You have copied your GUI trigger in a way you shouldn't have.

Go to the Trigger Editor. Right click on your trigger's name and click on "Copy as Text" in the window popping up.
You can make your copied trigger look the same like in the Trigger Editor by using the [ trigger] [ /trigger] tags without the space (" ").

When you post a trigger MAKE SURE YOU POST WHAT IT SHOULD DO, since it's hard to pull out the magic crystal ball from our wizard hat and ask it what it is supposed to do.

I think you shouldn't use the EVENT_PLAYER_UNIT_SPELL_FINISH but the "Unit starts the effect of an ability". That should be the problem, if not post the trigger and not this custom text junk.
 

Rui

Rui

Level 41
Joined
Jan 7, 2005
Messages
7,550
You appear to be using the event "Unit - A Unit finishes casting a spell". This event doesn't seem to work for some reason, try "Unit - A unit starts the effect of an ability".

As for the conditions, they probably don't work too. You're asking for two things for the trigger to run: the spell being cast has to be CustomSpell1, and it has to be CustomSpell2, which is obviously impossible.
You have to use the Or (which is at the bottom of the condition list).
 
Level 2
Joined
Apr 15, 2007
Messages
18
oxxo, read every replies and thank everyone after you've read them. Don't just read the latest one and thank that person... emperor_d3st took the effort to help you, so thank him.
 
Level 9
Joined
Jan 14, 2008
Messages
366
jeeees sry i started reading from bottom for a random reason (my cat was giving me headbuts) so i didnt bother reading more

I APOLOGIZE FOR BEING RUDE

and thank everyone who took the time to figure out my problems. honestly. i am sry, just like you i strongly dislike the attitude i just displayed.
 
Level 17
Joined
Apr 13, 2008
Messages
1,597
As for the conditions, they probably don't work too. You're asking for two things for the trigger to run: the spell being cast has to be CustomSpell1, and it has to be CustomSpell2, which is obviously impossible.
You have to use the Or (which is at the bottom of the condition list).

Oh, nope. He first checks for a spell type and then for the unit type, so it's okay.

Fabba, thanks for standing out for me. It felt good

I APOLOGIZE FOR BEING RUDE
Okay, thank you for clearing that up. :)
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Did you convert your trigger to Jass so it will look like you know Jass or just for fun ? because that Jass sucks.
Don't use all those useless BJs, fix your condition to "return condition" instead of "if not(condition) return false else return true".
And for god sake, make your function and trigger names readable.

As to the problem - 'H000' isn't 'h000' which is the normal syntax for custom units (h, not H).
 
Status
Not open for further replies.
Top