Jump to content

[SOLVED]AddItem not adding item


Kurogo

Recommended Posts

When I perform this the action ISTrellisShovelAction, the intention is to return the Trellis Kit to the player. I thought using the same code from the campfire kit might work, but although it is removing the trellisPlot world object, it's not putting the TrellisKit in the players inventory. Here's the part of the code in the IsTrellisShovelAction.lua where I added the line to do this.

 

Spoiler

function ISTrellisShovelAction:perform()    
if self.sound and self.sound:isPlaying() then        
self.sound:stop();    
end 
self.item:getContainer():setDrawDirty(true); 
self.item:setJobDelta(0.0); 
if isClient() then  
local sq = self.vine:getSquare()  
local args = { x = sq:getX(), y = sq:getY(), z = sq:getZ() }  
sendClientCommand(self.character, 'trellis', 'removeVine', args) 
else  
trellisFarming.removeVine(self.vine)  
self.character:getInventory():AddItem("Farmoid.TrellisKit")    
end 
ISBaseTimedAction.perform(self);
end

 

 

 

I've tried just using AddItem("TrellisKit") as well as the above "Farmoid.TrellisKit" in the code. I can remove the Trellis Kit from the player inventory in the ISBuildTrellisAction.lua by just referencing it as "TrellisKit", so I know it recognizes the item, it's just not appearing in my inventory when I test it. Any help would be greatly appreciated.

 

EDIT: I feel like an idiot. The code works, I was just making the changes to my backup file, not the mod file in use.

Edited by Kurogo
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...