• 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] Map Start/Unit Spawn Attatchments Crash.

Status
Not open for further replies.
Level 5
Joined
Oct 7, 2005
Messages
102
Hey guys,

I'm making a rather complicated map. It's pretty much a zombie apocalypse map set in a sprawling city full of lots of different units.

I've been having problems recently with what I think is a memory leak, I'm not sure I'm not experienced with dealing with that. Unit movement is very jittery and chaotic, also when I try to exit the program, the game freezes. I end up having to End Task every time.

I've gone through my triggers and I think I've zero'd in on the problem, attachments to units.

I've got a lot of units which are part of the Police and the Medical Authorities and they all have their own armour and weapon attachments to help show who they are in game.

This is definitely one of the triggers causing the problem...

  • Riot Police Spawn
    • Events
      • Unit - A unit enters (Entire map)
    • Conditions
      • (Unit-type of (Entering unit)) Equal to Riot Police
    • Actions
      • Special Effect - Create a special effect attached to the chest of (Entering unit) using BlackSteelChainMail.mdx
      • Special Effect - Create a special effect attached to the head of (Entering unit) using riot helmet.mdx
      • Special Effect - Create a special effect attached to the foot left of (Entering unit) using Metal_Boots_Tier1_Portrait.mdx
      • Special Effect - Create a special effect attached to the foot right of (Entering unit) using Metal_Boots_Tier1.mdx
      • Special Effect - Create a special effect attached to the hand left of (Entering unit) using Guantlet_Metal_Tier2_Portrait.mdx
      • Special Effect - Create a special effect attached to the hand right of (Entering unit) using Guantlet_Metal_Tier2.mdx
      • Special Effect - Create a special effect attached to the hand right of (Entering unit) using Spiked Club.mdx
      • Special Effect - Create a special effect attached to the hand left of (Entering unit) using Riot_Shield.mdx
I have triggers that pick every unit in group i.e police officer and give them the attachments, and I have a trigger that gives attachments to every new unit type that spawns so that they look the same.

When ever I add this trigger and other similar ones which I'm trying to pin point, I get that problem.

Does anyone know how to fix this?

Could it be that there's either just too many attachments in the map, or that trying to spawn them all at once on initiation is too much?

There are at least 70 units currently in the map that use triggers like this, varying in the amount of attachments.

Thanks.
 
Level 5
Joined
Oct 7, 2005
Messages
102
Okay, but no units have been removed when or shortly after the map starts.

Also, how would I do that when the attachments were created a long time ago? Policemen could die hours into the game, how would I trigger that?

But I do not think removing special effects is the cause of this problem.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
The duration does not matter as long as you store the information without space conflicts. You need to have the effects assigned to the unit, in a hashtable for example with the unit's handle id as a key.

If it happens right after the start of the game, it's more likely some model is corrupt. Some mere 1000 effects should not be a problem. Narrow the problem further down.
 
Level 5
Joined
Oct 7, 2005
Messages
102
Okay, I will narrow the problem down. The corrupted model makes sense.

But how am I supposed to keep track of dozens of policemen? More of them get created all the time just like any normal unit in a skirmish. How can I select the attachments from some random dying policeman and then destroy them? Do they not get destroyed with the unit when it dies?
 
Level 12
Joined
Mar 17, 2007
Messages
412
Hey guys, I'm making a rather complicated map

Complicated map or just complicated triggers

  • Riot Police Spawn
    • Events
      • Unit - A unit enters (Entire map)
    • Conditions
      • (Unit-type of (Entering unit)) Equal to Riot Police
    • Actions
      • Special Effect - Create a special effect attached to the chest of (Entering unit) using BlackSteelChainMail.mdx
      • Special Effect - Create a special effect attached to the head of (Entering unit) using riot helmet.mdx
      • Special Effect - Create a special effect attached to the foot left of (Entering unit) using Metal_Boots_Tier1_Portrait.mdx
      • Special Effect - Create a special effect attached to the foot right of (Entering unit) using Metal_Boots_Tier1.mdx
      • Special Effect - Create a special effect attached to the hand left of (Entering unit) using Guantlet_Metal_Tier2_Portrait.mdx
      • Special Effect - Create a special effect attached to the hand right of (Entering unit) using Guantlet_Metal_Tier2.mdx
      • Special Effect - Create a special effect attached to the hand right of (Entering unit) using Spiked Club.mdx
      • Special Effect - Create a special effect attached to the hand left of (Entering unit) using Riot_Shield.mdx

This is absolutely unnecessary, I highly recommend you to follow this guide.

Guide for Simple Attachments
 
Level 5
Joined
Oct 7, 2005
Messages
102
Complicated everything, lots of detail on all fronts.

Thanks mate, I will try that method.

Also, is there an easy way to detect a corrupt model? I've still got a lot of potential corrupted models, assuming that's the issue here.
 
Level 26
Joined
Aug 18, 2009
Messages
4,097
As I have said, everytime an effect gets created, you assign it to the unit. Since those can be multiple effects and you do not want to name every kind, you store them inside a collection like a linked list. You have to track/enwrap when the unit gets deleted and then traverse the effect collection to destroy them as well. And yes, GUI is not suitable for this task, for you should have an extra function for creating effects instead of spelling the collection adding out everytime.

You said it would be right after map start and that it would definitely be the attachments, so deactivate them consecutively via bisection.
 
Status
Not open for further replies.
Top