Page 1 of 1

scripted elevator problems.

Posted: Mon Jan 01, 2007 6:30 pm
by rgdyman
Hey all.. hope everyone had a great holiday season :)

I could really use a helping hand with my scripted elevator if anyone has a minute or two. What I have thus far is this...
1) elevator act file up and running.

2) I have the script points in place ( 4 floors)

3) In the script I have it so the player can chosse what floor he/she wants and away the elevator goes. Going up works perfect. It will stop at the proper floor run all the animations through and the such.

Here's the problem. When the elevator goes down it will stop at the wrong location. It will be up to far. The right floor and all but not at the script point spot. It seems to get close and stop. The script is running in High and low.

Would anyone have any ideas how to fix this ? Cause Im stumped. :D

Posted: Tue Jan 02, 2007 10:30 am
by Juutis
First of all, posting the script would really help. :P

The only thing I can think of is that the script thinks it is 'close enough' to the scriptpoint and stops.
I could probably say a lot more if you posted the script.

Posted: Tue Jan 02, 2007 10:53 am
by rgdyman
Here it is. :) TY for the help. .


SetUp[()
{
AttachCameraToEntity(self.EntityName,"");
PlayerMatchAngles(self.EntityName);
ShowText(1,"","","Floor?",8,"",350,275,"",255);
ShowText(2,"","","1 2 3 or 4",8,"",330,300,"",255);
PDIS=self.distancetopoint;
if(self.key_pressed=1)
{
FloorPoint=1;
RemoveText(1);
RemoveText(2);
HighLevel("Up2");
}
if(self.key_pressed=2)
{
FloorPoint=2;
RemoveText(1);
RemoveText(2);
HighLevel("Up2");
}
if(self.key_pressed=3)
{
FloorPoint=3;
RemoveText(1);
RemoveText(2);
HighLevel("Up2");
}
if(self.key_pressed=4)
{
FloorPoint=4;
RemoveText(1);
RemoveText(2);
HighLevel("Up2");
}
}]

Up2[()
{
Gravity(false);
SetNoCollision();
AnimationSpeed(0.6);
BoxWidth(1);
Delay("",1.0,"");
PlayAnimation(closing,true,"E_Door.wav");
PlayAnimation(closed,true,"");
SetEventState("shakeing",true);
NewPoint(FloorPoint);
MoveToPoint("",25,"elevator.wav");
SetEventState("shakeing",false);
Delay("",4.0,"");
PlayAnimation(opening,true,"E_Door.wav");
PlayAnimation(open,true,"");
Delay("",2.0,"");
LowLevel("SetUp");
Return();
}]

Posted: Tue Jan 09, 2007 5:00 pm
by Juutis
Sorry for being so slow, but I haven't had much free time.

Your problem here is indeed very weird! It seems that the MoveToPoint() command ignores the Y-distance to the script point. If you place two script points so that the other one is exactly over the other (X and Z are same, but Y is different) the pawn won't move at all with MoveToPoint() :!: If the script points are not exactly on top of each other, then the pawn will move a little, but won't reach the script point. I think it's a bug of some sort. I tried looking into the source code, but heck, I'm no programmer and I can't really say if there's something wrong with the code.. :?

I don't think the problem is in the 'moving' part because if there is difference in the X or Z coordinates, the pawn will move up/down too.
So could it be because Y-distance isn't taken to account when calculating the distance to the script point, or something like that?

Posted: Tue Jan 09, 2007 9:25 pm
by rgdyman
Well.. I have to admit that when it comes to source code its completely german to me.. :P

So all I ended up doing was add a TeleportToPpoint command in the script.
Its a little choppy and amature looking.. :P,, but.... it works.

Since I cant code in the source code to save my life... It will do. lol

( beggers cant be choosers)

thanks for the time and help anyway, juutis.

rgdyman