• 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] Backpack System Bug

Status
Not open for further replies.
Level 31
Joined
Jun 27, 2008
Messages
2,557
This is a simple backpack system by xorkatoss. I like the system, but it is somehow buggy. One item during the game is being saved that when I open a bag, it appear there and when I close bag, it reloads previous setting even though I dropped that item. It somehow saves on both bags, I don't have any knowledge on this one.

Is there a way to fix this?

  • Hashtable
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- This is the point where the saved items will be placed --------
      • -------- Does not really matter since they will be hidden anyway --------
      • Set Backpack_SavePoint = (Point(0.00, 0.00))
      • Hashtable - Create a hashtable
      • Set Backpack_Hashtable = (Last created hashtable)
  • OpenBackpack
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Open Bag
    • Actions
      • For each (Integer i) from 1 to 6, do (Actions)
        • Loop - Actions
          • Hashtable - Save Handle Of(Item carried by (Triggering unit) in slot i) as (Key (Triggering unit)) of i in Backpack_Hashtable
          • Item - Move (Item carried by (Triggering unit) in slot i) to Backpack_SavePoint
          • Item - Hide (Item carried by (Triggering unit) in slot i)
          • Hero - Give (Load i of (Key (Triggering unit)) in Backpack_Hashtable) to (Triggering unit)
      • Unit - Remove Open Bag from (Triggering unit)
      • Unit - Add Close Bag to (Triggering unit)
  • CloseBackpack
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Close Bag
    • Actions
      • For each (Integer i) from 1 to 6, do (Actions)
        • Loop - Actions
          • Hashtable - Save Handle Of(Item carried by (Triggering unit) in slot i) as i of (Key (Triggering unit)) in Backpack_Hashtable
          • Item - Move (Item carried by (Triggering unit) in slot i) to Backpack_SavePoint
          • Item - Hide (Item carried by (Triggering unit) in slot i)
          • Hero - Give (Load (Key (Triggering unit)) of i in Backpack_Hashtable) to (Triggering unit)
      • Unit - Remove Close Bag from (Triggering unit)
      • Unit - Add Open Bag to (Triggering unit)
Help would be truly appreciated and proper credits given for a project I am using this.
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
I made a similar system for 4 bags - each with an ability permanently visible on the hero's command card.

My approach was to make a dummy backpack unit for each inventory, and put them in some corner of the map that is invisible to everyone.

Although in its current setup only MPI, you could easily use that method + unit indexer to make a backpack dummy unit for each unit.

PS: I will read through the code provided, but this is just my initial response and suggestion.
 
Level 31
Joined
Jun 27, 2008
Messages
2,557
I need a system that could be easily manipulated during an intense battle for quick switching, this is the one, but it is buggy. Here it is. I would really appreciate a fix. Or at least a good alternative. A test map would be extremely helpful.
@rulerofiron
I am not sure how your system works.
@Kobas
I have no idea how to do it, I am not much of a coder, hehe.
 
Level 25
Joined
Jul 10, 2006
Messages
3,315
It works, thanks, but it is somehow laggy to use. To who credits should go?

The lag is the hero's casting time.

Hang on, I'll configure it to trigger on order.

EDIT: New version attached.

The inventory ability is based on Berserk (make sure you have no other spells based on berserk), so now there is no delay/casting time when using it, and hero doesn't stop when using it.

You can credit me.
 

Attachments

  • BackpackSystem101.w3x
    20.6 KB · Views: 68
Status
Not open for further replies.
Top