• 🏆 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/JASS] Potion with Ranom Effect

Status
Not open for further replies.
Level 13
Joined
Jul 26, 2008
Messages
1,009
Alright, I got a spell on a guy which has 2 negative effects, two positive effects, and a nuetral effect.

Problem is it's not working... at all really.

It's done in all triggers, but I was thinking of turning it into JASS and using local variables to handle it. But I think that would be unneccessary.

So here's the trigger:

  • Concoction
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Concoction
    • Actions
      • Set Random = (Random integer number between 1 and 100)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • Random Greater than (96 - ((Level of Concoction for (Casting unit)) x 1))
              • Random Less than or equal to 100
        • Then - Actions
          • Unit - Add Dire Form to (Triggering unit)
          • Unit - Set level of Dire Form for (Casting unit) to (Level of Concoction for (Casting unit))
          • Special Effect - Create a special effect attached to the origin of (Casting unit) using Abilities\Spells\NightElf\BattleRoar\RoarCaster.mdl
          • Unit - Order (Casting unit) to Night Elf Demon Hunter - Metamorphosis
          • Special Effect - Destroy (Last created special effect)
          • Unit - Remove Dire Form from (Casting unit)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • Random Less than or equal to (21 - ((Level of Concoction for (Casting unit)) x 1))
        • Then - Actions
          • Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Other\HealingSpray\HealBottleMissile.mdl
          • Unit - Set life of (Casting unit) to ((Percentage life of (Casting unit)) + (3.00 + ((Real((Level of Concoction for (Casting unit)))) x (Random real number between 1.00 and 3.00))))%
          • Special Effect - Destroy (Last created special effect)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • Random Greater than (21 - ((Level of Concoction for (Casting unit)) x 1))
              • Random Less than or equal to (39 + ((Level of Concoction for (Casting unit)) x 1))
        • Then - Actions
          • Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Weapons\ChimaeraAcidMissile\ChimaeraAcidMissile.mdl
          • Unit - Set life of (Casting unit) to ((Percentage life of (Casting unit)) - (3.00 + ((Real((Level of Concoction for (Casting unit)))) x (Random real number between 1.00 and 3.00))))%
          • Special Effect - Destroy (Last created special effect)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • Random Greater than (39 + ((Level of Concoction for (Casting unit)) x 1))
              • Random Less than or equal to (59 + ((Level of Concoction for (Casting unit)) x 1))
        • Then - Actions
          • Unit - Add Poison Spray (Nuetral) to (Casting unit)
          • Unit - Order (Casting unit) to Orc Tauren Chieftain - War Stomp
          • Unit - Remove Poison Spray (Nuetral) from (Casting unit)
          • Unit Group - Pick every unit in (Units within 555.00 of (Target point of ability being cast)) and do (Unit - Cause (Casting unit) to damage (Picked unit), dealing 500.00 damage of attack type Spells and damage type Normal)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • Random Greater than (59 + ((Level of Concoction for (Casting unit)) x 1))
              • Random Less than or equal to (74 + ((Level of Concoction for (Casting unit)) x 1))
        • Then - Actions
          • Unit - Add Doppleganger to (Casting unit)
          • Unit - Order (Casting unit) to Orc Blademaster - Mirror Image
          • Unit - Remove Doppleganger from (Casting unit)
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • Random Greater than (74 + ((Level of Concoction for (Casting unit)) x 1))
              • Random Less than or equal to (91 - ((Level of Concoction for (Casting unit)) x 1))
        • Then - Actions
          • Unit - Add Doppleganger to (Casting unit)
          • Unit - Order (Casting unit) to Orc Blademaster - Mirror Image
          • Unit - Remove Doppleganger from (Casting unit)
          • Unit - Change ownership of (Summoned unit) to Player 1 (Red) and Retain color
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • Random Greater than (91 - ((Level of Concoction for (Casting unit)) x 1))
              • Random Less than or equal to (96 - ((Level of Concoction for (Casting unit)) x 1))
        • Then - Actions
          • Unit - Create 1 Sorceress for Player 1 (Red) at (Target point of ability being cast) facing (Position of (Casting unit))
          • Unit - Add Polymorph to (Last created unit)
          • Unit - Order (Last created unit) to Human Sorceress - Polymorph (Casting unit)
          • Unit - Remove (Last created unit) from the game
        • Else - Actions
I'm not sure if the mirror image, polymorph, dire form, or negative mirror image would work yet, so if you can tell or not give me some advice.

The problem is, it's not picking any random number. I wouldn't even guess that it's storing the number.

What I need is for the trigger to produce a random number 1 - 100. Once it picks the number, every condition checks to see if they carry that number. When the right condition is picked, it executes that action. Simple enough, if you ask me.

I'm no good at storing variables in trigger form. I'm not even sure I have to. Having a game cache for this skill seemed highly unnecessary. So what's the solution?
 
Last edited:
Level 9
Joined
May 27, 2006
Messages
498
Set RandomNumber = (Random integer number between 1 and 100) // RandomNumber is an integer variable
I have no idea, why you used Game Cache to store a number... Just place this there where game cache thingies are now and everything will work fine.
 
Level 13
Joined
Jul 26, 2008
Messages
1,009
Thanks! I was mimicing an ability I saw someone using. Somehow I ended up using a Gamecache to store it because that was the only thing that piece of GUI would let me store it in.

Most triggers and JASS I learn, I learn by piecing together bits and pieces of other people's work, then finding out how to correct it via forum advice.

For some reason, the Dire Form part of the spell isn't working either. The base spell is metamorphosis.
 
Level 9
Joined
May 27, 2006
Messages
498
The metamorphosis spell is known to be kinda sensitive on changing its statistics. I dont know exactly what could be the problem, i use this spell very rarely though.

And also, i would advise using Triggering unit instead of Casting unit. Its just more efficient, and targets the same unit.

Btw, read this topic, your trigger leaks a bit.
 
Level 13
Joined
Jul 26, 2008
Messages
1,009
Gotcha. I ran leak checker on it, but that was before this change.

The two heal and damage effects are working. I might just use the Bear Form instead of Metamorphosis incase. Robogoblin was doing the same thing. Gonna check if it might be the model though.

The thing seems to have a much higher chance to cast Dire Form than the 5% it should be though.

As well, the nuetral effect, mirror image, and mirror image (Spawn Enemy Mirror), seem to not work at all either.
 
Level 9
Joined
May 27, 2006
Messages
498
The Mirror image doesnt work because you're removing the ability too fast, and so the unit has no time to cast it. You could do that by creating a new unit, or putting the mirror image into a disabled spellbook to prevent user from casting it manually, but i dont remember if you can order unit to cast a spell that is contained inside a spellbook.

And explain, whats the neutral effect?
 
Last edited:
Level 13
Joined
Jul 26, 2008
Messages
1,009
Well I'll try the mirror images with a wait time. But I'm worried the Wait - XX will cause it to bug out if another hero is using that same skill at the same time. (Pretty likely in this game)

Nuetral effect is an AoE based on warstomp. It wasn't working properly. Gonna have to fix that up to.

And the dire form is buggy. More stuff to fix :X It's a neverending cycle.
 
Status
Not open for further replies.
Top