Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Axis & Allies 1942 Online is now available in Early Access! Buy it on Steam. The FAQ is available.
New Premium Module: Tyrants of the Moonsea! Read More
Attention, new and old users! Please read the new rules of conduct for the forums, and we hope you enjoy your stay!

Set Max Henchmen Script?

I am trying to change the max henchmen in my module to more than one. I have managed to hire henchmen. But When i hire a 2nd the other one leaves the part automatically. I thought I had set the on module load script right but it still wont work, Here is the hire and load scripts below. Any help is much appreciated.

This is the load script...

// Example code for On Module Load to make the maximum
// number of henchmen 3

void main()
{
// No parameter other then a number needed
SetMaxHenchmen(3);

// Thats it!
}



And the hire script...

// * script: can_pay100

// * Does the PC have 100 gp?

// Use in [Text Appears When] tab of PC hiring dialog line.



#include "NW_I0_PLOT"



int StartingConditional()

{

return (HasGold(100,GetPCSpeaker()));

}

Comments

  • ProlericProleric Member Posts: 494
    You haven't given us the Action Taken script that runs when the henchman is hired.

    No doubt the problem is there - it's removing the existing henchman when the new one is hired.

    With multiple henchmen, you need to remove that code.

    Instead, the conditional script needs to decide up front whether hiring is permissible, and, if not, give the player the choice of which henchman to remove.

    What it needs to do first is count the number of henchmen (a loop through GetFirstHenchman / GetNextHenchman, not counting horses (HorseGetIsAMount) if they are allowed in your module).

    Compare that count with GetMaxHenchmen.

    If there are fewer than the maximum, return TRUE to allow hiring, otherwise return FALSE.

    The simplest way to handle the FALSE is for the NPC speaker to say "you have too many henchmen already", leaving it up to the player to remove a henchman before trying again (either through dialogue you have provided, or the radial menu).

    Alternatively, you can give the player conditional dialogue lines e.g. "Remove Anna", "Remove Bert" etc for each of the existing henchmen, each with an Action Taken that removes the selected henchman and hires the new one.

    leeuxMuttley
  • MuttleyMuttley Member Posts: 60
    Oops I thought I had. Here is the hire script on action taken.

    // * script: henchman_joins

    // * NPC Henchman joins PC, replacing other henchman if necessary.

    // Use in [Actions Taken] tab of henchman's joining dialog line.



    #include "nw_i0_henchman"



    void main()

    {

    if (GetIsObjectValid(GetHenchman(GetPCSpeaker())) == TRUE)

    { SetFormerMaster(GetPCSpeaker(), GetHenchman(GetPCSpeaker()));

    object oHench = GetHenchman(GetPCSpeaker());

    RemoveHenchman(GetPCSpeaker(), GetHenchman(GetPCSpeaker()));

    AssignCommand(oHench, ClearAllActions());

    }



    SetWorkingForPlayer(GetPCSpeaker());

    SetBeenHired();



    ExecuteScript("NW_CH_JOIN", OBJECT_SELF);

    }

  • ProlericProleric Member Posts: 494
    edited September 22
    So delete
    if (GetIsObjectValid(GetHenchman(GetPCSpeaker())) == TRUE)
      { SetFormerMaster(GetPCSpeaker(), GetHenchman(GetPCSpeaker()));
        object oHench = GetHenchman(GetPCSpeaker());
        RemoveHenchman(GetPCSpeaker(), GetHenchman(GetPCSpeaker()));
        AssignCommand(oHench, ClearAllActions());
      }
    

    Now the number of henchmen will be unlimited in the Action Taken, so you need to check whether hiring is permissible first, as previously explained.

    Muttleyleeux
  • MuttleyMuttley Member Posts: 60
    Yaaas. Its working now. Thankyou so much

  • leeuxleeux Member Posts: 108
    Can this be done to the OC too? Never tried and haven't seen a mod that does this... If it can be done, it would solve one of my biggest gripes about the OC :smile:

  • MuttleyMuttley Member Posts: 60
    I think it can be done. There are a few threads I found googling this question, but they were hard to follow. I have no idea how to script and have essentially been copying and pasting other peoples scrtipts. I am working on a module that will be DM run so there isn't a lot of conversations or scripts needed as most stuff can be done on the fly as a DM. I just wanted henchmen for hire to make up numbers if there isn't enough players. The only other custom script I have is to teleport players from one docked ship to it's destination in a different location.

    leeux
Sign In or Register to comment.