Jump to content

[Solved]Newbie's code


tormentedmage

Recommended Posts

I currently try to remove all the items from the map and tried three short codes.

 

local function lootTest()
local player = getPlayer();
player:getInventory():removeAllItems();
end
Events.OnNewGame.Add(lootTest);

 

local function lootTest2(zombie)
zombie:getInventory():removeAllItems();
end
Events.OnZombieDead.Add(lootTest2);

 

local function lootTest3()
local container = getContainer();
container:getInventory():removeAllItems();
end
Events.OnNewGame.Add(lootTest3);


The first one and the second one work well but the third one doesn't work at all.
Probably I don't correctly specify containers and I don't know how to specify all the containers at once.
I would appreciate if someone could fix the code.

Edited by tormentedmage
Solved
Link to comment
Share on other sites

1/ If I set aside the strangeness of your attempt:

you could parse all squares and for each of them:

parse static objects for containers

parse dynamic objects for containers

parse vehicles for containers

for each of theses containers:

remove all items inside them

 

2/ why would you remove all items from a world ?

you'd probably better create a world without items.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...