Difference between revisions of "Combine your SI and non-SI mods into one (OBSE, Patch v1.1, Other mods too)"
imported>Haama (→Using the test: What you can do with this) |
imported>Haama (Clarification) |
||
Line 1: | Line 1: | ||
It is possible to make a single mod for both users with Shivering Isles and without. Likewise, it's possible to make a single mod for OBSE/non-OBSE users, Patch v1.2/v1.1 users, and even specific mods (i.e., the user has Supreme Magicka installed or doesn't). Generally, if you needed multiple mods only because you needed multiple scripts you can combine them into one with these tests (more than scripts may be possible, I simply don't know and haven't tried--[[User:Haama|Haama]] 15:41, 12 January 2008 (EST)). This is an advanced script and assumes you know quite a bit about scripting already, so some of the smaller details are left out. | It is possible to make a single mod for both users with Shivering Isles and without. Likewise, it's possible to make a single mod for OBSE/non-OBSE users, Patch v1.2/v1.1 users, and even specific mods (i.e., the user has Supreme Magicka installed or doesn't). Generally, if you needed multiple mods only because you needed multiple scripts you can combine them into one with these tests (more than scripts may be possible, I simply don't know and haven't tried--[[User:Haama|Haama]] 15:41, 12 January 2008 (EST)). This is an advanced script and assumes you know quite a bit about scripting already, so some of the smaller details are left out. | ||
Each test has the same setup - When you need to tell what the player has installed, call up a Result Script (i.e., SetStage SITester 0). If the Installed variable on that quest script is 1, then the player has installed it. Otherwise, it will | Each test has the same setup - When you need to tell what the player has installed, call up a Result Script (i.e., SetStage SITester 0). If the Installed variable on that quest script is true (1), then the player has installed it. Otherwise, it will be false (0). Use the returned Installed value to determine if you need to run a piece of script (or a separate script altogether). | ||
Each test works a little bit differently, so they have been separated. For each, the test setup/coding is given first and then the explanation of how it works. Finally, there are some General Notes on what you can and can't do with each test. | Each test works a little bit differently, so they have been separated. For each, the test setup/coding is given first and then the explanation of how it works. Finally, there are some General Notes on what you can and can't do with each test. |
Revision as of 18:29, 12 January 2008
It is possible to make a single mod for both users with Shivering Isles and without. Likewise, it's possible to make a single mod for OBSE/non-OBSE users, Patch v1.2/v1.1 users, and even specific mods (i.e., the user has Supreme Magicka installed or doesn't). Generally, if you needed multiple mods only because you needed multiple scripts you can combine them into one with these tests (more than scripts may be possible, I simply don't know and haven't tried--Haama 15:41, 12 January 2008 (EST)). This is an advanced script and assumes you know quite a bit about scripting already, so some of the smaller details are left out.
Each test has the same setup - When you need to tell what the player has installed, call up a Result Script (i.e., SetStage SITester 0). If the Installed variable on that quest script is true (1), then the player has installed it. Otherwise, it will be false (0). Use the returned Installed value to determine if you need to run a piece of script (or a separate script altogether).
Each test works a little bit differently, so they have been separated. For each, the test setup/coding is given first and then the explanation of how it works. Finally, there are some General Notes on what you can and can't do with each test.
How to tell if the player is using OBSE
Test
Make sure you are using the Construction Set with OBSE loaded. Keep it loaded while you work on the mod! This test will ensure the player has the correct version of OBSE installed, if necessary.
First, create a quest (cobOBSETester in this case). Set it to Allow Repeated Stages and uncheck Start Game Enabled. Attach a script with these 3 variables to it
short Installed short ReqVersion short Version
Next create the stage (Stage 0, in this case) and add this Result script
set cobOBSETester.Installed to 0 set cobOBSETester.Version to GetOBSEVersion if (cobOBSETester.Version >= cobOBSETester.ReqVersion) set cobOBSETester.Installed to 1 endif ;Reset variables set cobOBSETester.Version to 0 set cobOBSETester.ReqVersion to 0
How it works
When Oblivion comes across a function it doesn't recognize, that function acts as a return. If the player doesn't have OBSE installed, the script stops at the second line and cobOBSETester.Installed remains at 0. This is followed by another test to make sure the player has a high enough version (ReqVersion) of OBSE installed, and if they do, sets Installed to 1.
Using the test
Each time you need to test for OBSE, use this snippet
set cobOBSETester.ReqVersion to 12 SetStage cobOBSETester 0 if (cobOBSETester.Installed) CopyAllEffectItems pPotion pSpell ;OBSE part of the script cobAlsEffectsDeterminerRef.Activate player, 1 ;or run a separate script else set bRunSorter to 1 ;Non-OBSE part of the script endif
Make sure OBSE functions are kept in the OBSE part of the script (or on another script), and that they will only run if Installed returns true.
How to tell if the player is using SI
This one works a little differently. Set up the quest as before, but you only need the 'Installed' variable. Here's the Result script [code]player.GetIsID SE02BoneArrow1 set cobSITester.Installed to 1[/code] Each time you need to test for SI, use this snippet
set cobSITester.Installed to 0 SetStage cobSITester 0 if cobSITester.Installed cobSIEffects.Activate player, 1;Code if SI is installed - if you're using any EditorIDs from SI, make sure to keep them on a separate script endif
How it works - Whenever a script uses a FormID that isn't loaded, Oblivion will ignore the entire script in-game. So, Installed must be set to 0 by the real script first, then the Test script will set Installed to 1 if the player has SI installed. This has been tested, and I'm sure that Oblivion will use the script once SI has been installed, even if the Test script attempted to run in an earlier save. There might be a better way to go around it - maybe
set cobSITester.Installed to 1 return player.GetIsID SE02BoneArrow1
would be a bit faster, maybe there are other things to test (however, any FormID, whether Quest, Magic Effect, etc. will cause the script to basically fail to compile, so I'm not sure what test would be truly different).
Again, Oblivion will ignore the script if it includes a SI EditorID - so keep your SI EditorIDs on a separate script. If it needs to happen at that exact line of the script, you can use either a Persistent Object/Activator with an onActivate block, or a Result script. onActivate blocks have a nesting limit, and only 4-5 can be called from one another. Result scripts don't have a limit (or, at least it's >250), but are Non-reference scripts and have a very small characters limit.
How to tell if the player is using the v1.2 Patch
(I have not tested this one (I don't have a way to short of re-installing Oblivion), but extrapolating from the OBSE test...--Haama 14:31, 5 December 2007 (EST))
Quest - just the 'Installed' variable. Result script
set cobPatchTester.Installed to 0 GetPlayerInSEWorld set cobPatchTester.Installed to 1
How it works - As with the OBSE tester, an unknown function acts as a return statement. If the player doesn't have the v1.2 patch installed, the script will stop on the second line and Installed will remain 0. Otherwise, it will be 1.
Each time you need to test for OBSE, use this snippet
SetStage cobPatchTester 0 if (cobPatchTester .Installed) cobAlsEffectsDeterminerRef.Activate player, 1;OBSE script, or you could have some code in this section else set bRunSorter to 1;Non-OBSE part of the script endif
How to tell if the player is using a particular Mod
(Credit to Opaj for the idea) This one is a bit odd and requires more work. However, it gets rid of the need for dependcies and false-Mastering so it's worth it. This requires the latest OBSE.
Set up a quest (cobOtherModsTest in this case) with 'Start Game Enabled'. Attach this script to it
begin GameMode if GetGameRestarted set Installed to -10 RunBatchScript "TamrIngTest.txt" endif end
Create the text file mentioned above, and put it in the Oblivion directory (not Data, just Oblivion), open it, add the line
set cobOtherModsTest.Installed to TamrIngTest.Installed
How it works - RunBatchScript will run the line from the text file as if it were used in the console. If the mod is installed (and has the quest installed, more on that later) Installed will be set to TamrIngTest.Installed, if it isn't it will remain at -10.
Here's where it gets a bit weird - first, you need to make sure the quest variable in the second mod is set to a number other than -10. Hopefully there will be some Init variable that you could use. Second, it would help to have a quest too! If there isn't one, you could ask the author to include one.
Suggestions?
A better solution would be to use an item from the second mod and grab a non-zero value from it. However, EditorIDs can't be used from the console, so I'm not sure how to make this work. Another possibility would be globals, but I haven't tried them, and I don't think they would be any better.
General notes
This can only be used for scripting purposes. You still can't take an item from another mod/SI into a container in yours directly - you'd have to add the item via script.
Remember that when a script uses a EditorID (including spells, quests) of something that doesn't exist when Oblivion is loaded, the entire script will be ignored. Therefore, keep any SI and other mod EditorIDs in a separate script (persistent Activator or Result script would be good).
Remember that when a script uses a function that isn't recognized by Oblivion, it acts as a return. Make sure all of your OBSE and Patch v1.2 functions occur after the test.