Jump to content

Container Script Help!


MarchUntoTorment

Recommended Posts

Hello all,

 

I'm very new to scripting, although not to modding as a whole.

 

I'm looking to create a script that will enable a crate containing a set of armour when, and only when, a certain stage in a certain quest is reached. The crate is, by necessity, located in a location traversed a few times prior, and I don't want the crate appearing then. The intention is to place a Primitive Form at the entrance to the building, and have the form check the player for the necessary variable each time.

 

Of course, given how abysmal I am with scripting, I'm not getting anywhere - it's refusing to save (I assume because there's an error in it), and I don't know why.

Please help!

SCN UniqueTeslaCrateScript

BEGIN OnTriggerEnter player
	If GetStage MQ11 == 50
			Enable UniqueTeslaArmorCrate
		Else
		If GetStage MQ11 == 60
			Enable UniqueTeslaArmorCrate
		Else
			Disable UniqueTeslaArmorCrate
	EndIf

END

Could someone please tell me what I'm doing wrong here? Any help would be much appreciated :)

 

Best regards,

- MarchUntoTorment

Link to comment
Share on other sites

  • You're missing an EndIf statement. Every If statement, without exception, must be accompanied by a closing EndIf statement.

You're using Enable and Disable wrong.

  • First, they are reference functions and need to be called directly on a reference using dot notation, like this: UniqueTeslaArmorCrateREF.Enable.

Second, you need to use the editor ID of the reference you've placed in the world, not the editor ID of the base form. Reference forms do not have an editor ID by default, you need to give it to them.

Third, the reference need to be persistent for the script to use it.

Link to comment
Share on other sites

Thanks for the advice, Ladez!

 

Anyway, I followed your advice - double-clicked on the placed object and gave it a reference, then checked 'persistent reference'. I also followed your instructions with relation to how to make it work.

 

However, most likely because I'm an idiot, it's still not working.

 

Here's the revised script:

SCN UniqueTeslaCrateScript

BEGIN OnTriggerEnter player
	If GetStage MQ11 == 50 OR If GetStage MQ11 == 60
		UniqueTeslaArmorCrateREF.Enable
	EndIf
	Else
		UniqueTeslaArmorCrateREF.Disable

END

Any idea what's still wrong? I think I followed your instructions right... I tried putting the Else inside my If block, but that didn't get me anywhere.

 

Help would be greatly appreciated!

Edited by MarchUntoTorment
Link to comment
Share on other sites

  • There's no such thing as OR, the correct expression is || (two vertical lines. Similarly, in place of AND you would have to use &&.)
  • The first If denotes everything down to the closing EndIf as an if-block, so using If again is incorrect.

Fixing those two things should allow you to move the else-block inside the if-block where it belongs.

SCN UniqueTeslaCrateScript

BEGIN OnTriggerEnter player
	If GetStage MQ11 == 50 || GetStage MQ11 == 60
		UniqueTeslaArmorCrateREF.Enable
	Else
		UniqueTeslaArmorCrateREF.Disable
	EndIf
END
Edited by Ladez
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...