• 🏆 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!

Simple Item Bound System v1.1 [GUI]

This bundle is marked as useful / simple. Simplicity is bliss, low effort and/or may contain minor bugs.
- This system allows your item to be preserved for one Player only.
- It is useful for RPGs or even AoS-type map, let your imagination runs wild
- It is in GUI !


External Instruction:
- Open World Editor - File -> Preferences... - General Tab - Tick the Automatically create unknown variables while pasting trigger data.
- Copy the folder Simple Item Bound System and paste it in your Trigger Editor.
- DONE !


  • IB Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- IB_FloatingTextLifeTime sets the duration of the Floating Text --------
      • -------- IB_FloatingTextLifeTimeFade sets the fading duration of the Floating Text, it is suggested this value should be half the IB_FloatingTextLifeTime value --------
      • -------- IB_FloatingTextSpeed sets the speed of the Floating Text --------
      • -------- IB_WarningMessage sets the message that would appear for the Floating Text, you should leave a space at end of the message --------
      • -------- ---------- --------
      • -------- DATA CONFIGURABLES --------
      • Set IB_FloatingTextLifeTime = 5.00
      • Set IB_FloatingTextLifeTimeFade = 2.50
      • Set IB_FloatingTextSpeed = 32.00
      • -------- END OF DATA CONFIGURABLES --------
      • -------- ---------- --------
      • -------- MISC CONFIGURABLES --------
      • Set MessageColor = |cffffcc00
      • Set IB_WarningMessage = This item is bounded to:
      • -------- END OF MISC CONFIGURABLES --------
      • -------- ---------- --------
      • Custom script: set udg_IB_Hashtable = InitHashtable()
      • Set PlayerColor[1] = |CFFFF0303
      • Set PlayerColor[2] = |CFF0042FF
      • Set PlayerColor[3] = |CFF1CB619
      • Set PlayerColor[4] = |CFF540081
      • Set PlayerColor[5] = |CFFFFFF01
      • Set PlayerColor[6] = |CFFFE8A0E
      • Set PlayerColor[7] = |CFF20C000
      • Set PlayerColor[8] = |CFFE55BB0
      • Set PlayerColor[9] = |CFF959697
      • Set PlayerColor[10] = |CFF7EBFF1
      • Set PlayerColor[11] = |CFF106246
      • Set PlayerColor[12] = |CFF4E2A04
  • IB Event
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • Set IB_Item = (Item being manipulated)
      • Custom script: set udg_IB_Key = GetHandleId(udg_IB_Item)
      • Custom script: if HaveSavedBoolean(udg_IB_Hashtable, udg_IB_Key, 0) then
      • Set IB_PlayerOwned = (Load 1 of IB_Key in IB_Hashtable)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Triggering player) Equal to IB_PlayerOwned
        • Then - Actions
        • Else - Actions
          • Set TempPlayerGroup = (Player group((Triggering player)))
          • Hero - Drop IB_Item from (Triggering unit)
          • Floating Text - Create floating text that reads ((MessageColor + IB_WarningMessage) + (PlayerColor[(Player number of IB_PlayerOwned)] + ((Name of IB_PlayerOwned) + |r))) above (Triggering unit) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
          • Set TempFloatingText = (Last created floating text)
          • Floating Text - Hide TempFloatingText for (All players)
          • Floating Text - Show TempFloatingText for TempPlayerGroup
          • Floating Text - Set the velocity of TempFloatingText to IB_FloatingTextSpeed towards (Random angle) degrees
          • Floating Text - Change TempFloatingText: Disable permanence
          • Floating Text - Change the lifespan of TempFloatingText to IB_FloatingTextLifeTime seconds
          • Floating Text - Change the fading age of TempFloatingText to IB_FloatingTextLifeTimeFade seconds
          • Custom script: call DestroyForce(udg_TempPlayerGroup)
      • Custom script: else
      • Set IB_IsOwned = True
      • Set IB_PlayerOwned = (Triggering player)
      • Hashtable - Save IB_IsOwned as 0 of IB_Key in IB_Hashtable
      • Hashtable - Save Handle OfIB_PlayerOwned as 1 of IB_Key in IB_Hashtable
      • Custom script: endif
- RPGs which I cannot remember its name anymore
Magtheridon96 - Trigger optimization
Kingz - Floating Text configurables


v1.0
- Initial release

v1.1
- Added message configurable
- Added floating text configurable
- Triggers optimized a bit
- Added comments for documentation


Keywords:
simple, item, bound, system, rpg, defskull, player, own, mute.
Contents

Just another Warcraft III map (Map)

Reviews
12th Dec 2015 IcemanBo: Too long as NeedsFix. Rejected. 08:52, 17th Aug 2012 Magtheridon96: Okay, the boolean check doesn't actually make it better than the previous version. You're not supposed to save any boolean of any kind, just the player...

Moderator

M

Moderator

12th Dec 2015
IcemanBo: Too long as NeedsFix. Rejected.

08:52, 17th Aug 2012
Magtheridon96: Okay, the boolean check doesn't actually make it better than the previous version.
You're not supposed to save any boolean of any kind, just the player id.
You would check if the player id has been stored in the hashtable.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Well if that's the idea, it is awesome :)
Might add that feature for the next version.

But that would require a check of order string per order by player, it would lag throughout the game ?
Because the event is Unit - A unit is issued an order targeting an object, that occurs each time the player order unit(s) to move right ?

Player won't move their unit by using the "Move" ability, but instead just 'smart' order.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
move is a point, object means when you right click some object, unit, tree, building
smart is right clicking however
well, you can check if the target of issued order is item in conditions.
Ahhh this could be nice if we can totally prevent the unit to acquire item that is near to them.
Because my plan is to order 'Stop' to a unit that order 'smart' to an item that does not belong to that player owning the unit.
This works well, but, I must put a Wait of 0.00 seconds before I order the unit to stop (if I don't put the Wait of 0.00 seconds, the unit will ignore the 'Stop' order via triggers, because it happens too fast).

Well, even a Wait of 0.00 seconds has its own delay, it has no problem when the item is afar from the unit (let's say the unit is 600 range from the item), it has a small delay like 0.25 seconds before the unit is stopped, therefore the unit succeed to move like 100 ~ 150 range towards the item before it is stopped and the Floating Text appears.

But, when the Unit and the Item is close (minimum pick item range), the unit is too close and the order is too slow, causing the unit to pick that item first before it can be stopped by ordering 'Stop' order via trigger.

It is flawed when near, but works good when afar.

Therefore, I'd like to stick to the current method.
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
do what Bribe(Appologies, again, the b and d are so similar...) did in his GUI friendly DDS(idk if he did it with the timers but he did that ExecuteFunc thingy).
  • Events - whatever
  • Conditions - whatever
  • Actions -
    • Custom script: call ExecuteFunc("ThisFunc")
    • Custom script: endfunction
    • Custom script:
    • Custom script: function TheTimerExpiresHere takes nothing returns nothing
    • Custom script: local timer t = GetExipredTimer()
    • Custom script: call BlaBlaBla...
    • Custom script: call DestroyTimer(t)
    • Custom script: set t = null
    • Custom script: endfunction
    • Custom script:
    • Custom script: function ThisFunc takes nothing returns nothing
    • Custom script: local timer t
    • Custom script: if ... then
    • Custom script: set t = CreateTimer() // this is because we dont want to create timer every time the unit is ordered, if you dont filter it right in the Conditions.
    • Custom script: call TimerStart(t, 0.00, false, function TheTimerExpiresHere)
    • Custom script: endif
    • Custom script: set t = null
    • Custom script: endfunction
of course not every line needs to be custom script but to give you idea how to do it.
However remember that if you start timer and you want it to expire in function inside the trigger then you must have the function ABOVE it.

You can also just create one more trigger with event - thetimer expires with global timer which exires in 0.00 and when it expires do the stop order etc... :D
 
Last edited:
Level 25
Joined
Jun 5, 2008
Messages
2,572
Isn't this a bit too simple?
It revolves around you saving data to hashtables using the handle of the item and then just checking the data later.

I guess it could be a good sample, but nothing anyone can't make in about 10 minutes if they know how to use a hashtable.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
do what bride did in his GUI friendly DDS(idk if he did it with the timers but he did that ExecuteFunc thingy).
  • Events - whatever
  • Conditions - whatever
  • Actions -
    • Custom script: call ExecuteFunc("ThisFunc")
    • Custom script: endfunction
    • Custom script:
    • Custom script: function TheTimerExpiresHere takes nothing returns nothing
    • Custom script: local timer t = GetExipredTimer()
    • Custom script: call BlaBlaBla...
    • Custom script: call DestroyTimer(t)
    • Custom script: set t = null
    • Custom script: endfunction
    • Custom script:
    • Custom script: function ThisFunc takes nothing returns nothing
    • Custom script: local timer t
    • Custom script: if ... then
    • Custom script: set t = CreateTimer() // this is because we dont want to create timer every time the unit is ordered, if you dont filter it right in the Conditions.
    • Custom script: call TimerStart(t, 0.00, false, function TheTimerExpiresHere)
    • Custom script: endif
    • Custom script: set t = null
    • Custom script: endfunction
of course not every line needs to be custom script but to give you idea how to do it.
However remember that if you start timer and you want it to expire in function inside the trigger then you must have the function ABOVE it.

You can also just create one more trigger with event - thetimer expires with global timer which exires in 0.00 and when it expires do the stop order etc... :D
By using global timer of expiring time of 0.00, are you sure it will stop the unit instantly ?
Meaning that, even if the unit is in minimum range of item pick, the 0.00 timer, helps ?
I don't think so, but I did not test it yet.

Isn't this a bit too simple?
It revolves around you saving data to hashtables using the handle of the item and then just checking the data later.

I guess it could be a good sample, but nothing anyone can't make in about 10 minutes if they know how to use a hashtable.
And yeah, THW consists of community that knows how to use Hashtable / Indexing.
There are no person at all in this community that don't know how to handle Hashtable / Indexing.
This system is aimed for people like Bribe, Magtheridon, Pharaoh_, yeah, they should use this system, it suits for them.
This system is not suitable at all for person that don't know Hashtable / Indexing, not at all.


i am just pointing out that it is really simple and easy to make yourself.
Like I said, all person in THW knows how to handle data with Hashtable / Indexing, there are no person at all that don't know Hashtable / Indexing, all has the same ability like you, to create this easy system in 10 minutes.
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
There are no person at all in this community that don't know how to handle Hashtable / Indexing.
This system is aimed for people like Bribe, Magtheridon, Pharaoh_, yeah, they should use this system, it suits for them.
This system is not suitable at all for person that don't know Hashtable / Indexing, not at all.

lol at the sarcasm

LOL AT there actually is (sarcasm)

it runs instantly after the last started thread/t/whatever I assume as its 0.00, it runs right after you start turning.
Even Damage detection systems uses it because if you dont use wait and for instance heal the unit you heal him and then he takes damage so you not really heal anything :D
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
it runs instantly after the last started thread/t/whatever I assume as its 0.00, it runs right after you start turning.
By mean "turning", are you referring to the turning Movement - Turn Rate ?
Well if you are referring to this, it can be done if the item is at the back of the unit (provided that the unit must turn back first before acquiring the item, therefore time can be delayed there).

But what happens if the item is at in front of the unit... ?
I bet it would be instant, meaning that the item is still acquired by the unit, only then the unit is issued stop order (too late)
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
It works, tested this:
JASS:
globals
    unit u
endglobals

function TehTimer takes nothing returns nothing
    local timer t = GetExpiredTimer()
    call IssueImmediateOrder(u, "stop")
    call BJDebugMsg("This Item Is Not YOURS!!!")
    call DestroyTimer(t)
    set t = null
endfunction

function Trig_Untitled_Trigger_001_Conditions takes nothing returns boolean
    local timer t
    set u = GetTriggerUnit()
    if GetOrderTargetItem() == gg_item_ratf_0010 then
        set t = CreateTimer()
        call TimerStart(t, 0.00, false, function TehTimer)
    endif
    set t = null
    return false
endfunction

//===========================================================================
function InitTrig_Untitled_Trigger_001 takes nothing returns nothing
    set gg_trg_Untitled_Trigger_001 = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_Untitled_Trigger_001, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER )
    call TriggerAddCondition( gg_trg_Untitled_Trigger_001, Condition( function Trig_Untitled_Trigger_001_Conditions ) )
endfunction
and it fires even before you start turning to pickup item, I was staying right on the item and you still wont pick it up
you just need to loop through the hashtable.
Also Im using Condition as actions because its a lot faster, you can still use actions as normally.

edit: Instead of using Unit - order blabla to stop you can use custom script: call IssueImmediateOrder(whichunit, "stop"), I think its a little bit faster
 
Level 25
Joined
Jun 5, 2008
Messages
2,572
Like I said, all person in THW knows how to handle data with Hashtable / Indexing, there are no person at all that don't know Hashtable / Indexing, all has the same ability like you, to create this easy system in 10 minutes

And if i were as snappy as you i could say that not everyone knows to open up the trigger editor thus even simple spells should be allowed in the spell section, which is plain dumb.

Your reaction to the plain fact i pointed out doesn't make this system any more useful nor any more better, it just shows you can't take any kind of criticism well.

And to think you actually think other people ruin your "reputation" other than you.
 
Well, bar the floating text, this system Would/Could be as short as 13 lines. (assuming modified to just check the owners instead of using the pretense checker of it being owned by anybody and see if the data exists as Maker said) The floating text part of this system, is actually longer than the "functioning" part of the system, as it is 16 lines, just thought it'd be worth pointing out.

Additionally, thought it was worth pointing out, that the map makers, whom make "decent" maps, tend to know about leaks/removing leaks and are actually not that code blind. They -probably- would know how to go about creating this, it saves time, but I thought that was worth knowing.

As for my critique, I don't have much to add other than to do as Maker suggests to further compact it.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
You don't necessarily need the IsOwned boolean, you can check whether the player data exists or not instead.
How to check Player Data... ?

And if i were as snappy as you i could say that not everyone knows to open up the trigger editor thus even simple spells should be allowed in the spell section, which is plain dumb.
You stated that as if all people on THW are a professional triggerer, compared to my current setup trigger, it's easier to configure rather than to do it for yourselves.
Don't think all person has the same capabilities as you.

Your reaction to the plain fact i pointed out doesn't make this system any more useful nor any more better, it just shows you can't take any kind of criticism well.
If you have your opinion, what makes you think that other people can't share their opinions too ?
I just shared my opinion, who said I was flaming and raging about the opinion you stated earlier ?

And to think you actually think other people ruin your "reputation" other than you.
This is getting personal, don't bring other thread's problem to another thread, it looks you're harassing, seriously stop it.

Kingz, I'm afraid I have to ask you to stop further commenting on this thread, I hate to argue with you any further, just drop it.
Just leave if you have nothing to say about the resource itself, your opinion will stay as your opinion, just focus on the resource, not the "idea" of it like "hey diz iz stoopeed sistem me can doo it in liek 5 minit".
 
Level 25
Joined
Jun 5, 2008
Messages
2,572
You stated that as if all people on THW are a professional triggerer, compared to my current setup trigger, it's easier to configure rather than to do it for yourselves.
Don't think all person has the same capabilities as you.
Don't turn this against me, i didn't start this argument i shared a valid opinion to which you responded with hostility.

On the resource itself:
It is missing a configuration block, all of the following should be configurable:
* Message layout which is shown
* Message color
* Message size
* Texttag velocity
* Texttag duration
* Texttag fade period
* Texttag z offset

And all of it should be present in the map initialization trigger with more documentation since if this is to be a system, hardcoded values shouldn't be present in such a number, you have to make it configurable.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
* Message layout which is shown
What other message would it be other than showing that whose item is it ?
I guess the current message is pretty clear for this particular system.

* Message color
I already included message color to vary with Player Color, what's more to it ?
For the basic message, I colored it a bit gold, I think that color pretty much emphasize on the message.

* Message size
Current size is readable, that's good enough.

* Texttag velocity
* Texttag duration
* Texttag fade period
* Texttag z offset
I might or might not include these configurables, since it is not the main focus of this system, also, current setup gives much time for the Player to read it (3 seconds), I think that's good enough.

Boolean -> Hashtable value exists
How do I do this in trigger ?
I'm still quite unsure what you're talking about.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Make the text tag values configurable
Done

JASS:
if HaveSavedInteger(udg_hashtable, key1, key2) then
    // the item is owned blabla
    // blablabla
else
    // the item is not owned
    // blablabla
endif
Okay, changed it.
But I wanna know this, what's the difference between using this method and my method ?
Is it just to improve performance ?
 
Level 19
Joined
Feb 25, 2009
Messages
2,004
You can give the unit a "Move" order at its current position instead of "Stop" it will not ignore it, and it works the same as stop.
Also I don't think texttags is the best way to inform a player if the item does not belong to him. You could've used this:

call DisplayTimedTextToPlayer (GetOwningPlayer(GetTriggerUnit), 0.52, 0.96, 2.00, "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nERROR HERE.|r")

It prints a message similar to the basic Warcraft 3 error messages.
And even more, you can add a protection trigger that disables players to destroy (attack) an item which again doesn't belong to them.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Okay, the boolean check doesn't actually make it better than the previous version.
You're not supposed to save any boolean of any kind, just the player id.
You would check if the player id has been stored in the hashtable.
Can you show me the most easiest example that you can think of ?
I have no idea what you were trying to say.
 
Top