Hello,
I'm sorry in advance if French my English is not so good: /
I had an idea of ??LUA script for the player to drive a vehicle.
TheGameCreators we decided to set this option as 2015 target though perhaps we can work together on a nearly identical system.
I thought of a simple design but I'm not very good at LUA script ... So if anyone want to help and share the final LUA script we can move faster on the idea
To explain quickly the idea of ??LUA script to create and its function is what he will spend:
1 - were placed in a vehicle GameGuru (dynamic).
2 - We will assign the famous LUA script drivecar.lua
3 - In the game when the player approaches the vehicle it displays a message "Press E to use the vehicle."
4 - The player presses "E": the player's camera is placed in front of the vehicle (and of course turned in a good way)
5 - The Player Configuration "Player Start" changes to "Speed" where you would put the value of "250"
6 - When the player advances (with Z or W depending on your keyboard) then the object dynamic vehicle behind the player will follow. Do you understand? It's a bit like if interconnects the player and the vehicle. When the player moves can even put a car engine sounds via the LUA script.
I said that everything done by the player will move will be transcribed on the vehicle.
7 - When the player want to go out there pressed again "E". The player's configuration reverts to "Speed ??= 100" and off the vehicle (at the link).
8 - The player can continue to walk again.
The only problem will be the footsteps of the player but must be removed (otherwise it is very inconvenient for now).
It could be based on the script "door.lua" to enter or exit the vehicle through the interaction of the "E" key on the keyboard.
I create an image editing so you can better see the original idea for the LUA script:
drive_pressed = 0
function drivecar_init(e)
end
function drivecar_main(e)
PlayerDist = GetPlayerDistance(e)
if PlayerDist < 100 and g_PlayerHealth > 0 then
GetEntityPlayerVisibility(e)
if g_Entity[e]['plrvisible'] == 1 then
if g_Entity[e]['activated'] == 0 then
if g_Entity[e]['haskey'] == -1 then
SetActivated(e,1)
else
if g_Entity[e]['haskey'] == 1 then
Prompt("Press E to use the car")
if g_KeyPressE == 1 then
SetActivated(e,1)
end
else
Prompt("The car is closed. First find the key to open it.")
end
end
else
if g_Entity[e]['activated'] == 1 then
-- door is unlocked and closed
Prompt("Press E to use the car")
if g_KeyPressE == 1 and g_Entity[e]['animating'] == 0 and door_pressed == 0 then
-- SetAnimation(0)
-- PlayAnimation(e)
g_Entity[e]['animating'] = 1
SetActivated(e,2)
ActivateIfUsed(e)
-- PlaySound(e,0)
StartTimer(e)
-- DRIVECAR = Here are the codes to create ideas :
* It moves the player to the entity (to the hood of the car)
* It is said the entity to perform the same movements as the player
* We modify the player in "Speed = 250" that he moves faster
drive_pressed = 1
end
else
if g_Entity[e]['activated'] == 2 then
-- door collision off after 1 second
if GetTimer(e)>1000 then
-- CollisionOff(e)
end
-- door is open
if g_KeyPressE == 1 and g_Entity[e]['animating'] == 0 and door_pressed == 0 then
-- SetAnimation(1)
-- PlayAnimation(e)
g_Entity[e]['animating'] = 1
SetActivated(e,1)
-- PlaySound(e,1)
-- CollisionOn(e)
-- DRIVECAR = Here are the codes to create ideas :
* It is said the entity to NOT follow the player's movements
* We modify the player's configuration "Speed = 100"
drive_pressed = 1
end
end
end
end
end
end
if g_KeyPressE == 0 then
drive_pressed = 0
end
end
I do not know if I made the right choices at the right place in the LUA script, but you can improve the way you want.
I do not know if we can develop this kind of script but actually, from what I've seen, it's quite simple (except maybe the player's position put before the hood of the car is déclicat enough ...).
The trouble is that I learn slowly LUA programming and I am very far from being able to do that. That's why more than we could conceive faster this type of script
Thank you to all those who have ideas or who want to work on this type of script
Of course I will try to create this script slowly and I hope to get there and share it free for all.
Good day to all,
Best Regards,
DevCore35