Jump to content

Modding context question


LazyWafflez

Recommended Posts

Hi,

 

I have been attempting to modify my game in an attempt to make it so when i pick a certain class I.E: Policeman. i would spawn with a pistol and some ammo, i can make it so that i spawn in with this if i am any class but i would like it so that if i pick a class i spawn with certain items relating to that class

 

i would love to have some assistance from the community if i am worth your time

 

Thank you

Link to comment
Share on other sites

This should be all you need:

 

 ----- Adds items to the player's inventory, whenever-- he starts a new game.---- @param _player-- @param _sq--local function giveItems(_player, _sq)	local p = _player;	if p:HasTrait("butterfingers") then -- Check for the profession instead of for a trait		p:getInventory():AddItems("Base.Popcorn", 2);		p:getInventory():AddItems("Base.Pop", 1);	endendEvents.OnNewGame.Add(giveItems);
That's how I did it in my old player taunts mod, but I'm pretty sure this still works.
Link to comment
Share on other sites

ive been trying your code and various iteration of it but i cannot figure out what i am doing wrong

 

if p:HasProfession = "FireOfficer" then -- Check for the profession instead of for a trait
getPlayer():getInventory():AddItem("Base.Axe");
 
That is the code im trying to get working as just a test
Link to comment
Share on other sites

Ive found a different problem for myself now i can get it working on certain professions but i cannot get it to work on others. There is only 4 that im trying to figure out 

Chef

Unemployed

Burglar

Repairman 

 

elseif profession == "chef" then
player:getinventory():Additem("Base.Pot");
 
This is a bit of code im using and i cant find the problem for it 
if you get the chance could i have some assistance with the correct naming for those 4 professions
thank you
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...