Variable Save Random Value

PooBucket

New Member
Reaction score
12
If I wanted to cast two spells at the same point but randomly at that same point (ie if i wanted anywhere 200-500AOE id have two spells cast at that 200-500 AOE but at the same spot as each other).

Is it possible to use a variable for random real number between 0-800 (thats my real figure) and then get dummy to cast both spells on VariableX? Will that work? Or will VariableX randomise again and make the other spell cast somewhere else?
 

canons200

New Member
Reaction score
50
>>>If I wanted to cast two spells at the same point but randomly at that same point............

what are you talking about, can't understand

yes, we can use variable for random number
 

PooBucket

New Member
Reaction score
12
>>>If I wanted to cast two spells at the same point but randomly at that same point............

what are you talking about, can't understand

yes, we can use variable for random number

If i had an area of 500, and my spell was to hit randomly at that area, it would strike one spot out of that 500 tho right? But I want a double spell in that spot that it chooses to strike. Therefore I can't use the random real number again or it would randomise again. So I was wondering if it's possible to use a variable to save the randomised number and use the second spell's position at that variable number too.
 

canons200

New Member
Reaction score
50
If i had an area of 500, and my spell was to hit randomly at that area, it would strike one spot out of that 500 tho right? But I want a double spell in that spot that it chooses to strike. Therefore I can't use the random real number again or it would randomise again. So I was wondering if it's possible to use a variable to save the randomised number and use the second spell's position at that variable number too.

hmm, seem know but also seem don't know. =.='

again, we can save variable for the number/point
 

Bogrim

y hello thar
Reaction score
154
I have to admit, I don't really understand your problem. Is this what you're asking for?
Trigger:
  • Actions
    • Set Point_1 = (Target point of ability being cast)
    • Set Real_1 = (Random real number between 0.00 and 800.00)
    • Set Real_2 = (Random real number between 1.00 and 360.00)
    • Set Point_2 = (Point_1 offset by Real_1 towards Real_2 degrees)

Running these actions and using Point_2 for your spells, the location will be random but the same for both abilities.
 

PooBucket

New Member
Reaction score
12
I have to admit, I don't really understand your problem. Is this what you're asking for?
Trigger:
  • Actions
    • Set Point_1 = (Target point of ability being cast)
    • Set Real_1 = (Random real number between 0.00 and 800.00)
    • Set Real_2 = (Random real number between 1.00 and 360.00)
    • Set Point_2 = (Point_1 offset by Real_1 towards Real_2 degrees)

Running these actions and using Point_2 for your spells, the location will be random but the same for both abilities.


Yes, that was what I was wondering about, you got it exact :D. So will the variable save the number that got randomised so I can use that variable for both spells?
 

HydraRancher

Truth begins in lies
Reaction score
197
It is possible.


>Is it possible to use a variable for random real number between 0-800 (thats my real figure) and then get dummy to cast both spells on VariableX? Will that work? Or will VariableX randomise again and make the other spell cast somewhere else?

I dont understand this one bit. Whats VariableX? Where does your real variable come from? A thorough explanation may help us all.
 

PooBucket

New Member
Reaction score
12
It is possible.


>Is it possible to use a variable for random real number between 0-800 (thats my real figure) and then get dummy to cast both spells on VariableX? Will that work? Or will VariableX randomise again and make the other spell cast somewhere else?

I dont understand this one bit. Whats VariableX? Where does your real variable come from? A thorough explanation may help us all.

Did u read Bogrim's code, my agreement with what he thought of what I was trying to explain, and my second explanation?

Basically two spells on polar offset random numbers (variableX for random numbers) but the problem comes when it'll randomise again instead of keeping the same number. so i want to use a variable to save that random number but i just tested it and it doesn't work out. Would appreciate any help.

And how did you think it's possible if you don't understand my question?
 

HydraRancher

Truth begins in lies
Reaction score
197
Did u read Bogrim's code, my agreement with what he thought of what I was trying to explain, and my second explanation?

Basically two spells on polar offset random numbers (variableX for random numbers) but the problem comes when it'll randomise again instead of keeping the same number. so i want to use a variable to save that random number but i just tested it and it doesn't work out. Would appreciate any help.

And how did you think it's possible if you don't understand my question?

Something as simple as this shouldn't be impossible.

Actually, I based my facts off your response, the fact you said "Hmmm... I just tested it out, and they keep randomising", led me to believe Bogrim's advice did not help, even though it most likely has.

Most likely trigger conflict. Show your whole trigger.
 

PooBucket

New Member
Reaction score
12
Something as simple as this shouldn't be impossible.

Actually, I based my facts off your response, the fact you said "Hmmm... I just tested it out, and they keep randomising", led me to believe Bogrim's advice did not help, even though it most likely has.

Most likely trigger conflict. Show your whole trigger.

Okie. This is the testing trigger. I hope it's simple :D

Trigger:
  • TEST ROC
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Banish
    • Actions
      • Set VariableX = (Random real number between 0.00 and 800.00)
      • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at ((Position of (Triggering unit)) offset by (Random real number between 200.00 and 500.00) towards (Random real number between 1.00 and 360.00) degrees) facing Default building facing degrees
      • Unit - Add Carrion Swarm to (Last created unit)
      • Unit - Order (Last created unit) to Undead Dreadlord - Carrion Swarm ((Position of (Triggering unit)) offset by VariableX towards (Random real number between 1.00 and 360.00) degrees)
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Unit - Create 1 Dummy for (Owner of (Triggering unit)) at ((Position of (Triggering unit)) offset by (Random real number between 200.00 and 500.00) towards (Random real number between 1.00 and 360.00) degrees) facing Default building facing degrees
      • Unit - Add Shockwave to (Last created unit)
      • Unit - Order (Last created unit) to Orc Tauren Chieftain - Shockwave ((Position of (Triggering unit)) offset by VariableX towards (Random real number between 1.00 and 360.00) degrees)
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
 

HydraRancher

Truth begins in lies
Reaction score
197
You did not follow Bogrim's example. Do as he says exactly, and order your dummies with "Point_2". What does your skill actually do? From what I see si your randomly scattering dummies to randomly fire projectiles. Are you wanting the Carrion Swarm and Shockwave to come OUT of the hero?
 

PooBucket

New Member
Reaction score
12
You did not follow Bogrim's example. Do as he says exactly, and order your dummies with "Point_2". What does your skill actually do? From what I see si your randomly scattering dummies to randomly fire projectiles. Are you wanting the Carrion Swarm and Shockwave to come OUT of the hero?

Yes, I am randomly scattering dummies to fire at a random position but both dummies are to cast at the same point as each other, so in this test, I want both carrion + shock to cast the same point as each other so they'll move with each other on the same line they are travelling at and finish with each other, but they'll always be casted at a random point but together. And they are to spawn randomly near the caster.

Perhaps this one is more like Bogrim's and more clear?

Trigger:
  • TEST ROC
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Banish
    • Actions
      • Set P1 = (Position of (Triggering unit))
      • Set R1 = (Random real number between 200.00 and 500.00)
      • Set R2 = (Random real number between 1.00 and 360.00)
      • Set P2 = (P1 offset by R1 towards R2 degrees)
      • Set Castasdf = (Random real number between 0.00 and 800.00)
      • Set CastP3 = (P1 offset by Castasdf towards R2 degrees)
      • Unit - Create 1 Dummy Comet for (Owner of (Triggering unit)) at P2 facing Default building facing degrees
      • Unit - Add Shockwave to (Last created unit)
      • Unit - Order (Last created unit) to Orc Tauren Chieftain - Shockwave CastP3
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)
      • Unit - Create 1 Dummy Comet for (Owner of (Triggering unit)) at P2 facing Default building facing degrees
      • Unit - Add Carrion Swarm to (Last created unit)
      • Unit - Order (Last created unit) to Undead Dreadlord - Carrion Swarm CastP3
      • Unit - Add a 1.00 second Generic expiration timer to (Last created unit)


And it's kinda stuffed up too... Now there's no shockwave D:. Before there were both but they weren't at the same spots as each other. :eek:
 

Bogrim

y hello thar
Reaction score
154
It's possible that the casting range isn't large enough. In your trigger, the maximum possible distance between the two random points is 1300 range, which might exceed one or both of the spell's limitations.

Try giving your dummy units an art model and selectability, then see why it isn't casting Shockwave. It's not always the trigger that's the source of your error.
 

PooBucket

New Member
Reaction score
12
OMG thank you so much hydrarancher! I didn't remember the creation wasnt saved with a variable! (therefore it would spawn differently but point at the same spot so it would eventually reach each other but not parallel with each other.) and thank you bogrim! that made me look back at my spell. It seemed right because there's two shockwaves of the same name without an editor suffix. When i saw that i immediately realised and i got the shockwave working :). Now both do target same spot and go along with each other! ty +rep
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top