Item Ownership

AriesX_420

Active Member
Reaction score
1
Hey Im just wondering....I have an ORPG. I want my items that are in any of a players inventory to become theirs and only theirs. So no other players can pick up that item, or so they can all be selected somehow. If the item is dropped from the player, it knows whos item it is.... This is is because i want to select all the items of that player that are on the ground and delete them if they repick.
 

jig7c

Stop reading me...-statement
Reaction score
123
you could set the items in an item array variable when a player gets it... and then check everytime when a player acquires an item, check if it matches any of the items in that item variable array!
 

Ayanami

칼리
Reaction score
288
You could use hashtables. Since you can call back the items by referring to a unit, it can be easily done.
 

AriesX_420

Active Member
Reaction score
1
Im am pretty good at map making, but i havnt experimented in hashtables, anyone care to give the the low down on it?
 

Ayanami

칼리
Reaction score
288
Are you using NewGen? If so, I believe Hashtables in GUI are bugged in NewGen. You'll have to use custom scripts if that's the case.
 

Ayanami

칼리
Reaction score
288
Well let's see if your Hashtables work. Try go to Actions - Hashtable. Go to the "Save 0 of 0" part and click the 0. Are you able to get something like Key(Picked unit)?
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
you can change and get the owner of an item with normal GUI, just use that.
 

AriesX_420

Active Member
Reaction score
1
Hey there so i figured it out... ya i used Item Ownership.. I was worried about item ownership because i only thought an item was owned by a player, when it was in a units inventory, and not on the ground. But it worked perfectly. I tweaked my trigger a bit to make it work but ill post it so show ya what i got.

Trigger:
  • Obtaining an Item
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Owner of (Triggering unit)) Not equal to (Owner of (Item being manipulated))
          • ((Triggering unit) is A Hero) Equal to True
        • Then - Actions
          • Wait 2000.00 seconds
          • Item - Change ownership of (Item being manipulated) to (Owner of (Triggering unit)) and Retain color
        • Else - Actions


So that trigger checks if i unit picks up an item whether it is that players item. If its not and its someone else's item that player must wait 2000 seconds(30 minutes approx) before it becomes theirs.(isnt that long) The main reason for the wait is to prevent item duping.


Trigger:
  • Buying an Item
    • Events
      • Unit - A unit Sells an item (from shop)
    • Conditions
    • Actions
      • Item - Change ownership of (Item being manipulated) to (Owner of (Triggering unit)) and Retain color


What happens if they buy an item instead of picking it up or receiving it by other means. simple enough


K now on the repick and leave game I added something that checks:
-all units for players ownership of the item, and
-also picks all items on the ground own by that triggering player who typed -repick or leaves.


i wont give you the hole thing of what my repick does.. just the item part as it checks for alot more then just items...

Trigger:
  • Repick P1
    • Events
      • Player - Player 1 (Red) types a chat message containing -repick as An exact match
    • Conditions
      • (Number of units in (Units in Hero Region <gen> matching (((Matching unit) is A Hero) Equal to True))) Greater than or equal to 1
    • Actions
      • Trigger - Turn on Player 1 chooses Hero <gen>
      • Item - Pick every item in (Playable map area) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Picked item)) Equal to (Triggering player)
            • Then - Actions
              • Item - Remove (Picked item)
            • Else - Actions
      • Unit Group - Pick every unit in (Units in (Playable map area) matching (((Matching player) controller) Equal to User)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Item carried by (Picked unit) in slot 1)) Equal to (Triggering player)
            • Then - Actions
              • Item - Remove (Item carried by (Picked unit) in slot 1)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Item carried by (Picked unit) in slot 2)) Equal to (Triggering player)
            • Then - Actions
              • Item - Remove (Item carried by (Picked unit) in slot 2)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Item carried by (Picked unit) in slot 3)) Equal to (Triggering player)
            • Then - Actions
              • Item - Remove (Item carried by (Picked unit) in slot 3)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Item carried by (Picked unit) in slot 4)) Equal to (Triggering player)
            • Then - Actions
              • Item - Remove (Item carried by (Picked unit) in slot 4)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Item carried by (Picked unit) in slot 5)) Equal to (Triggering player)
            • Then - Actions
              • Item - Remove (Item carried by (Picked unit) in slot 5)
            • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Item carried by (Picked unit) in slot 6)) Equal to (Triggering player)
            • Then - Actions
              • Item - Remove (Item carried by (Picked unit) in slot 6)
            • Else - Actions
      • Unit Group - Pick every unit in (Units owned by (Triggering player) matching (((Matching unit) is A Hero) Equal to True)) and do (Actions)
        • Loop - Actions
          • Item - Remove (Item carried by (Picked unit) in slot 1)
          • Item - Remove (Item carried by (Picked unit) in slot 2)
          • Item - Remove (Item carried by (Picked unit) in slot 4)
          • Item - Remove (Item carried by (Picked unit) in slot 3)
          • Item - Remove (Item carried by (Picked unit) in slot 5)
          • Item - Remove (Item carried by (Picked unit) in slot 6)


and im just wondering is there anyway to pick inventory 1-6 instead of each individually.... and your hero also has a backpack & units that i must get rid of the items inside of it which is in the code i just didnt post it. I also have this trigger for all the other players that repick. Instead of player 1... it would be player 2

But pretty much.... Allows heroes to trade items and share them... if a loaded character tries to dupe by dropping items on the ground or giving them to another unit and then -repicking... He cannot... unless he waits the 30 minutes, and hopefully after that he would save again making it pointless.
 

Laiev

Hey Listen!!
Reaction score
188
loop this:

Trigger:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
    • (Owner of (Item carried by (Picked unit) in slot 1)) Equal to (Triggering player)
    • Then - Actions
    • Item - Remove (Item carried by (Picked unit) in slot 1)
    • Else - Actions


and make shorter
>>

Trigger:
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
    • (Owner of (Item carried by (Picked unit) in slot (Integer A))) Equal to (Triggering player)
    • Then - Actions
    • Item - Remove (Item carried by (Picked unit) in slot (Integer A))
    • Else - Actions
 

Bogrim

y hello thar
Reaction score
154
There is a much simpler method to this, and that is to use the custom value of the item to give the item an ownership "ID":
Trigger:
  • Item Ownership
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • If - Conditions
        • Or - Any (Conditions) are true
          • Conditions
            • (Custom value of (Item being manipulated)) Equal to 0
            • (Custom value of (Item being manipulated)) Equal to (Player number of (Owner of (Triggering unit)))
      • Then - Actions
        • Item - Set the custom value of (Item being manipulated) to (Player number of (Owner of (Triggering unit)))
      • Else - Actions
        • Hero - Drop (Item being manipulated) from (Triggering unit)

This trigger alone will do the trick. Furthermore, you can then use the custom value of the items to select items belonging to certain players.
 

AriesX_420

Active Member
Reaction score
1
yes you are right.. however i want to allow players the option of exchanging items... as i see yours will not allow me to do so. Mine allows you to exchange items well still preventing item duplication whething through repicking or mutiple restarts of my map.
 

Bogrim

y hello thar
Reaction score
154
If you wish to be able to exchange items, simply remove the hero action from the trigger. You asked for a method to detect items owned by a certain player even when the hero no longer carries the items, and that is best achieved using custom value. Exchanging items would also allow duplication otherwise.
 

AriesX_420

Active Member
Reaction score
1
You are right, there is one loop hole i most close. I gotta make it so when you save it drops all the items from your hero that are not yours.


I will make that trigger and post it for you guys to complete...
Also i raised the wait trigger for the item alot more then 1000 seconds.

So if someone does save and the items arnt theres those items will drop before the code is written for you.

Oh btw there is a trigger i made that wont allow you to drop items for 30 minutes after you save prevent saving and droping items for dupe.
 

AriesX_420

Active Member
Reaction score
1
Trigger:
  • SaveLoad Save All
    • Events
      • Player - Player 1 (Red) types a chat message containing -save as An exact match
      • Player - Player 2 (Blue) types a chat message containing -save as An exact match
      • Player - Player 3 (Teal) types a chat message containing -save as An exact match
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (THE UNIT GROUP VARIABLE)) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Item carried by (Picked unit) in slot (Integer A))) Not equal to (Triggering player)
            • Then - Actions
              • Item - Remove (Item carried by (Picked unit) in slot (Integer A))
            • Else - Actions
          • Hero - Drop (Item carried by (Picked unit) of type Whatever) from (Picked unit)
          • Hero - Drop (Item carried by (Picked unit) of type whatever) from (Picked unit)

Then save the hero in same trigger.

I havnt fully tested this last trigger here, but it should work.. if what buddy said up top is true... using interger A instead of slot 1,2,3,4,5,6.
I still dont know if you need to set interger A to anything though..

So this trigger if you save it will drop all items on that hero that arnt yours, and if some items you dont want saving at all regardless of who owns it. Those are for what the last 2 Hero - Drops are for.
 

AriesX_420

Active Member
Reaction score
1
To sum it up i guess as this took me a while to figure out


Item Ownership works, as im sure variables setting, hashtables, and custom values work.

Which ever method is easiest i say go for it.

These rather crazy triggers i made up, are if you want your save/load ORPG !!Items!! to be exchanged between heroes and still not have the Heroes duplicate the Items. Look back on the previous page to see the triggers.

*So you must wait 30 minutes if someone else gives you an item before that item becomes yours..

*If you buy an item it becomes yours right away

*(Also if you create items for units, change last create item to owner of trigger unit) or however you need it to be... insuring that item becomes that players right away

*If you -repick it selects all items on the ground and in everyones inventory owned by repicker, and removes them. Unless 30 minutes are up.^

*If a Hero leaves game it removes items same way as -repick. ^
(Might take this out, dont know if its needed anymore, however it might be good to leave in.

*If you -save it will drop all items that were given too you by other players, unless 30 minutes are up.

*If you -save you cant drop items for 30 minutes (Do i still need this, keeping it for safety)


Wow rpgs are fun to make :thdown: If anyone find anything wrong with these triggers... Please help me out. You might say that 1000 wait trigger will lag it up if someone keeps droping and picking it up... But its a smaller trigger and the only way people really get items usually... is through buying them or having one created for them... There is also major level requirements, and you cant exchange gold.
 

AriesX_420

Active Member
Reaction score
1
BTW i dunno about advertising but this map that i have created all this for is on battle.net, east coast usually. Its in its MID Beta Testing, I keeping adding stuff to it all the time, messing things up lol.

Its called the DAEMONIC SWORD ORPG

Its got a Main quest, you can be evil and good, lots of items.

BUT IT STILL NEEDS TESTING...

and i figured what better people to help test my map then the best WC3 Map editors out there. My user name on battle.net is the same add me if you can help me beta test my map..

Its a solo project, i only have one of guy making my Special effects because i trust him not to wonder off on other parts of my world.

dont take this as advertising, im not asking you to buy anything just help test my triggers the fun way!! :thup:
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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