IsInList crashing scripts?

Post » Sat May 28, 2011 5:43 pm

I'm using the block of code below, and a few very much like it, in some object scripts. For some reason the scripts aren't doing what they should, making me think something is breaking them.

I tried replacing the line below with the call to IsInList with a simple "IF 0" conditional, and the script worked as it should. As soon as I added back in one of the calls to IsInList, it stopped working. Am I making some kind of a syntax error? It compiles fine in the GECK.

rArmor is a ref variable, and PPAT51b is a formlist with the vanilla T-51b armor in it.


begin gamemode	IF sRemoveCount		IF sRemoveCounter < sRemoveCount			set sRemoveCounter to sRemoveCounter + 1		ELSE			set sRemoveCounter to 0			set sRemoveCount to 0			rContainer.removeitem PPAMLCLower 1 1		ENDif	ELSE		set rContainer to getcontainer		IF rContainer.isActor 			set rArmor to rContainer.getequippedobject 2			IF isPowerArmor rArmor				IF rArmor.isinlist PPAT51b ; || rArmor.isinlist PPAAPA				ELSE					IF rcontainer.getitemcount PPALCLower					ELSE						rContainer.additem PPALCLower 1 1						rContainer.equipitem PPALCLower 1 0						set sRemoveCount to 1 + getrandompercent / 10						return					ENDif				ENDif			ENDif		ENDif	ENDifend

User avatar
Breautiful
 
Posts: 3539
Joined: Tue Jan 16, 2007 6:51 am

Post » Sat May 28, 2011 12:49 pm

http://fose.silverlock.org/fose_command_doc.html#GetEquippedObject returns a base object, so when you try to use it like a reference by calling http://geck.gamesas.com/index.php/IsInList on it your script halts. Try using http://fose.silverlock.org/fose_command_doc.html#ListGetFormIndex instead (if I remember correctly, it will return -1 if the specified form is not in the list).

Cipscis
User avatar
Chris Jones
 
Posts: 3435
Joined: Wed May 09, 2007 3:11 am

Post » Sat May 28, 2011 7:27 pm

Cool, thanks for the quick response. Works perfect now. :celebration:
User avatar
Lizs
 
Posts: 3497
Joined: Mon Jul 17, 2006 11:45 pm


Return to Fallout 3