Quick Scripting Suggestion

Feedback on past, current, and future development.
Post Reply
Wolvman
Posts: 23
Joined: 30 Apr 2012, 15:57

Quick Scripting Suggestion

Post by Wolvman »

Hey everyone. I was wondering if the OpenMW team is planning on adding any sort of automatic script attaching functions to the game at some point. By that I mean a way to have a desired script(s) attach to NPCs/Creatures/Activators/Ect. automatically as they spawn around the player without messing with any scripts that have already been manually placed on them in the construction set. MWSE already has two functions (xFirstNPC and xNextRef) that achieve this effect but sadly they are pretty buggy as is. The things that these two little functions make possible however are absolutely incredible and I've used both of them extensively in two of my own mods (Gratuitous Violence and Ravenous Hunger).

To help clarify what I'm talking about, an example of this in practice would be to create a script that constantly runs in the background and seeks out any NPCs/Creatures that have spawned around the player. Once it finds one it will attach a designated separate script to that actor that sits on them and monitors when that actor plays a specific sound effect. The second script will have the game mute that sound effect and play one of many new modded sound effects in place of it at random. I used this in GV to dynamically give all NPCS that the player encounters 6 random armor hit sound effects for each of the three armor types in-place of the original single sound effects. I've done the same for weapons swishes, foot-steps, ect.

I've also used the same setup to dynamically adjust NPC and creature stats and spells on the fly as they spawn around the player without causing any conflicts with their original scripts or with other mods that have affected that actor's stats manually.

A second example is the lycanthropy infection system I've been working on for RH. I've written a script that finds all of the nearby NPCs that have spawned and attaches a single script to each that detects when the player cuts them as a werewolf. These scripts are set to disable whenever needed but they can also remain on the actors for however long I need them to even through re-loading a saved game or changing cells. Once they are scratched by the player they then become werewolves themselves and a script that controls their werewolf abilities and transformations is placed on them that replaces the scratch detecting script. All of this goes on without messing up any scripts that were previously on the actor because of how the scripts can be layered on top of one another.

So is this something that the OpenMW team would ever be interested in eventually providing for us modders? :mrgreen:
User avatar
Zini
Posts: 5538
Joined: 06 Aug 2011, 15:16

Re: Quick Scripting Suggestion

Post by Zini »

Probably not. Sorry. Does not fit our data model and we are probably going into a different direction with scripting.
Wolvman
Posts: 23
Joined: 30 Apr 2012, 15:57

Re: Quick Scripting Suggestion

Post by Wolvman »

Ah, I understand. I have one more question however. Would it be possible for modders with knowledge of C++ to be able to program such scripting functions into OpenMW themselves at some point, perhaps through an engine based plugin if not directly? I ask because I'll be taking a few college courses on C++ this coming semester and would like to do so if possible. The number of mods on the official TES forums that require these functions to run as intended is growing, and I'd really like to be able to use them in OpenMW even if they'd need to be rewritten to use the alternative OpenMW versions of the functions.
Chris
Posts: 1626
Joined: 04 Sep 2011, 08:33

Re: Quick Scripting Suggestion

Post by Chris »

More to the point, I think, is that there could be much better ways to handle things like this without potentially resource-intensive scripting hacks. Oblivion, for instance, allows randomized sounds by pointing a sound record to a directory instead of a sound file. And things could be expanded to make impact sounds take into account the weapon and armor types.

Skyrim also has some pretty interesting features with quests and NPC aliases. Instead of globally searching out attaching scripts to whatever NPC you find, you can use a trigger (say an OnHit event from a script on the werewolf claws) to start an instance of a script using a specific NPC as a target alias. You could even use the same script to handle werewolves and werebears, for instance, by using property variables.

This is of course all post-1.0 stuff. But IMO the idea is to break out of the box that you've been stuck in with the original engine and provide new useful, flexible, and efficient methods to do what the original game wasn't intended to.
Wolvman
Posts: 23
Joined: 30 Apr 2012, 15:57

Re: Quick Scripting Suggestion

Post by Wolvman »

I for one would certainly be happy with improved alternatives to this system. Whatever works as long as it gets the job done. :D
Post Reply