Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Neverwinter Nights Script Help  (Read 1307 times)

The Scout

  • Bay Watcher
  • ?????
    • View Profile
Neverwinter Nights Script Help
« on: January 31, 2014, 08:42:03 pm »

So I found this amazing code for Neverwinter Nights, that lets you make creatures afraid of light. However, the script writer disappeared before adding in the feature of them watching the person outside of the range of their light. http://pastebin.com/GPhHG3Rq
Spoiler (click to show/hide)

Any help in this would be appreciated, as I'm trying to make a module focusing around this.
« Last Edit: February 01, 2014, 08:33:54 pm by The Scout »
Logged
Whatever you do, don't agree to stop looking at pornography or getting help from Jesus.
"mind if I sig this"
 - Person who isn't actually going to put that in their sig

LordBucket

  • Bay Watcher
    • View Profile
Re: Neverwinter Nights Script Help
« Reply #1 on: February 01, 2014, 06:31:11 pm »

watching the person outside of the range of their light.

Any help in this would be appreciated

I have neither NWN nor the toolset set installed so giving specific code is difficult. But conceptually I think this wouldn't be difficult. There are two sections in the script you linked that direct the creature to run away from light depending on distance:

Code: [Select]
ActionMoveAwayFromObject(oBrightestLight, TRUE);

and

Code: [Select]
ActionMoveAwayFromObject(oBrightestLight, FALSE, IntToFloat(iBrightest*5)+1.0);

I see a couple ways to do what you're describing. Either:

Spoiler: Me thinking out loud (click to show/hide)



Sample code that probably has syntax errors because I don't have the toolset installed and I'm just typing this in windows notepad:

Change this section of code:
Spoiler (click to show/hide)

...to something like this:

Spoiler (click to show/hide)

It's highly likely I've missed a bracket or something somewhere, but that seems the simplest way to do it. Also note that I removed all the ambient animations, but if there's no player in range, it doesn't really matter if the creatures are doing those where players can't see them.

Although, now that I look at it...the above will result in creatures that are constantly changing their mind about which way to go. It might be creepier if you use the ActionOrientToTag method described in that first spoiler. That way, instead of constantly changing their minds you can have a range at which they run, and a range at which they sit just out of the light constantly staring at the players with their beady little eyes.

The Scout

  • Bay Watcher
  • ?????
    • View Profile
Re: Neverwinter Nights Script Help
« Reply #2 on: February 01, 2014, 07:50:27 pm »

So I threw it in and...
Spoiler (click to show/hide)
The creatures are immediately swarming the player despite them glowing like the sun, but I've only tested hostile creatures so far. I'll test neutrals next. Also, you can throw in some debug lines if you want, and I'll report back what it spits out.
Edit: Neutrals appear broken too. They also do not respond to light.
« Last Edit: February 01, 2014, 08:33:28 pm by The Scout »
Logged
Whatever you do, don't agree to stop looking at pornography or getting help from Jesus.
"mind if I sig this"
 - Person who isn't actually going to put that in their sig

LordBucket

  • Bay Watcher
    • View Profile
Re: Neverwinter Nights Script Help
« Reply #3 on: February 01, 2014, 08:27:52 pm »

1) What are your expectations from this thread? I assumed that you were semi-familiar with the aurora toolset and merely wanted some input, didn't know some of the relevant commands you needed, etc. Aurora toolset is terribly finicky, and trying to debug code by posting samples then you applying them and reporting the results is probably not realistic.

2) What is the behavior of the original code you linked without my proposed change? I did no testing to confirm that it does what it claims to do. I merely changed the part relevant to what you said you wanted to something that might do that. What does it do if you plug it in unchanged?

3) Are you replacing the relevant heartbeat script? if you simply create a script and call it ag_ai_shyl_hb it's not going to do anything.

4) The code spoiler in your first post is empty and in the second post is scrunched together. Try removing the code tag from within the spoiler. No need for them both.

5) Upon counting, it looks like I copied too many curly brackets in the "change this section of code" spoiler in my previous post. See where it says this:

}
}
}

That should only have been two curly brackets, not three. Consequently one too many is being removed when you replace it with the code I suggested. Try adding it back in.



LeoLeonardoIII

  • Bay Watcher
  • Plump Helmet McWhiskey
    • View Profile
Re: Neverwinter Nights Script Help
« Reply #4 on: February 03, 2014, 07:58:15 pm »

Ah, tracking down that extra/missing close-paren. Gotta love those "ok NOW we can go to the moon" moments.
Logged
The Expedition Map
Basement Stuck
Treebanned
Haunter of Birthday Cakes, Bearded Hamburger, Intensely Off-Topic