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

[Need Fast Answer!] 50% Chance

Status
Not open for further replies.
Level 4
Joined
Jan 2, 2010
Messages
90
I want to do a trigger that when a spell chosen by mine (for instance, Doom). When it is cast, the caster has a 50% chance of able to turn its collisions off. Then after a specific time, the collisions will be back to normal. I forgot how to do that, it has been ages, can anyone make me a simple example of trigger to do this?

Thank you!
 
Last edited:
Level 24
Joined
Jun 14, 2005
Messages
2,506
This is what it would be as GUI:

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Random integer number between 0 and 1) Equal to 0
    • Then - Actions
      • -------- Turn Collision Off --------
    • Else - Actions
      • -------- Do not Turn Collision Off --------
 
Level 3
Joined
Apr 29, 2009
Messages
32
Their triggers are fully correct :thumbs_up: exept for the part that you wanted it to be time limited.

  • Create Hashtable
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set Hashtable = (Last created hashtable)
  • Ability being cast
    • Events
      • Unit - A unit starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Doom
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 2) Equal to 1
        • Then - Actions
          • Unit - Turn collision for (Casting unit) Off
          • Hashtable - Save 10 as (Key Doom) of (Key (Casting unit)) in Hashtable
          • Unit Group - Add (Casting unit) to UnitGroup
        • Else - Actions
  • Turns on collision after specific time.
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in UnitGroup and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Load (Key Doom) of (Key (Picked unit)) from Hashtable) Equal to 0
            • Then - Actions
              • Unit - Turn collision for (Picked unit) On
              • Unit Group - Remove (Picked unit) from UnitGroup
            • Else - Actions
              • Hashtable - Save ((Load (Key Doom) of (Key (Picked unit)) from Hashtable) - 1) as (Key Doom) of (Key (Casting unit)) in Hashtable
 
Level 4
Joined
Jan 2, 2010
Messages
90
I was wondering about adding a unit ability to a hero that lasts for 30 seconds, which turns the collisions off by triggers, and remove it when the time is up. So it just helps me to see if I have my collisions turned off or on. Oh well, I'll figure something out, and come back with results.

EDIT: I've found another way, I just need a trigger to detect the hero to see if it has the Phase ability (basically its a dummy unit ability that does nothing) and I'm already stuck here. Any help?
 
Last edited:
Level 9
Joined
Dec 6, 2007
Messages
233
I would suggest instead of using an ability for this, find this command:

  • Unit - Set the custom value of (Triggering unit) to 1
Every unit has a single custom value that can be used. Better and simpler than a hashtable, but can only be used for one thing. It can be called later with this:

  • Conditions
    • (Custom value of (Triggering unit)) Equal to 1
which is an integer comparison
 
Level 4
Joined
Jan 2, 2010
Messages
90
I would suggest instead of using an ability for this, find this command:

  • Unit - Set the custom value of (Triggering unit) to 1
Every unit has a single custom value that can be used. Better and simpler than a hashtable, but can only be used for one thing. It can be called later with this:

  • Conditions
    • (Custom value of (Triggering unit)) Equal to 1
which is an integer comparison

Good idea... but what if the trigger doesn't revert it back to 0?
 
Level 4
Joined
Jan 2, 2010
Messages
90
This is my best atm:

  • Phase
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Doom
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Random integer number between 1 and 2) Equal to 1
        • Then - Actions
          • Unit - Add Phase to (Triggering unit)
          • Unit - Turn collision for (Triggering unit) Off
          • Wait 30.00 seconds
          • Unit - Turn collision for (Triggering unit) On
        • Else - Actions
I haven't tested it yet, mostly likely not working though.
 
Status
Not open for further replies.
Top