DZomboid Posted September 10, 2016 Share Posted September 10, 2016 (edited) I thank the attention of the gentlemen. Please ONLY/JUST code/script. I need a code/script to two conditions: Condition 1: Start a new game with 1 pistol, 9mm rounds, 1 axe, 1 hammer and strength 50 (this condition is for unemployed and any chosen profession to start new game). Condition 2: If the player kill ten zombies, he finds in the zombie number ten: 1 pistol and 9mm rounds. Sorry for my noob english. Edited September 14, 2016 by DZomboid Link to comment Share on other sites More sharing options...
tommysticks Posted September 10, 2016 Share Posted September 10, 2016 Hey man, this shouldn't be too hard to program. You are requesting this, right? So you want a pistol and ammo found on every 10th zed? Mind me asking why? DZomboid 1 Link to comment Share on other sites More sharing options...
DZomboid Posted September 10, 2016 Author Share Posted September 10, 2016 Oh tommysticks! thanks for your attention. Ye! I need code/scripts for this 2 conditions. I am new to programming language. I am learning code/script. I am brazilian. I speak portuguese language. The forum does not have guides in portuguese language. Examples codes help much. If you can help, just paste the codes here. Ah! your mod is wonderful! Long live to tommysticks. Long live to Project Zomboid! Link to comment Share on other sites More sharing options...
tommysticks Posted September 11, 2016 Share Posted September 11, 2016 3 hours ago, DZomboid said: Oh tommysticks! thanks for your attention. Ye! I need code/scripts for this 2 conditions. I am new to programming language. I am learning code/script. I am brazilian. I speak portuguese language. The forum does not have guides in portuguese language. Examples codes help much. If you can help, just paste the codes here. Ah! your mod is wonderful! Long live to tommysticks. Long live to Project Zomboid! I won't be able to get to it til Tuesday, but just to make sure: Every profession starts with a hammer, ax, pistol, ammo, and high strength And every 10th zed drops pistol and ammo Anything else? DZomboid 1 Link to comment Share on other sites More sharing options...
DZomboid Posted September 11, 2016 Author Share Posted September 11, 2016 19 hours ago, tommysticks said: I won't be able to get to it til Tuesday, but just to make sure: Every profession starts with a hammer, ax, pistol, ammo, and high strength And every 10th zed drops pistol and ammo Anything else? Oh tommysticks! thanks for your attention. Ye! This! XD. Unemployed and every profession. (Strength 50). You are my teacher. XD. Don´t worry about the day to get ready. I wait. XD. Thanks tommysticks! Link to comment Share on other sites More sharing options...
tommysticks Posted September 12, 2016 Share Posted September 12, 2016 (edited) Here it is dawg: local function startUp() local player = getPlayer(); player:getDescriptor():setForename("Tommy"); --sets character firstname to Tommy player:getDescriptor():setSurname("Sticks"); --sets character lastname to Sticks local pistol = player:getInventory():AddItem("Base.Pistol"); --stores new pistol in variable pistol:setName("Tommy's Pistol"); --sets new pistol's name to Tommy's Pistol -- player:getInventory():AddItem("Base.Pistol"); --adds a pistol without storing it in a variable player:getInventory():AddItems("Base.Bullets9mm", 9); --adds 45 9mm rounds player:getInventory():AddItem("Base.Hammer"); --adds the hammer player:getInventory():AddItem("Base.Axe"); --adds the axe player:getXp():AddXP(Perks.Strength, 30000000); --sets the perk strength to the max player:getModData().zKills = 0; --initializes zKills in the player mod data -- print(player:getModData().zKills); --adding a bag that contains items -- local bag = player:getInventory():AddItem("tommyguns_items.Rucksack"); -- bag:getItemContainer():AddItems("tommyguns_items.Box556", 3); -- bag:getItemContainer():AddItem("tommyguns_items.BoxMRE", 1); -- bag:getItemContainer():AddItem("tommyguns_items.machete", 1); -- bag:getItemContainer():AddItems("Base.WaterBottleFull", 2); -- bag:getItemContainer():AddItem("tommyguns_items.BoxMRE", 1); -- bag:getItemContainer():AddItems("Base.BulletsBox", 2); --adding a gun that has attachments -- local startGun = player:getInventory():AddItem("tommyguns_items.weapon_ar15"); -- local part1 = InventoryItemFactory.CreateItem("Base.RedDot"); -- local part2 = InventoryItemFactory.CreateItem("Base.Sling"); -- local part3 = InventoryItemFactory.CreateItem("Base.RecoilPad"); -- local part4 = InventoryItemFactory.CreateItem("Base.FiberglassStock"); -- startGun:attachWeaponPart(part2); -- startGun:attachWeaponPart(part3); -- startGun:attachWeaponPart(part4); -- startGun:attachWeaponPart(part1); end local function killPlus() getPlayer():getModData().zKills = getPlayer():getModData().zKills + 1; --have to access player moddata and increase zed kills by 1 -- print(getPlayer():getModData().zKills); --prints zed kills for debugging end local function zedCheck(room, containerType, container) --i don't know how parameters work if (container:getType() == "inventorymale" or container:getType() == "inventoryfemale") and getPlayer():getModData().zKills >= 10 then --checks to for container zed and if player has 10 or more kills -- getPlayer():Say("Gun and Ammo Spawned"); --for debugging getPlayer():getModData().zKills = getPlayer():getModData().zKills - 10; --remove 10 kills from the player moddata zKills container:AddItem("Base.Pistol"); --adds pistol to 10th zed killed container:AddItems("Base.Bullets9mm", 6); --adds 30 9mm rounds to 10th zed killed -- print("zed kills"); --debugging -- print(getPlayer():getModData().zKills); --debugging end end Events.OnFillContainer.Add(zedCheck); Events.OnZombieDead.Add(killPlus); Events.OnNewGame.Add(startUp); Everything works out as requested: Every new character starts with strength maxed Every new character starts with a pistol, ammo, axe, and hammer Every 10th Zed drops a new pistol and ammo I left in some other code snippets for you to check out. Edited September 12, 2016 by tommysticks added notes to code Link to comment Share on other sites More sharing options...
tommysticks Posted September 12, 2016 Share Posted September 12, 2016 If you have any questions feel free to ask. DZomboid and DresdenBBQ 2 Link to comment Share on other sites More sharing options...
DZomboid Posted September 13, 2016 Author Share Posted September 13, 2016 On 10/09/2016 at 10:52 PM, tommysticks said: If you have any questions feel free to ask. Oh tommysticks! thanks! Nice, XD. Now, i need to know where i paste this code/script? XD. What folder? media-lua-client media-lua-server media-lua-shared Link to comment Share on other sites More sharing options...
DZomboid Posted September 13, 2016 Author Share Posted September 13, 2016 On 10/09/2016 at 10:52 PM, tommysticks said: What folder? Link to comment Share on other sites More sharing options...
tommysticks Posted September 14, 2016 Share Posted September 14, 2016 (edited) Client. But for modding purposes you should make a new mod and put the code into this directory: C:\Users\YOUR USERNAME\Zomboid\mods\DZomboid's Mod\media\lua\client There should be an example mod in the mods folder that shows how it needs to be put together. Edited September 14, 2016 by tommysticks DZomboid 1 Link to comment Share on other sites More sharing options...
DZomboid Posted September 14, 2016 Author Share Posted September 14, 2016 On 10/09/2016 at 10:52 PM, tommysticks said: Client. But for modding purposes you should make a new mod and put the code into this directory: C:\Users\YOUR USERNAME\Zomboid\mods\DZomboid's Mod\media\lua\client There should be an example mod in the mods folder that shows how it needs to be put together. Thanks! tommysticks the great! (Solved) 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