View Single Post
Old 01-28-2007, 07:23 PM   #2
SithRevan
Veteran
 
SithRevan's Avatar
 
Join Date: Jun 2006
Location: Delta Halo
Posts: 847
Helpful! 
Yeah, what you want is called a henchmen. Here is the code that I used for a henchmen once...

Code:
// k_fpm_heartbtxx

#include "k_inc_debug"
#include "k_inc_generic"
#include "k_inc_switch"
#include "k_inc_utility"



void main()
{



            object oEnemy = GetNearestCreature(CREATURE_TYPE_PERCEPTION, PERCEPTION_SEEN, OBJECT_SELF, 1, CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY);
            if(!GN_GetSpawnInCondition(SW_FLAG_AI_OFF) && !GetSoloMode())
            {
                if(GetPartyMemberByIndex(0) != OBJECT_SELF)
                {
                    if(//GetCurrentAction(OBJECT_SELF) != ACTION_FOLLOW && 
                       GetCurrentAction(OBJECT_SELF) != ACTION_WAIT  &&
                       !GetIsConversationActive() &&
                       !GN_GetSpawnInCondition(SW_FLAG_SPECTATOR_STATE) &&
                       GetCommandable())
                    {
                       
                          if(!GN_GetIsFighting(OBJECT_SELF) && !GetIsObjectValid(oEnemy))
                           
                          
                            ClearAllActions();
                            if(GetDistanceBetween(OBJECT_SELF, GetPartyMemberByIndex(0)) < 5.0)
                            {
                             ClearAllActions();
                             ActionForceMoveToObject(GetPartyMemberByIndex(0), FALSE, 1.0);
                             //SendMessageToPC(GetFirstPC(), "Debug Message: Henchmen just executed the bWalk routine.");
                            }
                            if(GetDistanceBetween(OBJECT_SELF, GetPartyMemberByIndex(0)) > 5.0)
                            {
                             ClearAllActions();
                             ActionForceMoveToObject(GetPartyMemberByIndex(0), TRUE, 3.5);
                             //SendMessageToPC(GetFirstPC(), "Debug Message: Henchmen just executed the bRun routine.");
                            }
                          
                     }
                }
            }
            else if(GetSoloMode() && GetCurrentAction(OBJECT_SELF) == ACTION_FOLLOWLEADER)
            {
                ClearAllActions();
            }
            if(GN_GetSpawnInCondition(SW_FLAG_EVENT_ON_HEARTBEAT))
            {
                SignalEvent(OBJECT_SELF, EventUserDefined(1001));
            }



}
You just put this in the "OnHeartbeat" function of the character and they should follow you around providing that they have been spawned near you in that level.


I have defied gods and demons.
I am your shield, I am your sword.
I know you; your past, your future.
This is the way the world ends...
-----------------------------------------
TAC-F v2.0 | Ubese Assassin's Armor | TSL: Warp Console v1.0 | Auto K1 DS Transitioning | Deralia Spaceport[TSL&K1] | Kotor2Files.com Co.Manager | K1RP: Kotor I Restoration Project
SithRevan is offline   you may: quote & reply,