Hey! I’m working on some code in Verse and I’m stuck on how to get it right.
I want to create an array of trigger devices. When the game starts, a random trigger should be activated. How I can do this in verse?
Hey! I’m working on some code in Verse and I’m stuck on how to get it right.
I want to create an array of trigger devices. When the game starts, a random trigger should be activated. How I can do this in verse?
Add an editable field and select all of the devices you need in the editor. Then go from there.
@editable my_trigger_device : []trigger_device = array{}
Look at the Random module which has
GetRandomInt(min, max)
Something along these lines, if you don’t want the same trigger to go twice in a row implement an int LastTrigger and check to make sure the Random int does not match the last one
@editable triggers : []trigger_device = array{}
void ChooseTrigger(): void =
if(RandomTrigger := triggers[GetRandomInt(0, triggers.Length-1)]):
RandomTrigger.Trigger()
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.