[RELz] Oblivion Script Extender (OBSE) 0019b

Post » Wed Sep 01, 2010 1:48 pm

While we are on the subject of animations, a godsend would be something like 'playidle idle designation' to supplement 'pickidle'. Much of the time, a lot of messing about has to be performed just to get pickidle to select the idle you know you want picked. Being able to name an idle that shall be played would save a lot of grief!
User avatar
Mason Nevitt
 
Posts: 3346
Joined: Fri May 11, 2007 8:49 pm

Post » Wed Sep 01, 2010 9:34 pm

While we are on the subject of animations, a godsend would be something like 'playidle idle designation' to supplement 'pickidle'. Much of the time, I lot of messing about has to be performed just to get pickidle to select the idle you know you want picked. Being able to name an idle that shall be played would save a lot of grief!

Congratulations, shademe recently added a PlayIdle command which should do exactly what you want. It'll be present in 0020.
Well, the engine already changes the speed of animations for the normal attack animations, based on the speed of the weapon that is equipped by the actor.

Right. I'll see if I can track down the code that does that.
Basically I'm looking to have the various doors at the city gates moved out of the way so they won't snap back into position when someone reloads the game. My specific purpose for it may be a bit narrow, but it seems like it would be useful in general since I can't be the only one who wants to move persistent objects out of the way without risking those moves becoming permanent.

The game's engine has a bug where removing the persistent flag and setting it to "initially disabled" via the CS won't stick if the game is reloaded without dropping all the way to the desktop first. So I'd want to use the new command to handle moving those doors when a game is restarted/reloaded instead of relying on the flaky method in place now.

If it's not feasible then I can try and work something out where the model data is swapped out for something the player can just pass through without incident.

Thanks, that helps.
I tried to load several savegames in Oblivion, after a two week hiatus. Except for an old savegame (from back when my character was new) the game crashes early into the savegame load. I removed several mods I had updated between playing sessions but that didn't seem to work. I opened up my obse.log file and noticed the following sequence, whenever I attempted to load one of the affected savegames:

loading from C:\Users\Jim's Account\Documents\My Games\Oblivion\Saves\Streamsave_2.obse
Reading mod list from co-save
Loading strings
Loading array variables
plugin has data in save file but no handler
plugin has data in save file but no handler
plugin has data in save file but no handler
OBSE: deinitialize

Is there a way to get OBSE to identify the plugin which left data in my save, but has no 'handler'?

What changed during your hiatus (did you upgrade OBSE, add/remove mods or plugins, etc)?
If you disable your OBSE plugins do the savegames load?
If problems persist, shoot me a PM with the full contents of obse.log after a crash.
User avatar
katsomaya Sanchez
 
Posts: 3368
Joined: Tue Jun 13, 2006 5:03 am

Post » Wed Sep 01, 2010 2:36 pm

Congratulations, shademe recently added a PlayIdle command which should do exactly what you want. It'll be present in 0020.


Wow that's awesome! I am cheering right here, that is also a function I will totally love!

Right. I'll see if I can track down the code that does that.


Great, you guys are the best!
User avatar
P PoLlo
 
Posts: 3408
Joined: Wed Oct 31, 2007 10:05 am

Post » Wed Sep 01, 2010 3:16 pm

Could an event be added to trigger when a form is first loaded, and more importantly, would it be able to catch everything assuming I set it up in the main menu? Something like:

OnFormLoad formType:int object:form

e.g.:
ScN FilterRegistrationint donebegin MenuModeif (GetGameRestarted) || (GetGameLoaded)  let done := 0endifif eval !(done)  SetEventHandler "OnFormLoad" fnSpellsAlwaysixplode ref::16endif-----ScN fnSpellsAlwaysixplodeint typeref spellbegin function {type, spell}  SetSpellExplodesWithNoTarget 1 spellend

User avatar
Josh Dagreat
 
Posts: 3438
Joined: Fri Oct 19, 2007 3:07 am

Post » Wed Sep 01, 2010 8:59 pm

Could an event be added to trigger when a form of a certain type is first loaded, and more importantly, would it be able to catch everything assuming I set it up in the main menu? Something like:

It *could* be. I'm not thrilled about the idea of hooking the loading of every form in the game, though, for both performance and logistical reasons.
Keep in mind that *all* base forms (aside from cloned/dynamic base forms) are loaded by the time the title menu is displayed, and remain in memory for the duration of the game session; and further, that during form loading the game isn't yet in a state to execute scripts. So an event handler wouldn't really be necessary or practical.
From your sample code it looks like you want to be able to apply certain changes to all spells in the game. Is that about right? Any further details?

Aside: does anybody know what language the magic syntax highlighting is trying to conform to? Javascript? Is that useful at all?
EDIT: Apparently you can specify the language in the code tag. Doubt they have one for Oblivion scripting though. /Aside
User avatar
Francesca
 
Posts: 3485
Joined: Thu Jun 22, 2006 5:26 pm

Post » Wed Sep 01, 2010 8:49 pm

Congratulations, shademe recently added a PlayIdle command which should do exactly what you want. It'll be present in 0020.

Best news I've had in a long while. Thank you all very much!
User avatar
Anna Watts
 
Posts: 3476
Joined: Sat Jun 17, 2006 8:31 pm

Post » Wed Sep 01, 2010 12:09 pm

Aside: does anybody know what language the magic syntax highlighting is trying to conform to? Javascript? Is that useful at all?
EDIT: Apparently you can specify the language in the code tag. Doubt they have one for Oblivion scripting though. /Aside


Not sure, but Unix shell scripts have "done" as a keyword. I'll have to grab a Bash script and see what it does with it! Oh, and in this context, Bash stands for Bourne Again Shell, which is a Unix shell scripting language :)

Edit: Actually I just saw in another post that "self" was highlighted as a keyword, so now I'm thinking PHP or javascript, with PHP being a little more likely.
User avatar
FABIAN RUIZ
 
Posts: 3495
Joined: Mon Oct 15, 2007 11:13 am

Post » Wed Sep 01, 2010 5:23 pm

It *could* be. I'm not thrilled about the idea of hooking the loading of every form in the game, though, for both performance and logistical reasons.
Keep in mind that *all* base forms (aside from cloned/dynamic base forms) are loaded by the time the title menu is displayed, and remain in memory for the duration of the game session; and further, that during form loading the game isn't yet in a state to execute scripts. So an event handler wouldn't really be necessary or practical.
From your sample code it looks like you want to be able to apply certain changes to all spells in the game. Is that about right? Any further details?

Does it have to be a hook on form load, per se? Perhaps a one-time cycle through forms in the data handler, some time during the first pre-loadgame event? Since mod-added base forms are loaded only once, it should amount to the same thing. Created base forms stored in savegames would still need to be processed after every savegame load, but there are far fewer of those.

I'd love to have this myself, because it allows a script to do things traditionally reserved to WryeBash (e.g. reweigh potions, rename spells, rebalance armor, etc.). But I don't know how long it actually takes to run a function script a few thousand times; perhaps this just isn't a task the scripting engine can handle.
User avatar
Lisha Boo
 
Posts: 3378
Joined: Fri Aug 18, 2006 2:56 pm

Post » Wed Sep 01, 2010 5:14 pm

Not sure if this has ever been asked before and I am new to OBSE dev...

how do I control the player's camera or any other object with a quaternion and a position? Not sure what function I should use or if this is possible. SetAngle etc looks like a gimbal lock waiting to happen...

Here is what I am trying to do: I am a virtual reality developer and I would like to develop a virtual reality version of Oblivion that can be played in a head mounted display along with a 6 degree of freedom tracking system. This will enable you to view the game by physically looking around and swing your sword by swinging a physical object around. Kinda like Wii in a tracked head mounted display... Essentially, the tracking system reports data in the form of a quaternion and a position that describes what the head or the 'sword' is doing. I would like to hook in a networking client (VRPN) into OBSE source so that Oblivion can talk to my tracking system (e.g., optitrack from naturalpoint.com) through script and create a function like a 'GetHeadRotation' which would return a 4 vector - a quaternion... I believe this is possible but I'm not sure how to constantly update the actual camera's modelview matrix.
User avatar
Charlotte Lloyd-Jones
 
Posts: 3345
Joined: Fri Jun 30, 2006 4:53 pm

Post » Wed Sep 01, 2010 5:27 pm

The http://cs.elderscrolls.com/constwiki/index.php/Algohol OBSE plugin has functions to calculate with quaternions. I am pretty confident you can evade the gimbal lock with those functions, it's one of the reasons why it was created, if I recall correctly.

I myself am creating a combat system that makes use of a scripted invisible sword dummy that accompanies the real sword in it's movement. It has an OnTrigger block to detect a hit with the sword, after which damage is applied. I use the quaternion data of the weapon-bone in the attack animations of every interval of 0.033 seconds, to make sure this dummy sword's position and movement is correct.

I wonder how you are going to handle the animations though. As far as I am aware, animations in Oblivion are always completely static, while yours should be dynamic and dependant on the movement of the physical sword object/controller. There is an AnimGroup called DynamicIdle, but I have no idea what that exactly means or how they work.
User avatar
Stacyia
 
Posts: 3361
Joined: Mon Jul 24, 2006 12:48 am

Post » Wed Sep 01, 2010 3:26 pm

The http://cs.elderscrolls.com/constwiki/index.php/Algohol OBSE plugin has functions to calculate with quaternions. I am pretty confident you can evade the gimbal lock with those functions, it's one of the reasons why it was created, if I recall correctly.


Thanks. I'll check out Algohol for quaternions. But I mainly need to know how to freely control the camera independently of the mouse/keyboard.
User avatar
Ally Chimienti
 
Posts: 3409
Joined: Fri Jan 19, 2007 6:53 am

Post » Wed Sep 01, 2010 4:53 pm

Thanks. I'll check out Algohol for quaternions. But I mainly need to know how to freely control the camera independently of the mouse/keyboard.


With the current tools, going into FPS mode and SetAngle x and SetAngle z are the only options. SetAngle x can break through the -89/89 degrees limit, all the way around. But SetAngle y won't do anything IIRC, because actors can't rotate along the y-angle.

Make a script run every frame, and let it convert the quaternion from the device to euler angles (requires Algohol). Player must be in first person mode, and this only works for the x and z angle. I copied this almost straight from my script, so it works:

float xAngle
float zAngle
float yAngle

float wQuat
float xQuat
float zQuat
float yQuat

Begin GameMode

;store your quaternion data from the device in the Quat floats

QToEuler "xAngle" "yAngle" "zAngle" wQuat xQuat yQuat zQuat

Player.SetAngle y, yAngle ;This one won't have any effect sadly
Player.SetAngle x, xAngle
Player.SetAngle z, zAngle
end
User avatar
Eibe Novy
 
Posts: 3510
Joined: Fri Apr 27, 2007 1:32 am

Post » Wed Sep 01, 2010 7:13 pm

Hmm... a random thought that I probably won't personally put into use any time soon, but could allow for far better NPC use of scripted effects: would it be possible to write functions that "teach" the AI how scripted items/spells work? For example, in Magickal Arsenal, Orbs improved the power of spells through a scripted effect, which means that NPCs who were intending to use magic should equip them. I could check their Combat Style and/or relevant stats to try to guess how likely they were to use magic, but it would be a lot better if there was a way to indicate to the AI that this weapon is good for use with magic. And since that's almost certainly impossible, seeing as nothing similar exists in the game at all, would it be possible, say, to get the AI to treat them as ranged weapons? Usually spellcasting is a ranged attack option, which means Orbs should be considered ranged weapons - but because they're one-handed I can't classify them as bows to indicate this.

This could also apply, say, to throwing weapons mods or gun mods or similar. Is anything along these lines possible?
User avatar
phillip crookes
 
Posts: 3420
Joined: Wed Jun 27, 2007 1:39 pm

Post » Wed Sep 01, 2010 11:29 am

With the current tools, going into FPS mode and SetAngle x and SetAngle z are the only options. SetAngle x can break through the -89/89 degrees limit, all the way around. But SetAngle y won't do anything IIRC, because actors can't rotate along the y-angle.

Make a script run every frame, and let it convert the quaternion from the device to euler angles (requires Algohol). Player must be in first person mode, and this only works for the x and z angle. I copied this almost straight from my script, so it works:

float xAngle
float zAngle
float yAngle

float wQuat
float xQuat
float zQuat
float yQuat

Begin GameMode

;store your quaternion data from the device in the Quat floats

QToEuler "xAngle" "yAngle" "zAngle" wQuat xQuat yQuat zQuat

Player.SetAngle y, yAngle ;This one won't have any effect sadly
Player.SetAngle x, xAngle
Player.SetAngle z, zAngle
end


Thanks! That is what I was looking for although it's annoying that we cant have any roll. Is there a way to disconnect the camera from the player actor?
User avatar
Setal Vara
 
Posts: 3390
Joined: Thu Nov 16, 2006 1:24 pm

Post » Thu Sep 02, 2010 12:26 am

Thanks! That is what I was looking for although it's annoying that we cant have any roll. Is there a way to disconnect the camera from the player actor?



Hmm yes, the command TFC (Toggle Free Camera). Though the camera doesn't have a reference as far as I know, so you can't address the camera with SetAngle. The keyboard/mouse control won't let you roll in free camera mode either.

Your best bet would probably be a request to the OBSE team to be able to address the camera with the SetAngle commands, with a working y-angle.

I am still curious how you will tackle animations, or will you have none?
User avatar
Chris Jones
 
Posts: 3435
Joined: Wed May 09, 2007 3:11 am

Post » Wed Sep 01, 2010 1:47 pm

Hmm yes, the command TFC (Toggle Free Camera). Though the camera doesn't have a reference as far as I know, so you can't address the camera with SetAngle. The keyboard/mouse control won't let you roll in free camera mode either.

Your best bet would probably be a request to the OBSE team to be able to address the camera with the SetAngle commands, with a working y-angle.

I am still curious how you will tackle animations, or will you have none?


heh, I'll worry about animations after I actually get tbe tracking to work inside Oblivion.
User avatar
Ellie English
 
Posts: 3457
Joined: Tue Jul 11, 2006 4:47 pm

Post » Wed Sep 01, 2010 10:15 am

Right. I'll see if I can track down the code that does that.

Out of curiosity, what tools do you use for this sort of reverse-engineering?
User avatar
sw1ss
 
Posts: 3461
Joined: Wed Nov 28, 2007 8:02 pm

Post » Wed Sep 01, 2010 7:35 pm

Another, less crazy, and more immediately useful idea: Oblivion must have some way of reading BSA files, yes? Scruggs, would it be possible to expose that to OBSE plugins? I'm having a lot of issues with the BSA reading code that I found (it was apparently written for the NifTools team by Timeslip many, many years ago), and it dawned on me that one sure-fire way to be able to read any BSA that Oblivion can read would be to call Oblivion's own function for doing so. Plus, I figure I may not be the only plugin author who's interested in the contents of a BSA? Or maybe I am. But still, if this is something you think you could track down and expose relatively easily, that would be awesome.
User avatar
Dorian Cozens
 
Posts: 3398
Joined: Sat May 26, 2007 9:47 am

Post » Wed Sep 01, 2010 10:31 pm

Another, less crazy, and more immediately useful idea: Oblivion must have some way of reading BSA files, yes? Scruggs, would it be possible to expose that to OBSE plugins? I'm having a lot of issues with the BSA reading code that I found (it was apparently written for the NifTools team by Timeslip many, many years ago), and it dawned on me that one sure-fire way to be able to read any BSA that Oblivion can read would be to call Oblivion's own function for doing so. Plus, I figure I may not be the only plugin author who's interested in the contents of a BSA? Or maybe I am. But still, if this is something you think you could track down and expose relatively easily, that would be awesome.

To address your immediate issues with your BSA reading code, consider taking a look at OBMM's. It's pretty robust (I derive from it a bit for CSE's BSA handler) and hasn't given me any issues so far(not that I've done a lot of testing). You should be able tofind anologues of the framework classes it uses in the standard library.
User avatar
Amber Hubbard
 
Posts: 3537
Joined: Tue Dec 05, 2006 6:59 pm

Post » Thu Sep 02, 2010 12:45 am

I remember having one odd problem packing BSA's with OBMM... had to do with filename capitalization. Oblivion is case-sensitive in some places where it shouldn't be. (No further details on my end, just a heads-up.)
User avatar
Matthew Barrows
 
Posts: 3388
Joined: Thu Jun 28, 2007 11:24 pm

Post » Wed Sep 01, 2010 11:42 pm

I remember having one odd problem packing BSA's with OBMM... had to do with filename capitalization.

This is getting a little off topic, but just had to mention this.

I was just a few hours ago perusing the OBMM source and, in the code for the BSACreator form Create button I found this:

Spoiler
foreach(ListViewItem lvi in lvFiles.Items) {    //Not sure why this was here. Cant htink of any reason why I wouldn't want to change the file name to lowercase    //lvi.Text=Path.GetDirectoryName(lvi.Text).ToLower()+"\\"+Path.GetFileName(lvi.Text);    lvi.Text=lvi.Text.ToLower();}


I guess there was a reason, huh.

If this needs fixing in OBMM, it would obviously be trivial to do. Doesn't have a lot to do with the internal format of BSA's though.

PS. If you can't read the code, the second line starting with //, which only converts the directory path to lower case but leaves the file name itself alone has been commented out and replaced with a line which converts the whole directory path + file name to lower case.
User avatar
Bereket Fekadu
 
Posts: 3421
Joined: Thu Jul 12, 2007 10:41 pm

Post » Thu Sep 02, 2010 1:05 am

Well, OBMM is written in C#, which I don't know. Can C++ call C# code?
User avatar
Sweet Blighty
 
Posts: 3423
Joined: Wed Jun 21, 2006 6:39 am

Post » Wed Sep 01, 2010 9:39 am

Ops... Wrong place.
User avatar
James Rhead
 
Posts: 3474
Joined: Sat Jul 14, 2007 7:32 am

Post » Wed Sep 01, 2010 4:26 pm

Well, OBMM is written in C#, which I don't know. Can C++ call C# code?
The code should be portable to native CPP without requiring alot of work, if i recall correctly. To answer your question, yes. But that'll make your code dependent on the .NET framework. The game may behave react weirdly when managd code gets called from its memory space though. Also, the BSA reading code will have go be exposed through a COM interface before it can be accessed by the native code.
User avatar
evelina c
 
Posts: 3377
Joined: Tue Dec 19, 2006 4:28 pm

Post » Wed Sep 01, 2010 9:32 am

So adaptation is the way to go. Oh man, I really don't want to do that. But at least it gives me something I can work on myself, as opposed to hoping that someone out there could do it for me. Without that suggestion, I really would have been dependent on Scruggs or MentalElf or Timeslip...
User avatar
Stacyia
 
Posts: 3361
Joined: Mon Jul 24, 2006 12:48 am

PreviousNext

Return to IV - Oblivion