• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Item for class / no more than one

Status
Not open for further replies.
Level 6
Joined
Apr 16, 2011
Messages
158
hello galley
Lets explain me my situation,
I Have different classes in my map (Mage and Duelist) and I want that each class, can only catch items of his/her class, I made that in two triggers:
  • Mage
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Item-type of (Item being manipulated)) Equal to Air Orb
          • (Item-type of (Item being manipulated)) Equal to Aquariuns Orb
          • (Item-type of (Item being manipulated)) Equal to Darkness Orb
          • (Item-type of (Item being manipulated)) Equal to Divine Orb
          • (Item-type of (Item being manipulated)) Equal to Elemental Orb
          • (Item-type of (Item being manipulated)) Equal to Flame Orb
          • (Item-type of (Item being manipulated)) Equal to Magma Orb
          • (Item-type of (Item being manipulated)) Equal to Nature Orb
          • (Item-type of (Item being manipulated)) Equal to Plasma Orb
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Name of (Hero manipulating item)) Equal to Mage
        • Then - Actions
        • Else - Actions
          • Hero - Drop (Item being manipulated) from (Hero manipulating item)
  • Pickup Weapon Condition
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Item-type of (Item being manipulated)) Equal to Air Orb
          • (Item-type of (Item being manipulated)) Equal to Aquariuns Orb
          • (Item-type of (Item being manipulated)) Equal to Darkness Orb
          • (Item-type of (Item being manipulated)) Equal to Divine Orb
          • (Item-type of (Item being manipulated)) Equal to Elemental Orb
          • (Item-type of (Item being manipulated)) Equal to Flame Orb
          • (Item-type of (Item being manipulated)) Equal to Magma Orb
          • (Item-type of (Item being manipulated)) Equal to Nature Orb
          • (Item-type of (Item being manipulated)) Equal to Plasma Orb
    • Actions
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Item-type of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to Air Orb
                  • (Item-type of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to Aquariuns Orb
                  • (Item-type of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to Darkness Orb
                  • (Item-type of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to Divine Orb
                  • (Item-type of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to Elemental Orb
                  • (Item-type of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to Flame Orb
                  • (Item-type of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to Magma Orb
                  • (Item-type of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to Nature Orb
                  • (Item-type of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to Plasma Orb
            • Then - Actions
              • Set AlreadyCarryingEquip = (AlreadyCarryingEquip + 1)
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • AlreadyCarryingEquip Greater than or equal to 1
          • And - All (Conditions) are true
            • Conditions
              • (Unit-type of (Hero manipulating item)) Equal to Mage
        • Then - Actions
          • Hero - Drop (Item being manipulated) from (Hero manipulating item)
        • Else - Actions
          • Set AlreadyCarryingEquip = -1
this trigger causes a delay (lag), a way exists of doing that system without causing that delay (lag) ?
Does a way exist of to classify the items (weapons, boots, helmets) and to do with what each class doesn't diffuse more than an item of the type?

Thank you for his/her attention, excuses if I was not clear or for English
:Goblin_good_job:
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
EDIT: Updated.

Here's a lagless system for that: Item system


  • IC Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set ICHT = (Last created hashtable)
      • -------- -------------------------------------------- --------
      • -------- -------------------------------------------- --------
      • -------- Set unit type 1 --------
      • -------- -------------------------------------------- --------
      • Custom script: set udg_int1= 'Hpal'
      • -------- -------------------------------------------- --------
      • -------- Claws of Attack +15 --------
      • Custom script: set udg_int2= 'ratf'
      • Hashtable - Save True as int2 of int1 in ICHT
      • -------- -------------------------------------------- --------
      • -------- Set unit type 2 --------
      • -------- -------------------------------------------- --------
      • Custom script: set udg_int1= 'Hblm'
      • -------- -------------------------------------------- --------
      • -------- Sobi Mask --------
      • Custom script: set udg_int2= 'rwiz'
      • Hashtable - Save True as int2 of int1 in ICHT
  • IC Acquire
    • Events
      • Unit - A unit Acquires an item
      • Unit - A unit Loses an item
    • Conditions
    • Actions
      • Custom script: if GetHandleId(GetTriggerEventId()) == 49 then
      • Custom script: if not(LoadBoolean(udg_ICHT, GetUnitTypeId(GetTriggerUnit()), GetItemTypeId(GetManipulatedItem()))) then
      • Hero - Drop (Item being manipulated) from (Triggering unit)
      • Set Force = (Player group((Triggering player)))
      • Game - Display to Force the text: |cffffcc00Can not ...
      • Custom script: call DestroyForce(udg_Force)
      • Custom script: else
      • Custom script: if not(LoadBoolean(udg_ICHT, GetHandleId(GetTriggerUnit()), GetItemTypeId(GetManipulatedItem()))) then
      • Custom script: call SaveBoolean(udg_ICHT, GetHandleId(GetTriggerUnit()), GetItemTypeId(GetManipulatedItem()), true)
      • Custom script: else
      • Trigger - Turn off (This trigger)
      • Hero - Drop (Item being manipulated) from (Triggering unit)
      • Set Force = (Player group((Triggering player)))
      • Game - Display to Force the text: |cffffcc00The hero...
      • Custom script: call DestroyForce(udg_Force)
      • Trigger - Turn on (This trigger)
      • Custom script: endif
      • Custom script: endif
      • Custom script: else
      • Custom script: call SaveBoolean(udg_ICHT, GetHandleId(GetTriggerUnit()), GetItemTypeId(GetManipulatedItem()), false)
      • Custom script: endif


You have to initialize each item you can pick up for each unit type.

In my example trigger, I initialize Claws of Attack +15 (ratf) for a Paladin (Hpal) and Sobi Mask (rwiz) for Blood Mage (Hblm).

You don't have to initialize item types you can not pick up, only the ones you can.

Use unit/item raw codes, press Ctrl + D in object editor to see them.
 
Last edited:
Level 6
Joined
Apr 16, 2011
Messages
158
itemtype.jpg


I find strange, here still it is possible two items of same type if it tries twice.I am ordering an image of a glance '-'
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
I find strange, here still it is possible two items of same type if it tries twice.

Could you tell me what do you do to get both items?

1. Pick up item #1
2. Try to pick up item #2
3. Try to pick up item #2 again

Like that? I can' pick up two masks.

I am ordering an image of a glance '-'

I'm not sure what you mean by that.
 
Level 6
Joined
Apr 16, 2011
Messages
158
1.Catch one mask
2.Catch another mask
3.You will not get
4.Try again
5.you could get 2 masks,This could not be possible
---
"I am ordering an image of a glance " = I was sending a picture but could not


thank you for her attention
 
Status
Not open for further replies.
Top