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

Activatable random attack spell

Status
Not open for further replies.
Level 10
Joined
Apr 9, 2004
Messages
502
Ok, i'm working on making a spell that works like dark arrow as in it actually casts a spell, but i want that each time you use it, you cast a random spell out of X number of spells. Example, have a silencing arrow, a dark arrow, cold arrow, poison arrow amd stunning arrow. It would be easy as a passive, but i want her to have the activated spell icon and have her missile change every time she fires one. How can i accomplish this?
 
Level 7
Joined
May 16, 2004
Messages
355
The easiest way that ic ould think of is to make your wanted spells and make several of the arrow spells and every several seconds make it remove that spell and replace it with one of its brother spells that looks different(missile) and different effects but the same tooltips

to do this make a triggers
Event- every 4 seconds
action-
if- random integer between 1 and 3 equal to 1 then
actions- add new spell
-set level of new spell to level of removed spell for spell getter
remove old spell from spell getter
else- another if then else that gives a different random spell

there is probably an easier way but i cant think of one at the moment, ill msg you if i find one
 
Level 11
Joined
Jul 20, 2004
Messages
2,760
Well... Darky made some way to discover when an unit is actually HIT by the arrow. You can then create a dummy unit and order it to cast a random spell. Use a random integer to determinate the random spell.

To detect the arrow, you will need to wait as much as the arrow would need to hit the target. I will show it to you in JASS but you'll probably get it. Ok, Unit x is the (Casting Unit). Unit Y is the (Target Unit of Ability Being Cast). GetUnitX gets the X position of the unit. Change it accordingly to triggers. GetUnitY gets the Y position of the unit. The unit in the paranthesis is the unit whose X/Y is coordinate is taken. Pow means power (example:2^5=32) and Square Root... You know.

Speed of Black Arrow means the Speed of the missile into the object editor for your black arrow ability.

Wait (Game Time) - SquareRoot(Pow(GetUnitX(u)-GetUnitX(y),2)+Pow(GetUnitY(u)-GetUnitY(y),2) / Speed of Black Arrow.

I hope you will find all these into your trigger.

Xipe_Totec: Too many abilities is a bad idea. You don't have to mess with them since bugs can occur.

~Daelin
 
Level 10
Joined
Apr 9, 2004
Messages
502
We'll the easiest i can think of is simply working with the duplicate dummy spells and switching to a random just before casting to allow for the proper cooldown and such. You're would work too Daelin, but i think simply switching the spells would work and there would be no chance of bugs because all of the effects are in the spells. Thanks for the suggestion. I might be able to use it in a different case anyways (but if i really need something like that, i susually use sphere with a dummy for a missile effect)
 
Status
Not open for further replies.
Top