Jump to content

Need scripting help


Ranokoa

Recommended Posts

I've asked several people, no one seems to know the answer. It's a relatively simple script that goes to a triggerbox. Once the player passes through it, it disables the parent, which is the target. And once the player passes again it enables it.

 

Here's the script

 

scn RTrigZoneScript


short triggered
ref target

begin onTrigger player

if triggered == 0
	set target to getParentRef
	target.disable
	playsound AMBStoneShift

	set triggered to 1
elseif triggered == 2
	target.enable
	playsound AMBStoneShift

	set triggered to 3
elseif triggered == 1 || triggered == 3
	return
endif

end


begin gameMode

if triggered == 1
set triggered to 2
elseif triggered == 3
set triggered to 0
endif

end

 

can someone figure out why it won't work? It works half way. When passing through it does disable, but when passing again nothing happens, nothing changes. It refuses to run the second part and enable the parent again. Should be continuous, such as, you walk through, the carrot in front of you disables, you walk back, it enables, you walk through again it disables again, so on and so forth. This is a vital script absalutely essential to a mod I've spent quite a few hours on but it refuses to work. Before I can get much further, or playtest the mod whatsoever, this script needs to function. It hinders my progress, and even if everything somehow got done without it working the mod is still useless without the script to work.

 

Can someone please write either this one to work and or a script to detect if the state of the parent and give opposite enable status, like, if disabled then enable and visa versa. Either will do, idc how its written so long as its function is the same.

 

Be well, sleep well, fight well, live long.

~Ranokoa

Link to comment
Share on other sites

I think you have too much code for the thing you're trying to accomplish.

 

all you need is something like this

 

scn RTrigZoneScript

short triggered
ref target

begin onTrigger player

if triggered == 0
	set target to getParentRef
	target.disable
	playsound AMBStoneShift
	set triggered to 1
else 
	target.enable
	playsound AMBStoneShift
	set triggered to 0
end

Link to comment
Share on other sites

Goes along with that bit I PMed you about not making the same trigger zone do both an enable and disable action. Parented objects share the enable/disable state as eachother. So, when the parent is enabled, the trigger can be triggered, but when the parent is disabled, the triggerzone is also disabled, preventing the trigger from occurring. The system has an obvious drawback, which is why it seems to have been adjusted in the GECK for FO3, but can still be rather useful once you know about this behavior and can work around it. IE:

 

Two triggerzones, one initially enabled, one initially disabled. Both linked to the same parent object, but with the initially disabled one as having the "set Enable state opposite of parent" box checked. When triggered by the initially enabled one, the linked parent will be disabled, causing the initially enabled trigger to disable and the initially disabled trigger to enable. Just make sure you don't have them overlapping as this can cause a sort of strobe effect (followed by eventual crash) due to the constant enable/disable cycle.

Link to comment
Share on other sites

hehe.. how many people have you asked, man? Forget the piece of code I've sent you and listen to what Vagrant0 says.

 

Parented objects share the enable/disable state as eachother

That's why your script wasn't working and that's why mine won't work as well. The trick with two triggerBoxes sounds pretty easy, but I'll ask again the question I was asking you before, isn't possible to make an object with visible textures but with no collision so you pass though the object? Wouldn't this be easier?

Link to comment
Share on other sites

  • Recently Browsing   0 members

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