My Script wont work.

Post » Mon May 31, 2010 4:00 am

Ive got a bunch of perks that improves the player when wearing the right armor type.
Basically Cloth, Light, Medium, Heavy, Power, and Science type armors.

This is done by adding all armors in the game to one of these 6 Formlists, then setting the Formlists as Conditions in the various perk/abilites.

But thats not compatible with the OTHER Armor mods out there, and i want to change that.

So my thought is this, if the player is wearing an armor from the game it activates or shuts off by FormList, BUT if the armor is not in any of the formlists it goes simply by DT.
So i needed NVSE for the DT since the GECK has no functions that checks for DT on its own.

Here is the script for the Light Armors.:

scn exoLightArmorSCRIPTref exoVariableCBegin GameModeset exoVariableC to Player.GetEquippedObject 2 if (( Player.GetEquipped exoPerkLightArmor == 1 ) || (( exoVariableC.GetArmorDT >= 9 ) && ( exoVariableC.GetArmorDT <= 19 ))) && (( Player.GetEquipped exoPerkClothArmor == 0 ) && ( Player.GetEquipped exoPerkMediumArmor == 0 ) && ( Player.GetEquipped exoPerkHeavyArmor == 0 ) && ( Player.GetEquipped exoPerkPowerArmor == 0 ) && ( Player.GetEquipped exoPerkScienceArmor2 == 0 )) 				Player.AddPerk exoLightArmorINVIS1endifif ( Player.GetEquipped exoPerkLightArmor == 0 ) && (( exoVariableC.GetArmorDT < 9 ) || ( exoVariableC.GetArmorDT > 19 ) || ( Player.GetEquipped exoPerkClothArmor == 1 ) || ( Player.GetEquipped exoPerkMediumArmor == 1 ) || ( Player.GetEquipped exoPerkHeavyArmor == 1 ) || ( Player.GetEquipped exoPerkPowerArmor == 1 ) || ( Player.GetEquipped exoPerkScienceArmor2 == 1 ))		Player.RemovePerk exoLightArmorINVIS1endifend


What happens is it still only works on armors that is in the game, any armor from the outside will REMOVE the perk, no matter their DT


So I tried adding some elseif statements instead to make it cleaner.

scn exoLightArmorSCRIPTref exoVariableCBegin GameModeset exoVariableC to Player.GetEquippedObject 2 if ( Player.GetEquipped exoPerkLightArmor == 1 ) && (( Player.GetEquipped exoPerkClothArmor == 0 ) && ( Player.GetEquipped exoPerkMediumArmor == 0 ) && ( Player.GetEquipped exoPerkHeavyArmor == 0 ) && ( Player.GetEquipped exoPerkPowerArmor == 0 ) && ( Player.GetEquipped exoPerkScienceArmor2 == 0 )) 				Player.AddPerk exoLightArmorINVIS1		elseif		 exoVariableC.GetArmorDT >= 9  && exoVariableC.GetArmorDT <= 19 			Player.AddPerk exoLightArmorINVIS1endifif ( Player.GetEquipped exoPerkLightArmor == 0 ) && (( Player.GetEquipped exoPerkClothArmor == 1 ) || ( Player.GetEquipped exoPerkMediumArmor == 1 ) || ( Player.GetEquipped exoPerkHeavyArmor == 1 ) || ( Player.GetEquipped exoPerkPowerArmor == 1 ) || ( Player.GetEquipped exoPerkScienceArmor2 == 1 ))		Player.RemovePerk exoLightArmorINVIS1		elseif		 exoVariableC.GetArmorDT < 9 || exoVariableC.GetArmorDT > 19			Player.RemovePerk exoLightArmorINVIS1endifend



But this wont even save.
Im sure im missing something obvious, but I cant see it.


-Exo
User avatar
ILy- Forver
 
Posts: 3459
Joined: Sun Feb 04, 2007 3:18 am

Post » Sun May 30, 2010 6:41 pm

		ElseIf				{Condition}
...Might compile, but you want...
				ElseIf {Condition}
...on the same line.

Also, you might want to create a FormList(s) for the many armors you want to make sure the player is/isn't wearing to replace all the 'If (Player.GetEquipped ARMO == 0)/'If Player.GetEquipped ARMO' checks with single 'If (Player.GetEquipped YourFLST == 0)'/'If Player.GetEquipped YourFLST' conditions. Edit: Sorry I'd missed, initially, that you were already looking into FLST's. *drinks more coffee*

Another tidbit: Any function that will only return 0 or 1 like GetEquipped is 'cheaper' sans the '== 1' so 'Player.GetEquipped ItemX' is the same thing as 'Player.GetEquipped ItemX == 1' but is A) easier on the eyes and B) less 'expensive' when the script runs.
User avatar
Batricia Alele
 
Posts: 3360
Joined: Mon Jan 22, 2007 8:12 am

Post » Sun May 30, 2010 7:36 pm

		ElseIf				{Condition}
...Might compile, but you want...
				ElseIf {Condition}
...on the same line.

Also, you might want to create a FormList for the many armors you want to make sure the player isn't wearing to replace all the 'If (Player.GetEquipped ARMO == 0)' checks with a single condition.


Yeah condition needs to be on the same line as the elseif statement, thats why it wouldnt save.
Still now it wont activate at all, for any armor.

Yeah I could do that, would sure make it easier to read.

-Exo
User avatar
JUDY FIGHTS
 
Posts: 3420
Joined: Fri Jun 23, 2006 4:25 am

Post » Sun May 30, 2010 7:50 pm

Here is the much easier to read code:

scn exoLightArmorSCRIPTref exoVariableCBegin GameModeset exoVariableC to Player.GetEquippedObject 2 if ( Player.GetEquipped exoPerkLightArmor == 1 ) && ( Player.GetEquipped exoNotLightArmor == 0 )				Player.AddPerk exoLightArmorINVIS1		elseif exoVariableC.GetArmorDT >= 9  && exoVariableC.GetArmorDT <= 19 			Player.AddPerk exoLightArmorINVIS1endifif ( Player.GetEquipped exoPerkLightArmor == 0 ) && ( Player.GetEquipped exoNotLightArmor == 1 )		Player.RemovePerk exoLightArmorINVIS1		elseif exoVariableC.GetArmorDT < 9 || exoVariableC.GetArmorDT > 19			Player.RemovePerk exoLightArmorINVIS1endifend


Still wont work though, the perk does not activate no matter what armor I try.

-Exo
User avatar
Esther Fernandez
 
Posts: 3415
Joined: Wed Sep 27, 2006 11:52 am

Post » Mon May 31, 2010 9:27 am

I tried the OR version as well, but still getting no result.

scn exoLightArmorSCRIPTref exoVariableCBegin GameModeset exoVariableC to Player.GetEquippedObject 2 if (( Player.GetEquipped exoPerkLightArmor == 1 ) && ( Player.GetEquipped exoNotLightArmor == 0 )) || ( exoVariableC.GetArmorDT >= 9  && exoVariableC.GetArmorDT <= 19 )			Player.AddPerk exoLightArmorINVIS1endifif (( Player.GetEquipped exoPerkLightArmor == 0 ) && ( Player.GetEquipped exoNotLightArmor == 1 )) || ( exoVariableC.GetArmorDT < 9 || exoVariableC.GetArmorDT > 19 )		Player.RemovePerk exoLightArmorINVIS1	endifend



Unless there is a logical error I am totally missing I can only conclude that the NVSE Functions do not work.
Which is a shame but not wholly unexpected since it is still in Beta.

Im talking about: GetEquippedObject and/or GetArmorDT.


-Exo
User avatar
Rebecca Clare Smith
 
Posts: 3508
Joined: Fri Aug 04, 2006 4:13 pm

Post » Mon May 31, 2010 8:50 am

You should change [item].GetArmorDT to GetArmorDT [item] for the function to work.
User avatar
Taylrea Teodor
 
Posts: 3378
Joined: Sat Nov 18, 2006 12:20 am

Post » Mon May 31, 2010 8:05 am

You should change [item].GetArmorDT to GetArmorDT [item] for the function to work.


THAT WORKED.

I love u so much i wrote a poem in ur honor.

Who is standing at my door?
Is it an Angel come to end my war?
Is it a stranger come merely to explore?
No, it is someone I cannot ignore.
Its my saviour, the knight, Pelinor.


Thank you sir.

Here is the final code, and it all works.

scn exoLightArmorSCRIPTref exoVariableCBegin GameModeset exoVariableC to Player.GetEquippedObject 2 if ( Player.GetEquipped exoPerkLightArmor == 1 )			Player.AddPerk exoLightArmorINVIS1		elseif ( GetArmorDT exoVariableC >= 9  && GetArmorDT exoVariableC <= 19 ) && ( Player.GetEquipped exoNotLightArmor == 0 )	 			Player.AddPerk exoLightArmorINVIS1		elseif ( Player.GetEquipped exoNotLightArmor == 1 )				Player.RemovePerk exoLightArmorINVIS1			elseif GetArmorDT exoVariableC < 9 || GetArmorDT exoVariableC > 19					Player.RemovePerk exoLightArmorINVIS1endifend


Thanks to everyone who helped me out.

-Exo
User avatar
joseluis perez
 
Posts: 3507
Joined: Thu Nov 22, 2007 7:51 am


Return to Fallout: New Vegas