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

[Trigger] Do Item-Types leak?

Status
Not open for further replies.
Level 3
Joined
May 21, 2011
Messages
31
I've been trying to construct a simple backpacking system that will store items in one bank, for all players. So any player can put in, and player can take out.

It works by indexing the items, BP_Times + 1, Save item type as Item_Type[BP_Times]. Then unpacking is setting P[0] to position of casting unit, for loop BP, from 1 to BP_Times. Create one Item_Type[BP] at P[0]. Then destroying the point. For some reason unloading causes unit lag (The unit will not play another action until it finishes whatever it was doing).

Here are the triggers

Pack
  • Pack
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Pack
    • Actions
      • Set BP_Times = (BP_Times + 1)
      • Set BP_Save[BP_Times] = (Item-type of (Target item of ability being cast))
      • Item - Remove (Target item of ability being cast)
Unpack
  • Unpack
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Unpack
    • Actions
      • Set P[0] = (Position of (Casting unit))
      • For each (Integer BP) from 1 to BP_Times, do (Actions)
        • Loop - Actions
          • Item - Create BP_Save[BP] at P[0]
      • Set BP_Times = 0
      • Custom script: call RemoveLocation(udg_P[0])
As you can see, VERY simple triggers. They work out fine, just cause lag. I really don't want to do hash tables unless I have to.


Thanks in advance.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
Removing stuff related to the cast while casting like the target here is not that nice. Maybe take the endcast event and store the item on spelleffect to be able to retrieve the item. For example, when trying to cast the Channel ability and pausing the caster on spelleffect, it will restart the order when being unpaused again.
 
Level 3
Joined
May 21, 2011
Messages
31
reply

It's based off of Finger of Death (Pack, targets items only), and avatar (unpack). None of them have any kind of effects or anything.

EDIT: Here's the map, no criticizing, I am no where near finished. It's a mini-map contest me and my friends are having :p, only 5 imports only. So no criticizing :O

http://www.hiveworkshop.com/forums/pastebin.php?id=3n734o
 
Last edited:
Level 3
Joined
May 21, 2011
Messages
31
I've tested everything, and the last thing I checked was "Unpack", which caused the lag. I don't mean lag, like high ping lag, I mean lag as in he waits to finish what he's doing before he'll do the next thing.

You get all the abilities in the beginning, they're in the tactics section.

I can't find any leaks in it.



Something running in the unpack trigger is leaking or something, I don't know. As soon as you get to select your character, press unpack before anything else, you get lag. So it can't be the item types because it isn't generating any items. The point is leak proof. The only thing I could say is the loop. :p
 
Level 16
Joined
Aug 7, 2009
Messages
1,403
What's wrong with channel? That's propably the most flexible ability out there, and it's kinda easy to use it. Once you base like 1-2 abils on it you can easily CnP them and use them once again. + You can use it as many times because you can change its base order.
 
Level 3
Joined
May 21, 2011
Messages
31
I never really liked using channel, just an OCD thing. I've usually never encountered problems without using it until now.

I used avatar because it was a no target ability I could use, just remove all the stats from it. Never gave me lag before :p.
 
Status
Not open for further replies.
Top