• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

spell: channel, trigger probs and variables

Status
Not open for further replies.
Level 4
Joined
Nov 24, 2010
Messages
70
Hi, i need help with a spell named Channel. i realised many custom spell used that, can i know the reason why? Also, when i used it with my trigger, it doesnt go on cooldown. Most of my triggers are those that move unit(instantly) that causes the problem. Also, what are the important things to note when using variable? I realised most custom spells set variable and removed it when done.( prevents lag or smth)

P.S. idk how to take a screen shot of my triggers. If needed, teach me how and i will post it here.

thanks for help and sorry if i sound very commanding of somesort. Dk how else to write this
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
Hi, i need help with a spell named Channel. i realised many custom spell used that, can i know the reason why? Also, when i used it with my trigger, it doesnt go on cooldown. Most of my triggers are those that move unit(instantly) that causes the problem. Also, what are the important things to note when using variable? I realised most custom spells set variable and removed it when done.( prevents lag or smth)

P.S. idk how to take a screen shot of my triggers. If needed, teach me how and i will post it here.

thanks for help and sorry if i sound very commanding of somesort. Dk how else to write this

Well, firstly they use channel because of the supreme customizability. It really allows far more than any other spell.
The cooldown problem comes from instantly moving unit.
The reason why people use variables is that many functions create values that don't go away. If you don't use variables, then the values are still created, but you will never know where and thus, can't clear them up. If too many of them are not cleared up(thousands), then it will clog up your RAM and start to lag. In extreme cases it can even crash the game.
 
Level 4
Joined
Nov 24, 2010
Messages
70
i've seen some spells that use something like CallRemove (smth_smth ). is that needed? or will the variable just be removed after the spells ends. Also, how to fix the moving unit instantly thing. i made a spell(channel) that when used, summons a dummy to storm bolt the target then move my Hero to the target. like a Blink, everything works other than the cool down not occuring. Also, is there a way to make the unit created appear directly in the position of our unit? Because the collision thingy makes the unit appear beside the caster instead.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
To deal with the cooldown issue, use a 0s Timer.

  • Cast
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Animate Dead
    • Actions
      • Set Caster = (Triggering unit)
      • Set Target = (Target unit of ability being cast)
      • Countdown Timer - Start Timer as a One-shot timer that will expire in 0.00 seconds
      • Set Timer = (Last started timer)
  • Move
    • Events
      • Time - Timer expires
    • Conditions
    • Actions
      • Set TempLoc = (Position of Target)
      • Unit - Move Caster instantly to TempLoc
      • Custom script: call RemoveLocation(udg_TempLoc)
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
i've seen some spells that use something like CallRemove (smth_smth ). is that needed? or will the variable just be removed after the spells ends. Also, how to fix the moving unit instantly thing. i made a spell(channel) that when used, summons a dummy to storm bolt the target then move my Hero to the target. like a Blink, everything works other than the cool down not occuring. Also, is there a way to make the unit created appear directly in the position of our unit? Because the collision thingy makes the unit appear beside the caster instead.


Removing is needed, because variables do not actually store values, they only refer to them.

I think SetUnitX and SetUnitY will not cause that cooldown problem.

Locust ability will remove pathing from unit, you can use that. However, it also makes it impossible to select that unit. If this is a problem, then you can use air as movement type.
 
Level 4
Joined
Nov 24, 2010
Messages
70
how do we insert images? ill show you a pic of my triggers.
Anyway, i had the cooldown thing working with my other skill(swap) without a timer.

Events
-Unit starts the effect of an ability
Conditions
-Ability being cast Equal to Swap
Actions
-Set CasterPosition = (Position of (casting unit)
-Set TargetPosition = (Position of Target unit of ability being cast)
-Unit - move target unit of ability being cast instantly to position of casting unit
-Unit - move casting unit instantly to target position

This works for my swap spell. The cooldown shows, Also using channel.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
I think SetUnitX and SetUnitY will not cause that cooldown problem.
Don't ever use SetUnitX/Y for this kind of situation, because that function ignores pathing.
You could end up in the middle of the Target unit.

Also, if you were trying to offset the coordinate away from the origin, you would need to do further operation, which is to determine either around the area is pathable or not, you could end up stuck to a cliff.

@zhiternn
You're leaking 2 locations - clear it.

  • Custom script: call RemoveLocation(udg_CasterPosition)
  • Custom script: call RemoveLocation(udg_TargetPosition)
 
Level 4
Joined
Nov 24, 2010
Messages
70
i cant get the custom script working. It keeps saying there is an error. Also, what does the udg stands for?

P.S. found my mistake. thanks, it works now. But my other spell's cooldown is still now working. anyway i could take a pic and post it here like how you did it? i dont know how
 
Last edited:
Level 4
Joined
Nov 24, 2010
Messages
70
oh, thanks. Anyway, the cooldown thing seem to be solved alternatively when i set "Disable other skills" = True. I think thats fine for now and thanks alot for help. But since you're here, can you help me solve me swap skill? the unit dont seem to take each other place but a little beside the target's place ( might also be collision problem ). If not possible then its fine, already helped me alot thanks! ^^
 
Level 4
Joined
Nov 24, 2010
Messages
70
Turn collision off for both units (unit - turn collision off), then move both and turn collision on again.

Spells usually do not disable other abilities.

ikr!! but i cant find any other way to do it... if i make it false my ability will not go on cooldown :(. Im sorry but as im new, i will need a more simple instruction.

Edit: thanks alot! the collision thing worked!
 
Last edited:
Level 4
Joined
Nov 24, 2010
Messages
70
so... Is there any way that i could allow the skill to be on cooldown with the Disable other abilities at False?
 
Level 16
Joined
Dec 15, 2011
Messages
1,423
Good ol' pathing check.

JASS:
// Use a dummy item that is invisible
function IsPathable takes real x, real y, item i returns boolean
    local real x1
    local real y1

    call SetItemPosition (i, x, y)
    set x1 = GetItemX(i)-x
    set y1 = GetItemY(i)-y
    call SetItemVisible(i, false)

    return x1*x1 + y1*y1 < 256
endfunction
 
Level 4
Joined
Nov 24, 2010
Messages
70
sorry but i dont really get it. i havent done any big coding before. just those minor call remove things.
 
Level 4
Joined
Nov 24, 2010
Messages
70
sorry but im not any good at codings. Only know Call RemoveLocation. thats all. Is there any other like object editor or trigger that allow the spell to go on cooldown? Because right for my spell based off Channel, the only way to let it go on cooldown is to tick "Disable other abilities" but this does not give a player the choice to cancel the ability quickly if they have a sudden change of reaction. Un-Ticking the ability will make the ability just be casted and not go on cooldown. Help will be appreciated. Thanks :)
 
Level 4
Joined
Nov 24, 2010
Messages
70
erm... somesort like it. i used the Channel spell, but my spell wont go on cooldown although it worked as i set my trigger. I heard it's something about my Move Unit instantly problem. Need help solving it, hopefully without using coding but just triggers

P.S. i still dk how to somehow SS my whole trigger down and paste it here rather than copy paste 1 by 1.
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
erm... somesort like it. i used the Channel spell, but my spell wont go on cooldown although it worked as i set my trigger. I heard it's something about my Move Unit instantly problem. Need help solving it, hopefully without using coding but just triggers

P.S. i still dk how to somehow SS my whole trigger down and paste it here rather than copy paste 1 by 1.

Right-click on the trigger icon just above events, then pick "Copy as text"
 
Level 6
Joined
Nov 24, 2012
Messages
198
i used the Channel spell, but my spell wont go on cooldown although it worked as i set my trigger.
]
to set cooldown in channel ability
1. make the custom ability based channel
2. edit follow throught time to 0
3. add option to visible
4. add cooldown in channel ability
P.S the super stomp i give to u with this link
i make it with channel ability
 
Level 4
Joined
Nov 24, 2010
Messages
70
Blinkstun
Events
Unit - A unit Starts the effect of an ability
Conditions
(Ability being cast) Equal to Blink
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Target unit of ability being cast) belongs to an enemy of (Owner of (Casting unit))) Equal to True
Then - Actions
Set BlinkStun_TargetPosition = (Position of (Target unit of ability being cast))
Unit - Create 1 Blink dummy for (Owner of (Casting unit)) at (Position of (Casting unit)) facing BlinkStun_TargetPosition
Unit - Order (Last created unit) to Human Mountain King - Storm Bolt (Target unit of ability being cast)
Animation - Play (Last created unit)'s attack animation
Unit - Move (Casting unit) instantly to (Position of (Target unit of ability being cast)), facing BlinkStun_TargetPosition
Wait 0.10 seconds
Animation - Change (Last created unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 20.00% transparency
Wait 0.10 seconds
Animation - Change (Last created unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 40.00% transparency
Wait 0.10 seconds
Animation - Change (Last created unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 60.00% transparency
Wait 0.10 seconds
Animation - Change (Last created unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 80.00% transparency
Wait 0.10 seconds
Animation - Change (Last created unit)'s vertex coloring to (100.00%, 100.00%, 100.00%) with 100.00% transparency
Wait 0.10 seconds
Unit - Remove (Last created unit) from the game
Custom script: call RemoveLocation(udg_BlinkStun_TargetPosition)
Else - Actions
Unit - Move (Casting unit) instantly to (Position of (Target unit of ability being cast))

Is there any problem with it? the spell is based off channel and when i untick the option "Disable Other Abilities" in object manager, the spell wont go on cooldown but when i do, it does. The problem left is if i tick it, the play cant stop the spell like how SF players in dota stop their razes.

Also, thanks alot Xonok
 
Level 4
Joined
Nov 24, 2010
Messages
70
sorry but the problem with my spell is it not going on cooldown. Yours has the same problem as mine. The stun duration and damage were set by me correctly. Just a ministun and not dmg as i wanted. But my skill doesnt go on cooldown if i un-tick Disable other abilities
 
Level 4
Joined
Nov 24, 2010
Messages
70
yea, i did download yours. The difference i notice was the effect and damage o.o
Sorry but i made it to deal 0 dmg with a short ministun. The only problem is the spell not going on cooldown, I tried yours and it's the same thing. you did set your cooldown at 5/4/3. But its constantly 0. Not sure if it's just me but if you dont mind can you try yours again? To see if it goes on cooldown
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
  • Blinkstun
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Blink(X)
    • Actions
      • Set Caster = (Triggering unit)
      • Set Pos = (Position of Caster)
      • Set Owner = (Owner of Caster)
      • Set Target = (Target unit of ability being cast)
      • Set BlinkStun_TargetPosition = (Position of Target)
      • Set zLevel = (Level of Blink(X) for Caster)
      • Set Effect = 0.00
      • Special Effect - Create a special effect attached to the origin of Caster using Abilities\Spells\NightElf\TargetArtLumber\TargetArtLumber.mdl
      • Set SpecialEffect[1] = (Last created special effect)
      • Special Effect - Create a special effect attached to the origin of Caster using Abilities\Spells\Items\OrbCorruption\OrbCorruptionSpecialArt.mdl
      • Set SpecialEffect[2] = (Last created special effect)
      • Special Effect - Create a special effect attached to the hand,left of Caster using Abilities\Weapons\PhoenixMissile\Phoenix_Missile_mini.mdl
      • Set SpecialEffect[3] = (Last created special effect)
      • Special Effect - Create a special effect attached to the hand,right of Caster using Abilities\Weapons\PhoenixMissile\Phoenix_Missile_mini.mdl
      • Set SpecialEffect[4] = (Last created special effect)
      • Unit - Create 1 Blink dummy for Owner at Pos facing BlinkStun_TargetPosition
      • Set Dummy = (Last created unit)
      • Unit - Turn collision for Dummy Off
      • Unit - Add a 0.50 second Generic expiration timer to Dummy
      • Unit - Set level of Blinkstun dummy for Dummy to zLevel
      • Unit - Order Dummy to Human Mountain King - Storm Bolt Target
      • Trigger - Turn on Effect <gen>
      • Special Effect - Create a special effect at Pos using Abilities\Spells\Human\ThunderClap\ThunderClapCaster.mdl
      • Special Effect - Destroy (Last created special effect)
      • Wait 0.00 seconds <--------------need wait if u want cooldown, cant move unit instantly during spell effect
      • Unit - Move Caster instantly to BlinkStun_TargetPosition, facing BlinkStun_TargetPosition
      • Unit - Cause Caster to damage Target, dealing zDamage[zLevel] damage of attack type Spells and damage type Normal
      • Special Effect - Destroy SpecialEffect[1]
      • Special Effect - Destroy SpecialEffect[2]
      • Special Effect - Destroy SpecialEffect[3]
      • Special Effect - Destroy SpecialEffect[4]
      • Custom script: call RemoveLocation(udg_BlinkStun_TargetPosition)
 
Status
Not open for further replies.
Top