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

Can't find the problem, please help a bit.

Status
Not open for further replies.
Level 9
Joined
Jun 7, 2007
Messages
195
A trigger doesn't work, but I cannot find what's wrong with it.
Please tell me if you can see what's wrong with it.

What the trigger is NOT supposed to do/be:
MUI, 'MPI' or leakless.

What the trigger IS supposed to do/be:
A test of concept.
I want to have n amount of inventories with their data stored in variables.
I want to be able to change the current inventory via abilities in a spellbook.

What I think might be the problem:
Using Item-Variables just won't work. I should use ItemType-Variables instead.

Global Variables ect.
Integer - ActiveBag
Item Array - BackpackItem

Abilities
Spellbook - Bags
Channel - Bag1, Bag2, Bag3


  • D Setup
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set ActiveBag = 0
  • D01
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to Bag1
          • (Ability being cast) Equal to Bag2
          • (Ability being cast) Equal to Bag3
    • Actions
      • Cinematic - Clear the screen of text messages for (All players)
      • Game - Display to (All players) the text: (Name of (Item carried by Warden 0000 <gen> in slot 1))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • ((Ability being cast) Equal to Bag1 ) and (ActiveBag Equal to 0)
              • ((Ability being cast) Equal to Bag2 ) and (ActiveBag Equal to 1)
              • ((Ability being cast) Equal to Bag3 ) and (ActiveBag Equal to 2)
        • Then - Actions
          • Game - Display to (All players) the text: D01 Skipped
          • Skip remaining actions
        • Else - Actions
      • Game - Display to (All players) the text: D01 Running...
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Wait 0.01 seconds
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item carried by (Triggering unit) in slot (Integer A)) Equal to No item
            • Then - Actions
              • Set BagItem[((Integer A) + (ActiveBag x 6))] = No item
              • Game - Display to (All players) the text: ((Item + (String((Integer A)))) + = No Item)
            • Else - Actions
              • Wait 0.01 seconds
              • Set BagItem[((Integer A) + (ActiveBag x 6))] = (Item carried by (Triggering unit) in slot (Integer A))
              • Game - Display to (All players) the text: (((Item + (String((Integer A)))) + = ) + (Name of BackpackItem[((Integer A) + (ActiveBag x 6))]))
              • Hero - Drop BackpackItem[((Integer A) + (ActiveBag x 6))] from (Triggering unit)
              • Item - Hide BackpackItem[((Integer A) + (ActiveBag x 6))]
      • Game - Display to (All players) the text: (ActiveBag = + (String(ActiveBag)))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Bag1
        • Then - Actions
          • Set ActiveBag = 0
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Bag2
        • Then - Actions
          • Set ActiveBag = 1
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Ability being cast) Equal to Bag3
        • Then - Actions
          • Set ActiveBag = 2
        • Else - Actions
      • Game - Display to (All players) the text: (ActiveBag = + (String(ActiveBag)))
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • Wait 0.01 seconds
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • BackpackItem[((Integer A) + (ActiveBag x 6))] Equal to No item
            • Then - Actions
              • Game - Display to (All players) the text: ((Item + (String((Integer A)))) + = No Item)
              • Do nothing
            • Else - Actions
              • Game - Display to (All players) the text: (((Item + (String((Integer A)))) + = ) + (Name of BackpackItem[((Integer A) + (ActiveBag x 6))]))
              • Item - Show BackpackItem[((Integer A) + (ActiveBag x 6))]
              • Wait 0.01 seconds
              • Hero - Give BackpackItem[((Integer A) + (ActiveBag x 6))] to (Triggering unit)
 

Attachments

  • TestMap001.w3x
    23.8 KB · Views: 45
Level 9
Joined
Jun 7, 2007
Messages
195
I put the Wait commands there just to see if it would make a diffirence. I wasn't going to leave them there and since im testing this in singleplayer it doesnt really make much difference otherways.
Yeah I suppose it's time to redo the whole thing using ItemTypes, thanks for agreeing with that.
 
Level 37
Joined
Mar 6, 2006
Messages
9,240
Here's the system, I created just for fun.

The only thing that "bugs" as far as I can tell is that it won't remember empty slots. If you have slots 1-4 empty and 5-6 with items, then when loading the bag the items will be created at slots 1-2.

That can be changed but I didn't bother.

  • D01
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to Bag1
          • (Ability being cast) Equal to Bag2
          • (Ability being cast) Equal to Bag3
    • Actions
      • Set Temp_Unit_1 = (Triggering unit)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Temp_Unit_1 is in Triggering_Units) Equal to False
        • Then - Actions
          • Unit Group - Add Temp_Unit_1 to Triggering_Units
          • Hashtable - Save (((Number of units in Triggering_Units) - 1) x 18) as (Key arrayID) of (Key (Triggering unit)) in Item_Hash
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • And - All (Conditions) are true
                • Conditions
                  • (Ability being cast) Equal to Bag1
                  • (Load (Key bag) of (Key (Triggering unit)) from Item_Hash) Equal to 0
              • And - All (Conditions) are true
                • Conditions
                  • (Ability being cast) Equal to Bag2
                  • (Load (Key bag) of (Key (Triggering unit)) from Item_Hash) Equal to 1
              • And - All (Conditions) are true
                • Conditions
                  • (Ability being cast) Equal to Bag3
                  • (Load (Key bag) of (Key (Triggering unit)) from Item_Hash) Equal to 2
        • Then - Actions
          • Game - Display to (All players) the text: This bag is already...
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Ability being cast) Equal to Bag1
            • Then - Actions
              • Set Temp_Integer_1 = 0
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Ability being cast) Equal to Bag2
                • Then - Actions
                  • Set Temp_Integer_1 = 1
                • Else - Actions
                  • Set Temp_Integer_1 = 2
          • For each (Integer A) from 1 to 6, do (Actions)
            • Loop - Actions
              • -------- Item slot to load item from --------
              • Set Temp_Integer_2 = ((Load (Key arrayID) of (Key (Triggering unit)) from Item_Hash) + ((Temp_Integer_1 x 6) + (Integer A)))
              • -------- Item slot to store the item to --------
              • Set Temp_Integer_3 = ((Load (Key arrayID) of (Key (Triggering unit)) from Item_Hash) + (((Load (Key bag) of (Key (Triggering unit)) from Item_Hash) x 6) + (Integer A)))
              • Set Item_Array[Temp_Integer_3] = (Item-type of (Item carried by Temp_Unit_1 in slot (Integer A)))
              • Set Item_Charge_Array[Temp_Integer_3] = (Charges remaining in (Item carried by Temp_Unit_1 in slot (Integer A)))
              • Item - Remove (Item carried by Temp_Unit_1 in slot (Integer A))
              • Hero - Create Item_Array[Temp_Integer_2] and give it to Temp_Unit_1
              • Item - Set charges remaining in (Last created item) to Item_Charge_Array[Temp_Integer_2]
          • Hashtable - Save Temp_Integer_1 as (Key bag) of (Key (Triggering unit)) in Item_Hash
 

Attachments

  • TestMap001.w3x
    17.6 KB · Views: 42
Status
Not open for further replies.
Top