I'm fairly new to scenes and all that stuff, especially battles, so here's what I know:
- agent is not a troop, agent is based on a troop
- agent can only equip a weapon that is in his inventory, and agent's inventory is a sub-set of items in troop's inventory
- I have a rough idea of how triggers work (once, on spawn, on hit, on dismount etc.)
Here's what I'm trying to do and have no idea how:
I have a special mounted troop that's supposed to use a bow when enemies are far, and lance (the nice-looking, tournament shaped lance) when enemies are near. However, when dismounted (due to horse dying, or because it's a siege or because player orders army to dismount), the agent is supposed to switch from bow+lance combo to bow+sword combo. So far I noticed that there is no tf_guarantee_everything, so I can't give both sword and lance to my troop - if I do, the agents get randomly either sword or lance. I solved this by not giving a sword to the troop. Using tf_guarantee_melee with tf_guarantee_ranged my agents get bow+lance 100% of the time. Giving only 1 melee weapon to my troop also solves the problem of forcing the agents not to use swords on horseback, so I'd prefer to stick to this setup.
Now, what I want to do is, when agent isn't mounted, I want to remove lance from him and give him the sword instead.
Detecting that he isn't mounted is easy, using on spawn, then on dismount and if horse death doesn't count as dismount, I can just follow with on agent death, and if it's a horse, then get rider agent and replace lance with sword.
Or at least that's the idea.
The problem is, I don't know how to edit agent's inventory during battle (it's not a troop).
I also can't use commands that force the agent to switch between weapons, because one of the weapons doesn't exist in agent's inventory.
Any help would be greatly appreciated.
- agent is not a troop, agent is based on a troop
- agent can only equip a weapon that is in his inventory, and agent's inventory is a sub-set of items in troop's inventory
- I have a rough idea of how triggers work (once, on spawn, on hit, on dismount etc.)
Here's what I'm trying to do and have no idea how:
I have a special mounted troop that's supposed to use a bow when enemies are far, and lance (the nice-looking, tournament shaped lance) when enemies are near. However, when dismounted (due to horse dying, or because it's a siege or because player orders army to dismount), the agent is supposed to switch from bow+lance combo to bow+sword combo. So far I noticed that there is no tf_guarantee_everything, so I can't give both sword and lance to my troop - if I do, the agents get randomly either sword or lance. I solved this by not giving a sword to the troop. Using tf_guarantee_melee with tf_guarantee_ranged my agents get bow+lance 100% of the time. Giving only 1 melee weapon to my troop also solves the problem of forcing the agents not to use swords on horseback, so I'd prefer to stick to this setup.
Now, what I want to do is, when agent isn't mounted, I want to remove lance from him and give him the sword instead.
Detecting that he isn't mounted is easy, using on spawn, then on dismount and if horse death doesn't count as dismount, I can just follow with on agent death, and if it's a horse, then get rider agent and replace lance with sword.
Or at least that's the idea.
The problem is, I don't know how to edit agent's inventory during battle (it's not a troop).
I also can't use commands that force the agent to switch between weapons, because one of the weapons doesn't exist in agent's inventory.
Any help would be greatly appreciated.
Last edited: