![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
#1 |
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. |
![]() |
![]() |
![]() |
#2 |
Jack Burton
![]() Join Date: March 31, 2001
Location: The zephyr lands beneath the brine.
Age: 40
Posts: 5,459
|
Have you considered a DoOnce thing stored on the container? For example,
SetLocalInt(oPC, "openme", 1); becomes SetLocalInt(OBJECT_SELF, "openme", 1); in which case each container only fires the spawnscript once no matter which PC opens it. Alternatively, change it to something like SetLocalInt(OBJECT_SELF, "openme"+GetName(oPC), 1); which results in each container spawn-in firing only once for every PC (or log-in, or cd key, or race, or ...). Another option is changing the script to work with a variable stored on the container instead of the resref (you'd use something as GetLocalString(oContainer,"SpawnCode") instead of GetResRef(oContainer)). If the problem lies more in that a bashed container is replaced with a new one, thus providing infinite spawns, you might assign players logging into your module a unique number, use that instead of the PC name to identify who already opened the container, and change the OnDeath script to transfer all openme# variables up to the highest one the module has handed out to the new container which is yet to spawn. A bit more work, but so long as it is the death script spawning the new chests it will work to keep track of who opened what. |
![]() |
![]() |
![]() |
#3 |
Xanathar Thieves Guild
![]() Join Date: March 17, 2001
Location: Wichita, KS USA
Age: 62
Posts: 4,537
|
![]()
__________________
To those we have lost; May your spirits fly free. Interesting read, one of my blogs. |
![]() |
![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Spawning items | johnny | Neverwinter Nights 1 & 2 Also SoU & HotU Forum | 3 | 12-03-2003 05:53 PM |
Critter spawning | Melb_Wiz | Wizards & Warriors Forum | 12 | 08-22-2003 02:34 PM |
ingredients not spawning | jgbrowning | Miscellaneous Games (RPG or not) | 5 | 01-05-2002 08:42 PM |
spawning | Cicero | Baldurs Gate II Archives | 8 | 10-11-2001 11:58 AM |
Loup Guru keeps spawning!!! | ccd02 | Baldurs Gate & Tales of the Sword Coast | 0 | 03-16-2001 06:20 PM |