Pawn as a Vehicle

Topics regarding Scripting with Reality Factory
Post Reply
User avatar
creekmonkey
Posts: 116
Joined: Tue Oct 23, 2007 2:55 pm

Pawn as a Vehicle

Post by creekmonkey » Wed Apr 23, 2008 10:33 pm

Is it possible to make a pawn a vehicle that you can actually ride on?

I have a pawn that moves from point to point. I attached a StaticMesh entity to it, but when the player collides with it the pawn stops moving. Is there a thread or tutorial that would point me in the right direction? I have searched the forum but cant seem to find anything that will help?

User avatar
metal_head
Posts: 1244
Joined: Sat Jan 05, 2008 8:31 pm
Location: Bulgaria,Sofia
Contact:

Re: Pawn as a Vehicle

Post by metal_head » Fri Apr 25, 2008 7:50 am

there's the gen1car.s script,which can be used for a mountable vehicle

User avatar
vrageprogrammer
Posts: 566
Joined: Wed Oct 31, 2007 2:59 pm
Location: On top of a tree
Contact:

Re: Pawn as a Vehicle

Post by vrageprogrammer » Fri Apr 25, 2008 2:38 pm

Which doesn't work.
It was not Possible to determine the dimensions of the image....

User avatar
creekmonkey
Posts: 116
Joined: Tue Oct 23, 2007 2:55 pm

Re: Pawn as a Vehicle

Post by creekmonkey » Fri Apr 25, 2008 8:36 pm

I am able to get the generic car script to work. But its not exactly what I need. I need a vehicle similar to a train that moves along a defined path, with the player onboard always facing the front of the train.

Need
1 to mount the vehicle
2 vehicle move along defined path
3 Player and camera to rotate with vehicle

I have been able attach a camera to the vehicle and move it from script point to script point. But the camera does not rotate with pawn, any suggestions why?

User avatar
Graywolf
Posts: 75
Joined: Mon Apr 14, 2008 8:36 pm
Location: Anchorage, Alaska
Contact:

Re: Pawn as a Vehicle

Post by Graywolf » Sat Apr 26, 2008 8:49 pm

How are you attaching the camera?
"So, what's the life of a programmer like?" "...Huh? What life?!"

RF System X:
http://www.realityfactory.info/forum/vi ... f=9&t=3599

User avatar
creekmonkey
Posts: 116
Joined: Tue Oct 23, 2007 2:55 pm

Re: Pawn as a Vehicle

Post by creekmonkey » Sun Apr 27, 2008 12:28 am

I have used

AttachCamera();
and
AttachCameraToBone();

both with the same result. Camera attaches but when pawn rotates the camera either keeps its original rotation and doesnt rotate at all, or sometimes it will rotate a little, maybe 45 degrees but in the wrong direction.

I have also tried adding
self.ideal_yaw=self.player_yaw;
ChangeYaw();

with no visible results.

Danimita92
Posts: 335
Joined: Sat Feb 09, 2008 5:47 pm
Location: Lanzarote/Canary Islands/Spain

Re: Pawn as a Vehicle

Post by Danimita92 » Sun Apr 27, 2008 2:28 pm

I think to do that last thing you've got to equalize the player's rotation to the pawn's rotation with
PlayerMatchAngles(char *szEntityName );

User avatar
Graywolf
Posts: 75
Joined: Mon Apr 14, 2008 8:36 pm
Location: Anchorage, Alaska
Contact:

Re: Pawn as a Vehicle

Post by Graywolf » Sun Apr 27, 2008 10:08 pm

Since you're attaching the camera, I'm assuming this is in third-person...

I don't have have my docs handy(I'm at the library at the moment.) so you'll have to look up the specific paramaters, but...

I'd approach that like this:

1. Create a dummy pawn, turn off it's collision and rendering, and attach a fixed camera to it.
2. Do an AddTriggerOrder to check a trigger for the player boarding the vehicle(This trigger could also switch the camera.).
3. When the trigger is tripped, have the pawn drop to low level, and use PositionToPlayer (I think that's the command, please don't hate me if I'm wrong...), and set the offsets and match angles flag for what you need.

But, that's just me... And 10-to-1, that's probably the hard way. I have a bad habit of finding those. I hope this helps.
Last edited by Graywolf on Tue Apr 29, 2008 5:45 pm, edited 1 time in total.
"So, what's the life of a programmer like?" "...Huh? What life?!"

RF System X:
http://www.realityfactory.info/forum/vi ... f=9&t=3599

User avatar
creekmonkey
Posts: 116
Joined: Tue Oct 23, 2007 2:55 pm

Re: Pawn as a Vehicle

Post by creekmonkey » Mon Apr 28, 2008 2:29 am

Well when i use the AttachCamera() command it appears as first person with the weapon showing. It seemed the actor i used for the pawn, created in milkshape was the problem. I made a new actor, a simple box for testing and the camera rotation worked.

Graywolf's approach sounds promising, and would probably give more control. Ill have to experiment and figure out the exact commands and see where it leads.

I also thought about a moving platform, but it seems the moving platform has limitations as to how far it would travel.

User avatar
darksmaster923
Posts: 1857
Joined: Wed Jan 03, 2007 10:32 pm
Location: Huntington Beach, California, USA
Contact:

Re: Pawn as a Vehicle

Post by darksmaster923 » Mon Apr 28, 2008 6:52 am

you have to have self.yaw_speed = 10000;
Herp derp.

User avatar
blutwurstchen
Posts: 57
Joined: Wed Mar 19, 2008 8:51 pm

Re: Pawn as a Vehicle

Post by blutwurstchen » Fri Mar 13, 2009 2:12 pm

I am trying to do something similar with an enclosed vehicle, that starts moving automatically along a fixed path once a player gets in.

The vehicle will be animated (its a horse-drawn carriage), so is it possible for this to be a pawn?

During the time it is moving, the character should be free to move around, but not get out. I would like the controls to be via conversation (with the driver). How should I start something like this?

Post Reply