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

[Trigger] Why makes this the game crash?

Status
Not open for further replies.
Level 17
Joined
Jun 12, 2007
Messages
1,261
As soon as this trigger is used, the game will crash.
Why is that? I don't see anything special about it that could drain all the memory.

  • Fake Crystal
    • Events
      • Unit - A unit Uses an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Fake |c000042ffC|rrystal |c007ebff1[Spell]|r
    • Actions
      • Set P_FakeCrystal[(Player number of (Owner of (Triggering unit)))] = (Position of (Triggering unit))
      • Special Effect - Create a special effect at P_FakeCrystal[(Player number of (Owner of (Triggering unit)))] using AImaTarget.mdx
      • Special Effect - Destroy (Last created special effect)
      • Item - Create Red Crystal at P_FakeCrystal[(Player number of (Owner of (Triggering unit)))]
      • Custom script: call RemoveLocation(udg_P_FakeCrystal[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])
 
Level 6
Joined
Jul 25, 2005
Messages
221
Hm, the only thing I can see from that script, is that it is a mess. One thing that can make a game crash is if you create/move something out of map bounds.

I suggest you clean the code by adding an integer variable representing the number of the triggering unit so you don't have to state that in all actions.
And as Justify pointed out, there is no actual need for an array in this case, as it isn't using a timer.
 
Level 17
Joined
Jun 12, 2007
Messages
1,261
Found it out, error on my side.
I forgot to edit the dummy items spell. It still was Intelligence gain. And because units can't become smarter the game goes WTF BOOM and crashes.

Still thanks though.

EDIT: And the array is needed for multiple players right.
If player 1 triggers it, the location will be set to the location of that player, if player 2 uses it, the location will be overwritten. If 2 players do it at the same time it wont clean the leak? =/

I'm confused now.
 
Level 8
Joined
Apr 7, 2008
Messages
176
wow dude yeah, you definately dont need those arrays, since your destroying the location anyways. Also the arrays your using dont work for MUI, trust me i started off doing the eexact same thing u did. U were worried about 2 units triggering this at the same time, what if its 2 unis of the same player?? See.... BAM!! I know right. Check out sopme MUI approved spells and take a look at their indexing systems. Hope I helped you with your other 250 triggers. :D
 
Status
Not open for further replies.
Top