1. Dismiss Notice
  2. GOG.com logo

    Thanks to YOUR votes, GOG.com now sells:
    - Sea Dogs - Sea Dogs: Caribbean Tales
    - Sea Dogs: City of Abandoned Ships

    Vote now to add Pirates of the Caribbean to the list!

    Dismiss Notice
  3. Under the Crossbones Podcast

    A Pirate Podcast with Interviews
    Music, Comedy and all things Pirate!

    - Episode Guide - About - Subscribe -
    - Twitter - Facebook - iTunes - Android -
    - Youtube - Fill the Coffers -

    Dismiss Notice
  4. New Horizons logo

    Quick links for PotC: New Horizons
    - Download latest version
    - Wiki - FAQ - Report bugs here
    - ModDB profile

  5. GOF logo

    Quick links for AoP2: Gentlemen of Fortune 2
    - Downloads and info
    - Historical Immersion Supermod
    - ModDB Profile

Dismiss Notice
New to the forum?
Please take a moment to read our Welcome Message and Forum Rules.

Abandoned Option to choose favorite weapon for your character

Discussion in 'Features Archive' started by ColonelKetchup30, Apr 10, 2016.

  1. ColonelKetchup30

    ColonelKetchup30 Sailor Apprentice

    Joined:
    Apr 18, 2014
    Messages:
    96
    Gender:
    Male
    Location:
    Amsterdam, Noord-Holland, Netherlands
    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
     
  2. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,615
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    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
     
  3. ColonelKetchup30

    ColonelKetchup30 Sailor Apprentice

    Joined:
    Apr 18, 2014
    Messages:
    96
    Gender:
    Male
    Location:
    Amsterdam, Noord-Holland, Netherlands
    Not using it as a cheat as such, more of a glitch that has its advantage.
     
  4. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,615
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    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
     
  5. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,615
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    @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.
     
  6. ColonelKetchup30

    ColonelKetchup30 Sailor Apprentice

    Joined:
    Apr 18, 2014
    Messages:
    96
    Gender:
    Male
    Location:
    Amsterdam, Noord-Holland, Netherlands
    Yeah abandon it... surprised it even got a look in.
     
  7. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,615
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    We can always *try* to help. ;)
     
  8. Mere_Mortal

    Mere_Mortal Free Like a Radical Storm Modder

    Joined:
    Jan 18, 2011
    Messages:
    568
    Gender:
    Male
    Occupation:
    Courting the Frown
    Location:
    Middle England
    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: May 6, 2016
  9. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,615
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    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.
     
  10. Mere_Mortal

    Mere_Mortal Free Like a Radical Storm Modder

    Joined:
    Jan 18, 2011
    Messages:
    568
    Gender:
    Male
    Occupation:
    Courting the Frown
    Location:
    Middle England
    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.
     
  11. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,615
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    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.
     
  12. Mere_Mortal

    Mere_Mortal Free Like a Radical Storm Modder

    Joined:
    Jan 18, 2011
    Messages:
    568
    Gender:
    Male
    Occupation:
    Courting the Frown
    Location:
    Middle England
    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: May 6, 2016
  13. Mere_Mortal

    Mere_Mortal Free Like a Radical Storm Modder

    Joined:
    Jan 18, 2011
    Messages:
    568
    Gender:
    Male
    Occupation:
    Courting the Frown
    Location:
    Middle England
    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
     

    Attached Files:

    Last edited: May 6, 2016
  14. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,615
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    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....
     
  15. Mere_Mortal

    Mere_Mortal Free Like a Radical Storm Modder

    Joined:
    Jan 18, 2011
    Messages:
    568
    Gender:
    Male
    Occupation:
    Courting the Frown
    Location:
    Middle England
    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: May 6, 2016
  16. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,615
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    Skip equip does need to work for NPCs.
    I think it is used for them in various spots already.
     
  17. Mere_Mortal

    Mere_Mortal Free Like a Radical Storm Modder

    Joined:
    Jan 18, 2011
    Messages:
    568
    Gender:
    Male
    Occupation:
    Courting the Frown
    Location:
    Middle England
    Fair enough, I guess I’d better use a new one then.
     
    Pieter Boelen likes this.
  18. Pieter Boelen

    Pieter Boelen (Not So) Old Seadog Staff Member Administrator Storm Modder Hearts of Oak Donator

    Joined:
    Nov 11, 2004
    Messages:
    66,615
    Gender:
    Male
    Occupation:
    Maritime Research: Project Engineer (Analysis)
    Location:
    Wageningen, The Netherlands
    Probably safer. :onya
     

Share This Page