• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Need help with the "RemoveLocation"...

Status
Not open for further replies.
Level 3
Joined
Sep 13, 2008
Messages
44
First i want to know if this is correct:
  • Trigger
  • Events
    • Unit - Unit did something...
  • Conditions
    • ...
  • Actions
    • Set Pos[(Player number of (Owner of (Triggering unit)))] = (Position of (Triggering unit))
    • Something happens with Pos...
    • Custom script: call RemoveLocation(udg_Pos[GetPlayerId( GetOwningPlayer(GetTriggerUnit())) + 1])
Or does it need to be like this:
  • Trigger
  • Events
    • Unit - Unit did something...
  • Conditions
    • ...
  • Actions
    • Set Pos[(Player number of (Owner of (Triggering unit)))] = (Position of (Triggering unit))
    • Something happens with Pos...
    • Custom script: call RemoveLocation(udg_Pos[GetPlayerId( GetOwningPlayer(GetTriggerUnit()))])
The other question is: is there a way to detect a "buying unit"?
Like the "GetTriggerUnit()" but with buying unit instead of triggering unit...

I need to "remove" a location but with the array number being the number of the player that owns the buying unit...

This is part of the trigger:
  • Trigger
  • Events
    • Unit - A unit Sells an item (from shop)
  • Conditions
    • (Item-type of (Sold Item)) Equal to Item
  • Actions
    • Set BuyerPos[(Player number of (Owner of (Buying unit)))] = (Position of (Buying unit))
    • Something happens with BuyerPos...
    • Custom script: call RemoveLocation(udg_BuyerPos[GetPlayerId( GetOwningPlayer(Get?????Unit()))])
What goes on the ????? and is the "+1" needed?
 
You need the +1 because "Player Number" in GUI is actually ranged from 1-16, and uses this function:
JASS:
function GetConvertedPlayerId takes player whichPlayer returns integer
    return GetPlayerId(whichPlayer) + 1
endfunction

GetPlayerId() returns values from 0-15.

So the +1 is required to remove the correct indexed location.
 
Level 3
Joined
Sep 13, 2008
Messages
44
So i must use "GetBuyingUnit()" and add the "+1" because im using GUI right?

Thanks for the help, added the rep for your replies. :thumbs_up:

---------------------------------------------------------------------------

EDIT*

hmm what about the "Picked Player"?

instead of "GetOwningPlayer()" is "GetPickedPlayer()" ???
 
Last edited:
Status
Not open for further replies.
Top