• 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.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

[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 https://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:
 
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.
 
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.
Back
Top