| 12-14-2006, 01:03 AM | #1 |
I wanted to make my first trigger-powered spell (GUI) and so far it's failing miserably. I tried making a freeze spell - A projectile flies at a target, upon landing a Frost-nova like animation occurs on the target, the enemy gets 1000% life regeneration, invulnerability, and can't do anything at all. Mainly a getaway hero spell. Lasts 10 seconds. Here's what I got: function Trig_Freeze_1_Conditions takes nothing returns boolean if ( not ( GetSpellAbilityId() == 'A007' ) ) then return false endif return true endfunction function Trig_Freeze_1_Actions takes nothing returns nothing call SetUnitMoveSpeed( GetSpellTargetUnit(), 0.00 ) call SetUnitInvulnerable( GetSpellTargetUnit(), true ) call SetUnitFacingToFaceUnitTimed( GetSpellTargetUnit(), GetTriggerUnit(), 10.00 ) call UnitAddAbilityBJ( 'A006', GetSpellTargetUnit() ) call TriggerSleepAction( 10.00 ) call UnitRemoveAbilityBJ( 'A006', GetSpellTargetUnit() ) call SetUnitInvulnerable( GetSpellTargetUnit(), false ) call SetUnitMoveSpeed( GetSpellTargetUnit(), GetUnitDefaultMoveSpeed(GetSpellTargetUnit()) ) endfunction //=========================================================================== function InitTrig_Freeze_1 takes nothing returns nothing set gg_trg_Freeze_1 = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Freeze_1, EVENT_PLAYER_UNIT_SPELL_CAST ) call TriggerAddCondition( gg_trg_Freeze_1, Condition( function Trig_Freeze_1_Conditions ) ) call TriggerAddAction( gg_trg_Freeze_1, function Trig_Freeze_1_Actions ) endfunction So far, it does nothing except set the unit to permanent invulnerability and the effects of the base spell - the Warden Shadow Strike (or something like that) ability. It slows them down. First of all, how do I make this particular part of the spell work? And second of all, I want the final frame of the Frost Nova animation stay on the unit and disable any actions by the player owning the target for 10 seconds - no spells, no attack, nothing. And yes, I converted this to custom text because I didn't want to write down every trigger and didn't know how to use the [trigger] thing. |
| 12-14-2006, 01:55 AM | #2 |
JASS:function Trig_Freeze_1_Conditions takes nothing returns boolean return GetSpellAbilityId() == 'A007' endfunction function Trig_Freeze_1_Actions takes nothing returns nothing local unit a = GetSpellAbilityUnit() local unit b = GetSpellTargetUnit() call SetUnitMoveSpeed( b, 0.00 ) call SetUnitInvulnerable( b, true ) call SetUnitFacingToFaceUnitTimed( b, a, 10.00 ) call UnitAddAbility( b ,'A006' ) call TriggerSleepAction( 10.00 ) call UnitRemoveAbility( b, 'A006' ) call SetUnitInvulnerable( b, false ) call SetUnitMoveSpeed( b, GetUnitDefaultMoveSpeed(b) ) set a = null set b = null endfunction //=========================================================================== function InitTrig_Freeze_1 takes nothing returns nothing set gg_trg_Freeze_1 = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ( gg_trg_Freeze_1, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddCondition( gg_trg_Freeze_1, Condition( function Trig_Freeze_1_Conditions ) ) call TriggerAddAction( gg_trg_Freeze_1, function Trig_Freeze_1_Actions ) endfunction theres the trigger optimized with locals, but things to check: Go to Gameplay Constants, then look at minimum movespeed for units. set that to 0 for it to go down to 0. Whats the spell based off of? Also, use EVENT_PLAYER_UNIT_SPELL_EFFECT not EVENT_PLAYER_UNIT_SPELL_CAST And to copy GUi, just Right Click the Trigger Icon Above the event icon and click Copy to Text then just paste it here in Code:
[trigger][/trigger] |
| 12-14-2006, 06:23 AM | #3 |
PolledWait is better here. |
| 12-14-2006, 08:44 AM | #4 | |
Quote:
Create it, then wait for some spesific time untill the animation you wanted, pause it, then remove it. |
| 12-14-2006, 10:49 AM | #5 |
You can copy triggers by right-clicking on the trigger name in the main window and selecting the "copy as text" option, then pasting it here in [trigger] tags. |
| 12-15-2006, 10:25 PM | #6 |
It's currently based off the Warden's shadow-slowdown/damage-over-time spell, but that's easily changable. I just choose any ability that has a missile (or not, depending how I decide the spell to work) and when it hits the target nothing happens except what the triggers say. The movement speed worked perfectly. Joker, what's that optimization for? How do I make it so that the unit sleeps for that period but without the zzz thing (if it's defaultly there)? That would remove the need for anything like movement restriction. The timer of 10 seconds still doesn't take off the effects of the spell, how do I fix that? Zen87, Thanks for the idea. How did I not think of that :P. Griffin, what's Polledwait? |
| 12-16-2006, 01:17 AM | #7 | |
Quote:
animationd of effects can only be paused if they are on an unit, after all we dont have any native like PauseTargetEffect or something =|PolledWait are like TriggerSleepAction, but it works in a better way... for the detail im also not very sure lol ! |
| 12-17-2006, 08:21 AM | #10 |
It doesn't work because you're using the line Trigger: Unit - Make (Target unit of ability being cast) Sleep when unprovokedThat has nothing to do with what you're trying to do, because it only affects creeps and things that sleep at night. The reason I don't have that line in my trigger (I should have explained this) is because I based the ability off of Storm Bolt, which I gave a 10 second stun. I changed the Art - Target field from the stun art to the freezing breath art. If you don't want to base it off of Storm Bolt, replace the lines regarding sleeping with Trigger: Unit - Pause/Unpause (Target Unit of Ability Being Cast)Also, I have read somewhere that after using any sort of a wait command, only the (Triggering Unit) function works, and that (Target unit of ability being cast) will not return a unit. I don't know if that is true or not, but that's why I used a variable in my triggers. |
| 12-17-2006, 01:42 PM | #11 |
Oh, that's why. It seems to not work, because anything after the 'wait' doesn't work. Stupid Blizzard. Thanks, the unpause worked and now I just need to apply a variable and fix graphical issues... |
| 12-17-2006, 02:29 PM | #13 |
It's not MUI. You'd need JASS and locals to make it MUI. |
| 12-17-2006, 05:27 PM | #14 |
No, you do not need JASS; in this instance you only need to read Darkwulfv's guide to MUI (multi-user instinceability) in GUI, and I highly suggest you do. Look into the part about local variables (Section 3 I think), or take a look at my trigger with locals because I used it. The reason you're having this bug is because when you cast it multiple times the variable gets overwritten so the first unit is never unfrozen. I also think I know why you got confused and added the "Unit - Sleep Unit..." actions. Since you posted the triggers converted to custom text, the guys reading the post thought you were working in JASS, or at least knew some. In JASS, TriggerSleepAction( x ) is what you use for a "Wait x seconds" command; PolledWait( x ) is the equivalent of "Wait x game-time seconds". That's what they were referring to. |
| 12-17-2006, 06:13 PM | #15 |
I had posted that I changed it to Jass just to post it. So to make it work I need the game to create seperate variables for each instance of the spell cast? Okay. |
