• 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.

Item Requriements

Status
Not open for further replies.
Level 13
Joined
Jun 3, 2011
Messages
1,058
Hi there, how can i make a item that requires you to be a archer, swordsman, mage, assassin, etc. to equip that item, and you need to be in that level to use it can you teach me please
 
Level 12
Joined
Sep 11, 2011
Messages
1,176
i'm sorry for double post, i gave you the wrong trigger. really sorry for the mistake. below is the right one

  • Item
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Tome of Experience
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • (Unit-type of (Triggering unit)) Equal to Archer
              • (Level of (Triggering unit)) Greater than or equal to 7
        • Then - Actions
        • Else - Actions
          • Hero - Drop (Item being manipulated) from (Triggering unit)
 
Last edited:
Level 12
Joined
Sep 11, 2011
Messages
1,176
i'm sorry for double post. Legendary, i gave you the wrong trigger. really sorry for the mistake. below is the right one

  • Item
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Sun Key
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • (Unit-type of (Triggering unit)) Equal to Archer
              • (Level of (Triggering unit)) Greater than or equal to 7
        • Then - Actions
        • Else - Actions
          • Hero - Drop (Item being manipulated) from (Triggering unit)
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
Ow thanks

basically i can tell in short words too:

u can use the item levels, if u hold shift then u can type any number in object editor at item - item level field or what and u can use this for anything what u want like:

you make 10 bow and 10 sword then u can change the item levels like this:

bow1 - item level 1000
bow2 - item level 1001
bow3 - item level 1002
bow4 - item level 1003
bow5 - item level 1004
bow6 - item level 1005
bow7 - item level 1006
bow8 - item level 1007
bow9 - item level 1008
bow10 - item level 1009
sword 1 - item level 1050
sword 2 - item level 1051
sword 3 - item level 1052
sword 4 - item level 1053
sword 5 - item level 1054
sword 6 - item level 1055
sword 7 - item level 1056
sword 8 - item level 1057
sword 9 - item level 1058
sword 10 - item level 1059

then u check item level and if it is between 1000 and 1009 then it is = bow and drop if u arent archer
else if it is between 1050 and 1059 then it is = sword and drop if u arent fighter

how u add more requiments?
just attach data to item levels, example u make a integer array then at map init do this
integer[1000] = 5
integer[1001] = 6
integer[1002] = 7

//we use a integer variable array only for be more short the code
//Set A = (Item level of (Item being manipulated))
something like this
  • Untitled Trigger 003
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • Set A = (Item level of (Item being manipulated))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • A Greater than or equal to 1000
          • A Less than 1010
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • (Unit-type of (Triggering unit)) Not equal to Archer
                  • (Hero level of (Triggering unit)) Less than integer[A]
            • Then - Actions
              • Hero - Drop (Item being manipulated) from (Triggering unit)
            • Else - Actions
        • Else - Actions
 
Level 11
Joined
Oct 31, 2010
Messages
1,057
pardon me if i am wrong, but i think shadowvzs's "system" requires lesser effort then your trigger O:, because the thing needed to change is just the item level while yours require us to change 3 stuffs
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
pardon me if i am wrong, but i think shadowvzs's "system" requires lesser effort then your trigger O:, because the thing needed to change is just the item level while yours require us to change 3 stuffs

System is a bit messed up anyway :)

Ill fix it and re-post if OP desires, but i dont even know why i made it, just bored i guess.

e/ herp de derp error

JASS:
library ClassReq initializer init
    globals
        hashtable ClassReqHash = InitHashtable()
    endglobals
    private function onItemPickup takes nothing returns nothing
        local unit picker = GetManipulatingUnit()
        local item manip = GetManipulatedItem()
        local integer manipID = GetItemTypeId(manip)
        local integer unitID = GetUnitTypeId(picker)
        local player p = GetOwningPlayer(picker)
        local integer playerID = GetPlayerId(p)
        local integer i = 1
        local integer i2
        local boolean trueCheck = LoadInteger(ClassReqHash, 1, manipID) > 5
        local boolean b = false
        if not trueCheck  then
            return
        endif
        set trueCheck = LoadInteger(ClassReqHash, 0, manipID) < GetHeroLevel(picker)
        loop
            set i2 = LoadInteger(ClassReqHash, i, manipID)
            if i2 > 5 then
                set b = b or i2 == unitID
                set i = i + 1
            else
                exitwhen true
            endif
        endloop
        if not(trueCheck and b) then
            call UnitRemoveItem(picker, manip)
            if not b then
                call DisplayTimedTextToPlayer(p, 0, 0, 15, GetUnitName(picker) + " cannot equip " + GetItemName(manip))
            else
                call DisplayTimedTextToPlayer(p, 0, 0, 15, GetUnitName(picker) + " is too low to equip " + GetItemName(manip))
            endif
        endif
        set picker = null
        set manip = null
        set p = null
    endfunction
        
    function RegisterItem takes nothing returns nothing
        local integer i = 0
        call SaveInteger(ClassReqHash, 0, udg_ClassReqItem, udg_ClassReqLevel)
        loop
            if udg_ClassReqUnit[i] > 5 then
                call SaveInteger(ClassReqHash, i + 1, udg_ClassReqItem, udg_ClassReqUnit[i])
                set i = i + 1
            else
                exitwhen true
            endif
        endloop
    endfunction
    private function init takes nothing returns nothing
        local trigger t = CreateTrigger()
        call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_PICKUP_ITEM)
        call TriggerAddAction(t, function onItemPickup)
    endfunction

endlibrary

To use, create a trigger, name it ClassReq, select it, go to Edit, go to Convert to Custom Text, and paste all of that text into the trigger.

Usage Example

  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set ClassReqItem = Mask of Death
      • Set ClassReqUnit[0] = Paladin
      • Set ClassReqLevel = 11
      • Custom script: call RegisterItem()
      • Set ClassReqItem = Partial Key of the Three Moons
      • Set ClassReqUnit[0] = Paladin
      • Set ClassReqUnit[1] = Archmage
      • Set ClassReqLevel = 0
      • Custom script: call RegisterItem()
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
shadow, there's no need to loop through Id's. You save the data on Map Init and retrieve only the data from the Acquired Item Id. It's faster than looping.

Some use the Item Level as an Item Class, so you just check "if Item Level is = 6 and Unit Type = Footman, drop item" asuming "lvl 6" is equal to bow or something a footman shouldn't be able to wear.
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
shadow, there's no need to loop through Id's. You save the data on Map Init and retrieve only the data from the Acquired Item Id. It's faster than looping.

Some use the Item Level as an Item Class, so you just check "if Item Level is = 6 and Unit Type = Footman, drop item" asuming "lvl 6" is equal to bow or something a footman shouldn't be able to wear.

u dont got what i mean, lets say i have 10 bow, 10 sword ,10 axe ,10 dagger ,10 staff, 10 wand etc, i can set the damage/level requiment in a single loop dont need make for each weapon +1 row, and if have many stat what u want attach to item then u avoid alot line with loop
 
Last edited:
Status
Not open for further replies.
Top