• 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.
  • 💡 We're thrilled to announce that our upcoming texturing contest is in the works, and we're eager to hear your suggestions! Please take this opportunity to share your ideas in this theme discussion thread for the Texturing Contest #34!
  • 🏆 Hive's 7th HD Modeling Contest: Icecrown Creature is now open! The frozen wastes of Icecrown are home to some of Azeroth’s most terrifying and resilient creatures. For this contest, your challenge is to design and model a HD 3D monster that embodies the cold, undead, and sinister essence of Icecrown! 📅 Submissions close on April 13, 2025. Don't miss this opportunity to let your creativity shine! Enter now and show us your frozen masterpiece! 🔗 Click here to enter!

[Trigger] Trigger Review

Status
Not open for further replies.
Level 4
Joined
Dec 31, 2014
Messages
68
Hello,
I am clearing up the last few Memory leaks in my Mp RPG map. Note: I have read through various websites documenting what triggers leak, their fixes and what-not, I also check my triggers with Leakcheck3.1.
**First of all i'd like to mention that when a human controlled unit enters the playable game area I have made a trigger/variable to add them to a PlayerGroup named Team1**

Q1)For this trigger I followed a tutorial from here http://www.hiveworkshop.com/forums/world-editor-help-zone-98/game-message-only-triggering-player-176146/.

  • Events
    • Unit - A unit enters REGION <gen>
  • Conditions
    • ((Entering unit) is A Hero) Equal to True
  • Actions
    • Set PGroup = (Player group((Triggering player)))
    • Game - Display to (All players) for 5.00 seconds the text: The Message Reads: ...
    • Custom script: call DestroyForce(udg_PGroup)
This still sends the message to all players (I suspect because of the Display to (All players) how do I fix this?

I have tried to change that line to;
  • Game - Display to PGroup for 5.00 seconds the text: xxxx
&
  • Game - Display to (Player group((Triggering player))) for 5.00 seconds the text: xxxx
Both don't work.

Q1)a) Can players only be assigned to 1 PlayerGroup at a time?



Q2) Area/Titles (Floating text) the following is my trigger for this at Map Initialization.
  • Set Floatingtext = (Center of REGION <gen>)
  • Floating Text - Create floating text that reads xxxx at Floatingtext with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
  • Custom script: call RemoveLocation(udg_Floatingtext)
Is this leak free?



Q3) Triggers that play a sound when a specific thing is typed in the chat box.Is this trigger free from leaks? (I imported a sound, right clicked it and chosen [USE AS SOUND] which is being referenced in the trigger) ;
  • Events
    • Player - Player 1 (Red) types a chat message containing xxxx as A substring
    • Player - Player 2 (Blue) types a chat message containing xxxx as A substring
    • Player - Player 3 (Teal) types a chat message containing xxxx as A substring
  • Conditions
  • Actions
    • Sound - Play SOUND <gen>
b)If this does leak, Can I condense this trigger down any?



Q4)A trigger that awards a preset amount of gold to all players in Team1. Is this Leak free?
  • Events
    • Unit - A unit Dies
  • Conditions
    • (Unit-type of (Dying unit)) Equal to Skeleton
  • Actions
    • Player - Add 1600 to Player 1 (Red) Current gold
    • Player - Add 1600 to Player 2 (Blue) Current gold
    • Player - Add 1600 to Player 3 (Teal) Current gold
    • Game - Display to Team1 the text: +1600 Gold
    • Wait 0.50 seconds
    • Sound - Play SOUND <gen>
Is this Leak free?
Q4)a)Can I condense this any?

Sorry for the length, and thank you.
 
A1: For entering event you have to use "Owner of TriggeringUnit":

  • Set PGroup = (Player group((OwnerOf(TriggeringUnit))))
  • Game - Display to PGroup for 5.00 seconds the text: The Message Reads: ...
  • Custom script: call DestroyForce(udg_PGroup)

A2: Yes leakfree. Still... "Floatingtext" is a bad name for a point/location variable.

A3 & A4: No leak there. :csmile:
 
Level 14
Joined
Oct 18, 2013
Messages
714
For Question 2, there is no leak if you want to have that Floating Text there all game. If not, then there is a leak.

On question 1, Triggering Player doesn't work from unit's entering regions. You could do
  • Set TempUnit=Triggering Unit
  • Set PGroup= Owner of TempUnit
Something along those lines.
 
Level 4
Joined
Dec 31, 2014
Messages
68
Thanks for the replies!

Iceman,
Ah so it was the wrong action I was doing ok thanks.
Also When I run it through Leak check It tells me:

(Line: 7) (Word: 3) Player Group Leak
Set PGroup = (Player group((Owner of (Triggering unit))))
Set PGroup = ^Leak

Is Leak check incorrect?
Anyway I tried this way and it worked, thank you.

Kakerate,
Yeah I wanted the floating text to be there all game so what iv done should be fine.

Is your suggestion a more optimized way of doing what Iceman said?
Your one also reports a leak with Leak check, should I not trust this?
(Also Should I not add a call DestroyForce for TempUnit?)
 
Status
Not open for further replies.
Top