• 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.

Custom Script Term for Picked Player

Level 13
Joined
Sep 25, 2013
Messages
717
How do I create a custom script to remove the point leak when the point is an array. What is the term in custom script for "picked player"? Thanks!

  • Set VariableSet AIAttackTarget_Point[(Player number of (Picked player))] = ((Random player from (All players matching ((((Matching player) is an enemy of (Picked player).) Equal to True) and (((Matching player) is in RealPlayers_PlayerGroup.) Equal to True)).)) start location)
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,871
How do I create a custom script to remove the point leak when the point is an array. What is the term in custom script for "picked player"? Thanks!
Edit:

The answer is: GetEnumPlayer()

But I would store this Point in a variable and simply reference it instead. No need to clear memory leaks for reoccurring things, just store them all game.
  • Events
    • Time - Elapsed game time is 0.01 seconds
  • Conditions
  • Actions
    • Player Group - Pick every player in (All players) and do (Actions)
      • Loop - Actions
        • Set Variable PN = (Player number of (Picked player))
        • Set Variable Player_Start_Loc[PN] = (Center of (Picked player)'s start location)
  • Actions
    • Set Variable Random_Player = (Random player from (All players matching ((((Matching player) is an enemy of (Picked player).) Equal to True) ...
    • Set Variable PN = (Player number of Random_Player)
    • Unit Group - Pick every unit in (Units owned by Computer) and do (Actions)
      • Loop - Actions
        • Unit - Order (Picked unit) to Attack-Move to Player_Start_Loc[PN]
I think Start Locations are already predefined global Point variables so Player_Start_Loc isn't really necessary, but the concept is important to understand.
 
Last edited:
Level 45
Joined
Feb 27, 2007
Messages
5,578
What is the term in custom script for "picked player"?
Next time make a new trigger with a single action that refers to the GUI function/object you want to know about and then convert the trigger to custom text so you can see exactly how it is referenced. Something simple like "Player - Victory for <Player>" with as few other fields as possible. It should be obvious to you from the order of arguments or the names of functions used what the thing you don't know is.
 
Level 13
Joined
Sep 25, 2013
Messages
717
Thanks Uncle! I'll give that a try. Could you show me what it would look like to remove this point with custom script? So "picked player" is GetEnumPlayer(), but what about the player number part? Sorry I'm just a simple lad doing my best. What I mean is removing
  • Set VariableSet tempPoint = (Position of (Triggering unit))
Looks like this
  • Custom script: call RemoveLocation (udg_tempPoint)
What would it look like to remove the point in the trigger below?

  • Untitled Trigger 004
    • Events
      • Time - Elapsed game time is 5.00 seconds
    • Conditions
    • Actions
      • Set VariableSet AIAttackTarget_Point[(Player number of (Picked player))] = (Position of (Triggering unit))
Like removing a point like
Edit:

The answer is: GetEnumPlayer()

But I would store this Point in a variable and simply reference it instead. No need to clear memory leaks for reoccurring things, just store them all game.
  • Events
    • Time - Elapsed game time is 0.01 seconds
  • Conditions
  • Actions
    • Player Group - Pick every player in (All players) and do (Actions)
      • Loop - Actions
        • Set Variable PN = (Player number of (Picked player))
        • Set Variable Player_Start_Loc[PN] = (Center of (Picked player)'s start location)
  • Actions
    • Set Variable Random_Player = (Random player from (All players matching ((((Matching player) is an enemy of (Picked player).) Equal to True) ...
    • Set Variable PN = (Player number of Random_Player)
    • Unit Group - Pick every unit in (Units owned by Computer) and do (Actions)
      • Loop - Actions
        • Unit - Order (Picked unit) to Attack-Move to Player_Start_Loc[PN]
I think Start Locations are already predefined global Point variables so Player_Start_Loc isn't really necessary, but the concept is important to understand.
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,871
Thanks Uncle! I'll give that a try. Could you show me what it would look like to remove this point with custom script? So "picked player" is GetEnumPlayer(), but what about the player number part?
Pyro gave you a solution you could use to figure this out on your own, but it would look like this:
  • Custom script: call RemoveLocation( udg_AIAttackTarget_Point[GetConvertedPlayerId(GetEnumPlayer())] )
Again, I recommend using variables like PN, it's not only more efficient but easier to work with.
 
Level 13
Joined
Sep 25, 2013
Messages
717
Pyro gave you a solution you could use to figure this out on your own, but it would look like this:
  • Custom script: call RemoveLocation( udg_AIAttackTarget_Point[GetConvertedPlayerId(GetEnumPlayer())] )
Again, I recommend using variables like PN, it's not only more efficient but easier to work with.
OH MAN! I never new about the ability to convert a trigger to custom text... I just looked it up after reading pyro's message above. That's a game changer. LOL, i just never new that existed at all and I just thought everyone knew all these custom text terms from some other source. Thanks for your help!
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,871
OH MAN! I never new about the ability to convert a trigger to custom text... I just looked it up after reading pyro's message above. That's a game changer. LOL, i just never new that existed at all and I just thought everyone knew all these custom text terms from some other source. Thanks for your help!
Yep, it's quite handy.

You can also dabble in some Jass yourself with something like this (very easy to setup):
Type the word "player" and the plugin will bring up a list of functions related to players. "Get" is a commonly used word for getting information about a specific thing -> GetPlayerName(), GetUnitName(), GetPlayerId(), GetUnitLevel(), etc.

It's not so confusing once you get the hang of it, the developers named things accordingly (for the most part).
 
Top