Visit the Ironworks Gaming Website Email the Webmaster Graphics Library Rules and Regulations Help Support Ironworks Forum with a Donation to Keep us Online - We rely totally on Donations from members Donation goal Meter

Ironworks Gaming Radio

Ironworks Gaming Forum

Go Back   Ironworks Gaming Forum > Ironworks Gaming Forums > Neverwinter Nights 1 & 2 Also SoU & HotU Forum
FAQ Calendar Arcade Today's Posts Search

Reply
 
Thread Tools Search this Thread
Old 02-08-2007, 11:50 AM   #1
robertthebard
Xanathar Thieves Guild
 

Join Date: March 17, 2001
Location: Wichita, KS USA
Age: 60
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.
Good Music: Here.
Interesting read, one of my blogs.
robertthebard is offline   Reply With Quote
Old 02-08-2007, 12:26 PM   #2
Legolas
Jack Burton
 

Join Date: March 31, 2001
Location: The zephyr lands beneath the brine.
Age: 39
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.
Legolas is offline   Reply With Quote
Old 02-08-2007, 12:30 PM   #3
robertthebard
Xanathar Thieves Guild
 

Join Date: March 17, 2001
Location: Wichita, KS USA
Age: 60
Posts: 4,537
I changed the check for, and the setting of the variable to OBJECT_SELF, since the script is on each version of the placeable, and tested it that way, and it works great now. The PC won't be able to farm the containers, which is good. When the PC leaves the area, all containers with this script attached will be destroyed, and replaced when another PC enters, so the variable will be back to 0, allowing the scripts to fire again.
__________________
To those we have lost; May your spirits fly free.
Good Music: Here.
Interesting read, one of my blogs.
robertthebard is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump

Similar Threads
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


All times are GMT -4. The time now is 07:37 AM.


Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
©2024 Ironworks Gaming & ©2024 The Great Escape Studios TM - All Rights Reserved