• 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!

Hotkeys

AmosTrask

Landlubber
hey,

Im sure I saw a post like this a while back but I cant find it now, so if anyone knows where it is and can point me to an answer rather than having to tell me again please do.

how do I make them then? has their been any tutorials on it?

(what i essentialy want to do is make 2 hotkeys, which are very similar.

1. equips a dagger, and then draws it
2. puts the dagger away and equips your sword.

I realise this may be difficult to do as youd have to draw it from the inventory, but I asume you could reference the position of the sword in the inventory for example position 1, and position 2, and then ingame ensure that the swords u need are in the correct position.)

so anyone wanna get me started?
 
There are three ways that you could add this option.

The hard way would involve modifying the game so that you could have two blades equiped at the same time and just draw which one you wanted. I have no idea how to do this as this is way beyond my feeble programming skills and even if someone could do it the animation files would limit us to drawing both blades from the same place as no one can edit these files.


The two easier ways would be to have a key that equips a dagger and then you can draw and sheath it as normal and another key that would equip your sword (but not whilst your dagger is drawn I suspect.)

There is one huge drawback with these easier options and that is that each blade has got it's unique ID and each quality of each blade changes that ID.
So a Badly Worn dagger has a different ID to a Fine dagger and if you were using a Good Sabre and then swap to using a Fine Bosun's Choice then the code would have to be edited to take that into account.

Now the easiest way would mean that every time you use a different dagger and a different sword you would have to exit the game and manually edit the code to suit the different weapons that you are using. This should work but obviously would be a pain in the arse as everytime you get a better blade you would have to do some editing.

The slightly harder way would involve working out how the game stores details of what weapons you have got equipped as there are some points in the game where you are disarmed for a while and then the game gives you back the same weapons later. I have no idea how it does this but it might work.
 
its a good point, thanks for your help, youve given me a lot to think about.

for me personaly id like to make a mod of the second one, as ive got a secure choice for my sword which rarely changes, I realise that the mod might be no good for anyone else however.

could someone point me to the location of the hot keys? so i can have a nosey n see if i can work out how to build them? or could anyone give me a quick post telling me how i might set this up as sugguested by sirus
 
You can find most of the hotkeys in <span style='color:red'>PROGRAMCONTROLSinit_pc.c</span> to form the full hotkey. For example, I set my 'change ship name' mod to use V as a hotkey. To set that up, I put a line in each of those files, like this:

<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->INIT_PC.C



...

    CI_CreateAndSetControls("", "JR_ShipNameChange", CI_GetKeyCode("KEY_V"), 0, false ); // iamthejarha

...



SEADOGS.C



...

    if(ControlName == "JR_ShipNameChange")    { ChangeShipName(GetMainCharacter()); } // iamthejarha

...<!--c2--></div><!--ec2-->

In both cases, I inserted my code right after NK's `name-change` controls, because my mod was very similar to that one. In your case, the position and exact syntax of what you want to do might make your entry in <span style='color:red'>seadogs.c</span> look a little--or a lot--different. Hopefully that'll give you somewhere to start, though. <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/pirate2.gif" style="vertical-align:middle" emoid=":p:" border="0" alt="pirate2.gif" />
 
cheers for that! most apreiciated, I shall have a go and let you all know how it turns out! <img src="http://www.piratesahoy.com/forum/style_emoticons/<#EMO_DIR#>/onya.gif" style="vertical-align:middle" emoid=":onya" border="0" alt="onya.gif" />
 
Hmm.
Way I'd do it is, set up one key as iamthejarha says, and then in seadogs in the processcontrols section, add a new case:
(only key needed because you can use it to switch between dagger and sword)
<!--c1--><div class='codetop'>CODE</div><div class='codemain'><!--ec1-->  case "swapdaggersword":

     ref pchr = GetMainCharacter();

     string bladeid = "";

     if(!CheckAttribute(pchr,"oldsword"))

     {

   pchr.oldsword = GetCharacterEquipByGroup(pchr, BLADE_ITEM_TYPE);

   bladeid = pchr.oldsword;

   string tmp = "";

   string bestdag = "";

   for(int i = -2; i < 4; i++)

   {

       if(i == 0) tmp = "blade5";

       else

       {

     if(i<0) tmp = "blade5" + i;

     else tmp = "blade5+" + i;

       }

       if(GetCharacterItem(pchr, tmp)) bestdag = tmp;

   }

   if(bestdag != "") bladeid = bestdag;

     }

     else

     {

   bladeid = pchr.oldsword;

   DeleteAttribute(pchr,"oldsword");

     }

     EquipCharacterByItem(pchr, bladeid);

     LAi_SetFightMode(pchr, true);

 break;<!--c2--></div><!--ec2-->

YMMV of course. And hey, it may not even work (haven't tested yet, brb).
{EDIT: It works, but pchar had to be changed to pchr, and is now changed above.}

Oh, also. The way it works now, you never put your sword away, the dagger just magically appears in your hand. If you want the player to put away the current item first, add LAi_SetFightMode(pchr, false); above EquipCharacterByItem at the end, so it goes
LAi_SetF...
EquipCh...
LAi_SetF...
 
Sorta. Because, pistols when equipped default to not being loaded.
So you'd swap pistols but then have to wait for it to be charged. And if you changed that so they defaulted to being loaded, you could "infinite fire" by swapping between two pistols.
 
Back
Top