Jump to content

MODDER'S RESOURCE - Real-Time Interactions


PrettyMurky

Recommended Posts

I have just released my modder's resource, Real-Time Interactions. I'm rather pleased with it. I should really explain it in better detail, but I'm pretty damned tired by this point, so herehttp://www.youtube.com/watch?v=Si_1ZJCCRfU are some

http://www.youtube.com/watch?v=Hn-FIGDikrk videos.

 

Here is the Readme.

 

MODDERS RESOURCE: Real-time Interactions

Version: 0.9

Requirements: OBSE, MenuQue

Author: PrettyMurky

 

Description

========================================

The aim of this modder's resource is to do away with as much 'frozen time' menumode, Oblivion as possible, bringing the content in real-time play, as well as effecting new, previously impractical, content into real-time play.

It can be used to avoid compatibility issues, as an alternative to adding script to objects.

It is a controller to interface between a UI, and the script functions of any 'plugged-in' mods.

Basically: This mod handles all the button presses & displaying the HUD, calling the appropriate script from your mod when neccessary.

 

This demonstration version also contains:

Part of my Persuasion Overhaul. Which I plan to finish and release soon.

The alpha of an Alchemy Overhaul. As above. (included as a separate plugin).

A basically working weapon selection system. Which I may expand upon, unless someone else wishes to take it over.

Options for Training a skill with an NPC, repairing your items, or recharging your items. These don't have any functionality, and are included only to demonstrate some of the many possibilites this mod allows.

 

Details

========================================

There are three states of operation:

Firstly, Object-targeted interactions, such as interaction with a mortar & pestle.

Secondly, Engaging with NPCs.

Finally, Non-target options. Such as the weapon selection demonstration.

 

Controls are fully configurable, but as default:

F4 - Initiate and activate interactions.

F3 - Cancel. Hold for over 3 seconds for force cancel.

F1,2 - Select between applicable plugins & within current plugin if active.

Mousewheel - Change selection within plugin

shift, control - modifier keys

It should make more sense when actually using it...

 

To plug-in your own mod, all you need is a correctly named and located ini file, containing the FormIDs of the various functions in your mod. More details in the documentation.

 

Future Versions

========================================

This version basically works as-is, however I'm sure there'll be a few little things to modify here and there, and I've got a few ideas for other features to add as well. The more feedback I recieve, the better it should be!

I also plan to make the documentation clearer and more thorough, but again this relies on YOUR feedback!

Needless to say, I have plans to make use of this mod for myself as well. I intend to finish Alchemy Overhaul, port the rest of my Gamemode Persuasion mod into RTI, and convert Skooma Deals to RTI.

 

Install & Uninstall

========================================

Copy the files into your Oblivion\Data folder. To uninstall, simply delete them.

 

 

Compatability

========================================

I don't think that this should clash with anything. The only issue would be with including it, or any plugins, in a bashed patch. However it wouldn't be much effort to combine plugins through other methods, so it hopefully won't be an issue.

 

Thanks to

========================================

TheNiceOne, without whose code to learn from, I'd still be trying to work out how to do most of this.

The Nexus forum community, especially FG109, for quickly solving numerous issues.

Bethesda, for making such a fine game in the first place.

Kyoma, the maker of MenuQue; without which, this wouldn't be possible.

The OBSE team, codings gods to us mere modding mortals.

 

Permissions

========================================

I intend to continue working on this for the immeadiate future, but if you wish to offer any help or suggestions, please do so. Feel free to make/request any translations desired.

 

Legal

========================================

I stand under common law.

 

 

And here is the Modder's Guide

 

PrettyMurky's Real-time Interactions

===================================

Modder's Guide

 

 

 

How Real-Time Interactions works:

---------------------------------

 

Upon initialisation, RTI checks for all installed mods, 'modname.esp', to see if there is a file 'ModName.ini' in the 'data\ini\RTIPlugins' folder. If there is, it runs it, and in doing so learns the IDs of the various functions in each plugin.

 

After this, it lays dormant, checking only for presses of the activate key(F4). If the key is pressed, then if the player has an object in their crosshairs (Doesn't have to be an activatable object, anything that is within the pick-up range will count(come to think of it, I need to add checks for if telekenisis is active...)) it will run through the 'check eligability' functions of the 'Object-targeted' plugins. Eg. 'FnCheckElig'in the Alchemy Overhaul checks to see if the object is a mortar and pestle. If F4 is pressed and no object is in the crosshairs, it checks the 'Non-Target Options', such as the 'Weapon selector' or 'Use Soul Gems'.

 

With the first appropriate option now displayed on the HUD, the player can either press F1 or F2, to switch to other eligable options(eg. from 'weapons selector' to 'Use Soul Gems'); use the mousewheel to change options within an option (eg. switching between weapons in the selector); Press F4 to activate the selected option; or press F3 to cancel. At this stage, the F1, F2, & F3 results are all handled by RTI, however for the rest, RTI call the appropriate function in that plugin's esp.

 

for some mods this is all that is needed, however if greater control is required, then control of the other buttons can be passed onto the plugins as well. In the case of the Alchemy Overhaul; initially upon targeting a mortar & pestle, the player is presented with the option 'Alchemy' pressing F4 again puts that plugin in control, and then the functions for F1, F2, & F3 are also controlled by that plugin. However even in these cases, holding F3 for over 3 seconds will cancel out of it.

 

A special form of the Object-targeted interactions are the Engaging NPCs options. These are supposed to be activites that require the NPCs attention. To enter this mode, either target an NPC and select the [Engage] option, or enter into normal dialogue and select the option there. In engage mode, the NPC will stay standing where they are, turning to face the player where they move. Moving too far away from the NPC, or entering combat etc. will cancel Engage mode.

 

 

How your mod works with RTI

---------------------------

 

I've tried to make the process as uncomplicated as I can, to enable as much complexity in your plugins as possible. Basically you will need:

 

- A Check Eligability function - To see whether your plugin is appropriate for a given object or occasion.

 

- A quest script to declare variables, most importantly:

 

- A HUD info array - where you declare what you want displayed in the HUD.

 

These are the only essentials, however without anything else, your plugin wont be able to do anything functional. So you'll probably also have:

 

- An Activate function - For when your option is both eligable and displayed, and the player... activates it.

 

For more control you can have:

 

- MouseWheelUp Function - & / or

- MouseWheelDown Function - If, such as with the 'Wait here/Follow me' option, you have only two choices; both keys can be assigned to the same function for simplicity.

 

If neccesary, as discussed earlier, you can also handle:

 

- F1 press functions -

- F2 press functions -

 

For when you want the controls, apart from cancel, frozen temporarily (such as when the option to 'Follow Me' has be activated, and the NPC is 'deciding' whether to accept), you can put RTI into a 'wait mode'. Once the timer runs out, then your:

 

- Wait Over function - will be called.

 

You also have the option to handle:

 

- the Cancel function - however if RTI will handle it if none is declared.

 

To save you from having to include any Gamemode DoOnce blocks. You can also declare:

 

- an Initialisation function - Which will be run upon load. This is a good place to set up any variables and arrays needed for your mod.

 

 

The Functions

----------------

 

-FnCheckElig- is a reference function, for Target-Options or NPC engages, it is called on the object/NPC, for Non-target Options it is called on the player. Use 'SetFunctionValue 1' if the object/NPC/etc. is appropriate for your plugin; or 'SetFunctionValue 0' if not. (There are other, more complex options here, that I will come to later).

 

-FnActivate- Also a reference function. It is passed with the short 'Mode', which refers to what 'state' RTI is in at that time. Here, 'SetFunctionValue' is used to tell RTI whether to stay in its current mode or enter a new one. This will be explained in detail shortly.

 

-FnKey1,FnKey2- The functions mapped to F1 & F2 respectivly. As above, are reference scripts, passed with 'Mode', and SetFunctionValue passes on the desired new mode.

 

-FnKeyA,FnKeyB- MouseWheels up and down. As above.

 

-FnKeyX- The cancel key. This is not run on a reference, but is passed with 'Mode'. It is also passed with a second variable 'Quit', which is set to 1 when your plugin is being canceled (either through the player force-cancelling, or selecting a new target). This is so you can reset your HUD array or any variables if neccessary. If 'quit' is 0, then your SetFunctionValue will, as before, dictate the desired 'mode'.

 

-FnWaitOver- Reference script, but passed with no variables. SetFunctionValue the desired new mode.

 

-FnInit- The script run on initialisation. Not run on a reference, passed with no variables, with no SetFunctionValue required.

 

 

The 'Mode's

-------------

 

Mode 0 - When RTI is only listening out for F4 presses and nothing else.

 

'Object-Targeted'

Mode 1 - When an object has atleast one eligable option, but RTI still retains control of the F1 & F2 keys. Such as when 'alchemy' is displayed for the mortar & pestle.

Mode 2 - When a plugin has taken control of the extra keys. Such as when 'Alchemy' is selected, and F1 and F2 are used to add & switch between extra ingredients.

Mode 3 - The 'Wait Mode' for 'Object targeted'.

 

'NPC Engages'

Mode 4 - When an NPC has atleast one eligable option, but RTI still retains control of the F1 & F2 keys. Such as when 'Wait here' is displayed, but F1 could be pressed to switch to 'Train Skill', if the NPC offers that service.

Mode 5 - When a plugin has taken control of the extra keys.

Mode 6 - The 'Wait Mode' for 'NPC Engages'.

 

'Non-Target Options'

Mode 7 - RTI retains control of the F1 & F2 keys.

Mode 8 - Plugin takes control of the extra keys.

Mode 9 - The 'Wait Mode' for 'Non-target Options'.

 

When sending RTI into a 'Wait mode', you will also need to include the line 'RunScriptLine "set pm0.WaitTime to X"' Where X is the number of seconds you want it to wait before calling your 'FnWaitOver'.

 

Your HUD array

---------------

 

This is where RTI checks when it is updating the HUD, and so it is where you need to put what you want displayed. You can use the 'FnInit' to declare it, which might look something like this:

 

let YourQuest.YourArray := ar_construct Array

let YourQuest.YourArray [0] := ar_construct StringMap

let YourQuest.YourArray [0] ["Text"] := "Stuff"

let YourQuest.YourArray [1] := ar_construct StringMap

let YourQuest.YourArray [1] ["Text"] := "Things

...

For as many different text lines as you want. You can also use:

let YourQuest.YourArray [n] ["x"] & ["y"] to change the position of the text on the screen. From 0 to 100 in each dimension.

 

let YourQuest.YourArray [n] ["Red"] &/or ["Green"],["Blue"] to set the desired colour of the text. If only "red" is used, then "green" and "blue" are taken as the same value, resulting in black with value of 0; white with 255; and grey in between.

 

let YourQuest.YourArray [0] ["NotNeedTarget"] Set to 1 if you want this HUD element to display even when the target object is not currently in the crosshairs. Only relevent for Modes 1 to 6.

 

When you change anything in the HUD, you need to let RTI know so it can update it accordingly. This is done through the line 'RunScriptLine "set pm0.HUDUpdate to X"' Where X is '1' to just update the text, '2' to update text and position, '3' for text and colours, and '4' for everything.

 

 

Your ini file

--------------

 

Finally, so that RTI know about your mod, you need an ini file. The name MUST match the name of the esp, so that YourMod.esp, has an ini file called YourMod.ini, and it must be stored in 'data\ini\RTIPlugins'. For each 'option' that you wish to present, you will need a block of code like this:

 

set pm0init.FnCheckElig to sv_construct "000ED6"

set pm0init.FnActivate to sv_construct "000ED5"

set pm0init.FnKey1 to sv_construct "000ED7"

set pm0init.FnKey2 to sv_construct "000ED8"

set pm0init.FnKeyA to sv_construct "000ED9"

set pm0init.FnKeyB to sv_construct "000EDA"

set pm0init.FnKeyX to sv_construct "000EDB"

set pm0init.FnInit to sv_construct "000EDC"

set pm0init.FnWaitOver ...

set pm0init.AutoRun to 1 Only include this for Object-targeted options, if you want them to bypass the HUD & run the Fnactivate block straight away when this is the only option for a targeted object.

set ServDial to 1 or 2 If this is an NPC Engage; 1 if this is a 'service' that the NPC offers, 2 if this is a 'dialogue' option. Worry about this more later...

set pm0init.HUD to sv_construct"YourQuest.HUDinfo"

SetStage pm0init 10/20/30 for Object-Target/NPC engage/Non-target.

 

See accompanying image for details on where to get the FormIDs

You can have as many 'options' in one esp/ini as you like.

 

 

-------------------------------------

 

 

I think that's about it. Or atleast as much as I can remember as being relevent for now. With time, and your feedback, we'll hopefully iron out any ambiguities. In the mean time, feel free to ask any and all questions, either through the forums, or the comments section of this file on TESNexus.

 

The best advice I could give would be to look at the scripts in pmAlchemyOverhaul.esp, to get a feel of what is going on when.

 

 

Now I badly need some sleep, but will be bang on this again once I wake up!

Link to comment
Share on other sites

Thanks!

 

But until we get some mods to use it, it is just a fancy HUD display. For people who don't know how to script; try and suggest things it could be used for. But you sir! Mr fg109 do not have that excuse! I've seen your prompt and bang-to-the-point answers for all the modding questions people post here, you can't claim you don't know how to script :P I'd like to see some of your skills in action; you can't claim you don't have the time either, as RTI does most of the lug-work for you, leaving you to deal with just the basic logic of what it is you want to do!

Link to comment
Share on other sites

Code for Bencebence's mining script:

 

First you'll need a quest in which to define a variable. It can be a pre-existing one of yours, or one you make just for this. Either way, in YourQuest you need to declare 'array_var VeinHealth'.

 

Next you'll need a FnCheckElig,

scn MiningCheckElig

 

Begin Function { }

 

if GetBaseObject == <BaseID of your ore>

if <player has pickaxe equipped>

SetFunctionValue 1

Return

endif

endif

 

SetFunctionValue 0

 

End

a FnActivate,

scn MiningActivate

 

short Mode

 

Begin Function { Mode }

 

<make the player swing the pickaxe(play the attack animation)>

RunScriptLine "set pm0.WaitTime to <time in seconds the pickaxe swing takes>"

SetFunctionValue 3

 

End

and a FnWaitOver.

scn MiningWaitOver

 

short Health

ref tempref

string_var StrA

 

Begin Function { }

 

if GetSelf == GetCrosshairRef

set tempref to GetSelf

set StrA to sv_construct "%i" tempref

sv_erase StrA 0 2

if eval ( ar_size <YourQuest>.VeinArray ) < 0

let <YourQuest>.VeinArray := ar_construct StringMap

endif

if eval ( ar_HasKey <YourQuest>.VeinArray $StrA )

let Health := <YourQuest>.VeinArray [$StrA]

else

set Health to <Whatever you want the starting health to be>

endif

 

<Do whatever processing you want to do to the vein's health now that the player has hit it>

 

let <YourQuest>.VeinArray [$StrA] := Health

endif

 

SetFunctionValue 0

 

End

 

You'll also need to make an ini file,

set pm0init.FnCheckElig to sv_construct "<FunctionID>"

set pm0init.FnWaitOver to sv_construct "<FunctionID>"

set pm0init.FnActivate to sv_construct "<FunctionID>"

set pm0init.AutoRun to 1

SetStage pm0init 10

with the name <YourModName>.ini and save it in the folder 'data\ini\RTIPlugins'. For help finding the FunctionIDs, look at the image found on Nexus or in the download of RTI.

 

Finally you'll need to download and install Real-Time Interactions, and that should be pretty much it!

Edited by PrettyMurky
Link to comment
Share on other sites

Thanks!

 

But until we get some mods to use it, it is just a fancy HUD display. For people who don't know how to script; try and suggest things it could be used for. But you sir! Mr fg109 do not have that excuse! I've seen your prompt and bang-to-the-point answers for all the modding questions people post here, you can't claim you don't know how to script :P I'd like to see some of your skills in action; you can't claim you don't have the time either, as RTI does most of the lug-work for you, leaving you to deal with just the basic logic of what it is you want to do!

 

I'm actually working on another mod right now, but I will be sure to take a closer look once I have the time. From looking at the post with the example you made for bencebence, it looks really easy to use. :biggrin:

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...