Move object back to parent 'game' (SOLVED)

Simple question but it's stumping me, after moving an item from parent game to a room for testing, how do I move it back to parent 'game'? In the GUI when you click on 'move' there isn't a 'game' option.

Thanks.


If your object is named widget:

To move widget to game (in Code View):

widget.parent = game


Or, in GUI, just use the RemoveObject script, if it doesn't matter if the widget is actually moved togame or simply removed from play.

You can still bring it back, just like when it's parent is game.

NOTE: If you ever run a script to check whether widget.parent = game, you will not want to employ the RemoveObject method.


thanks, but how do I do this in the online editor?


I just thought of that and edited the post, but you can use the Remove object option.

NOTE: If you ever run a script to check whether widget.parent = game, you will not want to employ the Remove object method.

The Remove object option is under Objects in Add New Script:

image


Or, you could select Code View rather than Add New Script, and paste the line to move the widget to the game, like so:
image


For anyone else reading this the problem is now solved, I wasn't clear enough with my question, I wanted to move the object within the code not within the game play, the solution was to copy it and then paste it into 'game' parent. For some reason there is no 'game' option when you click the 'move' button.


Oh, I see now!

You clicked on the object in the editor, then clicked MOVE, and you have no option to move it to GAME!

image


setting the 'paren't Object reference/pointer Attribute to 'null' does the same thing: set's the parent to the GAME OBJECT (which is the 'asl' tags):

<object name="npc">
  <attr name="parent" type="object">null</attr> // this is not shown by quest when it's already not within another Object, as seen here // the npc is NOT contained within another Object (not contained within the 'room' Object), as it's contained within the GAME OBJECT: <asl></asl>
</object>

// ------------------------------

<object name="room">
  <object name="npc">
    <attr name="parent" type="object">room</attr> // this is not shown when it's already nested in-code like this, as seen here // the npc IS contained within the 'room' Object
  </object>
</object>

 // -----------------------

<object name="room">
</object>

<object name="npc">
  <attr name="parent" type="object">room</attr> // the npc is contained within the 'room' Object // this is the same as if it was nested in-code within the room too
</object>

as for the in-code scripting:

npc.parent = null
npc.parent = room


as for the GUI/Editor's scripting:

run as script -> add new script -> 'variables' section/category -> 'set a variable or attribute' Script -> (see below)

set variable npc.parent = [EXPRESSION] null
set variable npc.parent = [EXPRESSION] room


the 'RemoveObject (NAME_OF_OBJECT)' Function is a helper function that sets the Object's 'parent' Object reference/pointer Attribute to 'null' for you.


This topic is now closed. Topics are closed after 60 days of inactivity.

Support

Forums