• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[AI] Player leaves- Run custom AI script for player

Status
Not open for further replies.
Level 6
Joined
Sep 19, 2005
Messages
169
Hi, posting from iphone here, so hopefully text doesnt appear weirdly. Ive made my own custom or "campaign" AI for my Risk mapsnthat works quite well. But Ive been trying to make the ai script run for players that leave, so far it hasnt worked. Is this even possiblenl to do? If so, then how?
 
Level 16
Joined
May 1, 2008
Messages
1,605
Seas =)

Hmm so you got your own script allrdy and you want it to run?

The create a trigger with no event and condition. The action is your script.

Then create a trigger:

  • Check
    • Events:
      • Player - Player 1 leaves
    • Conditions:
    • Actions:
      • Trigger - Run <Trigger with script> ignore conditions.
1) But ofc make sure, that your script is only running for the leaving Player then.

2) Maybe you need to create so many trigger with the script egual to the Players in your map - and a trigger for "Player 1 leaving > Run Script 1" "Player 2 leaving > Run Script 2" ...
 
Level 6
Joined
Sep 19, 2005
Messages
169
Seas? Ive tried this, doesnt seem to be working. When the game begins, I have the script run for all players of computer control. This works fine. But it hasnt been working when trying to run for the leaving player. The trigger I used was similar to what you posted. I'm not at the computer now, but I know when creating a run ai gui trigger, theres a descriptiom saying something to the effect run script only for computer players and make set forces disabled, if my memory serves me correct. Is this just not possible with GUI then?

EDIT: The trig i used was something like : Player Leaves. Run (aiscript) for triggering player)
 
Level 6
Joined
Sep 5, 2007
Messages
264
I think that the reason that the AI script isn't running is:
1) When Wc3 is told to run AI, it checks the "player slot controller" and only runs if the computer is in control of a given slot. When a game is hosted, the game sets the slot to "player" not "computer" so the AI can't run on that slot.
2) The leaving player is declared defeated when they leave, so the AI just continues with this assumption, and doesn't do anything (or stops running).

Either way, I don't know of ways to get around this, other than not using an AI script... use complex triggers to simulate AI. That's my only answer.
 
Level 6
Joined
Sep 19, 2005
Messages
169
Well, at first I used complex triggers. I've found that "complex triggers" or at least what I was doing-- (with my GUI knowledge -.-) was lagging up the game. Besides, my AI does much better than what I could hope to trigger. (Although it is still trigger-assisted.) So since I couldn't come up with a working solution, here's what I've done. When a player leaves, all of the players units are set to a variable. Another variable grabs a random AI player that is still alive, and then the leaving player's units are given to the random player. Not QUITE the same, but still better than to have units just sitting after a player leaves, better to have an AI player take over the units. (Might be hard to understand if not familiar with risk games)
 
Status
Not open for further replies.
Top