• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

trigger for item creation

Status
Not open for further replies.
Level 3
Joined
Feb 18, 2017
Messages
31
Hello everyone,

i can't figure out this trigger.


- A hero kills a special creep.
- The hero gets an item when he has space in his inventory.
- The item gets deleted from the game when there is no space in his inventory.

I know how i can give the item but i can't figure out how to check if he has inventory space and then delete the item.

Appreciate any help!
 
You could try with something like this:

  • 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
          • (Item carried by YourHero in slot (Integer A)) Not equal to No item
        • Then - Actions
          • Set Int_SpaceFilled = (Int_SpaceFilled + 1)
        • Else - Actions
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Int_SpaceFilled Equal to 6
    • Then - Actions
      • Item - Remove YourItem
    • Else - Actions
Theoretically, the integer should return 6 (aka the number of occupied inventory slots in your hero), and if so, the item is deleted. That seems a bit convoluted but I can't think of anything more simple :grin:
 
Pretty much the same as what Chaosium posted but inverted and added exitwhen true.
  • For each (ItemL) from 1 to 6, do (Actions)
    • Loop - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item carried by Hero in slot (ItemL)) Equal to No item
        • Then - Actions
          • Hero - Give Item to Hero
          • Custom script: exitwhen true
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ItemL Equal to 6
            • Then - Actions
              • Item - Remove Item
            • Else - Actions
 
You can do it even simpler:

  • itemsFull
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Storm Wyrm
    • Actions
      • Hero - Create Crown of Kings +5 and give it to (Killing unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Killing unit) has (Last created item)) Equal to True
        • Then - Actions
        • Else - Actions
          • Item - Remove (Last created item)
 
Status
Not open for further replies.
Back
Top