Jump to content

Home

Help on party placement in ebon hawk


randydg

Recommended Posts

#include "k_inc_debug"    // I think you need these...
#include k_inc_utility"

void main()
{
   int nParty = 0;    // This is the first party member's index number

   float x, y, z;
   x = /*first coordinate*/;
   y = /*second coordinate*/
   z = /*third coordinate*/
   r = /*orientation*/

   vector vParty = Vector(x, y, x);
   location lParty = Location(vParty, r);

   for  (nParty < /*last party member's index*/; nParty++)
   {
       object oParty = CreateObject(OBJECT_TYPE_CREATURE, "/*NPC ResRef*/", lParty);
   }

   int iCheck = GetLocalNumber(oParty);

   if (iCheck > 1)
   {
       SetLocalNumber(oParty, 0, 1);
   }
}

NWScript isn't my forte, but that may work.

Link to comment
Share on other sites

Originally posted by randydg

I need some help getting my new party members to spawn in the ebon hawk once i have them.

 

That depends if you are using the normal/old Ebon Hawk party management functionality of if you have ripped out all the old scripts.

 

I.e. do you need advise on how to modify the existing scripts, or how to do it from scratch?

Link to comment
Share on other sites

Originally posted by randydg

all new party members so i guess from scratch.

 

just a simle script that checks if their in your party file and if they are spawn them at x,y,z.

 

Here's a variant of that which I think should work. This script would go in the OnEnter script slot of the Ebon Hawk Area.

 

This script uses waypoints on the map rather than coordinates though since I don't know what coordinates you use. It requires a waypoint with a Tag named "WP_PARTY_" followed by the party number slot of the creature that should be spawned there.

 

For example, the creature you've added to Atton's party slot (0) would be spawned at a waypoint with the tag "WP_PARTY_0" and the one you've added to BaoDur's party slot would spawn at the waypoint "WP_PARTY_1" and so on.

 

Just place waypoints with the proper tags at the coordinates you wish your party members to appear on.

 

The script:


void SetupEbonHawk();

void main() {
   SetupEbonHawk();
}

void SetupEbonHawk() {
   // ST: Don't do this if reloading from a save, only after transit.
   if (GetLoadFromSaveGame()) {
       DelayCommand(1.0, RebuildPartyTable());
       return;
   }

   // ST: Set control back to player char.
   SetPartyLeader(NPC_PLAYER);

   // ST: Remove all other NPCs from active party.
   int nSlot;
   for(nSlot = NPC_ATTON; nSlot <= NPC_DISCIPLE; nSlot++) {
       if(IsNPCPartyMember(nSlot)) {
           RemoveNPCFromPartyToBase(nSlot);
       }
   }

   // ST: Remove all creatures from the area
   object oNPC = GetFirstObjectInArea(OBJECT_SELF);
   while (GetIsObjectValid(oNPC)) {
       if (!GetIsPC(oNPC)) {
           DestroyObject(oNPC);
       }
       oNPC = GetNextObjectInArea(OBJECT_SELF);
   }

   // ST: Respawn all party members at their waypoints
   object oWP;
   for(nSlot = NPC_ATTON; nSlot <= NPC_DISCIPLE; nSlot++) {
       if(GetNPCSelectability(nSlot) != -1) {
           oWP = GetObjectByTag("WP_PARTY_" + IntToString(nSlot));
           if (GetIsObjectValid(oWP)) {
               oNPC = SpawnAvailableNPC(nSlot, GetLocation(oWP));
               SetCreatureAILevel(oNPC, AI_LEVEL_HIGH);
           }
       }
   }    

}

 

Note that this is untested since I don't have any area to test it on. If there seems to be problems let me know and I'll see what I can do.

 

If you already have an OnEnter script for your area, copy all parts of the script except the main() function into it, and then call the SetupEbonHawk() function from your existing main function.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...