Why is this Code killing my Script?

Post » Tue Dec 29, 2009 12:48 pm

I'm working on a Mod, and have hit a problem: the Code below kills my SCript the moment the required Weapon is Drawn. By this, I mean that the Script completely stops running-- the Quest is still active, but none of the variables update, and even Messages do not display in the Console/Top Corner of the screen...
Removing this Code fixed the problem, so it seems to be the issue...

;	If ( ReaverEquipped == 1 );		Set CannotHarm to 0;	ElseIf ( ReaverEquipped == 0 );		Set PlayerWeapon to ( Player.GetEquippedObject 16 );		If ( PlayerWeapon.GetIsID ZCDMSRReaver01 == 1 ) ; This triggers the error.;			Set CannotHarm to 0;		ElseIf ( PlayerWeapon == 0 );			Set CannotHarm to 0	;		Else;			Set CannotHarm to 1;		EndIf;	EndIf


CannotHarm is a Variable that has no effect in this Script, it's only used by an Item Script later to check if the Weapon/PLayer's fists are equipped.
User avatar
Laura-Jayne Lee
 
Posts: 3474
Joined: Sun Jul 02, 2006 4:35 pm

Post » Tue Dec 29, 2009 10:07 pm

GetIsID is used to check if the calling reference is from a given base Object and must be called on a reference FormID (items in containers and inventories don't have reference FormIDs).

GetEquippedObject alredy returns a base object FormID, so you may just check if it is the object you want ("if PlayerWeapon == ZCDMSRReaver01")
User avatar
LittleMiss
 
Posts: 3412
Joined: Wed Nov 29, 2006 6:22 am

Post » Tue Dec 29, 2009 8:05 pm

GetEquippedObject returns a base object, not a reference, I think, so maybe "if PlayerWeapon == ZCDMSRReaver01"?

Right now, I think you're asking it to do a comparison to the base object of a base object.

edit: okay, my research took too long, but at least I was right about it.
User avatar
Jessie
 
Posts: 3343
Joined: Sat Oct 14, 2006 2:54 am


Return to IV - Oblivion