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.
Events
Timer - Every 5.0 seconds of Game Time
Local Variables
Conditions
(Status of player 1) == Left The Game
Actions
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)
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.
This seems pointless to me as when a player leaves game you get control of his units if you are an ally of him anyway? why would you bother with changing ownership of the units? its a waste of time?
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.
I was not trying to critic, sorry was meerly understanding the point in why you would take that approach, after explaining the purpose I can understand.
how are you testing when a player leaves the game?
and are you storing all the turrets a player builds in a group? otherwise the picked unit part of the change owner isn't going to work
edit. as in currently you are going unit group - pick all units and then do change only one unit, change the second action to a unit group change owner trigger not a unit owner
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.
Events
Timer - Every 5.0 seconds of Game Time
Local Variables
Conditions
(Status of player 1) == Left The Game
Actions
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)
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.
This seems pointless to me as when a player leaves game you get control of his units if you are an ally of him anyway? why would you bother with changing ownership of the units? its a waste of time?
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.
i need help not critics.
@poffik: Go
I was not trying to critic, sorry was meerly understanding the point in why you would take that approach, after explaining the purpose I can understand.
how are you testing when a player leaves the game?
and are you storing all the turrets a player builds in a group? otherwise the picked unit part of the change owner isn't going to work
edit. as in currently you are going unit group - pick all units and then do change only one unit, change the second action to a unit group change owner trigger not a unit owner
hope I'm being clear