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

help, small coding/control error

minimal_fuss

Landlubber
ok i was trying to manually add vipers cheats to the game:

THIS IS THE RELIVANT PART OF MY ORIGINAL INIT_PC.C (B4 CHEATS)

<!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->void ExternControlsInit(bool bFirst)
{
if(bFirst)
{
ExternInitKeyCodes();
CI_CreateAndSetControls( "", "ICancel", CI_GetKeyCode("VK_ESCAPE"), 0, false );
CI_CreateAndSetControls( "", "IAction", CI_GetKeyCode("VK_SPACE"), 0, false );
return;
}

ExternInitKeyCodes();

//CI_CreateAndSetControls( "", "Dump", CI_GetKeyCode("KEY_0"), 0, false );

CI_CreateAndSetControls( "", "TimeScale", CI_GetKeyCode("VK_MULTIPLY"), 0, false );

// Cameras =====================================================================
/* // character camera
CI_CreateAndSetControls( "", "ChrCamTurnV", 257, INVERSE_C

(ETC....)<!--QuoteEnd--></div><!--QuoteEEnd-->



THIS IS THE MODIFIED VERSION:

<!--quoteo--><div class='quotetop'>QUOTE</div><div class='quotemain'><!--quotec-->void ExternControlsInit(bool bFirst)
{
if(bFirst)
{
ExternInitKeyCodes();
CI_CreateAndSetControls( "", "ICancel", CI_GetKeyCode("VK_ESCAPE"), 0, false );
CI_CreateAndSetControls( "", "IAction", CI_GetKeyCode("VK_SPACE"), 0, false );
return;
}

ExternInitKeyCodes();

//CI_CreateAndSetControls( "", "Dump", CI_GetKeyCode("KEY_0"), 0, false );
// Spitfire Enable Cheats -->
CI_CreateAndSetControls( "", "CheatGod", CI_GetKeyCode("KEY_Y"), 0, false );
CI_CreateAndSetControls( "", "CheatShotGun", CI_GetKeyCode("KEY_U"), 0, false );
CI_CreateAndSetControls( "", "CheatGold", CI_GetKeyCode("KEY_H"), 0, false );
CI_CreateAndSetControls( "", "CheatSkill", CI_GetKeyCode("KEY_O"), 0, false );
CI_CreateAndSetControls( "", "CheatReputation", CI_GetKeyCode("KEY_J"), 0, false );
// Spitfire <--

CI_CreateAndSetControls( "", "TimeScale", CI_GetKeyCode("VK_MULTIPLY"), 0, false );

// Cameras =====================================================================
/* // character camera
CI_CreateAndSetControls( "", "ChrCamTurnV", 257, INV<!--QuoteEnd--></div><!--QuoteEEnd-->



Using this modded version the cheats work 100% fine.....however my sialing controls go a lil nuts, and no long do my select keys work...so i cant actually do much and the game becomes unplayable.

What mistake have i made?
 
None that I can see here. All those CI_CreateAndSetControls( lines run independent of each other, so putting the the cheat codes in ADDITIONALLY WITHOUT CHANGING THE REST should not affect the other commands.

Make sure that you haven't changed the original code anywhere. It happens easily, just a character at the wrong place is enough.

Check those /* and */ Everything that is between these is outcommented, i.e the program ignores these lines. The same applies to lines with a // in front.

You can use that to debug your code. Put // in front of all your new lines to outcomment them. If your problem is solved now the bug must be in one of the outcommented lines. Reenable them one after the other till the problem reappears, and then you will at least know WHERE the bug is.

HTH
 
Back
Top