Jump to content

Need Help with Scripting


Cartie3

Recommended Posts

Hey,

 

I'm just looking for some help with an attempted script I'm trying to make. I want to make a locked door open when I destroy a generator. I have linked the door to the generator and tried writing a script to make this happen but it always comes up with an error.

 

If anyone can provide assistance I would be grateful.

 

Edit: When I say generator, I mean one of the destructible electrical boxes.

Edited by Cartie3
Link to comment
Share on other sites

If the electrical box/generator has destruction data (look for 'Edit Destruction Data' in the object's record), then you can use OnDestructionStageChange to execute a command that will open the door once the electrical box is at the appropriate 'Damage Stage'. Something like:

begin OnDestructionStageChange  

	if GetDestructionStage == 3
		YourDoorREF.SetOpenState 1
	endif 

end
Link to comment
Share on other sites

scn yourscriptname

ref linkeddoor
short runonce

begin GameMode

set linkeddoor to getlinkedref

if runonce == 0
if getdestroyed
linkeddoor.unlock
set runonce to 1
endif
endif

end
 

p.s.: use this script in the e-box

Edited by nonplusultra
Link to comment
Share on other sites

  • Recently Browsing   0 members

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