I'm making a TD map, right now i'm trying to make a trigger that will change ownership of turrets to random integer when a player leaves the game
this does not work.
Timer - Every 5.0 seconds of Game Time
(Status of player 1) == Left The Game
Player Group - Remove player 1 from The Users
Unit Group - Pick each unit in (Any units in (Entire map) owned by player 1 matching Excluded: Missile, Dead, Hidden, with at most Any Amount) and do (Actions)
Unit - Change ownership of (Picked unit) to player (Player (Random integer between 0 and (Number of players in The Users)) from The Users) and Change Color
i know this is like basic stuff for everyone but i'm stupid and i don't know how to make it work :(
I not sure why it doesent work. But instead of periodicly checking if a player has left the game you could use the existing event "Player leaves game" and reference the player with "triggering player".
Also im not sure that picking a new owner from 0 to number of players is what you want. For example in a game with 8 players, player 2 could leave the game and the trigger will give his towers to random players from 1-7, including player 2.
Im pretty sure there you could use "pick random player" from player group "The Users" instead.
when player leaves the game, every building he had is assigned to random integer inlcuding the player who left and game freezes for half a second, then trigger error pops up
'gt_player2towers_Func': Parameter out of bounds in 'UnitSetOwner' (value: -1. min: 0. max: 15)
the trigger i posted in first post has name player2towers.
what i want trigger to do is to give control of the turrets to random players that are still in game excluding the player who left
also yes it is a 4 player map.
i would be grateful if anyone can make such trigger or could explain to me how to do it.
It's a tower defense map where you get credits for killing units, when credit number reaches 1000 you get 10 minerals, 1 turret cost 1 mineral.
problem is when a player leaves his towers still kill units but those credits don't go anywhere, so i figured i'd make towers change ownership when player leaves.