HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Spell - related troubles.

12-14-2006, 01:03 AM#1
Centreri
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
Joker
Collapse 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
Captain Griffen
PolledWait is better here.
12-14-2006, 08:44 AM#4
zen87
Quote:
Originally Posted by Centreri
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.
i guess you can use a dummy unit with the frost nova model
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
Anitarf
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
Centreri
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
zen87
Quote:
Originally Posted by Centreri
Zen87, Thanks for the idea. How did I not think of that :P.

Griffin, what's Polledwait?
well because i do have some spell are using that method 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-16-2006, 06:54 PM#8
Pyrogasm
Here you go: I made the spell in GUI (because that's what you said you were working in, right?). Once using Array variables and once using locals; both are included in the map. The only thing I couldn't get was the 1000% regen, so I made it regenerate 9% of total hit points per second. Another thing: I couldn't freeze the frost nova animation, but I used the Frost Wyrm Freezing Breath art, and it seemed to be very close to what you wanted.

Here are the triggers, and the map is attached.
With Local Variables:
Trigger:
Cast with Locals
Collapse Events
Unit - A unit Starts the effect of an ability
Collapse Conditions
(Ability being cast) Equal to Freezing Bolt
Collapse Actions
Custom script: local unit udg_Freezing_Bolt_Unit
Set Freezing_Bolt_Unit = (Target unit of ability being cast)
Wait 0.30 seconds
Unit - Make Freezing_Bolt_Unit Invulnerable
Unit - Add Freezing Bolt Regen to Freezing_Bolt_Unit
Animation - Change Freezing_Bolt_Unit's animation speed to 0.00% of its original speed
Wait 10.00 game-time seconds
Unit - Make Freezing_Bolt_Unit Vulnerable
Unit - Remove Freezing Bolt Regen from Freezing_Bolt_Unit
Animation - Change Freezing_Bolt_Unit's animation speed to 100.00% of its original speed
Custom script: set udg_Freezing_Bolt_Unit = null
Without Local Variables:
Trigger:
Cast
Collapse Events
Unit - A unit Starts the effect of an ability
Collapse Conditions
(Ability being cast) Equal to Freezing Bolt
Collapse Actions
Set Freezing_Bolt_Unit_Array[(Player number of (Owner of (Triggering unit)))] = (Target unit of ability being cast)
Wait 0.30 seconds
Unit - Make Freezing_Bolt_Unit_Array[(Player number of (Owner of (Triggering unit)))] Invulnerable
Unit - Add Freezing Bolt Regen to Freezing_Bolt_Unit_Array[(Player number of (Owner of (Triggering unit)))]
Animation - Change Freezing_Bolt_Unit_Array[(Player number of (Owner of (Triggering unit)))]'s animation speed to 0.00% of its original speed
Wait 10.00 game-time seconds
Unit - Make Freezing_Bolt_Unit_Array[(Player number of (Owner of (Triggering unit)))] Vulnerable
Unit - Remove Freezing Bolt Regen from Freezing_Bolt_Unit_Array[(Player number of (Owner of (Triggering unit)))]
Animation - Change Freezing_Bolt_Unit_Array[(Player number of (Owner of (Triggering unit)))]'s animation speed to 100.00% of its original speed
Attached Files
File type: w3xFreezing Bolt Test.w3x (19.6 KB)
12-17-2006, 01:04 AM#9
Centreri
I tried using what you did but customize it, and logically it should have worked.
Trigger:
Freeze 1
Collapse Events
Unit - A unit Begins casting an ability
Collapse Conditions
(Ability being cast) Equal to Freeze
Collapse Actions
Wait 0.30 seconds
Unit - Make (Target unit of ability being cast) Invulnerable
Unit - Add Freeze-Induced Regeneration to (Target unit of ability being cast)
Animation - Change (Target unit of ability being cast)'s animation speed to 0.00% of its original speed
Unit - Make (Target unit of ability being cast) Sleep when unprovoked
Unit - Create 1 Frost Effect for Neutral Passive at (Target point of ability being cast) facing Default building facing degrees
Wait 10.00 seconds
Unit - Remove Freeze-Induced Regeneration from (Target unit of ability being cast)
Unit - Make (Target unit of ability being cast) Vulnerable
Animation - Change (Target unit of ability being cast)'s animation speed to 100.00% of its original speed
Unit - Wake up (Target unit of ability being cast)

And also
Trigger:
Freeze Effect
Collapse Events
Unit - A unit enters (Playable map area)
Collapse Conditions
(Unit-type of (Triggering unit)) Equal to Frost Effect
Collapse Actions
Wait 10.00 seconds
Unit - Remove (Triggering unit) from the game
Simple and should logically work. The unit doesn't stop moving, it just gets the aura and invulnerability. The frost effect works perfectly, by the way.
12-17-2006, 08:21 AM#10
Pyrogasm
It doesn't work because you're using the line
Trigger:
Unit - Make (Target unit of ability being cast) Sleep when unprovoked

That 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)
The problem with this being that the owner of the unit upon which the ability is cast will have the unit's command card diabled also, making it seem a bit less like being frozen, where one simply couldn't act.

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
Centreri
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:11 PM#12
Centreri
Trigger:
Freeze 1
Collapse Events
Unit - A unit Begins casting an ability
Collapse Conditions
(Ability being cast) Equal to Freeze
Collapse Actions
Set FreezeTarget = (Target unit of ability being cast)
Unit - Make FreezeTarget Invulnerable
Animation - Change FreezeTarget's animation speed to 0.00% of its original speed
Unit - Create 1 Frost Effect for Neutral Passive at (Position of FreezeTarget) facing Default building facing degrees
Unit - Pause FreezeTarget
Wait 10.00 seconds
Unit - Make FreezeTarget Vulnerable
Animation - Change FreezeTarget's animation speed to 100.00% of its original speed
Unit - Unpause FreezeTarget
Trigger:
Freeze Effect
Collapse Events
Unit - A unit enters (Playable map area)
Collapse Conditions
(Unit-type of (Triggering unit)) Equal to Frost Effect
Collapse Actions
Set FreezeEffect = (Triggering unit)
Wait 10.00 seconds
Unit - Remove FreezeEffect from the game
Everything works fine with the exception that sometimes the wrong unit is unfrozen. I freeze 4 units, and the fourth one breaks early while the first three don't break.
12-17-2006, 02:29 PM#13
Captain Griffen
It's not MUI. You'd need JASS and locals to make it MUI.
12-17-2006, 05:27 PM#14
Pyrogasm
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
Centreri
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.