Jump to content

Custom "Grip" Spell Script


Manus812

Recommended Posts

Couple of thoughts

 

Firstly, if you don't want to change the weapon for every instance (which is why NPCs using the same weapon change when you do) you need to have a separate weapon. I would create 4 weapons (just copy any generic weapon) 1 of each blade/blunt 1h/2h. Use the script to add and equip the weapons, then modify their nif file, damage, speed etc to match what was equipped

 

Secondly, modify the speed and damage of the weapons. 1h converted to 2h, increase speed and damage, to increase the maximum rate of damage. Opposite with 2h converted to 1h

 

Use your script to remove any equipped shield. 1h to 2h remove it when you initially cast, 2h to 1h remove the shield when return it to it's original form.

 

Also, have a second think about using a set key. You're opening yourself up to conflicts. I would probably use a spell.

Work it something like this. Cast the spell > get message box > add the ability/ set key /remove ability > set the key will allow users to chose the key they want to use. Adding and removing the ability will change when you can use it - and stops scripts from running when not needed. Though you would want to return the weapon to normal before you remove the ability

Link to comment
Share on other sites

I've decided that it is ok that NPC's changing grip when PC does if they are both using same weapon. It isnt a big issue. I dont want to make separate weapons in CS because I want this mod to work with any weapon from and mod. The first alpha of the script works via a spell. You cast the spell and it works, but spell casting is rather slow. (in combat) Which is why I opted to (for testing) bind the script to be activated with the arrow keys. For final release I will either implement an in-game way to bind the keys, or through an INI file (IDK how to make one though).

 

If you want, I can upload the [working] alpha release if you want to see how it works currently. instructions will be on the mod page If you want me to upload it.

 

EDIT: Also in regards to a shield. I dont exactly know how to have the script: Unequipped shield if one is equipped & re-equip shield if one was present.

Edited by Manus812
Link to comment
Share on other sites

Secondly, modify the speed and damage of the weapons. 1h converted to 2h, increase speed and damage, to increase the maximum rate of damage. Opposite with 2h converted to 1h

 

Use your script to remove any equipped shield. 1h to 2h remove it when you initially cast, 2h to 1h remove the shield when return it to it's original form.

 

 

I already want to implement these features, I specifically said that this is what I wanted to accomplish. No offense, you telling me this won't help. I want to have these features, but have no idea how, hence me asking for help. No offense

Link to comment
Share on other sites

That's what I'm trying to do!!! But I want to take it one step at a time. First I made it work via a spell --> next I want to make it work via a hotkey, --> then I want it to have extra features (removing shield / + or - Dam) Right now I'm focusing on making the script be activated via a hotkey. It is in its most basic form as of right now. So do yo have any scripting advice, or are you just going to keep telling me what I am already trying to do?

Edited by Manus812
Link to comment
Share on other sites

okay, so when you say the script doesn't work, what exactly do you mean? Will it not compile? Which would make sense as you haven't set how it will start - probably want something along the lines of Begin GameMode, though I'm a little rusty. Also, what have you attached the script to?

Still think you're making a mistake by editing the original weapon. It's ridiculous that everyone else using the weapon will change when you do, then you have the shield issue. It's easy enough to set the weapon to 1 hand or 2 hand, but removing shields for everyone using the weapon is more work.

 

Also, you're possibly asking for problems if you start editing the speed, damage etc of the original weapon. If something goes wrong it's simple enough to change it back to either 1 or 2 handed, but restoring the original stats if they get messed up could pose a problem. Also, some things are not stored in the save data, other things are...

 

If you post a script that works with key pressed, I can help you to make the mod into something that would be compatible with pretty much everything and do what you're asking - if you're willing to stop editing the base weapon

Link to comment
Share on other sites

Here is the script that changes a 1hand blade to a 2hand blade. It works via a spell (lesser power) that is for now added via player.addspell [id] .You cast the spell and the grip changes. So how would I, instead of casting a spell, have it bound to a key.


Scn GripChangerBladeOne


begin ScriptEffectStart


ref weapon

short weapontype

set weapon to player.GetEquippedObject 16

SetWeaponType 1 weapon


end

Edited by Manus812
Link to comment
Share on other sites

So you are saying like this (208 is the DX scancode for the down arrow):

If it is a quest script that activates on gamestartup, wouldn't it then be running always in the background causing lag? I already have one mod that someone helped me create that uses a quest script to uncapp the armor rating. It sometimes give low fps.
Scn GripChangerBladeOne
begin Gamemode
iskeypressed2 208
ref weapon
short weapontype
set weapon to player.GetEquippedObject 16
SetWeaponType 1 weapon
end
Edited by Manus812
Link to comment
Share on other sites

don't put your refs and shorts inside of begin/end blocks.

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?

 

 

I've created a script that should work as I described before. It doesn't change the speed or damage yet - easy part.

For some reason my CS won't save it, though it isn't showing any errors. IF it is working all it needs is four new weapons and a quest

It doesn't remove the original from the player, it just makes it non playable and weightless. The weapons that get added SHOULD be exact copies except for the value and I need to add in to copy over any scripts

 

Important note with gamemode blocktypes, use return often. Also structure your scripts to keep the heaviest part at the end, hopefully after several returns, to stop it from being read when not needed. Those reducing lag. The Script below has four conditions

1 - Key is pressed, but this is the first time the script has registered it in this instance - register that the key has been pressed - return

2 - Key isn't pressed and has not been registered - do nothing - return

3 - Key is pressed and has been registered - do nothing - return

4 - Key is no longer being pressed but has been registered - now we do stuff. REMEMBER to unregister the keypress

 

under the first three conditions we do very little other than returning, to stop the game from reading the rest. I probably should change it to put the most common of those conditions first, so it should be 2, 1, 3, 4

1 always has to come before 3 or we would never register the key being pressed

 

 

Scriptname CFHCGQuestScript

Short DoOnce
Short KeyDown
Short MyKey
Short WeaponType
Short Health
Short EnchCharge
Short Speed
Short Resistance
Short Damage
Short Reach
Short Weight
Ref Weapon
Ref OriginalWeapon
Ref Poison
Ref Sheild
Ref Ench
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) && (DoOnce == 1)
Player.RemoveItemNS CFHCG1hBlade, 99
Player.RemoveItemNS CFHCG1hBlade, 99
Player.RemoveItemNS CFHCG1hBlade, 99
Player.RemoveItemNS CFHCG1hBlade, 99
Set Health to (Player.GetEquippedCurrentHealth 16)
Set Poison to Player.GetEquippedWeaponPoison)
Set EnchCharge to Weapon.GetEnchantmentCharge
OriginalWeapon.SetIsPlayable 1
Set Sheild to (Player.GetEquippedObject 13)
Player.UnequipItemNS Sheild
Player.EquipItemNS OriginalWeapon
OriginalWeapon.SetWeight Weight
Player.SetEquippedCurrentHealth Health, 16
Player.SetEquippedWeaponPoison Poison
OriginalWeapon.SetEnchantmentCharge to Charge
Set DoOnce to 0
Set KeyDown to 0
Return
ElseIf (IsKeyPressed3 MyKey == 0) && (Keydown == 1) && (DoOnce == 0)
Set OriginalWeapon to (Player.GetEquippedObject 16)
Set WeaponType to (GetWeaponType OriginalWeapon)
If (WeaponType == 4) || (WeaponType ==5) || (OriginalWeapon.IsWeapon == 0)
Return
Else
Set Health to (Player.GetEquippedCurrentHealth 16)
Set Poison to Player.GetEquippedCurrentPoison
Set EnchCharge to OriginalWeapon.GetEnchantmentCharge
Set Speed to OriginalWeapon.GetWeaponSpeed
Set Ench to OriginalWeaon.GetEnchantment
Set Resistance to OriginalWeapon.GetIgnoresResistance
Set Damage to OriginalWeapon.GetAttackDamage
Set Reach to OriginalWeapon.GetWeaponReach
Set Weight to OriginalWeapon.GetWeight
Set Sheild to (Player.GetEquippedObject 13)
Player.UnequipItemNS Sheild
If (WeaponType == 1) ;If 1hBlade add 2hBlade
Player.AddItemNS CFHCG2hBlade, 1
Player.EquipItemNS CFH2hBlade
ElseIf (WeaponType == 2) ;If 2hBlade add 1hBlade
Player.AddItemNS CFHCG1hBlade, 1
Player.EquipItemNS CFH1hBlade
ElseIf (WeaponType == 3) ;If 1hBlunt add 2hBlunt
Player.AddItemNS CFHCG2hBlunt, 1
Player.EquipItemNS CFH2hBlunt
ElseIf (WeaponType == 4) ;If 2hBlunt add1hBlunt
Player.AddItemNS CFHCG1hBlunt, 1
Player.EquipItemNS CFH1hBlunt
EndIf
OriginalWeapon.SetIsPlayable 0
OriginalWeapon.SetWeight 0
Set Weapon to (Player.GetEquippedObject 16)
Player.SetEquippedCurrentHealth Health, 16
Player.SetEquippedWeaponPoison Poison
Weapon.SetWeaponSpeed Speed
Weapon.SetEnchantment Ench
Weapon.SetIgnoresResistance Resistance
Weapon.SetAttackDamage Damage
Weapon.SetWeaponReach Reach
Weapon.SetWeight Weight
Weapon.SetModelPath (OriginalWeapon.GetModelPath)
EndIf
Set DoOnce to 1
Set KeyDown to 0
EndIf

End

 

 

Even if you don't like the way I've done it, you should find several answers on how to do what you want in there. If you don't hear from me for a while it's because I'm on holiday. Keep trying and post your progress -

Edited by cfh85
Link to comment
Share on other sites

  • Recently Browsing   0 members

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