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

[Solved] Item Count Trigger Question

Status
Not open for further replies.
Level 7
Joined
Jul 1, 2008
Messages
1,025
I'm making a quest where the player has to collect 3 of the same item type to recieve an reward.

Everythings fine exept I don't know how to detect when the player has all 3?

The items are removed from game as the player collects them, they dont stay in his inventory and he can collect them with different types of hero, so how can I detect when he has all 3?
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
I'm making a quest where the player has to collect 3 of the same item type to recieve an reward.

Everythings fine exept I don't know how to detect when the player has all 3?

The items are removed from game as the player collects them, they dont stay in his inventory and he can collect them with different types of hero, so how can I detect when he has all 3?
do a interger variable and always if disparea 1 item then increase variable value with 1, if multiplayer map then do a integer array variable and index must be the player number
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,219
To store the item count do this
  • item count
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Powerup
    • Actions
      • Set Quest_item_count[(Player number of (Owner of (Triggering unit)))] = (Quest_item_count[(Player number of (Owner of (Triggering unit)))] + 1)
      • Item - Remove (Item being manipulated)
and then use this to check if the player has colected all the items
  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • Quest_item_count[(Player number of (Owner of (Triggering unit)))] Equal to 3
    • Then - Actions
    • quest complete actions here
    • Else - Actions
 
Last edited:
Level 7
Joined
Jul 1, 2008
Messages
1,025
The quest only applies to one player so I created a variable which I added 1 value to everytime an item is aquired, but its not working for some reason, pls tell me what I'm doing wrong. :S

  • Gray gets a Limb
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to (==) Tartek's Abomination Limb
      • (Owner of (Triggering unit)) Equal to (==) Player 9 (Gray)
    • Actions
      • Set QuestItemCount = (QuestItemCount + 1)
      • Item - Remove (Item being manipulated)
      • Set Playergray = Player 9 (Gray)
      • Custom script: if GetLocalPlayer() == (udg_Playergray) then
      • Sound - Play SecretFound <gen>
      • Custom script: endif
      • Game - Display to Player Group - Player 9 (Gray) the text: Limbed Aquired.
  • Gray gets all Limbs
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to (==) Tartek's Abomination Limb
      • (Owner of (Triggering unit)) Equal to (==) Player 9 (Gray)
      • QuestItemCount Greater than or equal to (>=) 3
    • Actions
      • Unit - Change ownership of All 3 of Tartek's Limbs (Techtree Requirment Dummy) 1245 <gen> to Player 9 (Gray) and Retain color
      • Set Playergray = Player 9 (Gray)
      • Custom script: if GetLocalPlayer() == (udg_Playergray) then
      • Sound - Play QuestCompleted <gen>
      • Custom script: endif
      • Game - Display to Player Group - Player 9 (Gray) the text: You have aquired all...
 
Level 37
Joined
Mar 6, 2006
Messages
9,243
You only need one trigger:

  • Gray gets a Limb
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to (==) Tartek's Abomination Limb
      • (Owner of (Triggering unit)) Equal to (==) Player 9 (Gray)
    • Actions
      • if items < 2 then
        • items = items + 1
      • else
        • complete quest
      • endif
      • remove item
 
Status
Not open for further replies.
Top