Dak Vesser
09-21-2005, 03:42 PM
Hey there everybody. It’s been awhile since I’ve been in the H-Laboratory and off course, for my come back, thought I’d be so bold as to start a thread just for sharing our killer custom “Henchmen” scripts to each other here in the modding community. So if anyone here who knows how to, make custom henchmen script, post them here. If you want to learn scripting, you can look in the tutorial section of this forum, unless the administrators actually wanna put this thread in the tutorial section.
So anyways, I’ll start this off with a new custom heartbeat script I created for my next -Holo- Droid, coming out soon. This script is NOT meant for a character that you want to add as a party member. Instead, the routines are setup for what I like to call a “Fake Party Member” which is someone who will follow but is not assign to the party table, therefore cannot be selected to take lead.
#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_HEARTBE AT))
{
SignalEvent(OBJECT_SELF, EventUserDefined(1001));
}
}
This next one I created is an On Blocked Script. Added "Picked Lock Routine" for the Holo Droid just in case a locked door gets in its Pathway, it can unlock or attempt to unlock and open it. That way, the player won't have to Deactivate/reactivate the droid to get it back to within float range.
The reason for this is because when I added the “PC Location Jump” options in the planetary Debug section of the "g_cheatbot01" dialogue, I needed to make sure the Holo Droid could follow and or catch up.
#include "k_inc_debug"
#include "k_inc_generic"
#include "k_inc_switch"
#include "k_inc_utility"
void main()
{
object oDoor = GetBlockingDoor();
if(!GN_GetSpawnInCondition(SW_FLAG_AI_OFF))
{
if(GetAbilityScore(OBJECT_SELF, ABILITY_INTELLIGENCE) >= 5)
{
if(GetIsDoorActionPossible(oDoor, DOOR_ACTION_OPEN) &&
GetAbilityScore(OBJECT_SELF, ABILITY_INTELLIGENCE) >= 7 )
{
DoDoorAction(oDoor, DOOR_ACTION_OPEN);
SendMessageToPC(GetFirstPC(), "Debug Message: Henchmen just executed the -door open- routine...");
}
if(GetLocked(oDoor))
{
DoDoorAction(oDoor, DOOR_ACTION_UNLOCK);
SendMessageToPC(GetFirstPC(), "Debug Message: Henchmen just executed the -picked lock- routine...");
}
else if(GetIsDoorActionPossible(oDoor, DOOR_ACTION_BASH))
{
DoDoorAction(oDoor, DOOR_ACTION_BASH);
SendMessageToPC(GetFirstPC(), "Debug Message: Henchmen just executed the -door bash- routine...");
}
}
}
if(GN_GetSpawnInCondition(SW_FLAG_EVENT_ON_BLOCKED ))
{
SignalEvent(OBJECT_SELF, EventUserDefined(1009));
}
}
This is a good script if you wanna create a creature with a custom pathway through a locked door..
So anyways, I’ll start this off with a new custom heartbeat script I created for my next -Holo- Droid, coming out soon. This script is NOT meant for a character that you want to add as a party member. Instead, the routines are setup for what I like to call a “Fake Party Member” which is someone who will follow but is not assign to the party table, therefore cannot be selected to take lead.
#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_HEARTBE AT))
{
SignalEvent(OBJECT_SELF, EventUserDefined(1001));
}
}
This next one I created is an On Blocked Script. Added "Picked Lock Routine" for the Holo Droid just in case a locked door gets in its Pathway, it can unlock or attempt to unlock and open it. That way, the player won't have to Deactivate/reactivate the droid to get it back to within float range.
The reason for this is because when I added the “PC Location Jump” options in the planetary Debug section of the "g_cheatbot01" dialogue, I needed to make sure the Holo Droid could follow and or catch up.
#include "k_inc_debug"
#include "k_inc_generic"
#include "k_inc_switch"
#include "k_inc_utility"
void main()
{
object oDoor = GetBlockingDoor();
if(!GN_GetSpawnInCondition(SW_FLAG_AI_OFF))
{
if(GetAbilityScore(OBJECT_SELF, ABILITY_INTELLIGENCE) >= 5)
{
if(GetIsDoorActionPossible(oDoor, DOOR_ACTION_OPEN) &&
GetAbilityScore(OBJECT_SELF, ABILITY_INTELLIGENCE) >= 7 )
{
DoDoorAction(oDoor, DOOR_ACTION_OPEN);
SendMessageToPC(GetFirstPC(), "Debug Message: Henchmen just executed the -door open- routine...");
}
if(GetLocked(oDoor))
{
DoDoorAction(oDoor, DOOR_ACTION_UNLOCK);
SendMessageToPC(GetFirstPC(), "Debug Message: Henchmen just executed the -picked lock- routine...");
}
else if(GetIsDoorActionPossible(oDoor, DOOR_ACTION_BASH))
{
DoDoorAction(oDoor, DOOR_ACTION_BASH);
SendMessageToPC(GetFirstPC(), "Debug Message: Henchmen just executed the -door bash- routine...");
}
}
}
if(GN_GetSpawnInCondition(SW_FLAG_EVENT_ON_BLOCKED ))
{
SignalEvent(OBJECT_SELF, EventUserDefined(1009));
}
}
This is a good script if you wanna create a creature with a custom pathway through a locked door..