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 11-29-2004, 07:49 AM   #1
robertthebard
Xanathar Thieves Guild
 

Join Date: March 17, 2001
Location: Wichita, KS USA
Age: 60
Posts: 4,537
void main()
{

object oPC = GetEnteringObject();

if (!GetIsPC(oPC)) return;

int DoOnce = GetLocalInt(oPC, GetTag(OBJECT_SELF));

if (DoOnce==TRUE) return;

SetLocalInt(oPC, GetTag(OBJECT_SELF), TRUE);

object oTarget;
object oSpawn;
location lTarget;
oTarget = GetWaypointByTag("DG_HermePoint_01");

lTarget = GetLocation(oTarget);

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

}

This is the script, and it does work. My question is, how can I make it only fire one creature per Party, instead of pc, is there a faction command, or function I can use?
__________________
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 11-29-2004, 08:52 AM   #2
Legolas
Jack Burton
 

Join Date: March 31, 2001
Location: The zephyr lands beneath the brine.
Age: 39
Posts: 5,459
I'm not 100% certain of the intent, but I assume you mean it should fire once for each party as opposed to once for each PC.

Quote:
int DoOnce = GetLocalInt(oPC, GetTag(OBJECT_SELF));

if (DoOnce==TRUE) return;

SetLocalInt(oPC, GetTag(OBJECT_SELF), TRUE);
This bit is used to remember whether or not the event has already fired for a PC. It sets a variable with the name of the area's tag to 1 on the PC. One thing you could do then is to cycle through the PC's party members to see if someone else already has this variable set to 1, and if so, not to fire the script.

To do that, add something like this above the quoted area.

Quote:
object oTest = GetFirstFactionMember(oPC);
while(GetIsObjectValid(oTest))
{
if(GetLocalInt(oTest, GetTag(OBJECT_SELF)))
{
return;
}
oTest = GetNextFactionMember(oPC);
}
The creature will still spawn if the other player enters at a time when he/she is not in a party with the player who triggered the spawn.

Alternatively, if you only want to have one creature spawning at a time regardless of party, set the variable on the area (OBJECT_SELF) instead of on the PC. You can always reset it later on by setting the variabnle to 0.
Legolas is offline   Reply With Quote
Old 11-29-2004, 01:56 PM   #3
robertthebard
Xanathar Thieves Guild
 

Join Date: March 17, 2001
Location: Wichita, KS USA
Age: 60
Posts: 4,537
So setting the variable on the area would make it only fire one creature, instead of one creature per pc? Assuming yes, is there a way to make that work only if a pc is already in area, so that if no pc's are in the area, it would 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
Old 11-29-2004, 03:08 PM   #4
Legolas
Jack Burton
 

Join Date: March 31, 2001
Location: The zephyr lands beneath the brine.
Age: 39
Posts: 5,459
As the script is set up, I am assuming it is an area's OnEnter event. It could also be a trigger's OnEnter event but that's not really important.

What happens is that you have this variable which you chose to give the area's tag for a name. We could also name it SingleSpawn1 for example.
Someone enters the area, the script fires and checks if SingleSpawn1 is FALSE (default) or TRUE.

If then you set the variable on a creature and the creature hasn't been there before, SingleSpawn1 is set to TRUE and a creature spawns. If the creature has been there before (the SingleSpawn1 variable is TRUE already), nothing happens. Since each creature has its own list of variables, this will work once for everyone.
If you put the variable on the area instead, the very first PC entering will set SingleSpawn1 to TRUE. When other PCs enter, SingleSpawn1 is already set to TRUE so nothing happens. The area is the same in each instance, so you use the same SingleSpawn1 variable each time.

In the latter case, to make the spawning happen again, you need to set SingleSpawn1 back to FALSE at some point. For example, after a certain amount of time has elapsed, or when the area is empty, or when a player leaves, or when someone shuts a door , or when the spawned creature dies, or when a quest is completed, or...
In most cases, the SetLocalInt(OBJECT_SELF,SingleSpawn1,FALSE); command will be found in another script, and possibly in a different form as well (with a DelayCommand in front of it, or instead of OBJECT_SELF you might be using GetArea(OBJECT_SELF) or GetArea(oPC) or whatnot).

So the answer is yes, and you can also make it work under the conditions you specified, although an area's OnEnter won't be ideal for firing something when a player is already in the area, and in most cases there's no point to spawning a creature in an area where there's noone around to see it.
Legolas is offline   Reply With Quote
Old 11-29-2004, 08:34 PM   #5
robertthebard
Xanathar Thieves Guild
 

Join Date: March 17, 2001
Location: Wichita, KS USA
Age: 60
Posts: 4,537
What it's supposed to do, and does, is spawn a creature that gives a mini quest to pc, or party. At the end of the quest giver dialog, the creature is destroyed, so, I could reset the SingleSpawn1,False, in the other actions taken in the convo?
__________________
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 11-29-2004, 08:44 PM   #6
Legolas
Jack Burton
 

Join Date: March 31, 2001
Location: The zephyr lands beneath the brine.
Age: 39
Posts: 5,459
You could. In that case the creature would be destroyed and spawn again the next time a player enters the area. You can also build in a delay to make it the next player after x minutes. Something like
DelayCommand(180.0,SetLocalInt(GetArea(OBJECT_SELF ),SingleSpawn1,FALSE));
in a conversation script which effectively means it'll take 3 minutes to reset the variable.
Legolas 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
Need some help scripting again robertthebard Neverwinter Nights 1 & 2 Also SoU & HotU Forum 6 10-22-2003 07:31 AM
Scripting Son of Osiris Neverwinter Nights 1 & 2 Also SoU & HotU Forum 1 04-05-2003 08:34 AM
Please aid me in my scripting theholyavenger Neverwinter Nights 1 & 2 Also SoU & HotU Forum 0 07-22-2002 12:55 PM
Would like some help... scripting again... Calaethis Dragonsbane Neverwinter Nights 1 & 2 Also SoU & HotU Forum 2 07-22-2002 07:28 AM
AI scripting Sharak Baldurs Gate & Tales of the Sword Coast 0 11-28-2000 07:10 PM


All times are GMT -4. The time now is 04:00 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