// Climax army member creature script
// On death: send event to area
#include "log_h"
#include "utility_h"
#include "wrappers_h"
#include "events_h"
#include "ai_main_h_2"
#include "cli_constants_h"
void MoveToLeader()
{
#ifdef DEBUG
Log_Trace_AI("EVENT_TYPE_CUSTOM_COMMAND_COMPLETE", "MOVING TO LEADER");
#endif
object oPC = GetMainControlled();
command cMove = CommandMoveToObject(oPC, TRUE, 8.0);
WR_ClearAllCommands(OBJECT_SELF, TRUE);
WR_AddCommand(OBJECT_SELF, cMove, FALSE, FALSE, -1, 5.0);
}
I tried to make my AI script with this alone and it seems its not working because it doesn't have starting conditional or main. So I tried to put
command cMove = CommandMoveToObject(oPC, TRUE, 8.0);
WR_ClearAllCommands(OBJECT_SELF, TRUE);
WR_AddCommand(OBJECT_SELF, cMove, FALSE, FALSE, -1, 5.0);
to my spawning script and this is my resulting script
#include "log_h"
#include "utility_h"
#include "wrappers_h"
#include "plot_h"
#include "sys_ambient_h"
void main()
{
object oMainControlled = GetMainControlled();
object oArea = GetArea(oMainControlled);
vector vControlled = GetPosition(oMainControlled);
vector vSpawn1 = vControlled + AngleToVector(90.0) * 1.5;
vector vSpawn2 = vControlled + AngleToVector(180.0) * 1.5;
vector vSpawn3 = vControlled + AngleToVector(270.0) * 1.5;
vector vSpawn4 = vControlled + AngleToVector(45.0) * 3.0;
vector vSpawn5 = vControlled + AngleToVector(135.0) * 3.0;
location lSpawn1 = GetSafeLocation( Location(oArea, vSpawn1, 0.0) );
location lSpawn2 = GetSafeLocation( Location(oArea, vSpawn2, 0.0) );
location lSpawn3 = GetSafeLocation( Location(oArea, vSpawn3, 0.0) );
location lSpawn4 = GetSafeLocation( Location(oArea, vSpawn4, 0.0) );
location lSpawn5 = GetSafeLocation( Location(oArea, vSpawn5, 0.0) );
command cMove = CommandMoveToObject(oMainControlled, TRUE, 8.0);
object oNonPartyFollower1 = CreateObject(OBJECT_TYPE_CREATURE, R"npf1.utc", lSpawn1);
{
AddCommand(oNonPartyFollower1, cMove, FALSE, FALSE, -1);
}
object oNonPartyFollower2 = CreateObject(OBJECT_TYPE_CREATURE, R"npf2.utc", lSpawn2);
{
AddCommand(oNonPartyFollower2, cMove, FALSE, FALSE, -1);
}
object oNonPartyFollower3 = CreateObject(OBJECT_TYPE_CREATURE, R"npf3.utc", lSpawn3);
{
AddCommand(oNonPartyFollower3, cMove, FALSE, FALSE, -1);
}
object oNonPartyFollower4 = CreateObject(OBJECT_TYPE_CREATURE, R"npf4.utc", lSpawn2);
{
AddCommand(oNonPartyFollower4, cMove, FALSE, FALSE, -1);
}
object oNonPartyFollower5 = CreateObject(OBJECT_TYPE_CREATURE, R"npf5.utc", lSpawn3);
{
AddCommand(oNonPartyFollower5, cMove, FALSE, FALSE, -1);
}
}
When I spawn with this script, followers would spread out like 8 meter or whatever measurement system that this game use and not follow. From my understanding this script command should make whatever object that has this script should move to wherever I go. Am I making wrong assumption? If so, Can someone help me to complete this script?
Modifié par AnnoyingDisplayName, 30 janvier 2010 - 12:09 .





Retour en haut






