| 03-26-2004, 12:11 AM | #1 |
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 |
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 |
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 |
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
|
| 03-26-2004, 10:38 PM | #5 |
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 |
Better or not, GUI is funner. :P |
| 03-26-2004, 11:40 PM | #7 |
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 |
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 |
use jass? it seems so complicating. |
| 03-27-2004, 04:51 AM | #10 |
I would think having the building sell dummy units and upgrading appropriately would work... |
