• 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.

Help in grenade-like spell

Status
Not open for further replies.
Level 5
Joined
Oct 2, 2013
Messages
95
I've been successful in creating most of my spells till now, but this one seems real complicated.

I want something like this:

GRENADE: When the hotkey "Q" is pressed, the grenade is primed and a countdown ( from 6 to 0 )starts. When the hotkey is pressed again, the caster may choose the grenade's landing point, and throw it. The grenade only explodes when the timer reaches 0. It may explode at the caster's hand, or at the ground where it was thrown.

First problem is the press twice system. The fist press is an instant cast that starts the timer, the second one is a target ability, and I want them to be the same and have the same hotkey.

And how to make the grenade itself??

Help me please?
 
You would have to remove the original instant cast ability from the unit, then add the target ability. Then do opposite when the spell is over.

As for making the grenade you will need to create a dummy unit and either attach the grenade model to it, or make it the default model. Once you create the unit apply and remove Crow Form to allow the it to fly (so we can modify the height via triggers). Then, in order to make the grenade curve like it's falling down you should make use of some parabolic function, which might be harder in GUI but it's still doable.

I would take a look at the grenade spells in the spells section.

http://www.hiveworkshop.com/forums/spells.php?search=grenade&d=list&r=20
 
You can also use the ability to activate the countdown. Another ability that is invisible to the user can be used to throw the grenade. The second ability will also be what is used to select the target. Then it will throw the grenade while the other ability controls the countdown. This way it will always explode and can be thrown. Then you just need to do the damage which can be done in the countdowns ability trigger.
 
Level 5
Joined
Oct 2, 2013
Messages
95
Thanks!

I managed to do the whole base system even tho i need 5 triggers for that:

1 for setting the timer once the grenade is primed
2 to make the grenade be "carried" (follow) by the caster
3 to decrease the timer and show the timer text
4 to make it travel to the location it was thrown to
and 5 to make it go boom once the timer ends

I still got to figure the ARC animation. Most of the grenades i saw used JASS and the ARC SYSTEM causes errors on my map.

But i got a question...
If i have a trigger like this:
------
EVENT:
Periodic every 0.01 secs
CONDITIONS:
Var equal to 0.0
EFFECTS:
Do stuff
------
Will it cause lag even while "var" is not equal to 0.0?
Like, will it use memory for checking if the var is equal to zero, and will that cause lag?

I got a whole lot of triggers like that. Would it help to implement (Turn On/Off trigger) effects?
 
Level 5
Joined
Jan 27, 2014
Messages
164
Of course it's better to turn it off whenever it's not used. Also, I believe using 0.1 second periodic would suffice for your case. I'm not sure what is in your trigger. So, it's hard to tell if it would lag or not. It depends.

Alternatively, for your method, you can just set the expiration timer of your 'Grenade' to 6. When the 'Grenade' is dead, then trigger your explosion. This way, you don't need to use a periodic trigger. You just need to use the 'A unit is dead' event to know when the 'Grenade' should explode.
 
Level 5
Joined
Oct 2, 2013
Messages
95
Ok i got the spell working fine now, perfectly.

I just need one more thing...

Is there any way to put a skill on cooldown without activating/using it?

Is there any INSTANT spell that cannot be interrupted (/stop) ?
 
Level 5
Joined
Oct 2, 2013
Messages
95
What happens is that when the spell is over, I want to swich the "Throw Grenade" by "Dwarven Grenade" ( the ability that primes the grenade, starting the timer ), and i want "Dwarven Grenade" to be on cooldown. The method i came up with was ordering unit to use spell.

Problem is, if i just do unit order, the player can spam "S" (/stop) and get a no cooldown spell. To counter that, i gotta change unit ownership, use the spell, wait till its over, and change ownership again. That sounds like a lousy method and it looks quite ugly. This can disable the player in key situations, and that could be frustrating. So I wanna know if there's a spells that cannot be interrupted, or if there is any way to put abilities on cooldown withoung Unit - Order( use ability ).

The other method i was using is to make throw only work in the first cast. That way, casting throw afterwards did nothing. I would only give the player the "Dwarven Grenade" spell back after a Wait - 20 seconds, which is the spell's cooldown.
 
Level 10
Joined
Apr 18, 2009
Messages
601
Berserk is indeed instant. Base your custom spell that should be on cooldown off of Berserk. Then simply order your unit to cast that spell via the usual "Unit - Order Unit to Orc Troll Berserker - Berkerk" method. The player will not be able to interrupt the casting of the spell even if he spams S, and the spell will go on cooldown.
 
This is as close as I can get with the system I decided to use.

Full credits go to Ruke

EDIT: I re-read what you wanted and it sounds exactly like this so if you want better you'll need to do the indexing yourself so you can use multiple triggers with the same instance.
You will however have to add your own flying height formula.

Still the cool-down problem though it seems....

There are many ways to fix it so I will leave that up to you if you want to use this anyways. Sounds like you found something better though I noticed it uses custom value.
 

Attachments

  • grenade spell talattempt.w3x
    35 KB · Views: 53
Level 5
Joined
Oct 2, 2013
Messages
95
This is as close as I can get with the system I decided to use.

Full credits go to Ruke

EDIT: I re-read what you wanted and it sounds exactly like this so if you want better you'll need to do the indexing yourself so you can use multiple triggers with the same instance.
You will however have to add your own flying height formula.

Still the cool-down problem though it seems....

There are many ways to fix it so I will leave that up to you if you want to use this anyways. Sounds like you found something better though I noticed it uses custom value.

Nope, thats not what I wanted. The grenade won't explode when it hits the ground. It will ONLY explode when the timer reaches zero, and it doesn't matter if it was or wasn't thrown. But thanks anyway!

I got the spell full working now, just gotta implement the "berserk" thingie. Ty for all the help guys!

Im planning on adding my spell to the Spell Resource hero on hive as soon as i get it MUI, so all of you can see how my spell turned out!
 
Status
Not open for further replies.
Top