Aller au contenu

Photo

Problems with Script Hidden


  • Veuillez vous connecter pour répondre
9 réponses à ce sujet

#1
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
In one of my areas I have 62 script hidden creatures.  I have a script that unhides 31 of them, then after you dispose of those, it unhides the other 31.  When I tested the scenario without playing through the rest of my module, everything worked great.  When I did a full run through, the script hidden creatures would attack, but were invisible to the PC, that is, they did not show on the screen, but all the NPCs that were allied with the PC reacted to them and attacked them (and won, by the way!). 

Does anyone have any ideas why they would properly unhide without a full run-through, but fail to becom visible in a full run-through?

Also, I have 25 script hidden creatures in another area which behave properly in the full run-through. 

I do have a script that causes certain creatures in the area to be script hidden as part of the ambience, but I turn it off before the part where the 62 creatures are revealed. 

I am baffled!

#2
Lugaid of the Red Stripes

Lugaid of the Red Stripes
  • Members
  • 955 messages
Having disable AI when hidden set to FALSE might cause it, though I assume you haven't changed that in the meantime. It's also possible that some other section of code set them off--I've seen NPCs keep attacking creatures after they've become scripthidden. So maybe something else is causing your allied NPCs to attack the nearest hostile creature, some legacy NWN code that doesn't take into account being scripthidden.

#3
Dann-J

Dann-J
  • Members
  • 3 161 messages
If you have disabled the AI while hidden, and they are remaining invisible when un-hidden, then you may be pushing the limits of script-hidden-ness trying to un-hide so many at once.

How is the script getting hold of the creatures to un-hide them? Does it cycle through all creatures in the area and only unhide those with a specific tag, or are they in a custom group? If the former, then a slight delay between un-hidings might be kinder on the game engine (0.01 sec for the first, 0.02 for the second, etc).

Could you not spawn them via an encounter instead? It might be a bit more stable.

#4
M. Rieder

M. Rieder
  • Members
  • 2 530 messages

Lugaid of the Red Stripes wrote...

Having disable AI when hidden set to FALSE might cause it, though I assume you haven't changed that in the meantime. It's also possible that some other section of code set them off--I've seen NPCs keep attacking creatures after they've become scripthidden. So maybe something else is causing your allied NPCs to attack the nearest hostile creature, some legacy NWN code that doesn't take into account being scripthidden.


I do have a script that could possibly have changed disable AI to false. I'll check it.  That could explain why they remain hidden but still do stuff. 

#5
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
[quote]DannJ wrote...

If you have disabled the AI while hidden, and they are remaining invisible when un-hidden, then you may be pushing the limits of script-hidden-ness trying to un-hide so many at once.
[/quote]

I'm hoping that is not the case and I think it may not be since everything worked great when I was doing testing on this script without a full run through, but I don't know.  Could going through several areas versus just 2 like I did in the isolated testing change how the game engine addresses script-hidden?

[quote]
How is the script getting hold of the creatures to un-hide them? Does it cycle through all creatures in the area and only unhide those with a specific tag, or are they in a custom group? [/quote]

Each of the creatures has a specific tag and I use a loop to cycle through them.  it is coded like this:

while (nCounter<32)
{
do stuff that unhides creatures;
}


[quote]
If the former, then a slight delay between un-hidings might be kinder on the game engine (0.01 sec for the first, 0.02 for the second, etc).
[/quote]

I'll try that.  Thanks.

[quote]
Could you not spawn them via an encounter instead? It might be a bit more stable.[/quote]
[/quote]

I had not thought of doing this.  One challenge I have with this is I have a script that has to run on them to make them charge across the battlefield, but I suppose I could put that in their "on spawn" script, right?   This is definitely an option.  Thanks.

#6
Lugaid of the Red Stripes

Lugaid of the Red Stripes
  • Members
  • 955 messages
With large numbers, I think script-hidden is the way to go. For most of my big battles I spawn them script-hidden on the player's area enter event (not client enter), and unhide them at the appropriate time. Mass spawnings always create some sort of lag.

Are you placing the creatures in the toolset, or spawing them via script?

#7
BartjeD

BartjeD
  • Members
  • 249 messages
Did it work? (interested)

#8
M. Rieder

M. Rieder
  • Members
  • 2 530 messages

Lugaid of the Red Stripes wrote...

With large numbers, I think script-hidden is the way to go. For most of my big battles I spawn them script-hidden on the player's area enter event (not client enter), and unhide them at the appropriate time. Mass spawnings always create some sort of lag.

Are you placing the creatures in the toolset, or spawing them via script?


I placed them in the toolset.

#9
M. Rieder

M. Rieder
  • Members
  • 2 530 messages

BartjeD wrote...

Did it work? (interested)


Not yet.  I haven't gotten back to the toolset yet.

#10
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
I did some testing tonight and I found out my problem has to do with my area heartbeat script for that area. When that script runs at night, the soldiers will stay invisible when they are supposed to appear, but If I run the script to reveal the soldiers before the HB script runs at night, everything works great. That's why in all my testing, everything went fine but it broke on a playthrough.