Need Help With My Item Triggers

Marvic June B. Corpuz

You can change this now in User CP.
Reaction score
1
I have this item in my map that requires 3x an item.. Unfortunately the trigger that I created for the item is faulty.. The item requires 3x the item, but when a unit acquires even just one of the required item type, it gives the final item.. Can some one tell me how do i fix it..?
 

Solu9

You can change this now in User CP.
Reaction score
216
Post your trigger.

Go to the trigger and at the trigger name (in the actual trigger, not the folder name) right click and select "Copy as text".

Then paste it here between [.WC3]YOUR_TRIGGER[./WC3] (without the punctuation).
 

Marvic June B. Corpuz

You can change this now in User CP.
Reaction score
1
Pardon me sir.. Here's my trigger anyway..

Staff of Silence
Events
Unit - A unit Acquires an item
Conditions
((Triggering unit) has (Item carried by (Triggering unit) of type Gabriel Scepter)) Equal to True
Actions
For each (Integer A) from 1 to 6, do (If ((Item-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Quarter Staff) then do (Set Item_Amount_Scepter[(Player number of (Triggering player))] = (Item_Amount_Scepter[(Player number of (Triggering player))] + 1)) else do (Do nothing)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Item_Amount_Scepter[(Player number of (Triggering player))] Equal to 3
Then - Actions
Item - Remove (Item carried by (Triggering unit) of type Quarter Staff)
Item - Remove (Item carried by (Triggering unit) of type Quarter Staff)
Item - Remove (Item carried by (Triggering unit) of type Quarter Staff)
Special Effect - Create a special effect attached to the overhead of (Triggering unit) using Abilities\Spells\Items\AIlm\AIlmTarget.mdl
Special Effect - Destroy (Last created special effect)
Hero - Create Staff of Silence and give it to (Triggering unit)
Set Item_Amount_Scepter[(Player number of (Triggering player))] = 0
Else - Actions
 

death_knight

Dark is the heart of a corrupted man.
Reaction score
24
You could try separating them out into more than one trigger so that there's one that adjusts the count for when a hero acquires or drops one of these items, and a trigger that actually removes the 3 items and gives the bigger, better item. I might also suggest trying, on map initialisation, setting the count to zero.
 

Solu9

You can change this now in User CP.
Reaction score
216
Track the items in a variable.
When you acquire a Gabriel Scepter set the variable to: variable + 1
When you drop/sell a Gabriel Scepter set the variable to: variable - 1
Every time the hero acquires an item check if the variable is equal to 3. If yes the remove all the Gabriel Scepters and give the hero a Staff of Silence.
 

Solu9

You can change this now in User CP.
Reaction score
216
Try changing all your 'Triggering player' to 'Owner of (Triggering unit)'.


Right.

For each (Integer A) from 1 to 6, do (If ((Item-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Quarter Staff) then do (Set Item_Amount_Scepter[(Player number of (Triggering player))] = (Item_Amount_Scepter[(Player number of (Triggering player))] + 1)) else do (Do nothing)

Correct me if I'm wrong.
But that action only sets the one array to be equal to same array just +1 higher doesn't it?

Shouldn't it be something like:
[...]
Then do -
(Set Item_Amount_Scepter[(Player number of (Triggering player))] = (SOME INTEGER VARIABLE +1))?

@Marvic
What is the number of the player you are in control of?
 

vypur85

Hibernate
Reaction score
803
After studying the confusing trigger more properly, there are few weird things that I feel a lil lazy to point out one by one. So I created another set of proper trigger for your reference:

Trigger:
  • Events
    • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Claws of Attack +15
    • Actions
      • Set Integer_NoNeedArray = 0
      • 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-type of (Item carried by (Triggering unit) in slot (Integer A))) Equal to Claws of Attack +15
            • Then - Actions
              • Set Integer_NoNeedArray = (Integer_NoNeedArray + 1)
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Integer_NoNeedArray Equal to 3
        • Then - Actions
          • Item - Remove (Item carried by (Triggering unit) of type Claws of Attack +15)
          • Item - Remove (Item carried by (Triggering unit) of type Claws of Attack +15)
          • Item - Remove (Item carried by (Triggering unit) of type Claws of Attack +15)
          • Hero - Create Crown of Kings +5 and give it to (Triggering unit)
        • Else - Actions
      • Set Integer_NoNeedArray = 0 <-- Not required unless you're really anal about things...

Examine the main condition. It's supposed to be an 'Item-type comparison'. Not boolean.

> Correct me if I'm wrong.
The idea is correct. Increasing a single integer variable is the way to go. It's just to count how many items he already possess.

Then again, there is no need for array. Just a normal integer variable will do. It will be MUI anyways. (The poster is probably confused with MPI/MUIness in this case. :))
 

Solu9

You can change this now in User CP.
Reaction score
216
I guess an array is only necessary if the Quater Staffs were to be stored for future reference.
 

vypur85

Hibernate
Reaction score
803
I guess an array is only necessary if the Quater Staffs were to be stored for future reference.

I don't think so for this case. He set the variable to zero at the end of the trigger. Shows that it's not that important after all. It's probably just a confusion. :p
 

Solu9

You can change this now in User CP.
Reaction score
216
I don't think so for this case. He set the variable to zero at the end of the trigger. Shows that it's not that important after all. It's probably just a confusion. :p


Yeah. Kinda what I meant. Was trying to reason why arrays is not need here :)
 

Marvic June B. Corpuz

You can change this now in User CP.
Reaction score
1
Hey Guys.. Thanks you for all your suggestions... Already did fix the problem... The faulty action was "Item - Remove (Item carried by (Triggering unit) of type Quarter Staff)". I tried using a different action for the Hero category replacing it with "Hero - Drop item carried by (Item carried by (Triggering Unit) of type Quarterstaff" and then "Item - Remove last dropped item". The result did replace the 3 Quarterstaves with Staff of Silence.
That's why I used the the Player Number of Triggering Player so that the trigger responds to all players. Setting the Item Amount Variable to Zero also makes the item for the triggering player to be available again.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top