![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
#1 |
Xanathar Thieves Guild
![]() Join Date: March 17, 2001
Location: Wichita, KS USA
Age: 61
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. 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
|
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:
To do that, add something like this above the quoted area. Quote:
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. |
||
![]() |
![]() |
![]() |
#3 |
Xanathar Thieves Guild
![]() Join Date: March 17, 2001
Location: Wichita, KS USA
Age: 61
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. Interesting read, one of my blogs. |
![]() |
![]() |
![]() |
#4 |
Jack Burton
![]() Join Date: March 31, 2001
Location: The zephyr lands beneath the brine.
Age: 40
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. |
![]() |
![]() |
![]() |
#5 |
Xanathar Thieves Guild
![]() Join Date: March 17, 2001
Location: Wichita, KS USA
Age: 61
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. Interesting read, one of my blogs. |
![]() |
![]() |
![]() |
#6 |
Jack Burton
![]() Join Date: March 31, 2001
Location: The zephyr lands beneath the brine.
Age: 40
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. |
![]() |
![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|
![]() |
||||
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 |