Author Sticky: Post Working Scripts Here
ZeusNightFall Posted: Friday, 26 July 07:21AM
"Henchman Summons Creature on Command" v1.1(final)
3 Commented-out packages, default summons only one creature type once per day, random number gen tied to taggen(for random summoning of Creature1, Creature2,etc) and one to allow casting multiple times per day. Cut and paste the conversation hook & OnRested SetLocalInt statement. You must still create creatures in merchant faction with henchman scripts to use with this.
NWScript:
//\    //HENCHMAN SUMMONS CREATURE V1.1 BLANK

 // \\/ //   BY SHAWN CURRY AKA ZEUS NIGHTFALL

//  /\\//        MODIFIED JULY 26, 2002

      //

//THIS IS A BLANK READ THE COMMENTS TO FIGURE OUT WHAT

//YOU NEED TO FILL IN! I PLACED THE HOOK AT THE BOTTOM

//AGAIN SO ALL YOU NEED TO DO IS CUT-AND-PASTE

void main()

{

object oPC=GetPCSpeaker();

object oHench=GetAssociate(ASSOCIATE_TYPE_HENCHMAN);

object oTrig=GetNearestObject(OBJECT_TYPE_TRIGGER);

object oWP=GetNearestObject(OBJECT_TYPE_WAYPOINT);

location lTrig=GetLocation(oTrig);

location lWP=GetLocation(oWP);

float fTrig=GetDistanceToObject(oTrig);

float fWP=GetDistanceToObject(oWP);

//int nRand=d4();

//effect eSummon=EffectSummonCreature("SUMMONCREATURE"+IntToString(nRand));

//RANDOM NUMBER/TAGGENERATOR, UNCOMMENT IF YOU WISH TO USE

//IF YOU USE RAN GEN YOU MUST COMMENT NEXT STATEMENT OUT

//AND YOU MUST SET YOUR RESREFS TO SUMMONCREATURE1,2,3,etc

effect eSummon=EffectSummonCreature("");

//Your creature's blueprint_res_ref tag (a string) is

//inserted between the ("") Basically, this is like a

//monster spell.  It looks for your resref and then

//summons whatever you told it to.  This is why you change the creature's faction.



    if(GetIsObjectValid(oTrig)==TRUE && GetIsObjectValid(oWP)==TRUE)

        {

        if(fTrig >= fWP)

            {

            ActionMoveToLocation(lWP, FALSE);

            ActionWait (3.0);

//This tells the function caller(our Hench) to move to

//lWayPoint but not to run(the FALSE, set TRUE if you

//want Hench to run)

            ActionDoCommand(ApplyEffectAtLocation(DURATION_TYPE_PERMANENT, eSummon, lWP));

            ActionCastFakeSpellAtLocation(SPELL_SUMMON_CREATURE_VIII, lWP);

            ActionWait (2.5);

            object oSummoned=GetNearestCreature(CREATURE_TYPE_ , );

//This statement takes 2 inputs. Look up GetNearestCreature

//under functions(on the right side of the script editor)

//you can find the BIG_LONG_CONSTANTS under the constants button

            SetAssociateListenPatterns();

            SetLocalInt (oSummoned,"NW_COM_MODE_COMBAT", ASSOCIATE_COMMAND_ATTACKNEAREST);

            SetLocalInt (oSummoned,"NW_COM_MODE_FOLLOW", ASSOCIATE_COMMAND_FOLLOWMASTER);

            AddHenchman(oPC);//Note how Hench is added to the PC instead.

//This is nw_ch_join. Basically it adds the creature without removing Hench

            SetLocalInt (oHench, "HENCH_SUMMON", TRUE);

          //SetLocalInt (oHench, "HENCH_SUMMON",++1);

//USE ONE OR THE OTHER,IF CHANGED CHANGE ALL,USE ALTERNATE

//HOOK AND ONRESTED, IF YOU WANT YOU CHANGE SPELL LIMIT

//FOR THE REST OF THE SCRIPT YOU MUST FILL IN YOUR BIG_LONG_CREATURE_TYPE

            }

        else

            {

            ActionMoveToLocation(lTrig, FALSE);

            ActionWait (3.0);

            ActionDoCommand(ApplyEffectAtLocation(DURATION_TYPE_PERMANENT, eSummon, lTrig));

            ActionCastFakeSpellAtLocation(SPELL_SUMMON_CREATURE_VIII, lTrig);

            ActionWait (2.5);

            object oSummoned=GetNearestCreature(CREATURE_TYPE_ , );

            SetAssociateListenPatterns();

            SetLocalInt(oSummoned,"NW_COM_MODE_COMBAT", ASSOCIATE_COMMAND_ATTACKNEAREST);

            SetLocalInt(oSummoned,"NW_COM_MODE_FOLLOW", ASSOCIATE_COMMAND_FOLLOWMASTER);

            AddHenchman(oPC);

            SetLocalInt (oHench, "HENCH_SUMMON", TRUE);

          //SetLocalInt (oHench, "HENCH_SUMMON",++1);

            }

    if(GetIsObjectValid(oTrig)==FALSE && GetIsObjectValid(oWP)==TRUE)

        {

        ActionMoveToLocation(lWP, FALSE);

        ActionWait (3.0);

        ActionDoCommand(ApplyEffectAtLocation (DURATION_TYPE_PERMANENT, eSummon, lWP));

        ActionCastFakeSpellAtLocation(SPELL_SUMMON_CREATURE_VIII, lWP);

        ActionWait (2.5);

        object oSummoned=GetNearestCreature(CREATURE_TYPE_ , );

        SetAssociateListenPatterns();

        SetLocalInt(oSummoned, "NW_COM_MODE_COMBAT", ASSOCIATE_COMMAND_ATTACKNEAREST);

        SetLocalInt(oSummoned, "NW_COM_MODE_FOLLOW", ASSOCIATE_COMMAND_FOLLOWMASTER);

        AddHenchman (oPC);

        SetLocalInt (oHench, "HENCH_SUMMON", TRUE);

      //SetLocalInt (oHench, "HENCH_SUMMON",++1);

        }

    if(GetIsObjectValid(oTrig)==TRUE && GetIsObjectValid(oWP)==FALSE)

        {

        ActionMoveToLocation(lTrig, FALSE);

        ActionWait (3.0);

        ActionDoCommand(ApplyEffectAtLocation(DURATION_TYPE_PERMANENT, eSummon, lTrig));

        ActionCastFakeSpellAtLocation(SPELL_SUMMON_CREATURE_VIII, lTrig);

        ActionWait (2.5);

        object oSummoned=GetNearestCreature(CREATURE_TYPE_CLASS, CLASS_TYPE_ANIMAL);

        SetAssociateListenPatterns();

        SetLocalInt(oSummoned,"NW_COM_MODE_COMBAT", ASSOCIATE_COMMAND_ATTACKNEAREST);

        SetLocalInt(oSummoned,"NW_COM_MODE_FOLLOW", ASSOCIATE_COMMAND_FOLLOWMASTER);

        AddHenchman (oPC);

        SetLocalInt(oHench, "HENCH_SUMMON", TRUE);

      //SetLocalInt(oHench, "HENCH_SUMMON",++1);

        }

    if(GetIsObjectValid(oTrig)==FALSE && GetIsObjectValid(oWP)==FALSE)

        {

        ActionSpeakString("I can't find a good place to cast this spell");

        ActionPlayAnimation (ANIMATION_FIREFORGET_PAUSE_SCRATCH_HEAD);

        }

    }

}

/*

int StartingConditional()

    {

    int bCondition=GetLocalInt(OBJECT_SELF,"HENCH_SUMMON")==FALSE;

    return bCondition;

    }

//AND PUT THIS BEFORE LAST BRACKET IN ONRESTED HANDLE

    SetLocalInt (OBJECT_SELF,"HENCH_SUMMON",FALSE)

//OR IF YOU ARE ALLOWING MORE THAN 1 SPELL USE ALTERNATE

//"SetLocalInt" STATEMENTS IN THE main() BODY AND THIS:

int StartingConditional()

    {

    int bCondition=GetLocalInt(OBJECT_SELF,"HENCH_SUMMON")<="#" //WHERE "#" IS #ToStopAt

    return bCondition

    }

//AND USE THIS LINE BEFORE LAST BRACKET IN ONRESTED INSTEAD

    SetLocalInt (OBJECT_SELF,"HENCH_SUMMON",0)

* * * * *

Older script below

* * * * *

 

 

 
Author Sticky: Post Working Scripts Here
ZeusNightFall Posted: Friday, 26 July 12:52AM
"Henchman Casts Summon Creature on Command"
Instructions next post(script is REALLY big)
NWScript:
/////////////////////////////////////////////////////\

//** HENCHMAN SUMMONS ELEMENTALS ON COMMAND v1.0

//**        CREATED ON JULY 25TH 2002

//**     BY SHAWN CURRY  AKA ZEUSNIGHTFALL

//**        THIS SCRIPT WAS *NOT*

//**     CREATED BY THE SCRIPT WIZARD :P 

////////////////////////////////////////////////////\\

void main()

{

object oPC=GetPCSpeaker();

object oHench=GetAssociate(ASSOCIATE_TYPE_HENCHMAN);

//THIS SCRIPT *SURVIVES* ON WAYPOINTS AND (ENCOUNTER)TRIGGERS

//SCRIPT FAILS IF HENCH CANNOT FIND A PLACE TO SUMMON.

//IF HENCH HAS TROUBLE SUMMONING, ADD WAYPOINTS TO AREA

object oTrig=GetNearestObject(OBJECT_TYPE_TRIGGER);

object oWP=GetNearestObject(OBJECT_TYPE_WAYPOINT);

//Script has henchman appear to cast summoning spell,

//start filtering valid targets for the spell.

location lTrig=GetLocation(oTrig);

location lWP=GetLocation(oWP);

//Gets locations of target objects

float fTrig=GetDistanceToObject(oTrig);

float fWP=GetDistanceToObject(oWP);

//Measure distance to determine which is closer.

int nRand=d4();

//Randomly chooses elemental type

effect eSummon=EffectSummonCreature("SUMMONCREATURE"+IntToString(nRand));

//Put Elementals in Faction:Merchant, give henchman scripts

//Need to have **BLUEPRINT_RES_REF** "SUMMONCREATURE1,SUMMONCREATURE2,..4

    if(GetIsObjectValid(oTrig)==TRUE && GetIsObjectValid(oWP)==TRUE)

//Hench sees both a waypoint and a trigger, measuring

        {

        if(fTrig >= fWP)

            {

//Defaults to Waypoint if both values are equal(I hope :P )

            ActionMoveToLocation(lWP, FALSE);

            ActionWait(3.0);

            ActionDoCommand(ApplyEffectAtLocation (DURATION_TYPE_PERMANENT, eSummon, lWP));

            ActionCastFakeSpellAtLocation(SPELL_SUMMON_CREATURE_IX, lWP);

            ActionWait(3.0);

//Establish Slave/Master(Change this line for diff. creature types)

            object oSummoned=GetNearestCreature(CREATURE_TYPE_CLASS, CLASS_TYPE_ELEMENTAL);

//Change this line to use different creatures ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

            SetAssociateListenPatterns(oSummoned);

            SetLocalInt(oSummoned, "NW_COM_MODE_COMBAT", ASSOCIATE_COMMAND_ATTACKNEAREST);

            SetLocalInt(oSummoned, "NW_COM_MODE_MOVEMENT", ASSOCIATE_COMMAND_FOLLOWMASTER);

            AddHenchman(oPC);

//This ensures Hench can only cast the spell once per day

//Add a line to OnRested Event to set this back to FALSE

            SetLocalInt(oHench,"USED_SUMMON_SPELL", TRUE);

//You can also set this to a number.  Make sure if you do

//you remember to change the other statements and the conversation

//hooks.  If you do not change the conversation hook, the

//text may not pop up.  You'll also want to SetLocalInt(OBJECT_SELF,"USED_SUMMON_SPELL",0)

//in hench OnRested

//Uncomment next line and comment previous int statement.

            //SetLocalInt(oHench,"USED_SUMMON_SPELL",++1);

            }

        else

            {

//Trigger is closer

            ActionMoveToLocation(lTrig, FALSE);

            ActionWait(3.0);

            ActionDoCommand(ApplyEffectAtLocation (DURATION_TYPE_PERMANENT, eSummon, lTrig));

            ActionCastFakeSpellAtLocation(SPELL_SUMMON_CREATURE_IX, lTrig);

            ActionWait(3.0);

            object oSummoned=GetNearestCreature(CREATURE_TYPE_CLASS, CLASS_TYPE_ELEMENTAL);

            SetAssociateListenPatterns();

            SetLocalInt(oSummoned, "NW_COM_MODE_COMBAT", ASSOCIATE_COMMAND_ATTACKNEAREST);

            SetLocalInt(oSummoned, "NW_COM_MODE_MOVEMENT", ASSOCIATE_COMMAND_FOLLOWMASTER);

            AddHenchman(oPC);

            SetLocalInt(oHench,"USED_SUMMON_SPELL",TRUE);

            //SetLocalInt(oHench,"USED_SUMMON_SPELL",++1);

            }

        }

    if(GetIsObjectValid(oTrig)==FALSE && GetIsObjectValid(oWP)==TRUE)

        {

//Hench sees only waypoint

        ActionMoveToLocation(lWP, FALSE);

        ActionWait(3.0);

        ActionDoCommand(ApplyEffectAtLocation (DURATION_TYPE_PERMANENT, eSummon, lWP));

        ActionCastFakeSpellAtLocation (SPELL_SUMMON_CREATURE_IX, lWP);

        ActionWait(3.0);

        object oSummoned=GetNearestCreature(CREATURE_TYPE_CLASS, CLASS_TYPE_ELEMENTAL);

        SetAssociateListenPatterns();

        SetLocalInt(oSummoned, "NW_COM_MODE_COMBAT", ASSOCIATE_COMMAND_ATTACKNEAREST);

        SetLocalInt(oSummoned, "NW_COM_MODE_MOVEMENT", ASSOCIATE_COMMAND_FOLLOWMASTER);

        AddHenchman(oPC);

        SetLocalInt(oHench,"USED_SUMMON_SPELL", TRUE);

        //SetLocalInt(oHench,"USED_SUMMON_SPELL",++1);

        }

      if(GetIsObjectValid(oTrig)==TRUE && GetIsObjectValid(oWP)==FALSE)

        {

//Hench sees only trigger

        ActionMoveToLocation(lTrig, FALSE);

        ActionWait(3.0);

        ActionDoCommand(ApplyEffectAtLocation (DURATION_TYPE_PERMANENT, eSummon, lTrig));

        ActionCastFakeSpellAtLocation (SPELL_SUMMON_CREATURE_IX, lTrig);

        ActionWait(3.0);

        object oSummoned=GetNearestCreature(CREATURE_TYPE_CLASS, CLASS_TYPE_ELEMENTAL);

        SetAssociateListenPatterns();

        SetLocalInt(oSummoned, "NW_COM_MODE_COMBAT", ASSOCIATE_COMMAND_ATTACKNEAREST);

        SetLocalInt(oSummoned, "NW_COM_MODE_MOVEMENT", ASSOCIATE_COMMAND_FOLLOWMASTER);

        AddHenchman(oPC);

        SetLocalInt(oHench,"USED_SUMMON_SPELL", TRUE);

        //SetLocalInt(oHench,"USED_SUMMON_SPELL",++1);

        }

    if(GetIsObjectValid(oTrig)==FALSE && GetIsObjectValid(oWP)==FALSE)

        {

//Hench cannot find target

        ActionSpeakString("I would, but there doesn't seem to be a good place around here.");

        ActionPlayAnimation(ANIMATION_FIREFORGET_PAUSE_SCRATCH_HEAD);

        }

}

/*

int StartingConditional()

{

     int bCondition=GetLocalInt(OBJECT_SELF,"USED_SUMMON_SPELL")==FALSE;

     return bCondition;

}

Reply to last post:

"Henchman Casts Summon Creature on Command"

This a pretty finicky spell to teach a henchman to do..It's probably not for beginners.. you have to tweak your henchman a little.

1. This is triggered in a conversation. I added the hook i used at the end of it, and now that im thinkin of it, maybe you could add it to the nw_ch_spell0 script(the one that checks if hench is spellcaster)

2. The hook switches off after the spell is cast. I commented some lines to change this in the script if you want to increase the number of times your henchman can cast it without resting(if you wanna cheat, just dont use the hook.) I did leave a fair amount of comments in there to try and tell you what i was doing in case you wanna tweak it.

3. You must add one line to the OnRested default script of your henchman(put it near the end): SetLocalInt (OBJECT_SELF, "USED_SUMMON_SPELL", FALSE); This will make the ability come back online after a rest.

4. Its set up specifically for elementals right now. To change this, you must edit the "GetNearestCreature" lines.(unless you can think of a better way to reference the new summoned creature.)

5. Script looks for creatures by **BLUEPRINT_RES_REF**. It's looking for creatures with a resref SUMMONCREATURE1, SUMMONCREATURE2.....4. If you use the object's tag, you will have one super-flashy script-of-badger-summoning.

6. So, you need to make some custom characters. They should be in Faction:Merchant. Give them the same scripts as your henchman.(exept for the OnRested that you just edited) NOTE, IF YOU FAIL TO CHANGE THIER FACTION, *YOU* Become the target of thier OnSpawn.

7. ALMOST THERE!! Summon is not an area of effect spell, nor is it a projectile, so the only valid target is a spot on the ground. So, the script searches for waypoints and encounter triggers. IF IT DOESNT FIND ANY, YOUR HENCH DOESNT cast the spell. So, if the hench has trouble casting, you are lacking in these areas. If you dont want anymore encounters, add some waypoints.

Familiars should be up later tonite.