• 🏆 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] Casting Spells while Sliding? and on trees?

Status
Not open for further replies.
Level 15
Joined
Aug 18, 2007
Messages
1,390
Hi all, is it possible to make a unit able to cast spells like Carrion Swarm and Cluster Rockets while sliding? currently my checking is at 0.03 sec.

all spells works fine when there is no sliding.

Also, is it possible to make Phoenix Fire abillity only target trees, and instantly kill them? looking for a way to destroy trees when getting close to them. (Would be awesome, if the spell could be checked when its cast in triggers, so i can make the slide slow down when hitting.

Thanks in Advance.



I only need to be able to cast spells backwards, without changeing facing angle now! Read the last post s before you post!
 
Last edited:
Level 21
Joined
Jul 27, 2008
Messages
14,361
I think first can't be done.
Second you can make Phoenix Fire ability to attack only tree, but for some reason it doesn't work.I can ,make it to attack my own units but not trees.
But at least I know how to make it attack more often if you want.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
But moving a unit does not interupt casting at all, or any order for that matter. How you may ask? Simply do not use the crap move natives in GUI and use the SetUnitX and SetUnitY natives in JASS. You can even have units walking while you use those on them and the units will still walk to their final location if possiable. To me those natives are the only way to make a good slide system.
 
Level 23
Joined
Nov 29, 2006
Messages
2,482
DSG is right...

And when it comes to picking everyunit in range of a point/unit/whatever, does use a BJ function with filters and such, yes, could make the trigger inefficient. But well, I dont think it will lag up the game. An alternative would be to create a rect(region in Gui) on the map, then everytime the trigger is running, center it on the current slider and pick all destructables in the region.
 
Level 15
Joined
Aug 18, 2007
Messages
1,390
The tree-destruction is fixed and works as intended.

But spellcasting...

@DSG - I am not very familiar with Jass and Custom Scripts. If you (Or anybody else) could change my trigger into a custom script, and use the X/y-Natives, i would be happy.

My trigger looks like this (it's long)

  • Unit - Move (picked unit) instantly to ((Position of (Picked unit) offset by (Real(Int_Currentspeed[(player number of (owner of (picked unit)))])) towards (facing of (picked unit)) degrees)
Int_Currentspeed[value] is an Integer Variable.
Would be awesome, as i then could keep on going with that i want to be done first.

Sorry for the long action, but thats how it is (ofc, the whole trigger is longer).
 
Level 23
Joined
Nov 29, 2006
Messages
2,482
Yes, this is exactly the problem and it does leak too._.

If you want to make it Gui but using the X and Y jass natives you could do the following:
(and it clears away every leak too)
Write the following lines instead of yours above.
  • Custom script: call SetUnitX(GetEnumUnit(), GetUnitX(GetEnumUnit()) + udg_Int_Currentspeed[GetPlayerId(GetOwningPlayer(GetEnumUnit()))+1] * Cos(GetUnitFacing(GetEnumUnit()) * bj_DEGTORAD))
  • Custom script: call SetUnitY(GetEnumUnit(), GetUnitY(GetEnumUnit()) + udg_Int_Currentspeed[GetPlayerId(GetOwningPlayer(GetEnumUnit()))+1] * Sin(GetUnitFacing(GetEnumUnit()) * bj_DEGTORAD))
Note that the length of the code is probably more, but works better.
 
Level 15
Joined
Aug 18, 2007
Messages
1,390
Thanks for the code, but there is two problems.
1: The car wont accelerate as it did with my old code, and when the car reaches the clicked point, it will just keep moving around that spot. Also, it looks a little laggy when moving :(

This is how it used to look like

View attachment Vehicle Arena V0.08.w3x

Any new ideas?
*but the casting worked perfectly :

Edit: To accelerate, you have to press move multiple times.
 
Last edited:
Level 23
Joined
Nov 29, 2006
Messages
2,482
Oh, yeah I know the issue. Since we cant get it overcomplicated by the Gui restrictiveness there might be another solution:
Keep the original action you had before, the non custom script movement. I discovered that orderstring are triggered when you cast a spell, but the spell itself cannot be cast. So what you could do is to create a trigger which checks (unit issued ordering target/point/no target/etc) and matches it with your spell. The spell itself will not be triggered however, nor cooldown or manacost if you have something like that. But I guessed that you are creating triggered spells (I did never have time to check the map)?
 
Level 15
Joined
Aug 18, 2007
Messages
1,390
No, the basic spells will be simple Carrion Swarms/Cluster rockets. only special attacks will be triggered. ofcause, i could just use a dummy unit, but:
When using Gui Triggers, you got "Begins cast an abillity" and "Starts the effect of an Abillity". "Begins cast an Abillity" is when you click with the mouse, but this happens before cooldown is set, so using that event will make the spell cast, but without mana cost, cooldown and so.
"Starts the effect of an Abillity" is after the cooldown is sat on, and when the spell is casted, so that way i cant make the event work.

The problem is now: How can i add cooldown to a spell in GUI? maybe that can fix it :/
 
Level 23
Joined
Nov 29, 2006
Messages
2,482
there is no way to add cooldown to a spell, whatsoever by triggers :7. And well, I know you spoke about the ability events, which was why I proposed using issue order instead. I dont know whether the trigger will register the spell begin cast or starts channeling ability that quickly, the main problem is, after all, that the spell is aborted as soon as you move the unit with SetPositionLoc (the one in Gui). But yes, registring the spell order will not make it lose mana or cooldown either.
Maybe it works when you use an item instead (with the content of the spell ofcourse). If lucky, the 'Item is being used' (or something like that, I dont remember) event will fire off. That's probably the ideas I have, at the moment. Hope it helps.
 
Level 15
Joined
Aug 18, 2007
Messages
1,390
Didn't work with items :( i'll just stick with dummies and silence instead of cooldown, after all, would it not be funny, if you could fire a shockwave first, and a special abillity like a mana rift or so, just after.

Thanks all, i see if it works, and if it is funny that way :)

Ps. gimme a shout if you find a better idea.

Edit: So, Begins casting an abilltiy didn't work. Doesent seem like the unit begins to cast the spell at all? i hate this -.-
 
Last edited:
Level 15
Joined
Aug 18, 2007
Messages
1,390
It works now, but only sometimes. I may have to spam the spell 10-20 times before it cast.... any ideas to make it happen no matter what? (btw, im using Carrion Swarm and Cluster rocket Spells).

+rep for helping, now it just needs improvement :)

Edit: Found out whats wrong. The spell wont cast, if the car have to change facing... any ways to fix this (making a unit able to caste a spell backwards without turning around)?
 
Level 15
Joined
Aug 18, 2007
Messages
1,390
The problem is, that i want my players to be able to choose where to shoot. but they cant cast their spell, if they have to turn their facing.

slide is because the move is stopped when moved. just use a trigger like
Event - unit is issued order(smart)
condition -
action - make (unit issued order) face (target point of (issued order)) over 0.00 seconds.
 
Status
Not open for further replies.
Top