Jump to content

Grip Changer Revamped


Manus812

Recommended Posts

I recently installed Oblivion onto a new PC and have been remaking and re-editing various mod. Now I want to remake some of my own mods that are in a WIP state. One of them is this: https://forums.nexusmods.com/index.php?/topic/3993345-custom-grip-spell-script/

Please read to understand what it is about. Now, see the man who was trying to help me was quite blunt and rude, and he said that I should simply paste in his script and test it out. However, I cannot get my CS to load up with OBSE, and I can't seem to get it loaded up. Making obse_loader -editor isn't working, so can someone explain to me again?

Once I get OBSE loaded up with CS, i'll test his script and see if it works as intended, if not, I will need help again. It's been about a year since I've done modding so forgive me if I'm a noob again.

Link to comment
Share on other sites

Install the regular plain old vanilla Construction Set v1.2 from here. You will now have a desktop shortcut to the vanilla Construction Set. Right mouse click on that shortcut and select Properties from the right click menu. In the Properties dialogue box that opens you will see a field named Target (it will probably already have the entire path to the CS executable highlighted ... at least that's how it works in WinXP).

 

Single left click in the Target field to remove the highlight and then use the arrow keys to move the cursor insert point to just before the .exe part of the CS executable file name (been so long since I installed the CS I can't say for certain if the file name is ConstructionSet.exe or not ... the part we will be changing is just the file name part, not the file extension part). Once you have the cursor immediately to the left of the dot in .exe backspace over the entire file name but NOT any of the path that precedes the file name (so just the ConstructionSet part of ConstructionSet.exe if that is the correct file name).

 

Next type in obse_loader (so what we have done is replaced the ConstructionSet part of the file name with obse_loader). You will now have a Target field that has the original folder path with obse_loader.exe and then a quote mark (") at the end. Using the arrow keys move the cursor to the very end past the closing quote mark, hit Space for a single space and then type -editor.

 

Your Target field should now have obse_loader.exe" -editor at the last part. Click on Apply and then click on OK ... done.

Edited by Striker879
Link to comment
Share on other sites

If you know the path to your Oblivion installation, you could also maybe try the following or something similar:

start /d "F:\SteamLibrary\steamapps\common\Oblivion\" obse_loader.exe -editor -notimeout

With the path pointing at your Oblivion installation (not mine, hehe :happy: ). That one should work in the command prompt or shell or somesuch, but you can also turn it into a batchfile by opening a text editor, copy-pasting the command into it, and selecting to save it as "somename.bat" (with the extension being .bat for example). You should then be able to run the batchfile to start the editor.

 

The advice by Striker would probably be more straightforward, though, so you should probably try that first. :thumbsup:

 

Edit: Wait! Hmm. Why have I put "start" in it... just a minute... :huh:

 

Edit 2: A-ha. Hmm. So another way to do it would be to navigate to the drive, then the folder, and then run the thing from there (otherwise it will not find ConstructionSet.exe because the command prompt is not in the game folder).

:: go to the correct drive
F:

:: then the game folder
cd SteamLibrary\steamapps\common\Oblivion

:: then run the thing
obse_loader.exe -editor -notimeout

Try the shortcut edit by Striker first, it will also work and will basically just be one small edit in a shortcut. Sorry. :blush:

Edited by Contrathetix
Link to comment
Share on other sites

Alrighty, I got CS working with OBSE. And I tried the final script that man gave me in the previous thread. And it does not work. I paste the script into a new quest script. Save, attach to a quest. Save quest. Save Mod, load up game. Press DownArrowKey, and Nothing. Nothign happens. They said that it should make it switch grips back and forth and unequip a shield as well.

Link to comment
Share on other sites

This script that cfh85 gave doesnt work. And I do not know about scripting, or I forgot most of it. So can anyone help? All relevant info is in the old thread linked in first post

 

Scriptname CFHCGQuestScript

Short KeyDown
Short MyKey
Short WeaponType

Ref OriginalWeapon
Ref Shield

Begin GameMode
Set MyKey to 208
If (IsKeyPressed3 MyKey) && (Keydown == 0)
Set KeyDown to 1
Return
ElseIf (IsKeyPressed3 MyKey == 0) && (Keydown == 0)
Return
ElseIf (IsKeyPressed3 MyKey) && (Keydown == 1)
Return
ElseIf (IsKeyPressed3 MyKey == 0) && (Keydown == 1)
Set OriginalWeapon to (Player.GetEquippedObject 16)
Set WeaponType to (GetWeaponType OriginalWeapon)
If (WeaponType == 4) || (WeaponType ==5) || (OriginalWeapon.IsWeapon == 0)
Return
Else
If (WeaponType == 1)
OriginalWeapon.SetWeaponType 2
Set Shield to (Player.GetEquippedObject 13)
Player.UnequipItemNS Shield
ElseIf (WeaponType == 2)
OriginalWeapon.SetWeaponType 1
ElseIf (WeaponType == 3)
OriginalWeapon.SetWeaponType 4
Set Shield to (Player.GetEquippedObject 13)
Player.UnequipItemNS Shield
ElseIf (WeaponType == 4)
OriginalWeapon.SetWeaponType 3
EndIf
EndIf
Set KeyDown to 0
EndIf
End

 

Edited by Manus812
Link to comment
Share on other sites

As you can see in the example on this WiKi page (SetWeaponType), what GetEquippedObject returns is a BaseObject, not a reference, so the second notation "SetWeaponType 1 OriginalWeapon" is to be used, not "OriginalWeapon.SetWeaponType 1" like you did. Did you try it with this notation instead already?

 

That said, make sure this really is a Quest script, the Quest has "start game enabled" checked and is actually running once you start or load a game, and maybe also debug your nested IF block structure if it actually goes into the correct blocks at every point by perhaps inserting some PrintToConsole debug output or similar.

 

I'll check if I see anything else off once I realigned your block structure with some indentations where necessary.

And last but not least I'm not sure if SetWeaponType will also trigger an animation switch when the currently wielded weapon's type is changed. Chances are like almost all other type changing functions I know it will need an update of the player's state or rendering after the change first as well.

 

Update3D comes to mind, but I personally dislike the many drawbacks it comes with. It's the only way to make animation switches work it seems, but it completely messes up physics and animation state when used on the player by my own observations. UnequipItemNS followed by EquipItemNS to force a re-equip is another alternative I often used in the past, but one has to be careful which of the functions one uses not to loose scripted events of the affected items triggering or some such.

Link to comment
Share on other sites

Thanks for the reply. Yeah, I didnt make this current script, the other guy did. And a bug/feature of the original spell based mod that I did make, was that if you change weapon grips with the weapon drawn, it will switch, but if you do it while your weapon is stored (on your hip or back) then your weapon will be invisible when in your hands.

Will test out soon., and might even take a video.

Edited by Manus812
Link to comment
Share on other sites

I edited the script and replaced all "Original.SetWeaponType #" to "SetWeaponType # OriginalWeapon" and still nothing. I attached the Quest Script to a Quest, and enabled it on start, made the priority 6, loaded up the game, and when loaded I press the DownArrow, and nothing.

So far, my original Spell-Based GripChanging Works, except that it does not unequip any shields present, and it takes 1Spell to Change one way, and 1Spell to change it another way. So total it would take 4 Spells for all 4 Melee Weapon Types. IF i were to just go ahead and use the Spells

Link to comment
Share on other sites

Quest priorities seem to go from 0 to 100, although it probably does not matter which one you pick (it would, if you were to mess around with dialogue if I remember correctly).

 

Quest scripts, by default, run every five seconds. There seems to be a value with 5 in Oblivion.ini so maybe it could be tweaked, but I have never tried it and it would probably make no sense. However it is possible to override the update interval for individual quest scripts by using the fQuestDelayTime variable, like this:

float fQuestDelayTime

Setting that variable to something should then cause the quest script to run every fQuestDelayTime seconds (or every frame, if set to a value smaller than 1 second divided by your framerate or something like that - which is why some scripts use 0.01 so that they end up running each frame). So... the actual question: did you hold down the button for ten seconds or something to allow the quest script to run once while you have the button pressed down? The IsKeyPressed commands return 1 if the key is currently being held down when the command is called (which happens during one single frame every five seconds by default, being a quest script). So when that one frame 'happens', the key needs to be down. The ScriptEffectStart block of a spell effect runs immediately, and the ScriptEffectUpdate block of a spell runs every frame, but quest scripts need to be 'configured' with that fQuestDelayTime variable to run at intervals other than the default five seconds.

 

You can also do as Drake suggested and add in a group of informative console printings, for example:

PrintToConsole "quest script updates!"
PrintToConsole "hotkey pressed down, changing grip..."

As for the script itself, I have no opinions on it (no time to test). However if you want to format scripts nicely on the forums, you can use the script tag and then make sure indentation is right. It makes reading the scripts easier. For example this (in the post editor):

[ code ]

scriptname SomeScript

 

short SomeVar

 

begin GameMode

; this is indented

set SomeVar to 1

end
[ /code ]

 

Would produce this (where the spaces between '[' and '/?code' and ']' would be removed):

scriptname SomeScript

short SomeVar

begin GameMode
    ; this is indented
    set SomeVar to 1
end

There is also the '<>' button that you can use by selecting your script in the edit box and then clicking that one to turn it into a code section. Nothing too serious, just something to make life easier when reading scripts. Hiding the long-ish script inside a spoiler tag was a great idea (thumbsup :thumbsup: ), and to add to that, you can also place a code tag inside a spoiler. Hopefully that helps a bit.

 

If Drake (or anyone else) spots anything odd, feel free to correct. I am still learning myself, too. Talk about blind leading the blind... :blush:

Edited by Contrathetix
Link to comment
Share on other sites

  • Recently Browsing   0 members

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