Game Development Community

Move player from here to there- How?

by Mike Rowley · in Torque Game Engine · 09/16/2007 (4:02 pm) · 2 replies

I have a trigger that is supposed to move the player back to the start point when entered.
Here's my code:
Parent::onEnterTrigger(%this,%trigger,%obj);
   //%pos = $Player.setPosition("248.59 -162.475 226.602"); //Doesn't work
   %trans = %Player.getTransform();
       %rot = getWord(%trans, 3)
          SPC getWord(%trans, 4)
          SPC getWord(%trans, 5)
          SPC getWord(%trans, 6);
        %Player.setTransform("248.59 -162.475 226.602" SPC %rot );
    echo("\nEntering trigger area");

This isn't working. How can I move a player from position 1 to position 2 in a trigger? I've searched every word and sentance I can think of, but have found nothing on player transform.

I am getting the following in the console:
game/server/scripts/moveItTrigger.cs (29): Unable to find object: '' attempting to call function 'getTransform'
game/server/scripts/moveItTrigger.cs (34): Unable to find object: '' attempting to call function 'setTransform'

Any ideas?

#1
09/16/2007 (4:23 pm)
This looks a lot like what your doing already all I had to type into the search box was "teleport"
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=2930

Maybe it can help you.

Also from the looks of it, %player should probably be %obj but I'm not sure without testing it further.
#2
09/16/2007 (6:00 pm)
I added your files and attempted it. I made 2 triggers. (like you did and named them the same as you did. (TeleportTrigger1 and TeleportTrigger2) Walked thru one, but it did nothing more than showing the bottom print.
Here's the console log:

Teleport client: 1543
Mapping string: bottomprint to index: 13
TeleportTrigger::onLeaveTrigger called!

It looks like the onEnterTrigger isn't getting called?