• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[General] Name over item System, help?

Status
Not open for further replies.
Level 17
Joined
Mar 21, 2011
Messages
1,597
unless I misunderstood you, you can easily do that with bribe's unit indexer.
Unit indexer only indexes units afaik, not items.

Setting the items' custom value to the player number seems wrong to me, as this would only allow to track one floating text (= one item) per player at a time.

You would need to create an item indexer, and then save/load your data with the help of arrays

JASS:
integer i = Custom Value of Item
player p[i] = some_player
floatingtext ft[i] = some_floatingtext
 
in my trigger that I tried:
when a hero drops an item, the location of the item is set to(by wc3 engine) the location of the hero when he was ordered to drop it, instead of the drop location.
so:
I craeted a trigger that picks every item on ground every second. but im still thinking how to do it.

furthermore, when i tested, there no <order> when you order to drop an item or to pick it up

Also, I put custom value on item because i already have a soulbound system that uses it.
 
Last edited:
What do you think about this trigger?

  • Set PlayerName on Dropped Items
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Item - Pick every item in NOBLINK <gen> and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-class of (Picked item)) Not equal to Powerup
            • Then - Actions
              • For each (Integer A) from 1 to Item_Dropped_Counter, do (Actions)
                • Loop - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Picked item) Equal to Item_Dropped[(Integer A)]
                    • Then - Actions
                      • Set Item_Dropped_IsNotLabeled = False
                    • Else - Actions
                      • Floating Text - Destroy Item_Dropped_Text_Owner[(Integer A)]
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • Item_Dropped_IsNotLabeled Equal to True
                • Then - Actions
                  • Set TempP = (Position of (Picked item))
                  • Set TempP2 = (TempP offset by 50.00 towards 180.00 degrees)
                  • Set TempN = (Custom value of (Picked item))
                  • Set Item_Dropped_Counter = (Item_Dropped_Counter + 1)
                  • Set Item_Dropped[Item_Dropped_Counter] = (Picked item)
                  • -------- ------------------- --------
                  • Floating Text - Create floating text that reads (Name of (Player(TempN))) at TempP2 with Z offset 100.00, using font size 8.00, color (Color_R[TempN]%, Color_G[TempN]%, Color_B[TempN]%), and 0.00% transparency
                  • Set Item_Dropped_Text_Owner[Item_Dropped_Counter] = (Last created floating text)
                  • Custom script: call RemoveLocation(udg_TempP)
                  • Custom script: call RemoveLocation(udg_TempP2)
                  • Set Item_Dropped_IsNotLabeled = True
                • Else - Actions
            • Else - Actions
      • Set Item_Dropped_IsNotLabeled = True
 
Level 21
Joined
Mar 29, 2020
Messages
1,237
Unit indexer only indexes units afaik, not items.

I didn't mean directly. I meant to link it to the caster using the custom index. I haven't hashed out the details, but something like this:

Hero drops item:

Create dummy.

Set cv = custom value of dummy.

Set item[cv] = dropped item

Set player[cv] = triggering player

Create floating text on relevant point

FloatingText[cv] = last created floating text.


Hero picks up item:

Check for units of type dummy in range(1.) of point of manipulated item

Set cv = custom value of that dummy.

Etc’


Edit: - I'm not if the range has to be bigger than 1. does a dummy with no collision spawn directly on the item' s location, or does the game still move it off of the item's collision. if so the range will have to be bigger and then there is a slight chance of a problem if items are placed too close to each other...

Edit: a way you could get around the problem from my previous edit - scan through the dummies in range and only do the actions on it if it's "item[custom value of picked unit]" is the manipulated item.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,537
Variables:
Item = Item
ItemIndex = Integer
ItemOwner = Player [Array] <--- This could also be an Integer if you wanted to store their Player Number instead
ItemText = Floating Text [Array]
ItemPoint = Point
  • Acquire 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
          • (Custom value of (Item being manipulated)) Equal to 0
        • Then - Actions
          • Set VariableSet ItemIndex = (ItemIndex + 1)
          • Item - Set the custom value of (Item being manipulated) to ItemIndex
          • Set VariableSet ItemOwner[ItemIndex] = (Owner of (Triggering unit))
        • Else - Actions
          • Floating Text - Destroy ItemText[(Custom value of (Item being manipulated))]
  • Lose Item
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • (Custom value of (Item being manipulated)) Greater than 0
    • Actions
      • Custom script: local item i = GetManipulatedItem()
      • Wait 0.00 seconds
      • Custom script: set udg_Item = i
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item is owned) Equal to False
        • Then - Actions
          • Set VariableSet ItemPoint = (Position of Item)
          • Floating Text - Create floating text that reads (Name of (Owner of (Triggering unit))) at ItemPoint with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
          • Set VariableSet ItemText[(Custom value of Item)] = (Last created floating text)
          • Custom script: call RemoveLocation (udg_ItemPoint)
        • Else - Actions
      • Custom script: set i = null
It'd be better to use an Item Indexer system instead of my lazy method since I never de-index/recycle the indices -> Item Indexer v1.4.0 [GUI friendly]

You're limiting yourself by not using an Item Indexer, since you can only store a single Custom Value to an Item. The Indexer allows you to store an infinite number of Values to an Item. Your Soul Bound system and this Floating Text system could both easily work alongside one another if you used one.
 

Attachments

  • Item Name.w3m
    17.5 KB · Views: 7
Last edited:
Status
Not open for further replies.
Top