HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

How would I find the selecting player?

03-26-2004, 12:11 AM#1
Narwanza
I had the coolest idea for a "community" reasearch center for my map. It would only be one building, but everyone could research their own stuff out of it. Now you may ask how I planned to go about this, but it was quite simple once I figured it out. I am just going to make a dummy building right where the building is for the player that selected the building. (the "communit" building is owned by player 12) I planned to use GetLocaPlayer() to create the buildings and then select them for the player, but now I cannot figure out for the life of my why their isn't a dumb GetSelectingPlayer() native. Gosh dang Blizzard. Sometimes...... Anyways, is there any work around to find the selecting player? GetTriggerPlayer() doesn't work, and GetEventDetectingPlayer() doesn't work.
03-26-2004, 02:37 AM#2
linkmaster23
Event

A Player Selects a unit

Condition

Building = to the building

Actions

You have two choices here

Give abilites to building, and use triggers to make the upgrades work or...

Make a new unit and make the player select it, when it is un-selected, delete the unit.

And you can do it in GUI... I don't agree with using JASS... doesn't teach anyone anything.
03-26-2004, 01:27 PM#3
Vexorian
GetTriggerPlayer() (Triggering Player) works with player 1 selects a unit kind of events, and creating buildings for the local player will surely desync
03-26-2004, 10:23 PM#4
Narwanza
Oh, ya it would desync now that I think about it. I totally disagree with you liinkmaster about JASS. If you would just realize that it is better..... Oh well, not worth arguing about. Here is my code, and it does the wierdest thing.

Code:
function Trig_Upgrade_Facility_Select_Actions takes nothing returns nothing
    local unit u = null
    local location loc1 = GetUnitLoc(gg_unit_hars_0107)
    set u = CreateUnitAtLoc(GetTriggerPlayer(),'hhou',loc1,270)
    call SelectUnitForPlayerSingle(u,GetTriggerPlayer())
    call RemoveLocation(loc1)
    set loc1 = null
    set u = null
endfunction

//===========================================================================
function InitTrig_Upgrade_Facility_Select takes nothing returns nothing
    set gg_trg_Upgrade_Facility_Select = CreateTrigger(  )
    call TriggerRegisterUnitEvent( gg_trg_Upgrade_Facility_Select, gg_unit_hars_0107, EVENT_UNIT_SELECTED )
    call TriggerAddAction( gg_trg_Upgrade_Facility_Select, function Trig_Upgrade_Facility_Select_Actions )
endfunction
I am using the farm as my upgrades facility for players right now, eventually I will change it. But it creates a farm, for the owner of the selected building. It is really weird. I have the building owned by Neutral hostile, and it creates a farm for neutral hostile. I don't get it.
03-26-2004, 10:38 PM#5
Vexorian
That is the reason you should use THE PLAYER EVENT Player XXX selects a unit instead of the specific unit event A unit is selected. GetTriggerPlayer() will return the owner of GetTriggerUnit() when it is not a valid event response.
03-26-2004, 11:34 PM#6
linkmaster23
Better or not, GUI is funner. :P
03-26-2004, 11:40 PM#7
Vexorian
Really? It is a pain for me to do anything in gui at this moment, i guess it is a matter of tastes
03-26-2004, 11:42 PM#8
linkmaster23
Meh, I guess JASS is OK. Still, GUI has it's advantages. It's the whole, "Yay, I just did a confusing trigger!" thing that gets me everytime... ^_^
03-27-2004, 02:58 AM#9
BuRnInSpartan
use jass? it seems so complicating.
03-27-2004, 04:51 AM#10
ThyFlame
I would think having the building sell dummy units and upgrading appropriately would work...