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

[Trigger] MPI Item "Bank" Swap - Not Working, Confused

Status
Not open for further replies.
Level 21
Joined
Mar 16, 2008
Messages
955
A bit of a mess to look at but confused why this isn't working. Nothing happens at all.

Pretty much I want the items from the Altar to be swapped with the items in the Vault.

  • deposit withdraw
    • Events
      • Unit - Altar of Knights 0225 <gen> Finishes casting an ability
      • Unit - Altar of Knights 0226 <gen> Finishes casting an ability
      • Unit - Altar of Knights 0227 <gen> Finishes casting an ability
      • Unit - Altar of Knights 0319 <gen> Finishes casting an ability
      • Unit - Altar of Knights 0320 <gen> Finishes casting an ability
      • Unit - Altar of Knights 0326 <gen> Finishes casting an ability
      • Unit - Altar of Knights 0341 <gen> Finishes casting an ability
      • Unit - Altar of Knights 0342 <gen> Finishes casting an ability
      • Unit - Altar of Knights 0343 <gen> Finishes casting an ability
      • Unit - Altar of Knights 0352 <gen> Finishes casting an ability
      • Unit - Altar of Knights 0504 <gen> Finishes casting an ability
      • Unit - Altar of Knights 1689 <gen> Finishes casting an ability
    • Conditions
      • (Ability being cast) Equal to Deposit and Withdraw Items (Knight Bank)
    • Actions
      • Set VariableSet PN = (Player number of (Owner of (Casting unit)))
      • Hashtable - Save Handle Of(Item carried by Knight_Altar_Var[PN] in slot 1) as PN of 1 in item_vault_hash.
      • Hashtable - Save Handle Of(Item carried by Knight_Altar_Var[PN] in slot 2) as PN of 2 in item_vault_hash.
      • Hashtable - Save Handle Of(Item carried by Knight_Altar_Var[PN] in slot 3) as PN of 3 in item_vault_hash.
      • Hashtable - Save Handle Of(Item carried by Knight_Altar_Var[PN] in slot 4) as PN of 4 in item_vault_hash.
      • Hashtable - Save Handle Of(Item carried by Knight_Altar_Var[PN] in slot 5) as PN of 5 in item_vault_hash.
      • Hashtable - Save Handle Of(Item carried by Knight_Altar_Var[PN] in slot 6) as PN of 6 in item_vault_hash.
      • Item - Move (Load PN of 1 in item_vault_hash.) to vault_points[PN]
      • Item - Move (Load PN of 2 in item_vault_hash.) to vault_points[PN]
      • Item - Move (Load PN of 3 in item_vault_hash.) to vault_points[PN]
      • Item - Move (Load PN of 4 in item_vault_hash.) to vault_points[PN]
      • Item - Move (Load PN of 5 in item_vault_hash.) to vault_points[PN]
      • Item - Move (Load PN of 6 in item_vault_hash.) to vault_points[PN]
      • Hero - Give (Item carried by (Load PN of 0 in item_vault_hash.) in slot 1) to Knight_Altar_Var[PN]
      • Hero - Give (Item carried by (Load PN of 0 in item_vault_hash.) in slot 2) to Knight_Altar_Var[PN]
      • Hero - Give (Item carried by (Load PN of 0 in item_vault_hash.) in slot 3) to Knight_Altar_Var[PN]
      • Hero - Give (Item carried by (Load PN of 0 in item_vault_hash.) in slot 4) to Knight_Altar_Var[PN]
      • Hero - Give (Item carried by (Load PN of 0 in item_vault_hash.) in slot 5) to Knight_Altar_Var[PN]
      • Hero - Give (Item carried by (Load PN of 0 in item_vault_hash.) in slot 6) to Knight_Altar_Var[PN]
      • Hero - Give (Load PN of 1 in item_vault_hash.) to (Load PN of 0 in item_vault_hash.)
      • Hero - Give (Load PN of 2 in item_vault_hash.) to (Load PN of 0 in item_vault_hash.)
      • Hero - Give (Load PN of 3 in item_vault_hash.) to (Load PN of 0 in item_vault_hash.)
      • Hero - Give (Load PN of 4 in item_vault_hash.) to (Load PN of 0 in item_vault_hash.)
      • Hero - Give (Load PN of 5 in item_vault_hash.) to (Load PN of 0 in item_vault_hash.)
      • Hero - Give (Load PN of 6 in item_vault_hash.) to (Load PN of 0 in item_vault_hash.)
      • Hashtable - Clear all child hashtables of child (Key (Load PN of 1 in item_vault_hash.).) in item_vault_hash.
      • Hashtable - Clear all child hashtables of child (Key (Load PN of 2 in item_vault_hash.).) in item_vault_hash.
      • Hashtable - Clear all child hashtables of child (Key (Load PN of 3 in item_vault_hash.).) in item_vault_hash.
      • Hashtable - Clear all child hashtables of child (Key (Load PN of 4 in item_vault_hash.).) in item_vault_hash.
      • Hashtable - Clear all child hashtables of child (Key (Load PN of 5 in item_vault_hash.).) in item_vault_hash.
      • Hashtable - Clear all child hashtables of child (Key (Load PN of 6 in item_vault_hash.).) in item_vault_hash.
  • Set Misc Vars
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Hashtable - Create a hashtable
      • Set VariableSet item_vault_hash = (Last created hashtable)
      • Hashtable - Save Handle OfKnight's Vault 1333 <gen> as 5 of 0 in item_vault_hash.
      • Hashtable - Save Handle OfKnight's Vault 1333 <gen> as 5 of 0 in item_vault_hash.
      • Hashtable - Save Handle OfKnight's Vault 1334 <gen> as 6 of 0 in item_vault_hash.
      • Hashtable - Save Handle OfKnight's Vault 1361 <gen> as 7 of 0 in item_vault_hash.
      • Hashtable - Save Handle OfKnight's Vault 1362 <gen> as 8 of 0 in item_vault_hash.
      • Hashtable - Save Handle OfKnight's Vault 1363 <gen> as 9 of 0 in item_vault_hash.
      • Hashtable - Save Handle OfKnight's Vault 1375 <gen> as 10 of 0 in item_vault_hash.
      • Hashtable - Save Handle OfKnight's Vault 1376 <gen> as 11 of 0 in item_vault_hash.
      • Hashtable - Save Handle OfKnight's Vault 1379 <gen> as 12 of 0 in item_vault_hash.
      • Hashtable - Save Handle OfKnight's Vault 1381 <gen> as 17 of 0 in item_vault_hash.
      • Hashtable - Save Handle OfKnight's Vault 1382 <gen> as 18 of 0 in item_vault_hash.
      • Hashtable - Save Handle OfKnight's Vault 1383 <gen> as 19 of 0 in item_vault_hash.
      • Hashtable - Save Handle OfKnight's Vault 1384 <gen> as 20 of 0 in item_vault_hash.
      • Set VariableSet vault_points[5] = (Position of (Load 5 of 0 in item_vault_hash.))
      • Set VariableSet vault_points[6] = (Position of (Load 6 of 0 in item_vault_hash.))
      • Set VariableSet vault_points[7] = (Position of (Load 7 of 0 in item_vault_hash.))
      • Set VariableSet vault_points[8] = (Position of (Load 8 of 0 in item_vault_hash.))
      • Set VariableSet vault_points[9] = (Position of (Load 9 of 0 in item_vault_hash.))
      • Set VariableSet vault_points[10] = (Position of (Load 10 of 0 in item_vault_hash.))
      • Set VariableSet vault_points[11] = (Position of (Load 11 of 0 in item_vault_hash.))
      • Set VariableSet vault_points[12] = (Position of (Load 12 of 0 in item_vault_hash.))
      • Set VariableSet vault_points[17] = (Position of (Load 17 of 0 in item_vault_hash.))
      • Set VariableSet vault_points[18] = (Position of (Load 18 of 0 in item_vault_hash.))
      • Set VariableSet vault_points[19] = (Position of (Load 19 of 0 in item_vault_hash.))
      • Set VariableSet vault_points[20] = (Position of (Load 20 of 0 in item_vault_hash.))
      • ...
 
Last edited:
Level 21
Joined
Mar 16, 2008
Messages
955
Yes you are right. Got all the variables messed up after editing for so long.

Now the items from the vault aren't going back to the altar tho? hmm.

(I updated the triggers in the original post.)

EDIT:
This is seriously messed up, the hashtable isn't clearing like it's supposed to.

EDIT 2: fully clearing and re-creating the hashtable each time seems to work
 
Last edited:

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,866
I'm a little confused about the system. Why is a Hashtable necessary in the first place?

Isn't this just:

Hero to Bank:
For loop X from 1 to 6 -> Give item carried by Hero in slot X to Bank

Bank to Hero:
For loop X from 1 to 6 -> Give item carried by Bank in slot X to Hero
 
Level 21
Joined
Mar 16, 2008
Messages
955
1) I thought loops weren't MPI?
2) Would trading the items simultaneously end up with all items in an inventory? or would some items end up on the ground?

I now think hashtables are better for constants (static variables) and arrays are better for true variables that change.
 
Status
Not open for further replies.
Top