Jump to content

ModWeaponSpeed


cfh85

Recommended Posts

If I were to use something like this

 

Ref Self
Ref Weapon

Float ModBowSpeed

Begin ScriptEffectStart
Set Self to GetSelf
End

Begin ScriptEffectUpdate
If Weapon == (Self.GetEquippedObject 16)
	return
Else
	If ((GetWeaponType Weapon) == 5)
		Weapon.ModWeaponSpeed (ModBowSpeed * -1)
	EndIf
	Set Weapon to (Self.GetEquippedObject 16)
	Set Level to (Self.GetFactionRank CFHCompanionLevelFaction)
	If ((GetWeaponType Weapon) == 5)
		Weapon.ModWeaponSpeed ModBowSpeed
	EndIf
EndIf
End

 

would the script still know which bow the ref weapon was even if it had been dropped from the NPC's inventory?

is there any way to check if it has already been altered?

and finally, would wodweaponspeed alter every instance of the weapon, or just that specific one?

Link to comment
Share on other sites

Most things that alter inventory references and spells/enchantments will not be stored in a save game, because the original data from the source file overwrites it. This includes ModWeaponSpeed. However, changes made to cloned forms will be saved, as cloned references (FF forms) are a part of the save game. You can use CloneForm to create an exact copy of the original that will maintain any alterations. Even so, I think some of the more background-type AVs and AVMods are refreshed on load. You would be best to check on the CS wiki before working with new AVs, just in case.

 

 

would the script still know which bow the ref weapon was even if it had been dropped from the NPC's inventory?

GetEquippedObject returns the Base object. That means it does not technically refer specifically to the weapon in your hand, but to all instances of that weapon in general.

With that in mind, you need to fix the ModWeaponSpeed syntax to:

ModWeaponSpeed ModBowSpeed Weapon

 

 

is there any way to check if it has already been altered?

 

I don't think you can directly check if the weapon has been altered. Depending on how you alter it, you can try to guess by using IsClonedForm, but that returns true for player-enchanted weapons too. Or, you can compare it to the orignal, if you have the original weapon's ID saved. In an older project I helped someone out with, I used arrays to keep track of what weapons were cloned, so I could recycle them instead of repeatedly cloning them and clogging up the system. PM me if you want me to give you a closer look at the scripts.

 

 

and finally, would wodweaponspeed alter every instance of the weapon, or just that specific one?

Kind of answered already, but if you change the stats on a weapon without using CloneForm, ie the original weapon, ALL instances of that weapon are affected. For example if I feel like buffing up my iron longsword to 100 damage at the start of the game, then ALL iron longswords in the game will do 100 damage. CloneForm creates a new Base object, and since the scripter will often only have one copy in existence, it is essentially a unique weapon.

Edited by WarRatsG
Link to comment
Share on other sites

well I guess that idea is out then. The ability will be used by companions, currently 4 of my 29 hired classes will use the ability. I now going to use a different method for my marksmanship ability. For blade and blunt the abilities add (scripted)poison to the weapons.

 

:( I was looking forward to seeing a maxed out companion loosing arrows like a machine gun

Link to comment
Share on other sites

You can still use that idea, but it will just require a work-around. Like I said, I have an esp here that - for your purposes at least - has all the info you need to make your idea a reality.

 

The mod was designed to allow a player to become progressively stronger with any weapon over time, instead of having to just settle for a weapon because it has the highest stats. Arrays came in as the tools used to hold on to the IDs of the Base weapons and their clones. It meant that when a new weapon was equipped, a script checked whether that weapon was registered in the arrays. If it was registered as a known clone, then the previous weapon's data was saved and the new data was loaded up. If it was a known original, as in a weapon that has been cloned, then the original was replaced with the modified clone version. Otherwise, a clone was created and the two weapons were saved to their respective arrays.

 

The principle could probably be applied to NPCs too. Or, you could take the less conservative approach and just clone any weapon that gets equipped. I'm not sure how Oblivion handles obsolete cloned forms :P

Link to comment
Share on other sites

I think, for what I'm after, CopyModelPath would do the trick.

Clone a weapon once, after that you could just change it's nif and all it's stat/enchantment and just alter any stats then.

The script would need to check for the best weapon as the companion may not ever change weapons because the modded one may be better (but not better than a modded version of another weapon)

Link to comment
Share on other sites

CloneForm takes all the existing data from a weapon. It does not create an "empty" form - all data, including nifs, slots, damage, speed, etc is carried over from the original. It is, as the name of the function would suggest, a clone. You do not need to manually assign data to these clones.

 

From what I remember an NPC tends to use the first piece of equipment alphabetically, but I'm not sure about weapons. In any case, the best workaround I can remember was in Companion Vilja, where taking certain items from her inventory would open up a "sub-inventory", which was essentially a separate container. This meant that under special conditions (usually involving dialogue, not unlike your own mod) she could equip specific items of clothing, with no risk of sets mixing. It also meant that she wouldn't wear any of the junk you gave her to carry. Quite inspired if you ask me.

Link to comment
Share on other sites

CloneForm creates game save bloat. What I plan is to have the ability create 1 initial clone and then alter that clone to suit needs. If I used CloneForm on 5 NPCs, and changed their weapons 10-20 times that's already 50-100 clone forms, instead of 5.

Currently, there are no functions to remove created cloneForms as the implementation of any such function is tricky at best. You could however use the RefStuff OBSE plugin's destroyCloneform function. But bear in mind that it is an experimental plugin and the function itself is no different.
From the CS wiki

 

I may use this with a few of my companion classes.

 

From what I remember an NPC tends to use the first piece of equipment alphabetically, but I'm not sure about weapons. In any case, the best workaround I can remember was in Companion Vilja, where taking certain items from her inventory would open up a "sub-inventory", which was essentially a separate container. This meant that under special conditions (usually involving dialogue, not unlike your own mod) she could equip specific items of clothing, with no risk of sets mixing. It also meant that she wouldn't wear any of the junk you gave her to carry. Quite inspired if you ask me.

 

This is the sort of thing I need to do for my 'pack mule' NPCs. The Standard hireable NPCs wont carry stuff for the PC. They will borrow weapons, rings, amulets and armour, but not more than they can use. I realise many people wont like it like that, but the fighting companions will have a lot of benefits.

Link to comment
Share on other sites

CloneForm creates game save bloat. What I plan is to have the ability create 1 initial clone and then alter that clone to suit needs. If I used CloneForm on 5 NPCs, and changed their weapons 10-20 times that's already 50-100 clone forms, instead of 5.

Currently, there are no functions to remove created cloneForms as the implementation of any such function is tricky at best. You could however use the RefStuff OBSE plugin's destroyCloneform function. But bear in mind that it is an experimental plugin and the function itself is no different.
From the CS wiki

 

I may use this with a few of my companion classes.

 

Don't worry, I already know this. That said, I misinterpreted what you said - I thought you meant you were going to manually assign data to what you thought was an empty form. Now I can see that you're recycling it, quite cleverly. Keep in mind the masses of forms that people will create as a result of alchemy, enchanting and spell making; 50 extra forms will not cause any noticeable bloats. A little bit of recycling is all you need.

The only problem with what your saying is that what if you take the cloned bow from the companions inventory, then give them a different, normal bow. The normal bow will be replaced with the cloned bow, then have its mesh and stats changed to match the normal bow. The bow that the player took from the companion will change too. You could create a script that works in reverse, replacing the clone with the original if you really needed I guess.

 

Sounds like you've got your work cut out. Hope you're up to scratch with your arrays ;)

Link to comment
Share on other sites

  • Recently Browsing   0 members

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