Author Topic: My NPC Wolves Won't Cross My Waypoints. Please Help??  (Read 537 times)

Legacy_MissJaded

  • Full Member
  • ***
  • Posts: 243
  • Karma: +0/-0
My NPC Wolves Won't Cross My Waypoints. Please Help??
« on: January 14, 2011, 01:49:14 am »


               Excuse me?
is there anyone out there who can advise me with my problem please?

I'm trying to make a cutscene where the camera wil follow a couple of white wolves I setup to walk along a track of waypoints. I'm not using the cutscene option yet until I know that my wolves are following the waypoints correctly in the way that I want them to.

I find this a bit easier to get my explanation across with a screenshot.
Click Here

I have 2 wolves near the start there, (bottom of pic) and they will both follow the route of the waypoints I have setup for them. Near the top of the pic, they turn right, go round the corner, then up the small hill I set, and then stop DEAD at the top there before disappearing to make it look as though they will go through the pass in the trees.

But I am having a problem with my wolves following those waypoints.'<img'>

When I enter the area, (as the player) I SHOULD see my 2 wolves start to set off along those waypoints FROM the start. But instead..... they are coming back from the other way and towards the start.

I want to see my wolves set off from their start points as soon as I enter. But something is causing a problem here.'<img'>

There is something I am nor doing right, but I cannot work out what it is.'<img'>

Does anyone know of any issues which woudl cause this please?
If so, then it might help and give me some ideas of where my problem is so that I can fix it.

Also.... how do I get my wolves to actually STOP at the end waypoints, and NOT come back again?
Hence.... that will be the point where I will make them dissappear once they get there.

Is there anyone who can help me out here please?

Regards, "Missjaded"B)
               
               

               


                     Modifié par MissJaded, 14 janvier 2011 - 01:55 .
                     
                  


            

Legacy_jackkel dragon

  • Full Member
  • ***
  • Posts: 178
  • Karma: +0/-0
My NPC Wolves Won't Cross My Waypoints. Please Help??
« Reply #1 on: January 14, 2011, 01:57:52 am »


               I don't remember the script for stopping at the end waypoint, you may need to write a custom one that only uses each waypoint once.
Edit: The normal tag-based waypoints loop, going from start to finish to start. You may need a custom script and different waypoint tags.

As for the wolves starting at the end: is this the start area of the module? If not, the wolves may have been updating while the PC was in another area, thus are already partway through the waypoint loop (rather than the start, except in rare cases.)
Edit: To fix this the script that runs when entering the area the wolves are in could trigger them to walk their waypoints, rather than using the normal waypoint structure.
               
               

               


                     Modifié par jackkel dragon, 14 janvier 2011 - 02:01 .
                     
                  


            

Legacy_Greyfort

  • Sr. Member
  • ****
  • Posts: 442
  • Karma: +0/-0
My NPC Wolves Won't Cross My Waypoints. Please Help??
« Reply #2 on: January 14, 2011, 02:38:09 am »


               if using bioware default heart beat, replace with this file.

//:://////////////////////////////////////////////////
//:: NW_C2_DEFAULT1
//:: edited my_wolf_heart
/*
 Default OnHeartbeat script for NPCs.

 This script causes NPCs to perform default animations
 while not otherwise engaged.

 This script duplicates the behavior of the default
 script and just cleans up the code and removes
 redundant conditional checks.

*/
//:://////////////////////////////////////////////////
//:: Copyright © 2002 Floodgate Entertainment
//:: Created By: Naomi Novik
//:: Created On: 12/22/2002
//:://////////////////////////////////////////////////

#include "nw_i0_generic"

void main()
{
   // * if not runnning normal or better Ai then exit for performance reasons
   if (GetAILevel() == AI_LEVEL_VERY_LOW) return;

   // Buff ourselves up right away if we should
   if(GetSpawnInCondition(NW_FLAG_FAST_BUFF_ENEMY))
   {
       // This will return TRUE if an enemy was within 40.0 m
       // and we buffed ourselves up instantly to respond --
       // simulates a spellcaster with protections enabled
       // already.
       if(TalentAdvancedBuff(40.0))
       {
           // This is a one-shot deal
           SetSpawnInCondition(NW_FLAG_FAST_BUFF_ENEMY, FALSE);

           // This return means we skip sending the user-defined
           // heartbeat signal in this one case.
           return;
       }
   }


   if(GetHasEffect(EFFECT_TYPE_SLEEP))
   {
       // If we're asleep and this is the result of sleeping
       // at night, apply the floating 'z's visual effect
       // every so often

       if(GetSpawnInCondition(NW_FLAG_SLEEPING_AT_NIGHT))
       {
           effect eVis = EffectVisualEffect(VFX_IMP_SLEEP);
           if(d10() > 6)
           {
               ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, OBJECT_SELF);
           }
       }
   }

   // If we have the 'constant' waypoints flag set, walk to the next
   // waypoint.
   else if ( GetWalkCondition(NW_WALK_FLAG_CONSTANT) )
   {
       //check for way point
    object oTest=GetNearestObjectByTag("WP_mywolf_04",OBJECT_SELF);
    if(GetIsObjectValid(oTest)==TRUE&& GetDistanceBetween(OBJECT_SELF,oTest)<=1.0 )
        {
        //
        DestroyObject(OBJECT_SELF);
        //execute script
        //ExecuteScript("script_name",OBJECT_SELF);
        }
        else{
        WalkWayPoints();}
    }

   // Check to see if we should be playing default animations
   // - make sure we don't have any current targets
   else if ( !GetIsObjectValid(GetAttemptedAttackTarget())
         && !GetIsObjectValid(GetAttemptedSpellTarget())
         // && !GetIsPostOrWalking())
         && !GetIsObjectValid(GetNearestSeenEnemy()))
   {
       if (GetBehaviorState(NW_FLAG_BEHAVIOR_SPECIAL) || GetBehaviorState(NW_FLAG_BEHAVIOR_OMNIVORE) ||
           GetBehaviorState(NW_FLAG_BEHAVIOR_HERBIVORE))
       {
           // This handles special attacking/fleeing behavior
           // for omnivores & herbivores.
           DetermineSpecialBehavior();
       }
       else if (!IsInConversation(OBJECT_SELF))
       {
           if (GetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS)
               || GetSpawnInCondition(NW_FLAG_AMBIENT_ANIMATIONS_AVIAN)
               || GetIsEncounterCreature())
           {
               PlayMobileAmbientAnimations();
           }
           else if (GetSpawnInCondition(NW_FLAG_IMMOBILE_AMBIENT_ANIMATIONS))
           {
               PlayImmobileAmbientAnimations();
           }
       }
   }

   // Send the user-defined event signal if specified
   if(GetSpawnInCondition(NW_FLAG_HEARTBEAT_EVENT))
   {
       SignalEvent(OBJECT_SELF, EventUserDefined(EVENT_HEARTBEAT));
   }
}

this is a quickly edited file but you must replace the tag of your last way point ware you see WP_mywolf_04 and the wolf will disapear like asked.

EDIT NOTES: I also added a execute script option, and I adjusted to check for distance between waypoint and wolf you can adjust this also 1.0-2.0 seems to work well for my test it did
               
               

               


                     Modifié par Greyfort, 14 janvier 2011 - 03:27 .
                     
                  


            

Legacy_Greyfort

  • Sr. Member
  • ****
  • Posts: 442
  • Karma: +0/-0
My NPC Wolves Won't Cross My Waypoints. Please Help??
« Reply #3 on: January 14, 2011, 02:50:54 am »


               Forgive me I missed the wolfs starting when pc enters, If you placed them in the area with the toolset a PC wont be able to watch them from start to end.  You will need to simply remove just the wolfs from the area leaving the waypoints, edit you wolfs with the script above be sure to change your last waypoint tag.  Then either by laying a generic trigger, or useing the area enter event



place this code in:



// wolf_ent

void main()

{

CreateObject(OBJECT_TYPE_CREATURE,"mywolf",GetLocation(GetObjectByTag("WP_mywolf_01")) );

}

be sure to change the starting waypoint to that of your wolfs.



I hope it helps
               
               

               
            

Legacy_Balduvard

  • Full Member
  • ***
  • Posts: 126
  • Karma: +0/-0
My NPC Wolves Won't Cross My Waypoints. Please Help??
« Reply #4 on: January 14, 2011, 03:42:00 am »


               If you are making a cutscene, I highly recommend looking at the Gestalt Cutscene Scripting System. I picked it up and (with some scripting know-how) managed to create rather effective cutscenes with little effort beyond learning how to work the functions.

You can take a peek at my module to see how I implemented the system to do cutscenes, but here is a segment of a cutscene where I had one of my NPCs moving around:

-oMage is the NPC on screen
-oPC is the player character, which has been made cutscene invisible so that I can move them around to act as a camera
-You can see the ActionMove functions issued at specific times to move the "actors" in the scene to waypoints I want them at.


float fT = 0.0;
GestaltStartCutscene(oPC,"portalstart",TRUE,TRUE,FALSE,TRUE,FALSE);
GestaltCameraSetup(fT+=0.0,oPC,120.0,20.0,35.0,0.0);
GestaltActionMove(fT+=0.0,oPC,GetWaypointByTag("WP_PortalSpot"),TRUE,0.0,1.0);

GestaltCopy(fT+=2.0,oPC,oPC,FALSE,"cloned_pc");
GestaltActionMove(fT+=0.0,oMage,GetWaypointByTag("WP_PortalMage1"),FALSE,0.0,2.0);
GestaltCameraFacing(fT+=0.0,120.0,20.0,35.0,oPC);
GestaltJump(fT+=0.1,oPC,GetWaypointByTag("WP_PortalCam1"));
GestaltInvisibility(fT+=0.1,oPC,21.0);

GestaltExecuteScript(fT+=1.0,oPC,"getportalvfx");
GestaltActionMove(fT+=0.0,oMage,GetWaypointByTag("WP_PortalMage2"),FALSE,0.0,3.0);
GestaltActionMove(fT+=0.0,oPC,GetWaypointByTag("WP_PortalCam2"),TRUE,0.0,3.0);
GestaltCameraSmooth(fT+=0.0,0.0,0.0,0.0,-18.3,-5.3,20.0,3.0,30.0,oPC,2,0);

If I were to do anything involving cutscenes, Gestalt's scripts are the way I would do it.
               
               

               


                     Modifié par Balduvard, 14 janvier 2011 - 03:43 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
My NPC Wolves Won't Cross My Waypoints. Please Help??
« Reply #5 on: January 14, 2011, 11:13:57 am »


               Make sure you have set the switch in your OnModLoad script.

   // * AI: Activating the switch below will make the creaures using the WalkWaypoint function
   // * able to walk across areas
   // SetModuleSwitch (MODULE_SWITCH_ENABLE_CROSSAREA_WALKWAYPOINTS, TRUE);