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
  • WildTurkey WildTurkey:
    is there a stephen green in the house?
    +1
  • The Helper The Helper:
    What is up WildTurkey?
  • The Helper The Helper:
    Looks like Google fixed whatever mistake that made the recipes on the site go crazy and we are no longer trending towards a recipe site lol - I don't care though because it motivated me to spend alot of time on the site improving it and at least now the content people are looking at is not stupid and embarrassing like it was when I first got back into this like 5 years ago.
  • The Helper The Helper:
    Plus - I have a pretty bad ass recipe collection now! That section of the site is 10 thousand times better than it was before
  • The Helper The Helper:
    We now have a web designer at my job. A legit talented professional! I am going to get him to redesign the site theme. It is time.
  • Varine Varine:
    I got one more day of community service and then I'm free from this nonsense! I polished a cop car today for a funeral or something I guess
  • Varine Varine:
    They also were digging threw old shit at the sheriff's office and I tried to get them to give me the old electronic stuff, but they said no. They can't give it to people because they might use it to impersonate a cop or break into their network or some shit? idk but it was a shame to see them take a whole bunch of radios and shit to get shredded and landfilled
  • The Helper The Helper:
    whatever at least you are free
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?

      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