Spawning items, and bases

MasterPeace

Retired Staff
Retired Staff
Feb 2, 2015
269
69
28
45
Poland
Hello.

I have 2 questions.

1. I want to make some buildings always lighten up. It could be pretty done if in night server would drop flares always at same places, "life after life". So when they disappear new ones will come. Is it possible?

2. Is it possible to set indestructible bases? I would like to have 3 or 4 places on map indestructible and not allowed for players to build on and near them. Also wiper (I don't think he is working) need to ignore them.
 

DreTaX

Probably knows the answer...
Administrator
Jun 29, 2014
4,093
4,784
113
At your house.
github.com
Hello.

I have 2 questions.

1. I want to make some buildings always lighten up. It could be pretty done if in night server would drop flares always at same places, "life after life". So when they disappear new ones will come. Is it possible?

2. Is it possible to set indestructible bases? I would like to have 3 or 4 places on map indestructible and not allowed for players to build on and near them. Also wiper (I don't think he is working) need to ignore them.
My Wiper plugin works.
 

Snake

Moderator
Moderator
Jul 13, 2014
288
174
28
I hope so :p But it's not an issue now. So I would edit your Wipe plugin to make it ignore some houses. Let's say number 2 is done.

I see it's impossible to spawn flare.
Not impossible, but hard.

Take a look at FlareObj class at the rust assembly.
 

MasterPeace

Retired Staff
Retired Staff
Feb 2, 2015
269
69
28
45
Poland
Sorry, what do you mean by "rust assembly", where I can find it?

I would really like to look at all rust classes, not just that one.
 

MasterPeace

Retired Staff
Retired Staff
Feb 2, 2015
269
69
28
45
Poland
Wow cool.

World: Yea I saw it before, but I searched for some list of prefab names and found only foundations etc. on oxide.

Code:
--- Structure Wood ---
;struct_wood_foundation
;struct_wood_windowframe
;struct_wood_doorway
;struct_wood_wall
;struct_wood_ceiling
;struct_wood_ramp
;struct_wood_stairs
;struct_wood_pillar

--- Structure Metal ---
;struct_metal_foundation
;struct_metal_wall
;struct_metal_doorframe
;struct_metal_ceiling
;struct_metal_stairs
;struct_metal_windowframe
;struct_metal_ramp
;struct_metal_pillar

---- Other Metal ----
;deploy_metalwindowbars


------Door--------
;deploy_wood_door
;deploy_metal_door

------ Storage -------
;deploy_wood_box
;deploy_wood_storage_large
;deploy_small_stash

----- Attack and protect -----
;deploy_largewoodspikewall
;deploy_woodspikewall
;deploy_wood_barricade
;deploy_woodgateway
;deploy_woodgate

-- Base --

;deploy_camp_bonfire
;deploy_wood_shelter
;deploy_furnace
;deploy_workbench
;deploy_camp_sleepingbag
;deploy_singlebed

-- Ressource --
;res_woodpile
;res_ore_1
;res_ore_2


-- Other --
;drop_lootsack_zombie
;drop_lootsack
;sleeper_male
;explosive_charge
That's why I tought it's impossible.

Hope I'll find them with this software.
 

DreTaX

Probably knows the answer...
Administrator
Jun 29, 2014
4,093
4,784
113
At your house.
github.com
Try to use Util.TryFindReturnType("FlareObj")

Put that in a variable, and try to do Plugin.Log("Test", str(variable.lightPrefab.name))
 

MasterPeace

Retired Staff
Retired Staff
Feb 2, 2015
269
69
28
45
Poland
Error. No "lightPrefab" in MonoType.

You guys maybe know how to use this server commands:
Code:
objects.count( ) Logs object counts
objects.prefabs( ) Logs prefab names by count
 

DreTaX

Probably knows the answer...
Administrator
Jun 29, 2014
4,093
4,784
113
At your house.
github.com
Error. No "lightPrefab" in MonoType.

You guys maybe know how to use this server commands:
Code:
objects.count( ) Logs object counts
objects.prefabs( ) Logs prefab names by count
Maybe try importing UnityEngine. Throw a flare and execute a command and Use:

array = UnityEngine.Resources.FindObjectsOfTypeAll(UnityEngine.GameObject)

for ent in array:
Plugin.Log("Log", str(ent.name))
 

MasterPeace

Retired Staff
Retired Staff
Feb 2, 2015
269
69
28
45
Poland
Jakkee prefab name is working,

Dretax: I didn't check it. Have some bad time and haven't really head to check something that complicated (after about 2 hours of searching for prefab names).

I need to make now proper script to spawn it as I have no idea how to do this automatically. I will use files I guess and On_PlayerConnect.

I'll check also your code about Airdrops from other thread.
 

DreTaX

Probably knows the answer...
Administrator
Jun 29, 2014
4,093
4,784
113
At your house.
github.com
I looked at the first post. Remember my code from thenradiation thing? Thats how you do a normal timer. If you want the timer to have arguments look at the newest TpFriend or HomeSys. From the other hand you have to use world.time to check if its night. I think the flares last for 90secs.

Sent from my Samsung Galaxy S4
 

MasterPeace

Retired Staff
Retired Staff
Feb 2, 2015
269
69
28
45
Poland
Yeah I'm working on it now, no problem with flares, there is a couple of ways to do this, all with timers.

BUT

Flares giving exceptions:
Code:
Exception: Trying to read past the buffer size - likely caused by mismatching Write/Reads, different size or order.
Still working, but I hope it will not make any crash or something. More flares more exceptions.

I want to place Loot box/crates too. I'll show you image when I'll done everything :D

By the way Loot crates prefabs:
Code:
"AmmoLootBox"
"MedicalLootBox"
"WeaponLootBox"
 

Jakkee

Retired Staff
Retired Staff
Plugin Developer
Jul 28, 2014
1,465
932
113
Australia
Just do a try/except so you don't get the errors in console if its always throwing an error.
E.G:
Python:
Try:
    World.Spawn("WorldFlare_New", Player.X, Player.Y, Player.Z)
Except Exception:
    Exception = None
    #Do stuff here if error appears
^Something like this should work
 

MasterPeace

Retired Staff
Retired Staff
Feb 2, 2015
269
69
28
45
Poland
Hey, could you explain me why World.Spawn is not working in my function? Just explain why and what, I need to understand it, not just have working, so next time I'll manage this situation without help.

This is working:
Code:
def On_PlayerSpawned(self, Player, location):
     World.Spawn("WorldFlare_New", flare_1_x, flare_1_y, flare_1_z)
This is not:
Code:
def FlareCallback(self):
    Plugin.KillTimer("Flare")
    World.Spawn("WorldFlare_New", flare_1_x, flare_1_y, flare_1_z)
It's of course Object error, like always.