This should be easy :(

Post » Mon Mar 14, 2011 8:59 pm

I'm an experienced modder (with the GECK), but when it comes to scripting I'm terrible. I'm trying to make a switch that opens and closes a door when pressed, but I honestly don't know how to go about this. Here is what I have so far:

scn BLAHBLAHBLAHref myActionRefBegin OnActivate        if IsActionRef player == 0                set myActionRef to getActionRef                if myActionRef.getav variable01 == 0                        setopenstate 0                else                        setopenstate 1                endif        endifEnd


This script will only close the door when it's open (I used the console to open the door in-game and then pressed the switch). How do I fix this?

Thanks for reading.
User avatar
Pat RiMsey
 
Posts: 3306
Joined: Fri Oct 19, 2007 1:22 am

Post » Mon Mar 14, 2011 8:42 pm

Try reposting using the [code] tag and indentation.
The main problem I can see is you're checking for variable01 for no obvious reason. GetOpenState on your door would make far more sense if you want to, y'know, toggle the open state.
User avatar
Mari martnez Martinez
 
Posts: 3500
Joined: Sat Aug 11, 2007 9:39 am

Post » Mon Mar 14, 2011 6:43 pm

Thanks for replying. Sorry for my late reply.

Here it is. I got it from GECK.gamesas.com:

scn BLAHBLAHBLAHref myActionRefBegin OnActivate	if IsActionRef player == 0		set myActionRef to getActionRef		if myActionRef.getav variable01 == 0			setopenstate 0		else			setopenstate 1		endif	endifEnd

I've placed the script onto the door, and from the door I added the switch to the doors "Active parent". I'm planning on using the script on multiple objects, so I can't use references.
User avatar
Naazhe Perezz
 
Posts: 3393
Joined: Sat Aug 19, 2006 6:14 am

Post » Tue Mar 15, 2011 5:03 am

Yes, you should probably try and understand what the script is doing. It's looking for Variable01 on the action ref (which will be the activate parent, your switch). That's not being set by anything to anything useful, so the line's clogging things up. You want to use GetOpenState instead.
User avatar
Marine x
 
Posts: 3327
Joined: Thu Mar 29, 2007 4:54 am


Return to Fallout: New Vegas