View Single Post
Old 02-08-2007, 11:50 AM   #1
robertthebard
Xanathar Thieves Guild
 

Join Date: March 17, 2001
Location: Wichita, KS USA
Age: 62
Posts: 4,537
#include "nw_i0_generic"
location lTarget;
object oSpawn;
object oTarget;

void main()
{

object oPC = GetLastOpenedBy();

if (!GetIsPC(oPC)) return;

int nInt;
nInt=GetLocalInt(OBJECT_SELF, "openme");

if (nInt == 0)
{
oTarget = oPC;

lTarget = GetLocation(oTarget);

oSpawn = CreateObject(OBJECT_TYPE_CREATURE, "rb_gnollboss_01", lTarget);

oTarget = oSpawn;

SetIsTemporaryEnemy(oPC, oTarget);

AssignCommand(oTarget, ActionAttack(oPC));

AssignCommand(oTarget, DetermineCombatRound(oPC));

SetLocalInt(OBJECT_SELF, "openme", 1);

}
}

This script will spawn the creature, no problem. The problem was, until I added the int openme, it would continuosly spawn the creature when you used the placeable. However, I have a lot of placeables with the same script, and it locks out the other spawns. If I clear the int OnDeath, then a player could, and most probably would, farm one placeable for all it's worth. Adding a DoOnce thing would put me right where I am now, and my placeables must have the same resref for my spawn script.


Edit again: As listed this script will spawn a creature beside the PC, which then attacks the PC. It will only fire once, and now works on the other similar objects in the area. The same script will fix the multiple zombies spawning in the catacombs in my module as well.

[ 02-08-2007, 12:33 PM: Message edited by: robertthebard ]
__________________
To those we have lost; May your spirits fly free.
Interesting read, one of my blogs.
robertthebard is offline   Reply With Quote