Wulf updated Random Spawner with a new update entry:
1.2.1

RandomSpawner
Randomly spawn a specific amount of an entity on the map
Total Downloads: 1,856 - First Release: Nov 14, 2015 - Last Update: Apr 14, 2017
- 5/5, 4 likes
-
Wulf Community Admin
-
rspawn 50 horse
Failed to call hook 'ccmdSpawnRandom' on plugin 'RandomSpawner v1.2.1' (NullReferenceException: Object reference not set to an instance of an object)
rspawn 50 assets/bundled/prefabs/autospawn/animals/stag.prefab
Failed to call hook 'ccmdSpawnRandom' on plugin 'RandomSpawner v1.2.1' (NullReferenceException: Object reference not set to an instance of an object) -
Failed to call hook 'ccmdSpawnRandom' on plugin 'RandomSpawner v1.2.1' (NullReferenceException: Object reference not set to an instance of an object)---or... Ingame chat Couldn't find prefab "bear.prefab" , Couldn't find prefab "bear"
-
can't launch from console. seems to work with chat.. i think...
(15:03:37) | Failed to call hook 'ccmdSpawnRandom' on plugin 'RandomSpawner v1.2.1' (NullReferenceException: Object reference not set to an instance of an object)
(15:03:37) | at Oxide.Plugins.RandomSpawner.RunAsChatCommand (.Arg arg, System.Action`3 command) [0x00000] in <filename unknown>:0
at Oxide.Plugins.RandomSpawner.ccmdSpawnRandom (.Arg arg) [0x00000] in <filename unknown>:0
at Oxide.Plugins.RandomSpawner.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00000] in <filename unknown>:0
at Oxide.Plugins.CSharpPlugin.InvokeMethod (HookMethod method, System.Object[] args) [0x00000] in <filename unknown>:0
at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x00000] in <filename unknown>:0
at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00000] in <filename unknown>:0 -
Hello, i liked use: /rspawn 10 "scientist" ('spawn scientist' in console)
-
console commands not work
i plan to use this with Timed Execute, spawn scientist but
Timed Execute use console commands -
I have granted myself the permission and that worked.
But when i type "getprefabs" in console it pushes nothing to console, any ideas why? -
getting this errors
Code:Failed to call hook 'ccmdGetPrefabs' on plugin 'RandomSpawner v1.2.1' (DirectoryNotFoundException: Could not find a part of the path "C:\TCAFiles\Users\SeulGiJ\20789\server\Streamline\oxide\logs\Prefabs.txt".) at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) [0x00000] in :0 at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share) [0x00000] in :0 at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare) at System.IO.StreamWriter..ctor (System.String path, Boolean append, System.Text.Encoding encoding, Int32 bufferSize) [0x00000] in :0 at System.IO.StreamWriter..ctor (System.String path, Boolean append) [0x00000] in :0 at (wrapper remoting-invoke-with-check) System.IO.StreamWriter:.ctor (string,bool) at System.IO.File.AppendAllText (System.String path, System.String contents) [0x00000] in :0 at ConVar.Server.Log (System.String strFilename, System.String strMessage) [0x00000] in :0 at Oxide.Plugins.RandomSpawner.ccmdGetPrefabs (.Arg arg) [0x00000] in :0 at Oxide.Plugins.RandomSpawner.DirectCallHook (System.String name, System.Object& ret, System.Object[] args) [0x00000] in :0 at Oxide.Plugins.CSharpPlugin.InvokeMethod (HookMethod method, System.Object[] args) [0x00000] in :0 at Oxide.Core.Plugins.CSPlugin.OnCallHook (System.String name, System.Object[] args) [0x00000] in :0 at Oxide.Core.Plugins.Plugin.CallHook (System.String hook, System.Object[] args) [0x00000] in :0
Last edited by a moderator: Sep 17, 2017 -
ConVar.Server.Log("oxide/logs/Prefabs.txt", ListToString(prefabs, 0, Environment.NewLine));
to point to a valid directory on your server. for instance..
ConVar.Server.Log("Prefabs.txt", ListToString(prefabs, 0, Environment.NewLine));
should work
Ok so rspawn console command has been broken for a long time. I am not a programmer and don't quite get the errors so I decided to not use his "run as a chat command" thing and instead just plunked the spawn code within the consolecommand for simplicity. I also added some extra code so it'll actually tell you what its doing in the console... no more wondering if it actually worked
If you use N-Teleportation, you can use command teleport.topos <yourname> x y z to go check out the spawn yourself.
Find the line [ConsoleCommand("rspawn")] and replace the entire thing with this:
Code:[ConsoleCommand("rspawn")] void ccmdSpawnRandom(ConsoleSystem.Arg arg) { //Bandaid fix. if (arg.Connection != null && arg.Connection.authLevel < 2) return; if (!arg.HasArgs()) { Puts("Usage: rspawn <amount> <entity prefab>"); return; } string prefab = arg.Args[1]; int amount = 0; try { amount = Convert.ToInt32(arg.Args[0]); } catch (FormatException ex) { Puts("Amount must be a number value!"); return; } Vector3 rlocation = Vector3.zero; for (int i = 1; i <= amount; i++) { rlocation = GetRandomVector(); SpawnEntity(prefab, rlocation); Puts($"[{i}/{amount}] Spawned {prefab} at {rlocation}."); } }
[DOUBLEPOST=1505142634][/DOUBLEPOST]also here's a list of common prefabs:
assets/rust.ai/agents/bear/bear.prefab
assets/rust.ai/agents/boar/boar.prefab
assets/rust.ai/agents/chicken/chicken.prefab
assets/rust.ai/agents/horse/horse.prefab
assets/prefabs/player/player.prefab
assets/prefabs/player/player_corpse.prefab
assets/prefabs/npc/scientist/scientist.prefab
assets/rust.ai/agents/stag/stag.prefab
assets/rust.ai/agents/wolf/wolf.prefab
assets/rust.ai/agents/zombie/zombie.prefab
assets/prefabs/tools/c4/explosive.timed.deployed.prefab (lol)
If you want to see if the prefab spawned, you could comment out this line
//rlocation = GetRandomVector();
which forces the spawn location to 0, 0, 0
and then teleport.topos <yourname> 0 0 0 with noclip on or hard code in some coords.Last edited by a moderator: Sep 12, 2017 -
Thank you somuch!!
-
this plugin no longer compiles!
(09:53:31) | Error while compiling: RandomSpawner.cs(49,27): error CS0117: `ConVar.Server' does not contain a definition for `Log'
due to line
ConVar.Server.Log("oxide/logs/Prefabs.txt", ListToString(prefabs, 0, Environment.NewLine)); -
-
anyway i can add a command to the guishop menu so people can do /shop and then use the command?
-
-
its part of both plugins so i was unsure where to post i want people to beable to use random spawner via the guishop menu /shop plugin but im unsure of the command i need to add
oh wait maybe your right lol -
-
-
-
Hello.
I have this error on the screen