Jump to content
tormentedmage

[Solved]Newbie's code

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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...