• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Forced Cooldown

Status
Not open for further replies.
Level 6
Joined
Oct 1, 2012
Messages
166
Helloes Hive Workshop

I am currently working on a map where heroes have no regular attack but special skills which they can use instead. Everyone has two, player chooses which one they would like to master depending on their choice of build. The problem is, I want to unable cheating as one can use both skills in quick succesion and that doesn't work too well for my balance issues.

So, everytime one of those basic attack skills is cast, I want the other to start it's cooldown (less than 2 secs that is, but still important). I was trying to do it as instructed here:

http://www.hiveworkshop.com/forums/world-editor-help-zone-98/force-cooldown-221336/

but to no avail. Then I fount this thread:

http://www.wc3c.net/showthread.php?t=81742

which said about the Mana Shield's ability of not interrupting current unit's order, as I thought that was the problem. But this didn't work either. All ideas I have left is to make additional level for those basic attacks with an enormous mana cost, so that for a short period the player won't be able to cast them, but that won't look good and it will work all weird.

So, does anybody have any ideas? I'd appreciate anything!
 
Level 12
Joined
Mar 13, 2012
Messages
1,121
When one spell is cast by the user force a cast of all other ones by trigger. Only way to make them go to cd. Of course all those spells need to be recoded to dummy spells that they do nothing when force casted. Instructions clear :)?
 
Level 6
Joined
Oct 1, 2012
Messages
166
Of course. Problem is, whenever I order my unit to do so, it stops.

I'll give ya an example. I made a pushback skill with Storm Bolt. It works fine, everything is nice and clean. Then, to check this cooldown thing, I made a dummy skill with Acid Bomb. Simple acid bomb with nothing changed but levels = 1 and mana cost = 0. Afterwards I made a dummy Mana Shield and changed its order string to "acidbomb". Then, in a trigger which records an event of issuing a "thunderbolt" order... well, see for yourself:

JASS:
function Trig_Untitled_Trigger_001_Conditions takes nothing returns boolean
    return GetIssuedOrderId() == String2OrderIdBJ("thunderbolt") 
endfunction

function Trig_Untitled_Trigger_001_Actions takes nothing returns nothing
    local unit caster = GetTriggerUnit()
    local unit cel = GetOrderTargetUnit()
    local real angle = AngleBetweenPoints(GetUnitLoc(caster), GetUnitLoc(cel))
    local real dist = 500
    local integer a = fewi()
    call SaveStringBJ("push", a, 'WHAT', udg_wait)
    call SaveIntegerBJ('BPSE', a, 'BUFF', udg_wait)
    call SaveRealBJ(300, a, 'DIST', udg_wait)
    call SaveRealBJ(angle, a, 'ANGL', udg_wait)
    call SaveUnitHandleBJ(cel, a, 'UNI1', udg_wait)
    call IssueImmediateOrder(caster, "acidbomb")
    set cel = null
    set caster = null
endfunction

//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
    set gg_trg_Untitled_Trigger_001 = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Untitled_Trigger_001, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER )
    call TriggerAddCondition( gg_trg_Untitled_Trigger_001, Condition( function Trig_Untitled_Trigger_001_Conditions ) )
    call TriggerAddAction( gg_trg_Untitled_Trigger_001, function Trig_Untitled_Trigger_001_Actions )
endfunction

all these "cel" and "caster" and these hashes are for my pushback function. At the end, before nulling stuff, I made unit cast "acidbomb" with no target, which was supposed to be a Mana Shield. Doesn't work, unit stops and doesn't even throw the Storm Bolt.

I changed the order string to "manashield" just in case, didn't work.

When the unit is out of stormbolt's range it wants to come closer to its target, but stops after a split second because of this order.

So, what do I do wrong?
 
Level 12
Joined
Mar 13, 2012
Messages
1,121
I have very little time, so just two general things. Use the spell effect event, not the issued order event. Youre getting in some wc3 internals here. You have to run a 0.00 timer after the spell effect event which force casts the other abilities when running out.

see this for some more spells which dont interrupt orders.
 
Level 6
Joined
Oct 1, 2012
Messages
166
Well, your idea with the timer pretty much works fine, thanks for that. I also changed the issued order event to spell effect event and I kinda know why its better.

Anyhow, my forced cooldown doesn't work still. I have a dummy manashield and a real acidbomd skill. Manashield has order string equal to "acidbomb" but doesn't force acid bomb's cooldown. Any ideas here?
 
Level 12
Joined
Mar 13, 2012
Messages
1,121
I have a dummy manashield and a real acidbomd skill. Manashield has order string equal to "acidbomb" but doesn't force acid bomb's cooldown. Any ideas here?

I remember that changing those order string fields in the ability does not work well, though I had a testmap but cant find it right now. Generally use the default order string or use the order id to force cast an ability. Really gotta go now, srry.
 
Level 6
Joined
Oct 1, 2012
Messages
166
Well, just how I thought. So, no way to do this? I have to make a dummy additional level for my skills with enormous mana cost?
 
Level 3
Joined
Sep 30, 2012
Messages
31
You could also remove the ability for 2 seconds, but I guess that looks poor as well.

I have another idea but I have not tested it so I'm not entirely sure if it will work:
1. Create dummy abilities based off the same spell as the casted spell, with 0 mana cost and no effects, but look the same as the original spells.
2. When you cast a spell, replace the other spells with the dummy abilities.
3. Your hero should automatically cast all the spells since they are based off the same order id.
4. After 2 seconds (or when the cooldown is over), replace the dummy abilities with their originals.

I'm not entirely sure if step 3. will work with targeted spells.
 
Level 12
Joined
Mar 13, 2012
Messages
1,121
3. Your hero should automatically cast all the spells since they are based off the same order id.

I'm not entirely sure if step 3. will work with targeted spells.

Yes because its wrong. You can replace targeted abilities with untargeted dummy abilities but you have to force cast every single one of them. Just dont base them on the same spell. Ever. Use different based spells..
 
Level 6
Joined
Oct 1, 2012
Messages
166
Well, I could always make a dummy passive skill with no effect and replace it, but that won't do, as I want it to be kinda visible.

I'll simply make a dummy level for my spells with 1000 mana cost (my heroes' mana won't go over 300, so no problem here) and change it when the other base attack is used.

Anyhow, thanks for the help guys, appreciate it!
 
Status
Not open for further replies.
Top