Is This Script Right?

Post » Fri Dec 03, 2010 12:10 am

*Edit*

Took some trial and error but I managed to find the problem with the script and fixed a few unknown problems. For those curious here's the problems I ran into:

1. Code wouldn't save: *Solution* This happened due to my unfamiliarity with the coding of FO. I had not created the "ShowMessage NotLaserRifleWeaponMsg" item and as a result it was referencing something that didn't exist as a result the item failed. Going back to my c++ days it would be like the putting #include into my code with that .h file not being there.

2. Item Consumption On Message Trigger: The item would be consumed even though the person would not have a Laser Rifle Weapon equipped. To fix this I made a simple alteration where it produces the message then awards the player a Laser Repair Kit. The first one (1) is for the numerical item amount *they are using 1 and will be returned 1 item* and the second one (1) is to hide the message to the player saying they received a laser rifle repair kit since they really "Didn't" consume it.

3. Item wasn't being repaired: This was another fault of mine and a really amateurish one where I didn't set the appropriate amounts for the player. The character I tested it on had a skill of 99 repair and 95 energy weapons, but the script only included people below 75. As a result I altered the code so if a person has a skill of greater than 50 repair and 50 energy weapons it will account for that. Sadly this brings up another issue where a person may have greatly differing skill sets for their weapons. However to account for this I will be using this script in combination with a special recipe.

The special recipe will require the player to have a repair skill of 45 and a set weapon skill of 45 to go with that repair skill to produce this item. I would love to make this be an all encompassing item repairing an "Energy Weapon", but i'm unsure of how to get the weapontype boolean value.

If anyone would like to use this code for testing purposes or to put in their mode go ahead. Don't mind a bit of credit if you want to slide some my way though. ;) Mods can close this thread if they want managed to solve the problem with a bit of detective work.

scn RepairKitLaserEffectSCRIPT;Most code taken directly from the DLC05AlienEpoxyEffectScript.;Values have been adjusted slightly (-5 across the board), now includes a +30 bonus for having Repair 100;7.6.10 JESfloat WeapHealthBEGIN ScriptEffectStart     ;// get the current health percent and add 25     set WeapHealth to player.getWeaponHealthPerc     ;// run through the player's repair skill and augment appropriatelyIF (player.getEquipped WeapLaserRifle == 1)     IF ( player.getAV Repair < 25 )         IF ( player.getAV EnergyWeapons < 25 )               set WeapHealth to WeapHealth + 20         ENDIF     ELSEIF ( player.getAV Repair >= 25 && player.getAV Repair < 50 )            IF ( player.getAV EnergyWeapons >=25 && player.getAV EnergyWeapons < 50 )          set WeapHealth to WeapHealth + 25         ENDIF     ELSEIF ( player.getAV Repair >= 50 )              IF ( player.getAV EnergyWeapons >=50 )          set WeapHealth to WeapHealth + 30         ENDIF     ENDIF  ELSE  ShowMessage NotLaserRifleWeaponMsg  player.AddItem NVLaserRepairKit 1 1ENDIF     ;// set the weapons new health percent     player.setWeaponHealthPerc WeapHealthEND

User avatar
josie treuberg
 
Posts: 3572
Joined: Wed Feb 07, 2007 7:56 am

Post » Fri Dec 03, 2010 1:03 am

I would love to make this be an all encompassing item repairing an "Energy Weapon", but i'm unsure of how to get the weapontype boolean value.

IF (player.getEquipped WeapLaserRifle == 1)



Try changing that line to:

if player.IsWeaponSkillType EnergyWeapons == 1


Should trigger anytime the player is using any weapon that uses the Energy Weapons skill. Could probably also remove the "WeapLaserRifle" and replace with a Form List that contains all energy-based weapons.
User avatar
Roberta Obrien
 
Posts: 3499
Joined: Tue Oct 23, 2007 1:43 pm

Post » Thu Dec 02, 2010 10:16 pm

Try changing that line to:

if player.IsWeaponSkillType EnergyWeapons == 1


Should trigger anytime the player is using any weapon that uses the Energy Weapons skill. Could probably also remove the "WeapLaserRifle" and replace with a Form List that contains all energy-based weapons.


That's the one thing I was thinking about was a form list and referencing the form list. However i'm unfamiliar with Formlists and how they work within a script function.
User avatar
Samantha hulme
 
Posts: 3373
Joined: Wed Jun 21, 2006 4:22 pm

Post » Thu Dec 02, 2010 3:16 pm

That's the one thing I was thinking about was a form list and referencing the form list. However i'm unfamiliar with Formlists and how they work within a script function.


Either of these should work I believe:

if player.GetEquipped EnergyWeapons == 1


if player.IsWeaponInList EnergyWeapons == 1


There is already a formlist called "EnergyWeapons" (it includes all the energy weapons + energy weapon ammo). Should work here too I believe. If not, duplicate the list maybe, and drop the ammo from the list.

Here's the GECK info on FormLists (including a tutorial on them): http://geck.gamesas.com/index.php/FormList
User avatar
Jennifer May
 
Posts: 3376
Joined: Thu Aug 16, 2007 3:51 pm

Post » Fri Dec 03, 2010 4:32 am

Either of these should work I believe:

if player.GetEquipped EnergyWeapons == 1


if player.IsWeaponInList EnergyWeapons == 1


There is already a formlist called "EnergyWeapons" (it includes all the energy weapons + energy weapon ammo). Should work here too I believe. If not, duplicate the list maybe, and drop the ammo from the list.

Here's the GECK info on FormLists (including a tutorial on them): http://geck.gamesas.com/index.php/FormList


Ahh thanks for the formlist information I couldn't find it for some reason. Probably missed it in my hastiness in trying to find it to learn some information.
User avatar
FITTAS
 
Posts: 3381
Joined: Sat Jan 13, 2007 4:53 pm


Return to Fallout: New Vegas