BioWare Atari
BioWare Info BioWare Games Support Forums Visit the BioWare Store
Neverwinter Nights Home
Neverwinter Nights Home

NWN 1: Scripting

New Topic    Post Reply

Go to Page ( 1 , 2 Next )

    Add this To My Topics

   Go To Bottom

Author A more elegant looping way of doing this...
Beerfish
Moderator
Moderator

Joined: 17 Oct 2001
From: Edmonton
Posted: Friday, 24 February 2006 04:25AM
Greetings, this script creates the placeable footprints at waypoints with a short delay so that it gives you the proverbial ghostly tracks with no one there. It works but is certainly not effecient code I would think. I take it it would be better to use some kind of loop that goes through the functions for the number of times you want the prints created? Since I have called my waypoints WP1,2, 3 etc could you use the counter to identify them as well?

One other question, if I recall you need a seperate void function to be able to use delays with createobjects. I take it that function is in the include file at the top of the script?

NWScript:

View Post/Code in separate window


_________________
Beerfish's Modules:
In The Footsteps Of Dante
Click Here

The Nature Of A Man
Click Here
  Profile: Beerfish   Send Message To: Beerfish
Sir Elric


Joined: 12 Sep 2002
From: Australia
Posted: Friday, 24 February 2006 05:23AM
NWScript:

View Post/Code in separate window


Yes you are using the Bioware default void function in the include at the top of the script.

SE
_________________
My NWN Vault Submissions

Technical Designer
Ossian Studios
  Profile: Sir Elric   Send Message To: Sir Elric
Sir Elric


Joined: 12 Sep 2002
From: Australia
Posted: Friday, 24 February 2006 06:44AM
Was playing around with it and it works well if you use both the left and right footprint found in Placeables > Misc. I added facing so they follow the direction the waypoints are pointing and also fade them out after a delay too...
NWScript:

View Post/Code in separate window



[edit] Oop I'm using the 1.67 toolset the left and right footprints are not in the 1.66 toolset

SE
_________________
My NWN Vault Submissions

Technical Designer
Ossian Studios

Edited By Sir Elric on 02/24/06 06:58

  Profile: Sir Elric   Send Message To: Sir Elric
Beerfish
Moderator
Moderator

Joined: 17 Oct 2001
From: Edmonton
Posted: Friday, 24 February 2006 02:58PM
Thanks Sir Elric, i didn't even know that the individual prints existed. I haven't gone up to 1.67 yet but that sounds exactly what I am looking for. I'll study your script to see how you did things when I get home this evening.

Thanks!
_________________
Beerfish's Modules:
In The Footsteps Of Dante
Click Here

The Nature Of A Man
Click Here
  Profile: Beerfish   Send Message To: Beerfish
Sunjammer
Game Owner
Profile: SunjammerNWN
NWN: SoU
NWN: HotU
SW: KotOR PC
Jade Empire:SE
NWN 2
NWN 2: MotB
NWN 2: SoZ
Mass Effect PC


Joined: 03 Jul 2002
From: Scotland
Posted: Sunday, 26 February 2006 03:59AM
I read this thread after getting home from work on Friday and I had a thought about just using one waypoint and calculating the subsequent footprints relative to it and then to the previous footprints. In fact I started to wonder if you could have some way of defining a whole layout just using waypoints to indicate change of direction.

However before I started scripting anything I got distracted by the discovery that we could (in fact, have been able to for a while but apparently no-one realised) change the colour of TileMagic effects by applying GLOW (and now the new AURA) VFXs to them!

Fortunately later that evening Sir Elric and I were chatting away when he mentioned this thread (he knows I like to mess with vectors). It turns out he had had the very same idea as me (only before me because of the time difference). Moreover he had another idea which was to use a Null Human creature and use it to determine the location of the footprints. This would allow users to take advantage of WalkWaypoints etc.

I rattled up a buggy example (it turned out) and fired over to the other side of the world for SE to play with. After finding to our amusement that the script was making footprints 20m to the left and right rather than 20cm we soon had it working as intended. We could happily create a trail of footprints behind a creature (invisible or otherwise) that would slowly fade after a few seconds.

By then it was 3am in Scotland and I was about to call it a night however SE had one last request: to make the width of the footprints (left to right) vary according to creature size. He had been using Halfling and the footprints were a bit to far apart to look convincing. I promised to add that functionality and post the script along with an explanation of what it's doing.

So why I am I regaling you with a long winded tale rather than simply posting the final script? Well because I got a little carried away and it seems to have grown into a feature-rich system and consequently it isn't quite finished yet. So rather than wait until Sunday or Monday I thought I would post up the original script just now on the off-chance that it is useful and add the full system to the Vault when it's done.

So here it is ...

NWScript:

View Post/Code in separate window




I apologise for the lack of prototypes (everything outside of main was pulled from an unfinished core library so this could work as a stand alone script). Also if anyone has any questions about what I did and/or why I did it just let me know and I'll do my best to explain it.
_________________
Sunjammer
Code Monkey

Edited By Sunjammer on 02/26/06 04:02

  Profile: Sunjammer   Send Message To: Sunjammer
Beerfish
Moderator
Moderator

Joined: 17 Oct 2001
From: Edmonton
Posted: Sunday, 26 February 2006 05:09AM
Well I see my question has been keeping you coding chaps busy and out of trouble. Thanks for your efforts and it looks like this type of thing could be very useful for other mod makers which is a good thing. I take it I have to get 1.67 before I test this? (I have been holding off only because the small private PW my self and a few friends play on is still on the old patch version.)

Once again thanks for your help.
_________________
Beerfish's Modules:
In The Footsteps Of Dante
Click Here

The Nature Of A Man
Click Here
  Profile: Beerfish   Send Message To: Beerfish
Sir Elric


Joined: 12 Sep 2002
From: Australia
Posted: Sunday, 26 February 2006 06:34AM
See what you started?

The script will run in 1.66 you would just need to change the resref back to the old "tracks", though it will look a little wierd but it will give you the idea.

I added the foot print width to SJ's script too while he's napping heh heh...

NWScript:

View Post/Code in separate window



SE
_________________
My NWN Vault Submissions

Technical Designer
Ossian Studios
  Profile: Sir Elric   Send Message To: Sir Elric
Sunjammer
Game Owner
Profile: SunjammerNWN
NWN: SoU
NWN: HotU
SW: KotOR PC
Jade Empire:SE
NWN 2
NWN 2: MotB
NWN 2: SoZ
Mass Effect PC


Joined: 03 Jul 2002
From: Scotland
Posted: Sunday, 26 February 2006 02:08PM
I forgot to mention it was 1.67 because of the footprints however if you want we could pop them in a hak for you to allow you to test it - might still need a change of the ResRef but you get a better picture of what is going on.

Alternatively just increase the time between callbacks to about 0.8s (tweaking may be required) and reduce the footstep width to 0.0. That will stop the overlaying and offsetting effects. Won't be as cool but will allow you to use it with the pre-1.67 footsteps placeables.

As for the footprint width in the full system: I lucked out on that a bit.

My initial thought was the same as SEs however after a bit of testing I still wasn't very happy with the results. So I did what I always do which was to go and browse the underlying data, in this case appearance.2da. The values in the CREPERSPACE column looked useful but were a bit too high. Initially I tried dividing them by 2 however the footprints were still too far apart but when I divided the values by 3 I struck gold. Consequently I now use the following to determine the default offset for each footprint (it is only called once and the value is cached).

NWScript:

View Post/Code in separate window


_________________
Sunjammer
Code Monkey

Edited By Sunjammer on 02/26/06 14:11

  Profile: Sunjammer   Send Message To: Sunjammer
Beerfish
Moderator
Moderator

Joined: 17 Oct 2001
From: Edmonton
Posted: Sunday, 26 February 2006 03:47PM
I think I am doing things incorrectly here so looks like I need further instuction.

The 1st part of the scripting (with the polars) I assumed was to be saved as "sj_footprint".

The second part of the script that instructs you to put it in the onenter of a trigger gave me a 'parsing variable list error' on this line: int nStep = IncLocalInt(oSelf, "footprint_count") % 2; when I tried to save it.

Also what about the null human part? I assume I have to plunk one down somewhere too tell the scripts where the tracks are to start?




Quote: Posted 02/26/06 06:34:31 (GMT) by Sir Elric

See what you started?

The script will run in 1.66 you would just need to change the resref back to the old "tracks", though it will look a little wierd but it will give you the idea.

I added the foot print width to SJ's script too while he's napping heh heh...

NWScript:

View Post/Code in separate window



SE

_________________
Beerfish's Modules:
In The Footsteps Of Dante
Click Here

The Nature Of A Man
Click Here
  Profile: Beerfish   Send Message To: Beerfish
Hairy_Brain
Game Owner
Profile: Hairy_BrainNWN: SoU


Joined: 07 Jan 2005
From: Scotland
Posted: Sunday, 26 February 2006 04:08PM
hmm, do you think you could make a sort of tracking system with this?
  Profile: Hairy_Brain   Send Message To: Hairy_Brain
Sunjammer
Game Owner
Profile: SunjammerNWN
NWN: SoU
NWN: HotU
SW: KotOR PC
Jade Empire:SE
NWN 2
NWN 2: MotB
NWN 2: SoZ
Mass Effect PC


Joined: 03 Jul 2002
From: Scotland
Posted: Sunday, 26 February 2006 05:22PM
Quote: Posted 02/26/06 15:47:20 (GMT) by Beerfish

I think I am doing things incorrectly here so looks like I need further instuction.
As it stands at the moment it all goes together as one script. Also I just copied SE's version and it compiled fine so you might be missing a bit.

To set it up you do indeed need a creature (if you want a ghost then Null Human is a good start or use an Allip and apply CutsceneGhost and a CUTSCENE_INVISIBILITY VFX OnSpawn).

I added my call to sj_footprint from a custom OnSpawn script but I think SE used a trigger. Either way you just need something to kick it off and then it will happily call itself until you destroy the creature.

You'll be glad to hear the full system will do a lot of this for you. It has a GHOST property which will apply the CSG and CSI effects automatically, a SILENT property which sets the footstept type to NONE, and I am adding a VFX property so you can apply a VFX to each footprint (for demons-in-human-form and the like). Also adding some controls that allow you turn the footprints on and off, suppress them and SE wants a "timed off" so I'll be adding that too.

However I feel kind of bad you aren't getting to enjoy all this so while it might not make the initial release I will update the system to handle the pre-1.67 footprints as a standard funciton. Perhaps even a footprint override too so you can have custom footprints ... like those new arrows we got in PotSC.
_________________
Sunjammer
Code Monkey
  Profile: Sunjammer   Send Message To: Sunjammer
Sunjammer
Game Owner
Profile: SunjammerNWN
NWN: SoU
NWN: HotU
SW: KotOR PC
Jade Empire:SE
NWN 2
NWN 2: MotB
NWN 2: SoZ
Mass Effect PC


Joined: 03 Jul 2002
From: Scotland
Posted: Sunday, 26 February 2006 05:22PM
Quote: Posted 02/26/06 16:08:26 (GMT) by Hairy_Brain

hmm, do you think you could make a sort of tracking system with this?
Possibly what did you have in mind?
_________________
Sunjammer
Code Monkey
  Profile: Sunjammer   Send Message To: Sunjammer
Beerfish
Moderator
Moderator

Joined: 17 Oct 2001
From: Edmonton
Posted: Sunday, 26 February 2006 05:42PM
Quote: Posted 02/26/06 17:22:15 (GMT) by Sunjammer

Quote: Posted 02/26/06 15:47:20 (GMT) by Beerfish

I think I am doing things incorrectly here so looks like I need further instuction.
As it stands at the moment it all goes together as one script. Also I just copied SE's version and it compiled fine so you might be missing a bit.

To set it up you do indeed need a creature (if you want a ghost then Null Human is a good start or use an Allip and apply CutsceneGhost and a CUTSCENE_INVISIBILITY VFX OnSpawn).

I added my call to sj_footprint from a custom OnSpawn script but I think SE used a trigger. Either way you just need something to kick it off and then it will happily call itself until you destroy the creature.

You'll be glad to hear the full system will do a lot of this for you. It has a GHOST property which will apply the CSG and CSI effects automatically, a SILENT property which sets the footstept type to NONE, and I am adding a VFX property so you can apply a VFX to each footprint (for demons-in-human-form and the like). Also adding some controls that allow you turn the footprints on and off, suppress them and SE wants a "timed off" so I'll be adding that too.

However I feel kind of bad you aren't getting to enjoy all this so while it might not make the initial release I will update the system to handle the pre-1.67 footprints as a standard funciton. Perhaps even a footprint override too so you can have custom footprints ... like those new arrows we got in PotSC.

Okie dokie, I'll save it all in one script and stick it in an onenter of a trigger. I will also probably get 1.67 in anycase.
_________________
Beerfish's Modules:
In The Footsteps Of Dante
Click Here

The Nature Of A Man
Click Here
  Profile: Beerfish   Send Message To: Beerfish
Sunjammer
Game Owner
Profile: SunjammerNWN
NWN: SoU
NWN: HotU
SW: KotOR PC
Jade Empire:SE
NWN 2
NWN 2: MotB
NWN 2: SoZ
Mass Effect PC


Joined: 03 Jul 2002
From: Scotland
Posted: Sunday, 26 February 2006 05:45PM
Quote: Posted 02/26/06 17:42:10 (GMT) by Beerfish

Okie dokie, I'll save it all in one script and stick it in an onenter of a trigger. I will also probably get 1.67 in anycase.
Well if you go for the 1.67 beta I can send you the demo mod I am working on and you can enjoy the unwholesome goodness of the full system (WIP obviously).
_________________
Sunjammer
Code Monkey
  Profile: Sunjammer   Send Message To: Sunjammer
Beerfish
Moderator
Moderator

Joined: 17 Oct 2001
From: Edmonton
Posted: Sunday, 26 February 2006 06:03PM
Quote: Posted 02/26/06 17:45:54 (GMT) by Sunjammer

Quote: Posted 02/26/06 17:42:10 (GMT) by Beerfish

Okie dokie, I'll save it all in one script and stick it in an onenter of a trigger. I will also probably get 1.67 in anycase.
Well if you go for the 1.67 beta I can send you the demo mod I am working on and you can enjoy the unwholesome goodness of the full system (WIP obviously).

I'll probably do just that. I have become a bit confused between Elrics original script and the one you created. (Yours did complie when I put the whole thing in.)

Now here are my questions about it. You have an Execute script command near the end. I take it that I must save the script as sj_footprint and that line calls itself?

I take it I must create a null human in my module and create waypoints for it to walk? On what even does your script go? (As in what are you using to get it started in the 1st place?)
_________________
Beerfish's Modules:
In The Footsteps Of Dante
Click Here

The Nature Of A Man
Click Here
  Profile: Beerfish   Send Message To: Beerfish

Go to Page ( 1 , 2 Next )

New Topic    Post Reply

What do these icons mean?
Where can I learn how to use the forums?

Jump To:

Search Forums | Forums FAQ | Forum Archives

 

 

BioWare Store
Neverwinter Nights 2 Forums
Hide/Show

English
Deutsch
Français
Español
Italiano

Hide/Show

View Latest Screenshots 

View Latest Screenshots
Hide/Show

Multiplayer Games at Neverwinter Connections

Today
Schedule a Game...



Current time is: (set time)
Fri, 03 September 2010 12:57AM

Hide/Show

Buy Premium Modules

Top NWN: HotU Modules:
1. Good vs Evil III
2. More...

Top NWN: SoU Modules:
1. Good vs Evil III
2. More...

Top CEP Modules:
1. The Lord of Terror The Diablo Campa...
2. More...

Top Modules - NWVault:
1. Hall of Fame
2. More...

Total Modules: 4423

Hide/Show

6,251,297 BioWare Users:
  11 Logged In
  1 Hidden
  158 Guests

1135 Playing Online
  100% NWN
  100% NWN: SoU
  100% NWN: HotU

380 Registered Guilds

9,046,484 posts in forums

Newest Forum Topics:
1. These forums are now closed (NWN 1: Scripting)

2. These forums are now closed (NWN2: Guilds and Registry)

3. These forums are now closed (BioWare News Discussion)

4. Can you level items? (NWN 1: Scripting)

5. Thank you! (NWN 1: Scripting)