Aller au contenu

Photo

It is time for more... experiments.


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

#26
Tchos

Tchos
  • Members
  • 5 030 messages

Something perhaps of interest.  I'm playing around some more with on-the-fly environmental modifications, this time of interiors.  Most of the time lately I've been using placeable construction materials rather than tilesets, but I saw a reference to something called "tile magic" in NWN1 that allowed them to dynamically change tilesets during the game for some cinematic purpose in one of the expansions, so I took a couple of hours to see how it might work in NWN2. 

 

The scripting they used relied on some constants in a 2DA, a model that doesn't exist in NWN2, and a different set of tiles, so I wrote a new function based on the same general idea to do it the NWN2 way (and without the use of a 2DA), and wrote a couple of utility scripts to do things like change to various standard sets and rotate them. 

 

 

Tinting is of course possible as well, and presumably texture swapping as well, but it would take more time and I just wanted to see this in action in a hurry.

 

One limitation is that I can't seem to find a way to spawn an actual door object, aside from a door placeable which could be spawned as a non-usable cosmetic door positioned ajar in the doorway.  However, since you likely don't want the player to walk through walls, you'd probably want to start the room out with some tiles already in it (I just started out with a blank room in this video to show how it was done), and pre-bake your walkmesh with the expected wall arrangement in place, so you could place real doors in there at that time.

 

Basically, my purpose for a script like this would be to let me create new interiors as I need them without having to add actual new areas to my modules.  Of course I'd spawn decorative placeables and NPCs into them as well.  One other potential problem with such a system would be players dropping items in the area and expecting them to still be there later, which they wouldn't if I needed to change the area to something else, unless I really wanted to take the trouble to store the contents of the area for any future time they might enter it.


  • rjshae, kamal_, Loki_999 et 1 autre aiment ceci

#27
4760

4760
  • Members
  • 1 204 messages

I already see two interests in these scripts:

1- create secret doors/walls that can't be highlighted (except when they're actually discovered or known, when the corresponding tile is then changed)

2- make the results of a fight appear (with tiles showing fire marks, broken pillars, etc...)

 

The only drawback being the walkmesh, triggers to prevent the party from crossing the walls need to be scripted (but that would have been necessary - at least for me - to hide/unhide the secret doors anyway). And slopes (changes in floor level) still need to be in a different area (or location in the same area), but good work all the same!



#28
kamal_

kamal_
  • Members
  • 5 238 messages

Something perhaps of interest.  I'm playing around some more with on-the-fly environmental modifications, this time of interiors.  Most of the time lately I've been using placeable construction materials rather than tilesets, but I saw a reference to something called "tile magic" in NWN1 that allowed them to dynamically change tilesets during the game for some cinematic purpose in one of the expansions, so I took a couple of hours to see how it might work in NWN2. 

 

The scripting they used relied on some constants in a 2DA, a model that doesn't exist in NWN2, and a different set of tiles, so I wrote a new function based on the same general idea to do it the NWN2 way (and without the use of a 2DA), and wrote a couple of utility scripts to do things like change to various standard sets and rotate them. 

 

 

Tinting is of course possible as well, and presumably texture swapping as well, but it would take more time and I just wanted to see this in action in a hurry.

 

One limitation is that I can't seem to find a way to spawn an actual door object, aside from a door placeable which could be spawned as a non-usable cosmetic door positioned ajar in the doorway.  However, since you likely don't want the player to walk through walls, you'd probably want to start the room out with some tiles already in it (I just started out with a blank room in this video to show how it was done), and pre-bake your walkmesh with the expected wall arrangement in place, so you could place real doors in there at that time.

 

Basically, my purpose for a script like this would be to let me create new interiors as I need them without having to add actual new areas to my modules.  Of course I'd spawn decorative placeables and NPCs into them as well.  One other potential problem with such a system would be players dropping items in the area and expecting them to still be there later, which they wouldn't if I needed to change the area to something else, unless I really wanted to take the trouble to store the contents of the area for any future time they might enter it.

Can you dynamically change the textures on the tiles, or tinted? Dynamically changing the tint/texture would be really cool.



#29
Tchos

Tchos
  • Members
  • 5 030 messages

I haven't tried changing the textures yet, but I've done tints.  I don't know if it's possible to specify colours directly by scripts, but I can use the scripts to select from prepared tint sets.  I believe changing the textures to any of the standard variations for the tileset should be possible, since it works for other objects such as the paintings I did and the doors Bob did.

 

As for secret doors, something like this could certainly be used to change a tile with a plain wall into a tile with a doorway with an appropriate skill check.  Another method for doing that would be using a normal placeable wall, set to unusable so that it won't highlight, and either changed to usable upon a successful skill check (and using it would destroy it) or destroying it directly upon detection.

 

Something else I hadn't noticed until I uploaded the video is that the UI circle isn't appearing on the ground.  I'll have to test and see if it's because of the slight height offset I put in the script to account for spawning tiles over exterior terrain.  Perhaps with no height offset the circles will appear.



#30
PJ156

PJ156
  • Members
  • 2 980 messages

If the script were on a trigger then this could for the basis for a random dungeon level?

 

PJ



#31
Tchos

Tchos
  • Members
  • 5 030 messages

It would work fine on a trigger as long as some trigger-related lines were added to the script, and you could use it for a random dungeon layout, but you'd have to write a random generator that could intelligently pick tiles that logically go together (like making sure door openings are on both sides of a wall, for instance).  Right now it's a ga_ script that expects parameters to be passed into it, so those parameters would have to be supplied in another way, like local variables or a random generator.

 

Depending on how random you're talking about, such as whether you would want to have a wall in one random layout, where it's a doorway or a large open room in another layout, you'd probably also have to use push-back triggers, dynamic collision boxes, or something like that to deal with the walkmesh, and those aren't as good as real walkmeshes.  I don't know if it's possible to generate a real walkmesh or swap to one of a bank of premade walkmeshes within the game engine.



#32
Tchos

Tchos
  • Members
  • 5 030 messages

I tested to see if the CreateObject function would work for a door despite OBJECT_TYPE_DOOR not being listed as one of the options.  I had found earlier that RemoveEffect works on placeables even though the function comments specify that it's to be used for creatures, so I thought this had a chance of working, too. 

 

In my test, I tried to spawn a door at the location of the PC.  Unfortunately, no door appeared in my test.  Either CreateObject does not work for OBJECT_TYPE_DOOR, as expected, or possibly doors cannot be spawned in a location currently occupied by a creature.



#33
andysks

andysks
  • Members
  • 1 645 messages

I see mini games on this :).



#34
Tchos

Tchos
  • Members
  • 5 030 messages

Another experiment has borne fruit, so I'm putting it in this long-dormant thread.  Some time ago, as some here may recall, I was experimenting with speakers and listeners as a means to make things happen when you type in the standard chat box in the game.  The purpose would be for things like the player being able to enter passwords or speak magic words without the game having to prompt them to do so, as well as to be able to run my own debugging scripts without having to open the console or activate debug mode.

 

Though that experiment was successful, and in fact remains in the BSoCC as a hidden feature, a commenter (I don't remember who, unfortunately, but it was a NWN1 player) mentioned that it could be done more easily without speakers and listeners by using the OnChat module event.  I stopped experimenting with the speakers and listeners at that point, but it took several years for me to get around to trying the OnChat method.  I did today, prompted by a NWN1 example, and although the syntax is different in the NWN2 version, it works just as simply and cleanly.  There doesn't seem to be a template for the event in the toolset, but the NWN2 wiki had the necessary documentation and examples.

 

I do wish I'd done this years ago, since it would have made my debugging tasks easier when testing my module, not having to use the console to access my debugging scripts and commands.  That's what I'm primarily using it for, though Claudius has hinted that his current module uses something of this sort as a gameplay feature.  I don't know whether it's through listeners or the OnChat event, though.



#35
Claudius33

Claudius33
  • Members
  • 256 messages

That's what I'm primarily using it for, though Claudius has hinted that his current module uses something of this sort as a gameplay feature.  I don't know whether it's through listeners or the OnChat event, though.

 

Nothing related to the OnChat event, let alone speakers and listeners.

 

It's just a set of scripts systematically included in all my campaigns folders which allows me to (relatively) easily direct a player if he's stuck because of a bug or an unanticipated behaviour. I also use them for debugging and test purposes. They require less memory efforts than standard scripts.

 

For instance to update the journal, call sd_debug_quest("quest_tag", iStep). ga_journal would do the same thing but the syntax is more complex because of unecessary parameters.

sd_debug_jump("WP_tag) moves the party to a specific waypoint,  sd_debug_convo("locutor_tag", "convo_tag") fires a convo, etc...



#36
GCoyote

GCoyote
  • Members
  • 341 messages

Last of the Dana'an 2.0 has some functionality like that. The player can use the chat box to draw a crowd, then perform to raise money.



#37
Tchos

Tchos
  • Members
  • 5 030 messages

Nothing related to the OnChat event, let alone speakers and listeners.

 

Ah, I thought you had said something about the player having to guess a password in one place.

 

Last of the Dana'an 2.0 has some functionality like that. The player can use the chat box to draw a crowd, then perform to raise money.

 

Hm, I've played part of the original Last of the Dana'an, but not far enough to know whether that functionality was in the earlier version as well.



#38
Claudius33

Claudius33
  • Members
  • 256 messages

Ah, I thought you had said something about the player having to guess a password in one place.

 

Just done through traditional search for clues and convos.



#39
GCoyote

GCoyote
  • Members
  • 341 messages

... Hm, I've played part of the original Last of the Dana'an, but not far enough to know whether that functionality was in the earlier version as well.

 

No, it was added in the 2.0 WiP release. There may be other functions planned for access using the chat feature but that is the only one I'm aware of from playing it. You can always ping Lugaid' for more info.