I don't know if these would be hard to implement, bet here are a few commands I'd gladly use if I could:
- States.UnitSelected(player) and/or procedure OnUnitSelected(player, UnitID): know which unit is currently selected (or has been selected last; by using a global variable to store the value, the two things become the same)
- States.HouseSelected(player) and/or procedure OnHouseSelected(player, HouseID): know which building is currently selected
- Actions.ForceSelect(player, ID): force a player to select a building or unit
- Actions.GiveUnitFromHouse/GiveGroupFromHouse: same as GiveUnit/GiveGroup, but the new unit/group comes out of a building instead of spawning on the ground
- Actions.UnitSetCarrying(unitID, ware type) or Actions.UnitSetCarryingAndOrderWalk: give a ware to a serf; if his AI tries to find immediately a building to bring it to, then Actions.UnitSetCarryingAndOrderWalk would let the scripter decide what the serf should do with that ware before the game logic decides otherwise
- Actions.UnitKillInHouse(unitID/GroupID, houseID): the unit (or group) is ordered to enter the building (if he's not in there already), and is then removed (without playing the "exit from building" animation first, of course, or even cancelling it if it's already playing, if possible); this, by the way, would give a way to remove Recruits from inside their Barracks without playing their "exit from building" animation first
Now, what could these commands be used for?
Well, let me explain with a few examples: I tried to make a script that would allow Allies to trade with each other using the Marketplace.
But then found out that even though I could order around a non idle civilian (by killing him, then respawning him OnUnitAfterDied and immediately using Actions.UnitOrderWalk), I couldn't get him to enter a building, nor could I give him a ware to move.
Another example: in GoldenCliffs - Bonus, one of the bonuses allows the player to recruit Barbarians... but its implementation is ugly.
With a UnitKillInHouse function, I could kill the Militia before he leaves the Barracks, and then spawn a Barbarian with GiveGroupFromHouse... way way better.
One last example: with these functions, it would be possible to fake a TPR recruiting centre in any building.
How? Simple:
- Give the player a Barracks hidden in an unexplored area (the fog doesn't update, if the area is covered after the building is completed), and make sure it always has Leather Armors and Shields
- When the player produces a Wooden weapon, find a serf who is idle (if there aren't, just kill a serf who is not carrying anythin and respawn him OnUnitAfterDied) and order him to enter the workshop with Actions.UnitKillInHouse
- when he's inside and died (OnUnitAfterDied will run with his Unit Type and with the building's X and Y coordinates), respawn him inside the same building, give him the produced weapon and order him to enter your "fake recruiting centre", and remove one weapon from the workshop
- when he's inside it and died, respawn him one last time and add the weapon to the hidden Barracks
- When the player selects the fake recruiting centre, have him select the hidden Barracks instead
- if he trains a Scout, kill him and have a Vagabond exit the fake recruiting centre; if he trains a Bowman, have a Rogue exit instead; and so on
I know, this last one looks complex, but keep in mind this is just an example of the possibilities... also, imagine how neat would something like this be in a campaign mission!
What do you think about this?
Just when you think you know something, you have to look at it in another way, even though it may seem silly or wrong. You must try! - John Keating, "Dead Poets Society"