Hi Guys,
Along with everyone else (well, that\'s what it looks like from reading through old posts) I\'ve been thinking about the vehicle scripting possibilities in FPSC.
I took a look at Les Horribres script, and Xplosys lift script, and have been getting my head round the difficulties faced in getting the vehicle/platform to move up and down, as well as backwards and forwards.
My understanding is that it all comes down to the physics engine...
By scripting the .fpe to make the entity a character (enemy) you can use the scancodekeypressed function to issue movement commands:
movefore=1, movefore=-1, rotateiy=3 etc etc.
This is fine until you want to move up or down, at which point you have to turn collison off (coloff) so the player doesn\'t block the lifts upwards movement, and instead of relying on the lifts surface to move the player (because collision is off) you have to use associateplayer so that the player accompanies the lift in its upwards movement. The problem is that the associateplayer command doesn\'t seem to function with the movefore command...
Thinking about it as if it was real life, I thought that perhaps the reason the lift couldn\'t move up with collision on and the player standing on it was because it could not produce enough energy to lift the player.....in a rather silly eureka moment, I decided to increase the virtual mass of the platform, to see if I could trick the physics engine into re-calculating the energy behind the upwards movement...Setting the physics weight of the platform to a ridiculously high value allowed me to use the scancodekey command, with collision on and without using associateplayer to execute the moveup command.
It still doesn\'t let me move the platform sideways once it\'s off the ground, but it\'s given me a few ideas for \"tricking\" the physics engine in the DB source code.
Ok....edited \'cos I realised I was being stupid...the answer was in Les Horribres script all along.....nogravity
whack the physics weight of the entity/paltform up to a really high level to push the character up when he stands on the platform, but turn gravity off for the entity/platform so when it\'s up, it doesn\'t fall down! Collision is still on, so you don\'t need to use associateplayer, and the player will still be able to stand on it as it goes along.
Does this help anyone else (or am i just behind the times and its common knowledge?)
Thanks to Les Horribres and Xplosys for posting clear and logical scripts that really helped me to understand how the language works.