Blockland Forums > Modification Help
Is this possible with Inventory items/weapons?
<< < (2/4) > >>
xS K I D z:

--- Quote from: PhantOS on September 17, 2017, 03:23:19 PM ---player.value = 5;

that's what it means. you store stuff like player.durability[itemname] = 10; and then you can access it for that specific item or its id

--- End quote ---

Ah alright that makes sense lol. I'll experiment with it, thanks!


--- Quote from: Shift Kitty on September 17, 2017, 03:24:29 PM ---Third one is similar to the first one. Make a separate datablock for the upgraded gun. When the upgrade item is used, search the player's inventory for the gun, if it's found, remove the upgrade from the inventory, and replace the gun with the upgraded gun.

--- End quote ---

And thanks Shift Kitty! Excuse my noobness, but I get confused at "Make a separate datablock..." What exactly does that mean? Am I just thinking about it the wrong way or...? Idk. I haven't slept in about 23 hours (holy shet) so I could be just using too much brain power lol
Shift Kitty:

--- Quote from: xS K I D z on September 17, 2017, 03:35:26 PM ---And thanks Shift Kitty! Excuse my noobness, but I get confused at "Make a separate datablock..." What exactly does that mean? Am I just thinking about it the wrong way or...? Idk. I haven't slept in about 23 hours (holy shet) so I could be just using too much brain power lol

--- End quote ---
Get some sleep, it helps.

But what I mean by that is make a completely new item and mounted image, copying almost all the values of the old one, and then make it better.
xS K I D z:

--- Quote from: Shift Kitty on September 17, 2017, 03:37:47 PM ---Get some sleep, it helps.

--- End quote ---
Yeah, I can't continue to get up at noon 'o clock anymore and I know this'll work :\


--- Quote from: Shift Kitty on September 17, 2017, 03:37:47 PM ---But what I mean by that is make a completely new item and mounted image, copying almost all the values of the old one, and then make it better.

--- End quote ---
That's what I thought. Lil more work than I wanted (especially for multiple different items) but I can manage probably. Thanks!
xS K I D z:
I'm still having some trouble with this -_- I did some looking and found this bit of code:

--- Code: ---for(%i=0;%i<5;%i++)
    {
        %toolDB = %obj.tool[%i];

        if(%toolDB $= %image.item.getID())
    }
--- End code ---
How would I use this? I suppose I just don't know how to use ID's or how I would have it recognize an item. I also found this:

--- Code: ---if(isObject(%client = %obj.client))
    {
        %currSlot = %obj.currTool; //Object's current slot
        %item = %obj.tool[%currSlot]; //The item (usually it's an ID)
        %image = %obj.tool[%currSlot].image; //Get the image of the current tool the guy is holding
        if(isObject(%item) && isObject(%image)) //Make sure they both exist
            if(%image == %this) //%this = the current image the object is holding, usually it's an ID, you could also do -> if(nameToID(%image) == nameToID(%this))
            {
                %obj.tool[%currSlot] = 0;
                %obj.weaponCount--;
                messageClient(%client, 'MsgItemPickup', '', %currSlot, 0);
                serverCmdUnUseTool(%client);
            }
    }
--- End code ---
This bit of code makes more sense as to how I would "use" two items by requiring one by the other.

Otherwise all I see is that I'm trying to match two different datablocks or whatever to then use code on the item I activated in the first place and I can't make sense of it. Can someone put some light on the subject?
phflack:
The first code block checks to see if you have a specific item in your inventory, like the key for your lock example
Do note that it's hard coded for 5 item slots, so will not detected extended player slots and may throw errors in the console for less item slots
Also, to see the IDs, you can use echo to print to the console

The second looks like it would be used to remove an item from the inventory
Navigation
Message Index
Next page
Previous page

Go to full version