Spawning random object at certain %
l2gstar
Member Posts: 19
Hello again,
So I have situation here where I have no idea how to make things work.
I want to spawn a random object on certain % when pressed.
So I have few different objects.
When I click on actor I want that one of those objects would spawn randomly at my given percentage.
I want that 1 object would spawn let's say at 5% chance and other object at 25% chance.
How do I do that?
Please help!
So I have situation here where I have no idea how to make things work.
I want to spawn a random object on certain % when pressed.
So I have few different objects.
When I click on actor I want that one of those objects would spawn randomly at my given percentage.
I want that 1 object would spawn let's say at 5% chance and other object at 25% chance.
How do I do that?
Please help!
Comments
if the attribute <=5 then spawn actor A.
if the attribute >5 and <=30 then spawn actor B.
etc.
Have a rule that says:
When touch is pressed
change "Dice" to random(1,20) [use the expression editor for this]
A second rule that says:
If "Dice" = 1
spawn actor
This would be for a 5% chance. For 25% use 'random(1,4)'
I think my math is right here.
If you open the Round Rules actor, you'll see the change attribute which change the game attribute to random(1,4) - What this is doing is changing that attribute to either 1, 2, 3 or 4. Based upon that attribute, we can spawn different actors.
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
https://dl.dropboxusercontent.com/u/72942216/randomSpawn.zip
edit: looks like Braydon beat me! PS @Braydon_SFX how do we add files like that?
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx