Search the Community
Showing results for tags 'Server specific'.
Found 1 result
Came up with some code that checks for a custom item I've modded in called "Ctoken". Have a look if you like, I have gotten to the point where I access the server specific item, then realised I don't have a clue if I can just 'add' in values to it. The idea behind storing it on an item is for our persistent server, each character will get the item when they join (If they don't already possess one that is!). The event OnGameStart is serving fine for this purpose, anyway, boolean (true or false) values such as "Trusted Player" and custom player factions such as "Trader" are going to be set on this wonderific "do it all" item. Here's my code: --+ Raenbow +----+ 9th May 2014 +-- --+ CHARACTER TOKEN HANDLER. +---- function loadToken(_player)local player = _player;local token = player:getInventory():FindAndReturn("Raenbow.Ctoken");--local string sDebug = token:getName(); --returns "Character Token" --How can I add in 'another' value to the object token? end function raenbow_ctoken() local player = getPlayer(); --Check if a ctoken exists in inventory or not here:if player:getInventory():contains("Item_Ctoken") == false then--No Ctoken exists, create one and move on:print("Raenbow: No CTOKEN FOUND. CREATING ONE:");getPlayer():getInventory():AddItem("Raenbow.Ctoken");elseprint("Raenbow: CTOKEN FOUND!");end --to do here, Check there is not more than one ctoken here: --Execute next part here:loadToken(player);end Events.OnGameStart.Add(raenbow_ctoken); I'm entirely unsure if I can just 'add' in a value somehow, like with a simple "SetValue()" command or whatever, all I managed to trawl up from the javadocs and gleaming the forums was these: setScriptItem(token);ScriptManager():getItem(); But from what I see on the forums, the scripting stuff is getting binned or whatever anyway. Surely there must be a simple way to attach a bunch of string/int/bools to an inventory item object? Thanks in advance! This one has me stumped