HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

How to turn on computer for a leaver

06-19-2006, 02:20 PM#1
Alexander244
I am in the process of making an AI for my map, everything works as I want it to, except that the units whose controller has left do not cast abilities (this is obvious as the slot is still a user slot). I was wondering if/how it would be possible to make the computer take control of the slot (all i need it to do is to cast abilities like the normal computer would if the slot started under the
control a a computer)

Here is my current leave trigger which, amoung other things, turns over control to the AI, I have attempted to make the computer take control of the slot, but i have had no success:

Collapse Leave Trigger:
function Trig_Player_Leaves_Actions takes nothing returns nothing  
    
    local player p = GetTriggerPlayer()
    call SetPlayerController(p, MAP_CONTROL_COMPUTER )
    call PauseCompAI(p, false)
    
    call StartPlayerAI(p) // Links to other AI funtions, that all work
    
    //... some other stuff, not relevant
    
endfunction

Hopefully it is quite simply, i am just missing something.
Any help would be appreciated.
06-19-2006, 03:11 PM#2
shadow1500
I dont think you can set up a computer for a user slot, even if the player left.
You will need to make the player cast spells with triggers.
06-19-2006, 03:50 PM#3
darkwulfv
I think it's possible. Blade made an AI that did that in his hero arena. If a player left, a computer would take control. IDK if this will do the same for you, but it may help some to look at the code.
06-19-2006, 06:49 PM#4
Captain Griffen
Odds are Blade.dk's hero arena AI was triggered, so don't get your hopes up.
06-19-2006, 07:24 PM#5
Blade.dk
Yes, it was simple triggers.
06-20-2006, 07:32 AM#6
Alexander244
Oh well, I have started to trigger the abilities to be cast now...
If anyone does know of a way to use the code blizzard made to cast abilities it would be very useful. (either by using computers or not)

Edit: I have finished triggering the abilities now, so don't worry
06-20-2006, 12:12 PM#7
BertTheJasser
Use a dummy AI, so do not nedd to to code an AI for every single spell. Just use a base spell that the standard uses the same way.
And additionally use:
Collapse JASS:
SetPlayerController      takes player whichPlayer, mapcontrol controlType 
06-20-2006, 12:56 PM#8
Vexorian
SetPlayerController will change the controller for comparissions. I tried many ways but I could not find ANY way to make the native AI or a .ai script take the control of a Human Player's slot.

The only way is to have an AI that is completelly triggered.
06-20-2006, 04:51 PM#9
shadow1500
You dont have to use the leaver's slot, you can just change the hero's owner to a computer slot on the same team as the leaver. (You can even use the 4 neutral slots)
06-20-2006, 07:35 PM#10
Vexorian
neutral slots will only use the basic unit AI , never AI scripts. Besides they are limited to 2 of them, it is not like you will use Neutral Hostile or Neutral Passive . I am also not sure if Neutral Extra or Victim are able to use the basic unit AI.

Using other slots is an excellent idea, unless all the 12 slots are being used
06-20-2006, 08:26 PM#11
Rising_Dusk
Neutral Hostile/Passive don't follow typical unit ai anyways.
They have their own private set of artificial intelligence to follow, so they usually go totally screwy.

Victim/Extra will follow typical unit AI perfectly.
I've tested it on multiple occasions.