• The forum has been updated. For an explanation of some of the changes, head over here.

[WB] Bows used with shields [Discussion]

Currently viewing this thread:

Antonis

Marquis
WBWF&SVCNW
Hey guys! Following a very interesting discussion with our very own Earendil, I post this here:
So, in the game, if you take off the two handed property from any bow, you can use it simultaneously with a shield. Like in the well-known images of the Eastern horse archers the player or any troop with those two types of items equipped can shoot with a bow while having a shield equipped in the other hand. It's also possible then to block with it like with any other weapon type instead of a bow. It's a very interesting idea and quite immersive, especially in historical themed mods at which there are archer units on horse.



The only problem with it is that the game, of course, allows the player to equip any kind of shield with any bow that lacks the two_handed property, even a humongous tower shield; which is not really believable or immersive.
So, we've been thinking of a mission template trigger, one that would check if any number of bows is equipped in the four item slots and then go on checking if specific shields are also in these slots. Then, when the player would want to equip the bow with a shield, if this shield was in the list of the 'forbidden' items, it simply would un-equip it.

This is pretty much a theoretical discussion, a brainstorming session, if you like. Speaking for myself, I would be interested in the most efficient way possible, performance-wise, not just anything that works.

Now, the way I (with the valuable additions of Earendil) was thinking about it:
- make a mission template trigger, which would run all the time, without intervals, for the duration of the mission.
- it would check if player has any of the bows without the two_handed porperty equipped (troop_has_item_equipped)
- if it has one such bow equipped, it would go on to check if it has a specific shield in any of the 4 item slots and unequip it. That could be done with consecutive this_or_next or better, imo, with a is_between, if the shields are one after the other.

I am looking forward to hear thoughts and ideas, thanks!
 
Last edited by a moderator:

Eärendil Ardamírë

Subforum Moderator
WBWF&SM&B
The main problem is that the function of having both weapons, bow and shield, equiped is that it is done via a flag at the bow. A flag at the shield marking the ability to equip both would have been far more suitable for this purpose but is sadly not given. Hence the workaround with a necessary mission template trigger.

Since bots don't pick up stuff from the ground it's mostly about the player (or players in multiplayer). So the mission template would not have to run all the time but only if a player is changing something at his current wielded equipment.
The list of shields with which it should work could either be done inside a script which gets then called inside the trigger or in the trigger itself. Having it in a script would perhaps give a better overview if the count of shields with which it should work is getting higher.

So the flow would basically like this:
1) Mark all bows for which it is suitable to have them with a shield (it don't have to be all necesarily) as an one handed weapon.
2) Make a list of shields with which it should work to have both equiped to rule out tower shields etc.
3) Mission template trigger checks for possible combination and unwields shield if no match

Trigger: Player wields a bow (itp_type_bow) and a shield (itp_type_shield)
Condition: Shield is not listed in the script
Consequence: Shield gets unwielded

A check for one-handed bows is in my opinion not necessary since at two-handed bows the problem is anyway not appearing (trigger is to wield both items at the same time).
 

Antonis

Marquis
WBWF&SVCNW
A check for one-handed bows is in my opinion not necessary since at two-handed bows the problem is anyway not appearing (trigger is to wield both items at the same time).

Ah, yes, you're absolutely right. :facepalm:
Fortunately, the game blocks ( :shifty: ) the player from equipping a shield with 2 handed stuff by default. Still, I am worried about having the trigger check a whole load of stuff that way. In Native, it's fine, because there are just a couple of shields. But in other mods (like my Fires of War) there are tons of shields, easily more than 100-200.
 

Eärendil Ardamírë

Subforum Moderator
WBWF&SM&B
Still, I am worried about having the trigger check a whole load of stuff that way. In Native, it's fine, because there are just a couple of shields. But in other mods (like my Fires of War) there are tons of shields, easily more than 100-200.
In the end it is the question if you have more shields with which it should be possible or more shields with which it shouldn't be. Depending on that you can list the lesser amount at the script getting called and organise the condition via eq (if count of no-no-shields is shorter) or neq (if count of yes-yes-shields is shorter).
 

Antonis

Marquis
WBWF&SVCNW
Hmm, yeah. Still, there are mods, like 1257AD or Clash of Kings, that can benefit from this and potentially have an equal (very large) amount of shields in either category.
 

Eärendil Ardamírë

Subforum Moderator
WBWF&SM&B
Well, in my opinion it should only work with buckler or small round shields. Typically it's the lesser amount of shields in a mod. Having a bigger shield makes it also really hard to shoot a bow with the same efficiency as without. Which could bring up the potentail of getting a malus when shooting with shields since then the players would have to decide for either going with better shooting abilities or for more cover, so the idea here expands already :lol:,
However, with big shields it makes simply no sense. I am doing archery and while I am not the strongest guy myself it is hard enough to shoot a bow without an additional weight at your left arm.
 

Tocan

Sergeant Knight at Arms
Haha thanks for screens, just tought about holding the shield with the teeth. That trigger could be a monster but there's no other way to do this I think. For performance it would maybe a good idea to bound the trigger/check to a key...
 

Antonis

Marquis
WBWF&SVCNW
Plus, I found that any shield that is larger than the huscarl shield of Native just clips with every bow animation, when using a shield. Of course, some modders in a fantasy setting would probably not mind, depending on their designs and setting.

Haha thanks for screens, just tought about holding the shield with the teeth

Earendil provided them, from a previous discussion, some months ago. I was quite unclear, wasn't I? :razz:
As for button checks, I don't know. They would need additional checks to make sure everything works correctly, plus, in my mind the process should be automagically done.
 

Eärendil Ardamírë

Subforum Moderator
WBWF&SM&B
Haha thanks for screens, just tought about holding the shield with the teeth.
We are talking here about civilized factions, not about the Nords :lol:
Plus, I found that any shield that is larger than the huscarl shield of Native just clips with every bow animation, when using a shield. Of course, some modders in a fantasy setting would probably not mind, depending on their designs and setting.
Yeah, basically every shield which is bigger than the forearm will clip more or less I would guess.
For performance it would maybe a good idea to bound the trigger/check to a key...
Yes. The most important question would be how to trigger it. What do you have in mind with a key?
As for button checks, I don't know. They would need additional checks to make sure everything works correctly, plus, in my mind the process should be automagically done.
Yes, automatically it would be better. I mean, the player would have every incentive not to press the button for checking it to avoid loosing the shield cover with a bow.
 

Antonis

Marquis
WBWF&SVCNW
Yeah, basically every shield which is bigger than the forearm will clip more or less I would guess.

Interestingly enough, the Native animation doesn't clip with heater shields. PapaLazarou's animation clips with all shields, especially on horseback, as Seek n Destroy pointed out to me.
 

Tocan

Sergeant Knight at Arms
Yeah automagically would be better but don't forget the trigger would also need to run/work everytime you switching back to the bow.

Yes, automatically it would be better. I mean, the player would have every incentive not to press the button for checking it to avoid loosing the shield cover with a bow.
How about replacing the bow with the one-handed version of it, but only if I press the key and have a valid shield... Wow I need sleep
 

Eärendil Ardamírë

Subforum Moderator
WBWF&SM&B
How about replacing the bow with the one-handed version of it, but only if I press the key and have a valid shield... Wow I need sleep
Wow, a nice idea, I was not thinking about that. In Native we have only itp_next_item_as_melee which is working only from 'any weapon kind' -> 'melee' (we really should make a thread about the experiments with that flag from a while ago, @SupaNinjaMan ). A week ago I have had however a discussion with @Seek n Destroy about alternative weapon modes at the modding discord, he was using Autolykos' system for alternative weapon modes from his Module System Overhaul. With that one it could be possible to do such thing, haven't looked into that yet myself. Perhaps Seek n Destroy has gathered some experience there already.

It would be a nice and neat solution if it would work out with that one.
 

In Vain

Count
Good idea Antonis. Might be interesting for TLD, too.
Here's how I'd do it.

- Don't check for equipped items, use agent_get_wielded_item and agent_set_wielded_item instead.
- You'd need to test if agents automatically re-equip the shield when they switch to melee weapons. But I believe they do.
- Don't use this_or_next or ranges to check for shields. Check for shield size instead.
- You can of course go wild and make allowed shield size scale with the agent's shield skill or agility.
- If you want to check the player only (prohibit the player from using picked up shields), run the trigger every 1 second or so and only check the player agent. Minimal performance impact.
- For NPCs you'd need to do an agent loop, which would be slightly more performance expensive. But I guess you can get away with triggering it every 3-5 seconds. Do a troop_is_hero check to limit the operation.

Edit: Or use ti_on_item_wielded
 
Last edited:

Eärendil Ardamírë

Subforum Moderator
WBWF&SM&B
A lot of good points, InVain! I haven't had in mind that one can simply check for the shield size and to connect it with the shield skill, a really good idea! Got point also with the NPCs. I would have ignored them since the bots get their equipment assigned but I forgot about the NPCs getting their equipment assigned by the player.
 

Antonis

Marquis
WBWF&SVCNW
Hey, thanks, really cool points, as Earendil mentioned! Indeed, for all the units it doesn't matter, as the modder assigns equipment to them, so assigning a large shield with a bow can be avoided.
- You'd need to test if agents automatically re-equip the shield when they switch to melee weapons. But I believe they do.
I agree, they do it automatically, as long as they have an intact shield or the player holsters it, by himself.

For NPCs you'd need to do an agent loop, which would be slightly more performance expensive
Yeah, I fear as much. And if someone has all native NPCs in their party, or in mods with more companions + claimants etc.
That can be heavy and I think all of those are flagged as heroes.
 

Eärendil Ardamírë

Subforum Moderator
WBWF&SM&B
- For NPCs you'd need to do an agent loop, which would be slightly more performance expensive. But I guess you can get away with triggering it every 3-5 seconds. Do a troop_is_hero check to limit the operation.
Yeah, I fear as much. And if someone has all native NPCs in their party, or in mods with more companions + claimants etc.
That can be heavy and I think all of those are flagged as heroes.
Perhaps it could work with only an initial check for the NPCs and depending on the result the bow could be exchanged with a two-handed version of it. That would be one trigger at the beginning of a battle but wouldn't require a check later on anymore. Drawback of it would be that the module_items file would get blown up with the duplicates.
 

Antonis

Marquis
WBWF&SVCNW
Yeah, that'd require an identical entry for a bow with a two_handed flag. A bit pointless, really. Oof, that simple thing has more meat to it that I figured. I love it.
 

In Vain

Count
Yeah, I fear as much. And if someone has all native NPCs in their party, or in mods with more companions + claimants etc.
That can be heavy and I think all of those are flagged as heroes.

It's not heavy. Most mods that are not simple native reskins have dozens of try_for_agents operation. If you only do it once every 3 seconds or so, it won't be noticeable. (Depending on the battle size, of course.) Having more companions than native will hardly affect performance, either.
What's bad is having try_for_agents within try_for_agents.

In the end, it's up to the modder's discretion. But you can't do it without the loop. There's no try_for_hero_agents



Edit: If you want a static solution that might be lighter, run an on_agent_spawn trigger, check for NPCs, check for bow+shield combination, unequip shield. But that will make them not use the shield at all. Or yeah, replace bow with 2H version.
 

Antonis

Marquis
WBWF&SVCNW
Yeah, true that. On top of that, I think (just as a personal preference, ofc) that it would need to run every second, all the time really; my reasoning is that if it runs every 3 seconds and the player or NPC equips the items between those seconds, the game would force unequip them, which wouldn't really look good while playing. The check would need to run all the time, so that no-one will equip the items.
 
Top Bottom