Jump to content

Custom "Grip" Spell Script


Manus812

Recommended Posts

This is a stripped down version, it will edit the base weapon, which I don't recommend

It checks that there is a weapon equipped, if it is either a 1/2 hand blade/blunt and changes the 1/2 hand part. It also unequips any shields when go 1 hand to 2 hand.

Also, I'm using "isKeyPressed MyKey" instead of "isKeyPressed 208" because it makes it easier to edit the key choice at a later date

 

 

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 cfh85
Link to comment
Share on other sites

 

Also, what checks do you have to decide if the weapon is currently 1h or 2h, and then change it as required.

Is this the full script that you posted?

 

This is the full scrip for transitioning a 1hand Blade to a 2hand blade.
Scn GripChangerBladeOne
begin ScriptEffectStart
ref weapon
short weapontype
set weapon to player.GetEquippedObject 16 (<--- This command detects if the player has a weapon equipped; does not detect what type of weapon)
SetWeaponType 1 weapon (<--- And this command sets the players' equipped weapon to a different weapon type; with "1" representing a 2hand blade)
end
http://cs.elderscrolls.com/index.php?title=SetWeaponType (<--- This is where I got this information, and copied example script and edited values)
http://obse.silverlock.org/obse_command_doc.html (<--- This is where I look up most commands, but of course is useless if you dont know what it does)
"Iskeypressed2" is different than "iskeypressed" because iskeypressed2 uses DX scan codes, and a list of them can be found here: http://cs.elderscrolls.com/index.php?title=IsKeyPressed2
Edited by Manus812
Link to comment
Share on other sites

Also since, again, for testing purposes, as this new scrip will be in "GripChangerAlpha2" file. For Alpha1 I had 2 separate scripts attached to changing 1hand -to- 2hand and another spell for changing 2hand -to- 1hand. my plan for Alpha 2 is to bind:

 

↑ [2H Blade -to- 1H Blade]

↓ [1H Blade -to- 2H Blade]

→ [1H Blunt -to- 2H Blunt]

← [2H blunt -to- 1H Blunt]

 

Again this is for my own testing purposes as this version is Alpha2. Once I get into the Beta stage, at which the mod will be uploaded for free testing, I will try and implement an .ini file or in-game way to rebind the keys. Now that all of this is said, I will try and create a new scrip using you advice. Here is also my plans for each mod version (im making them separate files so if I mess up I can go back a version on my pc)

 

Alpha1 = [1H Blade -to- 2h Blade Via Spell] & [2H blade -to- 1H Blade Via Spell]

Alpha2 = Bind each script to the arrowkeys

Alpha3 = Find a way to implement a shield unequipp/re-equipp script.

 

So, with that said, for right now I would like to focus on finding out how to bind each script effect to an arrow key. Once we get that down and have it work, we can start development on shields and whatnot. I want to take this slowly and one step at a time. The script examples listed above are getting a bit ahead of ourselves and I'm having trouble deciphering it, Sorry. So how from the long quest script do I bind: 1H Blade -to- 2H blade to the Down arrow?

Note: thanks for the help, I do appreciate it, but this is my first time delving into higher scripting, so forgive me if I want to take it as slow as possible :smile:

Edited by Manus812
Link to comment
Share on other sites

right then, your script so far is junk. As I said, refs and shorts should not be inside begin/end blocks.

What happens if you press the button while you have a blunt equipped, or bow, or staff... oops. Also, are you planning on have 4 scripts using 4 keys?

 

The second, stripped down script is the one you'll probably use. The original script I thinks is way beyond your abilities. You need to spend a lot more time learning about scripting

 

If you read my scripts you should have noticed I use IsKeyPressed3

Link to comment
Share on other sites

step 1. press the show button on my post above.

step 2. copy and paste the script into the cs

step 3. set the script as a quest script

step 4. attach said script to newly created quest

step 5. save

 

Done. press the down key. it will change 1h blade to 2h blade, 2h blade to 1h blade, 1h blunt to 2h blunt, 2h blunt to 1h blunt. It will also unequip any shield.

Link to comment
Share on other sites

Thanks for the input. In regards to the problem if you have a bow or staff equipped, there is bound to be some bugs that either will have to be ironed out leading into the final release, or something the player (people who will use the mod once it is uploaded) will have to take into consideration when playing. I can imagine if you save while a weapon is not in it's vanilla default grip there might be a problem, for something like that, it's just up to the player to correctly switch grips before saving etc. It's the same with NPC's changing weapon when you do if you both have the same weapon. It's a bug that will have to be ignored. The way I see it, you eventually will be using weapons that NPC's wont be using, like a a unique sword such a goldbrand. I only noticed that NPC's were changing grips because I was testing it out fighting guards. The guards had silver longswords, and so did I. Once you start to use weapons NPC's don't it wont be a big issue anymore.

 

There is bound to be bugs with mods, especially for a game as old as oblivion. So addressing the issue of going into the CS and copping a weapon and changing it 4 times into the different weapon types, I want this to work for any mod. So that you can take an axe or sword from a different mod, and change grips.

Edited by Manus812
Link to comment
Share on other sites

right. This is the last time I'm posting on this, as I'm pretty sure you are beyond helping. I've provided 2 scripts, one that needs a little work because it does it differently, the other should work as is.

 

"In regards to the problem if you have a bow or staff equipped, there is bound to be some bugs that either will have to be ironed out leading into the final release" I've already ironed it out. It's taken more time trying to explain to you than it took to create the mod.

Link to comment
Share on other sites

I am just addressing any concerns to keep my intentions clear before I start working*. I am going to use you scripts and experiment around with testing them tomorrow. I just wanted to map out a plan for each and every release so if we run into a problem during a certain version we can see what we are trying to accomplish without getting overwhelmed and confused.

I am sorry I seemed "hopeless".

 

*Where I listed what I want to accomplish with each Alpha Version because I do not want to get confused and lost by trying to accomplish everything at once.

Edited by Manus812
Link to comment
Share on other sites

  • Recently Browsing   0 members

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