Jump to content

problems enabling/disabling parent objects via script


Recommended Posts

Ok, I'm annoyed, hence why I'm now posting :)

 

I have 10 separate references of a small house boat in various places around Cyrodiil. I have the doors of each reference lead inside a common interior cell (the inside of the boat) The boat starts parked and enabled in one spot. When you go to drive the ship, a menu asks where you wanna go, and you select where to go. The script then enables the destination parent ref (including the doors inside the boat which lead to the correct exterior) and moves the player to the destination ship helm and then disables all the other ship parent references and resets the overall state of the script. problem is that the script doesn't seem to be RE-disabling or enabling the parent refs and their child objects. Here's the code:

 

ScriptName CRboatscript

Short button
Short controlvar

Begin OnActivate
if Controlvar == 0
	Messagebox "Where would you like to travel?" "Leyawiin" "Draklowe farm" "Imperial City" "Bravil river" "Anvil Bay" "Firid river" "Jerral Mountains" "Lake Arrius" "Fort Rayles" "cancel"
	set controlvar to 1
else
	return
endif
end

Begin GameMode

if controlvar == 1
	set button to getbuttonpressed	
		if button == 0 					;Leyawiin
			CRB01.enable
			player.moveto CRleyawiinhelm
			CRB02.disable
			CRB03.disable
			CRB04.disable
			CRB05.disable
			CRB06.disable
			CRB07.disable
			CRB08.disable
			CRB09.disable
			set controlvar to 0				
		elseif button == 1				;Draklowe
			CRB02.enable
			player.moveto CRdraklowehelm
			CRB01.disable
			CRB03.disable
			CRB04.disable
			CRB05.disable
			CRB06.disable
			CRB07.disable
			CRB08.disable
			CRB09.disable	
			set controlvar to 0
		elseif button == 2				;Imperial city
			CRB03.enable
			player.moveto CRICwaterfronthelm
			CRB01.disable
			CRB02.disable
			CRB04.disable
			CRB05.disable
			CRB06.disable
			CRB07.disable
			CRB08.disable
			CRB09.disable	
			set controlvar to 0
		elseif button == 3				;Bravil river
			CRB04.enable
			player.moveto CRbravilhelm
			CRB01.disable
			CRB02.disable
			CRB03.disable
			CRB05.disable
			CRB06.disable
			CRB07.disable
			CRB08.disable
			CRB09.disable	
			set controlvar to 0
		elseif button == 4				;Anvil
			CRB05.enable
			player.moveto CRanvilhelm
			CRB01.disable
			CRB02.disable
			CRB03.disable
			CRB04.disable
			CRB06.disable
			CRB07.disable
			CRB08.disable
			CRB09.disable	
			set controlvar to 0		
		elseif button == 5				;Skingrad firid river
			CRB06.enable
			player.moveto CRskingradhelm
			CRB01.disable
			CRB02.disable
			CRB03.disable
			CRB04.disable
			CRB05.disable
			CRB07.disable
			CRB08.disable
			CRB09.disable	
			set controlvar to 0			
		elseif button == 6				;Jerral mts - cloud ruler
			CRB07.enable
			player.moveto CRCRThelm
			CRB01.disable
			CRB02.disable
			CRB03.disable
			CRB04.disable
			CRB05.disable
			CRB06.disable
			CRB08.disable
			CRB09.disable	
			set controlvar to 0
		elseif button == 7				;lake arrius - cheydenhal area
			CRB08.enable
			player.moveto CRarriushelm
			CRB01.disable
			CRB02.disable
			CRB03.disable
			CRB04.disable
			CRB05.disable
			CRB06.disable
			CRB07.disable
			CRB09.disable	
			set controlvar to 0
		elseif button == 8				;Fort Rayles - chorral area
			CRB09.enable
			player.moveto CRrayleshelm
			CRB01.disable
			CRB02.disable
			CRB03.disable
			CRB04.disable
			CRB05.disable
			CRB06.disable
			CRB07.disable
			CRB08.disable
			set controlvar to 0
		elseif button == 9				;cancel
			return
	endif
endif
end

 

-All child objects are persistent and not initially disabled (though their parent object is which is fine).

-The child objects do not have REF ID's other than the doors inside the boat (which are children to the parent objects which are being controlled directly... is it an issue to have child objects with REF ID's?).

-Once I use the activator, the new reference items appear but the old ones do not disable again like they should

-If I fast travel back to the old REF which SHOULD have been disabled, the boat is still there (but shouldn't be) but the activator no longer functions but the doors still link properly into the interior space

-The doors inside the interior continue to spawn, but old doors also remain which really screws things up

 

I am assuming that it is possible to enable and disable a parent ref and it's children multiple times back and forth right? I mean I know it works with direct REF ID control as I have another part of my mod control interchangeable references but it uses REF ID's for ALL objects being controlled.

 

 

So any clues?

Edited by icecreamassassin
Link to comment
Share on other sites

button is a short variable which is assigned to the "Getbuttonpressed" call, the value of which is determined by the message box selections. The first item is 0, the second is 1, the third is 2, etc. it's just faster to write "button" in the script instead of using "getbuttonpressed" every time
Link to comment
Share on other sites

  • Recently Browsing   0 members

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