Anathema Posted May 7, 2016 Share Posted May 7, 2016 So here's the deal, I made some basic starter kits based on the occupation, but I'd like to be able to do things like spawning the pistol fully loaded as opposed to giving the player a handful of rounds to load manually (unsuccessful attempt below). Something else I've been wondering, is there a more elegant way of spawning an item multiple times? (see burgerflipper) Spoiler function GiveOccupationItems(player,square) local profession = player:getDescriptor():getProfession(); if profession == "fireofficer" then player:getInventory():AddItem("Base.Axe"); elseif profession == "policeofficer" then local firearm = player:getInventory():AddItem("Base.Pistol"); firearm.setClipSize(15); player:getInventory():AddItem("Base.Torch"); --snip elseif profession == "burgerflipper" then player:getInventory():AddItem("Base.Pan"); player:getInventory():AddItem("Base.Pop"); player:getInventory():AddItem("Base.Pop"); player:getInventory():AddItem("Base.Pop"); --snip end end Events.OnNewGame.Add(GiveOccupationItems) I've already tried my best in finding a solution for both, but I've come up with nothing. Most people just seem to resort to the more simple and crude solutions. Thank you in advance. Link to comment Share on other sites More sharing options...
Anathema Posted May 7, 2016 Author Share Posted May 7, 2016 So far I've figured out spawning an item multiple times: Spoiler elseif profession == "burgerflipper" then player:getInventory():AddItem("Base.Pan"); player:getInventory():AddItems("Base.Pop", 2); I'd still like to know how to spawn a pistol with a full magazine inside it. Link to comment Share on other sites More sharing options...
SandyBeaches Posted June 6, 2016 Share Posted June 6, 2016 I'd probably add the pistol to inventory, then find the spawned object in player inventory and change its properties. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now