Item Carrying System

BlackNerubia

New Member
Reaction score
12
Alright, so im trying to make it when a hero gets 2 of the same item he drops it, mainly weapons so he cant carry 2, i know i can make a storage of the heros complete invintory and update it, but im hoping theres a easyer way to check this and compare the items. any ideas?
 
S

Sunny_D

Guest
check out the free trigger section - there should be an item-restriction trigger (or use search for "item restriction", im sure you will find sth as well)
 

Nestharus

o-o
Reaction score
84
Is that you slayer]blood? lol

oh well, there are many different ways to do this, all of them a lot easier than making a huge array of all the items and checking and so forth ><

Here is the very easiest way that gives you the absolute most freedom:

For this, you can either use life or custom value. Life can just be edited in the Object Editor, Custom value will have to be triggered. If you do life, you should use dummy units for the items that way players don't attack them ><

Ok, here we go:
In most games, items are given an item type. For example, EverQuest has many different item types, one for each slot. Now, let's say you have 6 item types, one for each slot. Right Hand Sword, Left Hand Sword, Shield, you can have both on one item (Left and Right hand), Two Hand Sword, Beastplate, and Helmet.

Now, let's say:
Right Hand = 1
Left Hand = 2
Shield = 3
Two Hand = 4
Breastplate = 5
Helmet = 6

Now you need an array for all the items. This array will contain all of the item's information, meaning its damage, attack range, weight, whatever you want, go wild.

(trust me, you want an array so you can have a lot more freedom to edit item attributes such as upgrades. Maybe even a new combat system? ^)^)

If you don't want that, you can just assign it a custom value or change its item life, like custom value 1 = weapon, 2 = shield, 3 = helmet, and so on. This will limit them for you. You can do it with life too.

Now back to the cooler system : P

Now, let's say an item drops

We do a for loop for our array of items checking those against the item typeof this item. When we find a match, we assign it a custom value based on that match (this is the item's stats).

Let's say it is:
Item Type: 102 (0 just means and in tnhis case. This means we have a sword that can either be used in the left hand or right hand)

Item Damage: 900

Item Attack Range: 100

Item Attack Radius: 90 degrees (small attack radius, maybe a dagger?)

Item Special Attributes: 3 (this in theory will access another array called Special Attributes. Let's say 3 in the special attributes gives the item ice attack).

Now, here's what we do for the custom value:
First, we define how long all of our values are.
102 = 3 characters
900 = 3 characters
100 = 3 characters
90 = 2 characters

Now we have 310239003100290 for a custom value

We assign that to the item. To check a stat, we break it up

Custom Value (substring 1,1)
it's a 3 so we go from 1+1 to 1+3, or 2 - 4

We get 1 0 2
since this is item type, we exlude the 0 and just check our 1 and 2. From here, we check what it's being used as (slot 1 or slot 2 / left hand or right hand)

now we do a for loop
for each item in inventory from 1 - 6 or w/e
if picked item custom value (get our item type) = new item custom value

drop new item and say you already have this

Now, since we have 1 and 2 for the item type, it'll be a lot more interesting.

For this, we need to see if we have 2 items, a 1, and a 2, or 2 1 2s or whatever, so we do a count:

btw, we also need to do shields

if item type of picked item = item type 1 of new item
set x = x + 1
if item type of picked item != item type 1 of new item (this'll just make sure we don't count a 102 item twice, lol)
then
if item type of picked item = item type 2 of new item
set x = x + 1
(and since we also have shields and we're shooting for realism)
if item type of picked item == 3 and item type of new item == 1 or item type of new item == 2 or item type of new item == 3
set x = x + 1

if x >= 2

drop new item

Now, obviously, for armor, this would be a lot easier. It would just go

pick every item
if item type of picked = item type of new

drop new item

it just gets more complex when we can switch around slots. Now, obviously this system is a little advanced and isn't very easy, but it allows you to do whatever you want to do.

Like I said, you can just assign like a custom value of 1, 2, and so forth and just allow 1 wep, 1 shield, and so on. Or you can assign item levels, like item level 1 = wep, item level 2, = w/e, but this will only give you 9 item types (level 0 to level 8)

or you can assign item life in the object editor and just do a for loop to pick all the items and compare their item lives, but to make it so the system doesn't bug up, you need to do something to either regenerate their life to full or use a dummy unit with invulnerable : P

Hope this helps! I told you just about every possible good way to do this ^_^
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top