Hi where can I find examples of GetRandomNumber? plugins or web scripts.
I try to get a list of locs on the map and randomly spawn players on them when dead
(no dont refer me to spawns plugin or events/jail I know they use it but I couldnt make it done well. so im doing it on my own.
I just dont want a min max locs.
1: x=111 y=222 z=333
2: x=444 y=555 z=666
3: x=777 y=888 z=999
etc
random between 1 to 3 and get that loc to use.
Any help to get reference examples?
EDIT: nevermind got it to work
GetRandomNumber
Discussion in 'Rust Development' started by FireBurst, Sep 8, 2015.
-
Random.Range(1,3);
? I saw that somewhere in Unity forums ;x -
You could do like I do with Cornucopia and reuse collectible spawns.
-
Calytic Community Admin Community Mod
That shouldn't be difficult. You have an array or List of Vectors..
To retrieve a random element from the List using System.RandomCode:List<Vector3> positions = new List<Vector3>();
Alternatively using Oxide.Core.RandomCode:System.Random rnd = new System.Random();int r = rnd.Next(positions.Count);Vector3 randomPosition = positions[r];
Code:int r = Oxide.Core.Random.Range(0, positions.Count-1);Vector3 randomPosition = positions[r];
