Stratagus function expanded
-
- Posts: 87
- Joined: Wed May 21, 2014 6:26 am
Stratagus function expanded
Hi i want to ask if is possible to expand lua functions, like for set ChangeUnit to different player, or create teams of players, where there will be alliances, any help regards this??
Re: Stratagus function expanded
All of this is already possiblefrancot514 wrote:Hi i want to ask if is possible to expand lua functions, like for set ChangeUnit to different player, or create teams of players, where there will be alliances, any help regards this??
To change a unit's owner to a different player, use the following function:
ChangeUnitOwner(unit, old_player, new_player)
"unit" is the slot used by the unit
"old_player" is the index of the unit's current player
"new_player" is the index of the player you want to become the unit's owner
To create alliances between players, use the following function:
SetDiplomacy(player, "allied", other_player)
"player" is the index of the player you are changing the diplomatic stance of
"'allied'" - leave this as is (other values this argument can take are "enemy" and "neutral)
"other_player" is the index of the player object of the diplomatic stance change
You also need to do this for the other player, so you also need to add:
SetDiplomacy(other_player, "allied", player)
Remember to set shared vision for the players:
SetSharedVision(player, true, other_player)
SetSharedVision(other_player, true, player)
-
- Posts: 87
- Joined: Wed May 21, 2014 6:26 am
Re: Stratagus function expanded
Ok, good to know all this is currently possible, i will need to allow my maps have it by default, there is a way to configure this ingame, or can only be added by modyfying map script??
Re: Stratagus function expanded
It is possible to have your maps do those things by default (with triggers which appear on all maps, for instance).francot514 wrote:Ok, good to know all this is currently possible, i will need to allow my maps have it by default, there is a way to configure this ingame, or can only be added by modyfying map script??
-
- Posts: 87
- Joined: Wed May 21, 2014 6:26 am
Re: Stratagus function expanded
What you mean triggers that appear on all maps??, a common lua file that contains all triggers?