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

[Trigger] How to put Item Lvl Requirement

Status
Not open for further replies.
Level 3
Joined
Dec 23, 2009
Messages
32
My question is fairly simple but I have been trying to do it for several days now.. how do you put a lvl restriction on an item?

Example:

Item Name: Small Axe
Lvl: 2
Cost: 500 Gold

Please post the trigger if you know how to do it, +rep :)
 
I think you will need two items to do that, since requirements on item abilities don't seem to work for me.
So, have an item that does nothing at all and display in the tooltip the requirement.
Then, do this:
  • Trigger0
  • Events
    • Unit - A unit acquires an item
  • Conditions
    • (Item-type of (Item being manipulated)) Equal to Small Axe
    • (Hero level of (Triggering unit)) Less than 2
  • Actions
    • Unit Group - Add (Triggering unit) to Temp_Group
  • Trigger
  • Events
    • Unit - A unit gains a level
  • Conditions
    • (Hero level of (Triggering unit)) Equal to True
    • ((Triggering unit) is in Temp_Group) Equal to True
  • Actions
    • Unit Group - Remove (Triggering unit) from Temp_Group
    • For each (Integer A) from 1 to 6, do (Actions)
      • Loop - Actions
        • If (All conditions are true) then do (Actions)
          • If - Conditions
            • (Item-type of (Item carried by (Triggering unit) in slot (IntegerA)) Equal to Small Axe
          • Then - Actions
            • Item - Remove (Item carried by (Triggering unit) in slot (IntegerA) of type Small Axe)
            • Hero - Create Small Axe (Active) and give it to (Triggering unit)
          • Else - Actions
  • Trigger2
  • Events
    • Unit - A unit loses an item
  • Conditions
    • (Item-type of (Item being manipulated)) Equal to Small Axe
    • ((Triggering unit) is in Temp_Group) Equal to True
  • Actions
    • Unit Group - Remove (Triggering unit) from Temp_Group
 
Level 3
Joined
Dec 23, 2009
Messages
32
Okey Im pretty sure I understand this but do I really have to make 1050 triggers (350 items in map) ... :S + makeing 350 new items also takes some time.. is there any possible way to have ONE trigger which find the item in a variable I set in intialaiztion?

I tried

  • Starting Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Lvl 1-5 --------
      • Set CommonItemGroup[1] = Small Axe
      • Set CommonItemGroup[2] = Short Sword
      • Set CommonItemGroup[3] = Long Sword
(New item each lvl)

And then

  • Items Identify
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item being manipulated)) Equal to CommonItemGroup[HeroLvl[(Player number of (Owner of (Triggering unit)))]]
          • (Picked item) Equal to TempItem
        • Then - Actions
        • Else - Actions
          • Hero - Drop (Item being manipulated) from (Triggering unit)
(HeroLvl is a variable which is set to the hero lvl of the players hero)

But this only worked if you were that exact lvl, any way to change the

''Equal to CommonItemGroup[HeroLvl[(Player number of (Owner of (Triggering unit)))]]'' to
''Greater or Equal to CommonItemGroup[HeroLvl[(Player number of (Owner of (Triggering unit)))]]'' ?
 
Yes, do this:
  • Trigger
  • Events
    • Map Initialization
  • Conditions
  • Actions
    • Set LevelsRequired[1] = 2
    • Set LevelsRequired[2] = 4
    • Set LevelsRequired[3] = 14
    • Set FakeItems[1] = Gloves (x)
    • Set FakeItems[2] = Axe (x)
    • Set FakeItems[3] = Sword (x)
    • Set Items[1] = Gloves
    • Set Items[2] = Axe
    • Set Items[3] = Sword
  • Trigger
  • Events
    • Unit - A unit gains a level
  • Conditions
  • Actions
    • For each (IntegerA) from 1 to 3, do (Actions)
      • Loop - Actions
        • If (All conditions are true) then do (Actions) else do (Actions)
          • If - Conditions
            • (Item-type of (Item carried carried by (Triggering unit) in slot (IntegerA))) Equal to FakeItems[(IntegerA)]
          • Then - Actions
            • If (All conditions are true) then do (Actions) else do (Actions)
              • If - Conditions
                • (Hero level of (Triggering unit)) Equal to LevelsRequired[(IntegerA)]
              • Then - Actions
                • Item - Remove (Item-type of (Item carried by (Triggering unit) in slot (IntegerA) of type FakeItems[(IntegerA)]
                • Hero - Create Items[(IntegerA)] and give it to (Triggering unit)
              • Else - Actions
          • Else - Actions
Not completely sure if this is going to work, but let me know.
 
Level 13
Joined
Feb 18, 2009
Messages
1,381
I am not sure if you by now have editted it, but the FakeItems, is that a item which does not give any attack or stat plus?
 
Level 13
Joined
Feb 18, 2009
Messages
1,381
Pharaoh_ would it work with a CustomInventory as Anachrons? I guess so, but i am not completely sure.
 
Level 3
Joined
Dec 23, 2009
Messages
32
I just noticed that will this work if I increase the ''For each Integrer from 1 to 3'' to something ABOVE 6?
 
Pharaoh_ would it work with a CustomInventory as Anachrons? I guess so, but i am not completely sure.
Pharaoh_ would it work with a CustomInventory as Anachrons? I guess so, but i am not completely sure.
I created an callback for checking whether the item conditions are met.
Basically, you can use any condition you'd like to have.
 
Level 13
Joined
May 11, 2008
Messages
1,198
i got a way. make custom researches. set those research id to integer array.
so, level 10 item research level might be itemresearch[10]. make the trigger do, a hero gains a level event...it'll learn him itemresearch[getherolevel]. and make the items that require level 10 requre the tech.

i think this method merely prevents buying...i'm thinking it does nothing to prevent pickup of items...so if an item drop requires level 10...you might be able to use it if you're level 9. i haven't tested this yet, though, it's just a guess. but obviously it shouldn't be hard to control what items are dropping depending on the hero level...if those items would even be allowed. it's just that if it's a multiplayer map then a guy could get level 10 faster than other players, and buy the item for his buddy that wants it who is lower level...that could be an exploit.

like i said, i didn't test how the requirements work on items yet. but i'll do so soon.
 
Status
Not open for further replies.
Top