mirror of
https://github.com/SWG-Source/dsrc.git
synced 2026-07-29 23:15:55 -04:00
155 lines
4.8 KiB
Plaintext
155 lines
4.8 KiB
Plaintext
//------------------------------------------------
|
|
// pet_test.script
|
|
// Brandon Reinhart
|
|
//
|
|
// Usage:
|
|
//------------------------------------------------
|
|
|
|
//------------------------------------------------
|
|
// Includes
|
|
//------------------------------------------------
|
|
|
|
include library.create;
|
|
include library.pet_lib;
|
|
include library.colors;
|
|
include ai.ai_combat;
|
|
|
|
//-----------------------------------------------
|
|
// OnAttach
|
|
//-----------------------------------------------
|
|
|
|
trigger OnAttach()
|
|
{
|
|
debugSpeakMsg( self, "Pet test ready." );
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//------------------------------------------------
|
|
// OnSpeaking
|
|
//------------------------------------------------
|
|
|
|
trigger OnSpeaking( string text )
|
|
{
|
|
// Get the location of the player?
|
|
location playerLocation = getLocation( self );
|
|
|
|
if ( text == "beginpetdemo" )
|
|
{
|
|
petTest( self );
|
|
}
|
|
else if ( text == "endpetdemo" )
|
|
{
|
|
endPetTest( self );
|
|
}
|
|
|
|
return SCRIPT_CONTINUE;
|
|
}
|
|
|
|
//-----------------------------------------------
|
|
// petTest
|
|
//-----------------------------------------------
|
|
|
|
void petTest( obj_id self )
|
|
{
|
|
// Attach pet skills.
|
|
grantSkill( self, "outdoors_creaturehandler_master" );
|
|
grantSkill( self, "outdoors_creaturehandler_support_04" );
|
|
grantSkill( self, "outdoors_creaturehandler_healing_04" );
|
|
grantSkill( self, "outdoors_creaturehandler_training_04" );
|
|
grantSkill( self, "outdoors_creaturehandler_taming_04" );
|
|
grantSkill( self, "outdoors_creaturehandler_taming_03" );
|
|
grantSkill( self, "outdoors_creaturehandler_training_03" );
|
|
grantSkill( self, "outdoors_creaturehandler_healing_03" );
|
|
grantSkill( self, "outdoors_creaturehandler_support_03" );
|
|
grantSkill( self, "outdoors_creaturehandler_training_02" );
|
|
grantSkill( self, "outdoors_creaturehandler_taming_02" );
|
|
grantSkill( self, "outdoors_creaturehandler_healing_02" );
|
|
grantSkill( self, "outdoors_creaturehandler_support_02" );
|
|
grantSkill( self, "outdoors_creaturehandler_taming_01" );
|
|
grantSkill( self, "outdoors_creaturehandler_training_01" );
|
|
grantSkill( self, "outdoors_creaturehandler_healing_01" );
|
|
grantSkill( self, "outdoors_creaturehandler_support_01" );
|
|
grantSkill( self, "outdoors_creaturehandler_novice" );
|
|
|
|
// Create a pet.
|
|
obj_id pet = create.object( "bantha", getLocation(self) );
|
|
|
|
// Attach pet script.
|
|
attachScript( pet, "ai.pet_advance" );
|
|
|
|
// Make it our pet.
|
|
pet_lib.makePet( pet, self );
|
|
showFlyTextPrivate( pet, self, new string_id( "npc_reaction/flytext", "success" ), 1.5f, colors.FORESTGREEN );
|
|
|
|
// Teach it some commands.
|
|
setObjVar( pet, "ai.pet.commandList"+pet_lib.COMMAND_FOLLOW, "bob follow me");
|
|
setObjVar( pet, "ai.pet.commandList"+pet_lib.COMMAND_ATTACK, "bob attack");
|
|
setObjVar( pet, "ai.pet.commandList"+pet_lib.COMMAND_TRICK_1, "bob do a trick");
|
|
|
|
// Store the pet.
|
|
setObjVar( self, "pet_test.pet_id", pet );
|
|
|
|
// Send a system message.
|
|
sendSystemMessage( self, "Ready for pet demonstration.", null );
|
|
}
|
|
|
|
//-----------------------------------------------
|
|
// endPetTest
|
|
//-----------------------------------------------
|
|
|
|
void endPetTest( obj_id self )
|
|
{
|
|
// Get a reference to the pet.
|
|
obj_id pet = getObjIdObjVar( self, "pet_test.pet_id" );
|
|
if ( !isIdValid( pet ) )
|
|
return;
|
|
|
|
// Untame the pet.
|
|
pet_lib.removeFromPetList( pet );
|
|
|
|
// Destroy the pet.
|
|
messageTo( self, "destroyPet", null, 2.f, true );
|
|
}
|
|
|
|
//-----------------------------------------------
|
|
// destroyPet
|
|
//-----------------------------------------------
|
|
|
|
messageHandler destroyPet()
|
|
{
|
|
// Get a reference to the pet.
|
|
obj_id pet = getObjIdObjVar( self, "pet_test.pet_id" );
|
|
if ( !isIdValid( pet ) )
|
|
return SCRIPT_CONTINUE;
|
|
|
|
// Kill it.
|
|
destroyObject( pet );
|
|
|
|
// Remove CH skills.
|
|
/*
|
|
revokeSkill( self, "outdoors_creaturehandler_novice" );
|
|
revokeSkill( self, "outdoors_creaturehandler_taming_01" );
|
|
revokeSkill( self, "outdoors_creaturehandler_taming_02" );
|
|
revokeSkill( self, "outdoors_creaturehandler_taming_03" );
|
|
revokeSkill( self, "outdoors_creaturehandler_taming_04" );
|
|
revokeSkill( self, "outdoors_creaturehandler_training_01" );
|
|
revokeSkill( self, "outdoors_creaturehandler_training_02" );
|
|
revokeSkill( self, "outdoors_creaturehandler_training_03" );
|
|
revokeSkill( self, "outdoors_creaturehandler_training_04" );
|
|
revokeSkill( self, "outdoors_creaturehandler_healing_01" );
|
|
revokeSkill( self, "outdoors_creaturehandler_healing_02" );
|
|
revokeSkill( self, "outdoors_creaturehandler_healing_03" );
|
|
revokeSkill( self, "outdoors_creaturehandler_healing_04" );
|
|
revokeSkill( self, "outdoors_creaturehandler_support_01" );
|
|
revokeSkill( self, "outdoors_creaturehandler_support_02" );
|
|
revokeSkill( self, "outdoors_creaturehandler_support_03" );
|
|
revokeSkill( self, "outdoors_creaturehandler_support_04" );
|
|
revokeSkill( self, "outdoors_creaturehandler_master" );
|
|
*/
|
|
|
|
// Send a system message.
|
|
sendSystemMessage( self, "Pet demonstration complete.", null );
|
|
|
|
return SCRIPT_CONTINUE;
|
|
} |