Masochist Posted December 1, 2014 Share Posted December 1, 2014 I am not sure why my function is not working...I am sure it is some sort of silly stupid issue I am missing...but perhaps someone else can see it. I can't seem to find very good information on functions and stuff. The goal is to have professions that start with XP and items...I have only put in the XP for carpenter for testing but that wont work nor do the items.function giveItemsAndXP() if getPlayer():HasTrait("Axeman") == true then getPlayer():getInventory():AddItems("Base.Axe", 1), end if getPlayer():HasTrait("Marksman") == true then getPlayer():getinventory():AddItems("Base.Shotgun", 1); end if getPlayer():HasTrait("Outdoorsman") == true then getPlayer():getInventory():AddItems("Base.Matches", 1); getPlayer():getInventory():AddItems("camping.CampfireKit", 1); getPlayer():getInventory():AddItems("camping.CampingTentKit", 1); getPlayer():getInventory():AddItems("camping.FireWoodKit", 1); getPlayer():getInventory():AddItems("camping.WaterBottleFull", 2); end if getPlayer():HasTrait("Handy") == true then getPlayer():getXp():AddXP(Perks.Woodwork, 1900); getPlayer():getInventory():AddItems("Base.Hammer", 1); getPlayer():getInventory():AddItems("Base.NailsBox", 1); getPlayer():getInventory():AddItems("Base.ScrewsBox", 1); getPlayer():getInventory():AddItems("Base.Saw", 1); getPlayer():getInventory():AddItems("Base.Screwdriver", 1); end if getPlayer():HasTrait("NightOwl") == true then getPlayer():getInventory():AddItems("Base.Battery", 1); getPlayer():getInventory():AddItems("Base.Torch", 1); getPlayer():getInventory():AddItems("Base.Pistol", 1); getPlayer():getInventory():AddItems("Base.Bullets9mm", 2); endendEvents.OnGameStart.Add(giveItemsAndXP) Link to comment Share on other sites More sharing options...
EnigmaGrey Posted December 1, 2014 Share Posted December 1, 2014 getPlayer():getinventory():AddItems("Base.Shotgun", 1),You have a , at the end of this line.You don't actually need to add semicolons to the end of statements in Lua -- I tend to avoid them for this reason. Link to comment Share on other sites More sharing options...
Masochist Posted December 1, 2014 Author Share Posted December 1, 2014 Ahh ok will try without...I noticed one was different then I switched them all over to commas...will try with nothing. Thank you very much...I am not familiar with Lua and knew it was some incredibly stupid syntax error...now I can move forward with my life lol EnigmaGrey 1 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