Jump to content

i think its right....but its not.


eaglescout666

Recommended Posts

hello, im trying to make a mod for a trauma kit, but it needs items to spawn within. problem its, the do not. i have no clue what is going on. the first part goes like this, and works fine

-- LargeTraumaBagtable.insert(SuburbsDistributions["pharmacy"]["shelves"].items, "TRAUMAKIT.LargeTraumaBag");table.insert(SuburbsDistributions["pharmacy"]["shelves"].items, 3);table.insert(SuburbsDistributions["all"]["crate"].items, "TRAUMAKIT.LargeTraumaBag");table.insert(SuburbsDistributions["all"]["crate"].items, 3);table.insert(SuburbsDistributions["policestorage"]["metal_shelves"].items, "TRAUMAKIT.LargeTraumaBag");table.insert(SuburbsDistributions["policestorage"]["metal_shelves"].items, 4);table.insert(SuburbsDistributions["gunstore"]["locker"].items, "TRAUMAKIT.LargeTraumaBag");table.insert(SuburbsDistributions["gunstore"]["locker"].items, 2);

then THIS part keeps screwing everything up

------------------------------------------------------------------------- Add Items To EMT Bag-----------------------------------------------------------------------function TRAUMAKIT (return true)if(function(TRAUMAKIT)==true){}thenwhile true dofor LargeTraumaBag, if item ipairs (table [medSuppliesTable]) then if container:getType() == "LargeTraumaBag" thenplayer:getCurrentSquare():AddWorldInventoryItem(item, 0.0, 0.0, 0.0);else{container:AddItem(Base.Bandaid = 100and AddItem Base.AlcoholBandage = 100and AddItem Base.Disinfectant = 100and AddItem Base.AlcoholWipes = 100and AddItem Base.SutureNeedle = 75and AddItem Base.SutureNeedleHolder = 75and AddItem Base.PillsBeta = 50and AddItem Base.PillsAntiDep = 50and AddItem Base.PillsSleepingTablets = 50and AddItem Base.Splint = 11)};};};};};endend-- -------------------------------------------------- Game hooks-- ------------------------------------------------Events.OnGameBoot.Add(TRAUMAKIT.init);print("TRAUMAKIT: SuburbsDistributions added. ");

any adivce or help in figuring out whats going on is greatly apreciated

 

btw item table is as follows:

 

table = medSuppliesTable {"Base.Bandaid","Base.AlcoholBandage","Base.Disinfectant","Base.AlcoholWipes","Base.SutureNeedle","Base.SutureNeedleHolder","Base.PillsBeta","Base.PillsAntiDep","Base.PillsSleepingTablets","Base.Splint"};

i just nedd help getting items to spawn in bag. i don't know what is issue

 

many thanks

 

Link to comment
Share on other sites

My first reaction was "Oh god...". My second was "wait... what?!"...
 
Don't take that as an offence, you're doing a good effort, but your code is... well, first of all dangerous:

while true do 

^ This will loop forever, which means you're telling the code to never go to the next script. Freezing the game, and everything... forever...

if(function(TRAUMAKIT)==true){}then

^ this isn't lua, and... possibly calls itself, creating another infinite loop.
 
there are the 2 critical things.
 
the rest of the code... well... Please... PLEASE do not take this offensive. I'm not trying to be mean... but... there is litterally not a single thing in it that could work or isn't wrong...
I'm not giving this as deconstructive critisism, or to tell you off. And please don't let this demotivate you, but instead take it as a sign that you should do some more learning about how coding works. Specifically lua.
 
 
Here is your code, but pleaaase put some time in learning the basics of coding... ;___; because, it's nearly impossible to even see what you're trying to do in your code, and I'm still not sure if I did want you "expected" the code to do. But this is what your code would do, if it was working. I think...

function giveTraumaKit()	local spawnedLargeTraumaKit = getPlayer():getCurrentSquare():AddWorldInventoryItem("TRAUMAKIT.LargeTraumaBag", 0.0, 0.0, 0.0);	local spawnedLargeTraumaKitContainer = spawnedLargeTraumaKit:getItemContainer();		local medSuppliesTable = {		"Base.Bandaid" = 100,		"Base.AlcoholBandage" = 100,		"Base.Disinfectant" = 100,		"Base.AlcoholWipes" = 100,		"Base.SutureNeedle" = 75,		"Base.SutureNeedleHolder" = 75,		"Base.PillsBeta" = 50,		"Base.PillsAntiDep" = 50,		"Base.PillsSleepingTablets" = 50,		"Base.Splint" = 11	};		for item,chance in pairs(medSuppliesTable) do		if chance > ZombRand(0, 100) then			spawnedLargeTraumaKitContainer:AddItem(item);		end	end		print("TRAUMAKIT: SuburbsDistributions added. ");endEvents.OnGameBoot.Add(giveTraumaKit);

Edit: I'm really trying to be nice, I really am... So please please don't take this the wrong way.

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...