| 10-18-2003, 03:48 PM | #1 |
I made a trigger trying to do it, but I don't have actual ways of testing it, so the question is, Does this actually work? Code:
function Trig_TakePlayerControl_Actions takes nothing returns nothing
local string temp=udg_name[GetConvertedPlayerId(GetTriggerPlayer())]
//====================================================================
call SetPlayerController(GetTriggerPlayer(),MAP_CONTROL_COMPUTER )
//====================================================================
call ForceAddPlayerSimple( GetTriggerPlayer(), udg_Compuplayers )
// The AI script
call StartCampaignAI( GetTriggerPlayer(), "VexorianHA.ai" )
// Changes the name to Computer N
call SetPlayerName( GetTriggerPlayer(), ( "Computer " + I2S(GetConvertedPlayerId(GetTriggerPlayer())) ) )
// Changes Acquire Range
call SetUnitAcquireRangeBJ( udg_Heroes[GetConvertedPlayerId(GetTriggerPlayer())], 1000000.00 )
// Add Dummy Stop Command
call UnitAddAbilityBJ( 'A03X', udg_Heroes[GetConvertedPlayerId(GetTriggerPlayer())] )
// Change Multiboard Values:
call SetPlayerTextColor(GetConvertedPlayerId(GetTriggerPlayer()))
call DisplayTextToForce( GetPlayersAll(), ( udg_name[GetConvertedPlayerId(GetTriggerPlayer())] + ( " has taken control of " + ( temp + "'s Hero" ) ) ) )
endfunction
//===========================================================================
function InitTrig_TakePlayerControl takes nothing returns nothing
local integer a=0
set gg_trg_TakePlayerControl = CreateTrigger( )
call DisableTrigger( gg_trg_TakePlayerControl )
loop
exitwhen a>=12
call TriggerRegisterPlayerEvent( gg_trg_TakePlayerControl, Player(a), EVENT_PLAYER_LEAVE )
set a=a+1
endloop
call TriggerAddAction( gg_trg_TakePlayerControl, function Trig_TakePlayerControl_Actions )
endfunction |
| 10-20-2003, 02:44 PM | #2 |
I really need a confirmation on this |
| 10-22-2003, 04:15 AM | #3 |
Why can't you test this? Heavylock your map and test with 1 other person on IRC. |
| 10-22-2003, 12:19 PM | #4 |
You are right, even so SetPlayerControl does the trick or doesn't? |
| 10-22-2003, 01:19 PM | #5 |
I tried this too, but it doesn't work. I asked on bnet forums, and Brett said it's impossible if SetController doesn't work (there is no other way). This is indeed a big bummer. You will need to reserve a player slot for the computer player. Using the slots past 12 doesn't work perfectly either :( |
| 10-22-2003, 01:26 PM | #6 |
Then how to do it, errhh I once found a map where the author was claiming that it had an advanced ai that could get the control of leaving players I'll have to research further |
| 10-24-2003, 08:58 PM | #7 |
I only tried simple AI scripts, never anything advanced. Thing is, when the AI takes over, unit micro becomes much better. That's what I tested. |
