• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Problem with a trigger

Status
Not open for further replies.
Level 24
Joined
Jun 26, 2020
Messages
1,852
I create this trigger to acumulate items (I really don't want doing the powerup thing), I think it is ok but it just do until "remove item being manipulated" what am I doing bad? To understand I only have 10 types of items that I wanna stack saved in a variable called "Objetos_cargado":
  • Acumular mismos items
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-class of (Item being manipulated)) Equal to Charged
    • Actions
      • Custom script: local player p
      • Custom script: local integer i
      • Custom script: local integer B
      • Set Temp_Bool = False
      • For each (Integer Atemp_Int2) from 1 to 10, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item being manipulated)) Equal to Objeto_cargado[Atemp_Int2]
            • Then - Actions
              • Set Temp_Bool = True
              • Custom script: set B=udg_Atemp_Int2
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Temp_Bool Equal to False
        • Then - Actions
          • Skip remaining actions
        • Else - Actions
      • Custom script: set p=GetItemPlayer(GetManipulatedItem())
      • Custom script: set i=GetItemCharges(GetManipulatedItem())
      • Item - Remove (Item being manipulated)
      • Wait 0.01 seconds
      • Custom script: set udg_Atemp_Int=i
      • Custom script: set udg_Atemp_Int2=B
      • Custom script: set udg_Dueno=p
      • Set Temp_Unit = (Triggering unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Temp_Unit has an item of type Objeto_cargado[Atemp_Int2]) Igual a True
        • Then - Actions
          • Set Temp_Item[1] = (Item carried by Temp_Unit of type Objeto_cargado[Atemp_Int2])
          • Item - Set charges remaining in Temp_Item[1] to ((Charges remaining in Temp_Item[1]) + Atemp_Int)
        • Else - Actions
          • Hero - Create Objeto_cargado[Atemp_Int2] and give it to Temp_Unit
          • Item - Set charges remaining in (Last created item) to Atemp_Int
          • Item - Change ownership of (Last created item) to Dueno and Cambiar color
      • Custom script: set p=null
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,539
I'm not sure why it's not working but you can try something like this:
  • Charge Item Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set VariableSet Charged_Items[1] = Wand of the Wind
  • Acquire Charged Item
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-class of (Item being manipulated)) Equal to Charged
    • Actions
      • For each (Integer Loop) from 1 to 1, do (Actions)
        • Loop - Actions
          • -------- Check Item-Type --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item being manipulated)) Equal to Charged_Items[Loop]
            • Then - Actions
              • -------- Set Item Charges --------
              • Set VariableSet Base_Charges = (Charges remaining in (Item being manipulated))
              • Set VariableSet New_Charges = 0
              • -------- --------
              • -------- Check Inventory Slots --------
              • For each (Integer Loop) 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 Loop)) Equal to (Item-type of (Item being manipulated))
                      • (Item carried by (Triggering unit) in slot Loop) Not equal to (Item being manipulated)
                    • Then - Actions
                      • Set VariableSet Item_Integer = Loop
                      • Set VariableSet New_Charges = (Charges remaining in (Item carried by (Triggering unit) in slot Loop))
                    • Else - Actions
              • -------- --------
              • -------- Remove Item / Update Charges --------
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • New_Charges Greater than 0
                • Then - Actions
                  • Item - Remove (Item being manipulated)
                  • Item - Set charges remaining in (Item carried by (Triggering unit) in slot Item_Integer) to (Base_Charges + New_Charges)
                • Else - Actions
            • Else - Actions
 

Attachments

  • Charged Items.w3m
    17.6 KB · Views: 21
Last edited:
Status
Not open for further replies.
Top