Is there a way to modify a weapons damage via scripting?

Post » Mon Mar 14, 2011 6:02 pm

Alright, I've been trying to make some weapon mods, and I was wondering if there was a way to change the weapon's damage through a script applied to the object?
User avatar
Anna Krzyzanowska
 
Posts: 3330
Joined: Thu Aug 03, 2006 3:08 am

Post » Tue Mar 15, 2011 3:12 am

FOSE has functions that can help you with this. Have a look at http://fose.silverlock.org/fose_command_doc.html#SetAttackDamage and http://fose.silverlock.org/fose_command_doc.html#GetAttackDamage.

Cipscis
User avatar
Dawn Porter
 
Posts: 3449
Joined: Sun Jun 18, 2006 11:17 am

Post » Mon Mar 14, 2011 7:01 pm

FOSE has a direct command for it as Cipscis said but you can also do it with an object effect which you put on the weapon.

You put the scripted object effect on the weapon, and you create a variable somewhere, either a quest variable or a global. The weapon would apply an extra damage effect based upon the value of whatever you set that value to.

If you were using a quest variable and quest script to modify the weapon damage, the pair would look something like this:

scn MyWeaponDamagyQuestSCRIPTshort ExtraDamagebegin gamemodeif (I want a really powerful weapon)     set ExtraDamage to 50elseif (I wanna bit more damage)     set ExtraDamage to 25else (I want no extra)     set ExtraDamage to 0)endifend



scn MyHappyEffectSCRIPTref	TargetBEGIN ScriptEffectStart	set Target to GetSelf	if target != player		Target.damageav health MyWeaponDamageyQUEST.ExtraDamage	endifEND


The effect script itself could be allowed to mess with the variables, but the variable must live outside of the weapon damage script, such as in that quest or as a global. Each instance of the weapon script will, I believe, re-run each time the weapon makes a hit, and it'll refresh any variable values that are defined within it. An outside quest variable or global will allow it to maintain state on variables throughout multiple hits.

To do this you first create a base effect
http://geck.gamesas.com/index.php/Base_Effect
then create an object effect
http://geck.gamesas.com/index.php/Object_Effect
then you put the base effect into your object effect.

For an example, look at:
base effect MQ01BehemothWeaponEffect
object effect EnchBehemothWeapon
weapon BehemothFireHydrant

when you create your effect script, don't forget to set the dropdown on the top right for "Effect" instead of "Object" or you'll be sitting there for hours wondering why your script is missing from the list of available scripts when you try to put it onto your effect.
User avatar
Bereket Fekadu
 
Posts: 3421
Joined: Thu Jul 12, 2007 10:41 pm

Post » Tue Mar 15, 2011 12:13 am

Thanks for the help. I wasn't being very specific, as I was pretty tired when I wrote the OP, but I was actually trying to find a way to multiply damage based on the user's health, not add a specific amount. I appreciate the help and thankfully the link to the FOSE command docs helped me find what I needed (using con_setGameSetting right now.) Thanks again!
User avatar
Claire Jackson
 
Posts: 3422
Joined: Thu Jul 20, 2006 11:38 pm


Return to Fallout 3