MoveObjectHere Question [Solved]

So I know about

MoveObjectHere

But I was wondering if there a...

CloneAndMoveObjectHere

I ask because there is a.
CloneAndMoveObject
and
CloneObject
as well as
MoveObject

Anyone know?


no, there isn't. But you can easily create your own function.

  <function name="CloneObjectAndMoveHere" parameters="object" type="object">
      return (CloneObjectAndMove(object, player.parent))
  </function>

Withdrawn


  <function name="CloneObjectAndMoveHere" parameters="object" type="object">
      return (CloneObjectAndMoveHere)
  </function>

Would this function work as well? And if it was put into another Function?


um Anonynn, you've called a function, but not told it what to do. Let's translate this:

return (CloneObjectAndMove(object, player.parent))
........................^^^^^.....................^^.............^^^^^^
...........Use Which function....Do What....Who Owns

If you just do this:

return (CloneObjectAndMoveHere)

All you did was tell the game to try to run a function. The word "return" is a command to the game to expect a value to come back after the function runs.

But you didn't tell it what object to clone (The first part of the function -> CloneObject)
And you didn't tell it who owns the object (the second part of the function ->AndMoveHere)

So the game will try to call the function, and it'll probably crash with some kind of funky error.

Kinda like me saying "Add two numbers and give me a sum" but not telling you which two numbers to add.


Well, the original code in my "EnemyLoot Function" was...

MoveObjectHere (small_health_potion) ---- for example. 

But I'm changing all my object scripts to clone's and having them handle "this" instead of the original object. All of that is done.

Unfortunately, when I changed the scripting in the "EnemyLoot Function"

 CloneObject (small_health_potion)

It can't and doesn't move the item into the player's current room. "Here" refers to the location of the player's current room. But there is no code in Quest that can move a clone to the player's current room. That's essentially what I'm trying to figure out.

I was thinking...

CloneObject (small_health_potion) 
MoveObjectHere (this)

But I doubt that'll work.


MoveObjectHere assigns the parent of the object to be game.pov.parent.

game.pov should be the room you are in.

So try:

function name="CloneObjectAndMoveHere" parameters="object" type="object"
return (CloneObjectAndMove(object, game.pov.parent))
/function


This should work, too:

x = CloneObject (small_health_potion) 
MoveObjectHere (x)

Awesome! I'll try out both and see which I like best. Thank you guys ^_^

So I tried Pertex's first simply because it was easier/quicker to implement and it worked out great. ^_^ Thank you Pertex, and thank you Crystal.

Anonynn.


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

Support

Forums