• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

Abandoned Option to choose favorite weapon for your character

Ketchup

Sailor
After playing the mod for some time, playing around with the settings for looting, that when you auto loot blade/gun/money, and you press 1 or 2 you fast equip the "best" weapon in your inventory. But when you have a weapon such as an Excellent Horse Pistol, which is your favored weapon, and you pick up a musket, and press 2, because as I found out pressing 2 reloads your "best" weapon without having to wait for it to reload by itself :onya So, I was wondering if a "Choose favored weapon" system could be implemented, so you don't equip something like a musket or a blunderbuss, which is better by statistics, but the Horse Pistol is your favorite, when pressing 2?:wp
 
How?

Also, sounds to me like you're trying to use it as a cheat, rather than a feature.
If you want to have no reload time, why don't you edit initItems.c and actually give your preferred weapon no reload time?
Might be a far simpler solution for what you want. :cheeky
 
Not using it as a cheat as such, more of a glitch that has its advantage.
Execute this line through console:
Code:
EquipCharacterByItem(PChar, GetCharacterEquipByGroup(Pchar,GUN_ITEM_TYPE));
Then it should "glitch" like that every time you press F12 and without changing the gun you've got equipped.

That is what you actually wanted to do, right? :razz
 
@ColonelKetchup30: Does the above suggestion serve your purposes?
If so, I am archiving the original request as "Abandoned". No response by the end of the week also means it gets archived.
 
As much as said “glitch” helps me “turkey shoot” my way through boarding while debugging stuff, that isn’t my intention here.

Actually, I do see a purpose in flagging a weapon as a favourite. With blades it doesn’t matter because they all do exactly the same job, albeit with different damage amounts (although do some have a longer range?). With guns, the player might want to legitimately switch between them and a good example is the musket vs musketoon: the former does a lot of damage to one victim whereas the latter does much less damage but spreads it. During boarding it might be preferable to use the musketoon to blast through the crew, but upon reaching the cabin there are less enemies and the musket might then be the better option.

I assume it’s trivial to set a flag and then check it if the hot-key is pressed, instead of defaulting to looking at weapon strength?

The problem with this idea is that I am certain it would promote what is akin to animation cancelling. Is there not a way to fix this?
 
Last edited:
Maybe the reload status in percentage can be maintained upon equipping?

How would you mark specific weapons to switch between them though?
Apart from the suggestion I did last week (remember the currently equipped one), I think something like "fully customizable hotkeys" would be a bit overkill.
Ingame anyway. Would be easier to link the desired weapon IDs through a code file that users can edit.
 
I’m still trying to understand how flags are set, but I was thinking something along the lines of setting an attribute on the main character which could be defined (and preferably removed as well) in-game via a button (say in the inventory screen). If there is no such attribute (or the player no longer possesses whichever weapon was assigned) then it will default to doing it the way it already does. This would just be a matter of telling the hot-key function to look at the attribute first and if the checks fail then it chooses the best weapon. The flag could simply be the ID for the weapon.
 
So a "Set Favourite Weapon" button in the Inventory? Sounds feasible.
Still only sets a single weapon. Or a single blade and gun since can probably be separate.
 
I think it’s perfectly viable to make a button in the inventory, right on the info box for the selected weapon. If the button is pressed then it ought switch to an “unset as favourite” version so that the attribute can be deleted, thus allowing the auto-equip to function as normal.

This works just fine from the console, it quite happily switched from another gun to the musketoon...
Code:
   aref tempFavGun
   makearef(tempFavGun,MainChar.FavGun)
   MainChar.FavGun = "pistolmtoon"
   string weapon = MainChar.FavGun
   EquipCharacterByItem(&MainChar, weapon)
Now, I have absolutely no idea where all the code is which controls the number keys. I put in a few random traces and none them were called when I used the hot-keys, so I wasn’t looking in the right places. I even changed the text for “You have equipped” where I found it, and it still didn’t do anything.

I reckon it’s just a matter of checking the attribute and throwing a return if the check passes, otherwise it continues with what it was doing.

Also... items already have the skipequip attribute available. What about a button setting this flag which would therefore allow the player to explicitly filter weapons as they find them? It’s not as easy as selecting a favourite, but it would certainly be easier to code.

@Pieter - So I’ve put a toggle in place on my inventory which flips skipequip on a per-item basis (it doesn’t care what the item is at the moment). However, the auto-equip hot-keys are completely ignoring it because the best gear is still being equipped. I know it’s in place properly because the button says “No” (as in do not auto-equip) when my trusty fists are highlighted and then it will change to “Yes” when I scroll along. If I exit the interface and go back in then I can see that it has kept any status I changed. But it equips my musketoon, rapier and golden cuirass regardless. :confused:
 
Last edited:
Okay, I’ve got it now. I added this...

CharacterUtilite.c (line #3274 I think, mine differs though)
Code:
string FindCharacterItemByGroup(ref chref, string groupID)
{
   ...
     // check to see if this item is even something we can bother with selecting
     if ( refItm.skipequip == 1 ) continue;
Works like a charm, I can now toggle the weapons based on their ID. :woot

I turned the armour off and if I press auto-equip then it tells me I don’t have any!

Files included, aside of the above. If anybody wants to do this they can do that bit by their self. :yes
 

Attachments

  • Files.zip
    16.6 KB · Views: 321
Last edited:
If you change 'skipequip', it could very well NPCs from using those weapons too.
Better to use a brand new attribute so it doesn't interfere with the regular game functionality.

What is the purpose of that 'tempFavGun' section you have in that code you quoted?
Looks like it does nothing there....
 
I was thinking about NPCs being equipped, so a new attribute is probably the best thing to do.

The “FavGun” thing doesn’t do anything itself, it was just an example of switching the weapon by using a flag.

I put this in...
Code:
if (refItm.skipequip == 1 && chref.index == 0) continue;
... but I guess NPCs could still skip it?

Hmm... I keep spawning officers and they quite happily try to stab me to death.
 
Last edited:
Skip equip does need to work for NPCs.
I think it is used for them in various spots already.
 
Back
Top