I need help with this player transport script
Because at any new level loading the fly going to a different height,
and the player weapon can't be moved up or down when he's in that transport mode.
I've used this adapted script for escape with a helicopter:
-- https://forum.game-guru.com/thread/213433?page=1#msg2529879
-- script by Smallg adapted for my game purpose
-- setting in the entity options at "Used = Player", and "if Used = UH-1escape"
-- Allows Player To ride a platform (or any entity) that moves from A to B in straight line (and then B to A / optional).
-- Make sure platform entity has the IfUsed properties field the same as its Name field
-- Orientate the entity's forward aspect towards the required direction of travel.
-- Set Static Mode to 'No'
-- Set Physics On to 'No'
-- Tested with "Floor (Mystery)" and other assets...
planes = planes or {}
SndPlaying = SndPlaying or {}
--adjust these two fields for the speed of the platforkm and how far it needs to move to get the playe from A to B
local platformSpeed = 300
local distanceToTravel = 8100
local oneWayTrip = 1 -- set to 1 if Player can move from B to A once at B from A
local distanceTravelled = 0
local state = 0
local initialX = 0
local initialZ = 0
--local timer = aTimer:new(e) -- initialize timer (doesn't need in this case, but I'm not sure)
function heli_escape_init(e)
end
function heli_escape_main(e)
planes[e] = planes[e] or {} --initialize plane (helicopter) data
planes[e]['speed'] = planes[e]['speed'] or 150 + math.random(150,151) -- set helicopter speed (100-200)or greater
planes[e]['takeoffspeed'] = planes[e]['takeoffspeed'] or 150 -- set takeoff speed
PlayerDist = GetPlayerDistance(e)
if PlayerDist < 1600 then
--timer:start() -- start timer(!?!)
LoopSound(e,0)
end
--Prompt(state .. " " .. distanceTravelled .. " " .. distanceToTravel)
if PlayerDist < 250 and state == 0 then
state = 1 -- start moving platform with player associated to it
GravityOff(e)
CollisionOff(e)
MoveUp(e, planes[e]['takeoffspeed'] - (planes[e]['takeoffspeed'] *3) ) -- first fly height, not sure...
--this is more fly height
MoveUp(e, planes[e]['takeoffspeed'] *373) -- go at your desidered flying height
-- I've used the same weapon crosshair fly height with a bell of the church,
-- because in the transport mode can't move up or down any weapon, you can just rotate with your weapon...
initialX = g_Entity[e]['x']
initialZ = g_Entity[e]['z']
--MoveUp(e,1) --this is not neeeded in my case
SetRotation(e,0,0,0) --the heli flying direction
--MoveForward(e,100)--this is not neeeded in my case
end
if state == 1 then
TransportToIfUsed(e)
MoveForward(e,platformSpeed)
--PlaySound(e,0)
distanceTravelled = g_c2c_distance(initialX,initialZ,g_Entity[e]['x'],g_Entity[e]['z'])
if distanceTravelled >= distanceToTravel then
GravityOn(e)
CollisionOn(e)
state = 2
end
return
end
if state == 2 and PlayerDist > 500 and oneWayTrip == 0 then
state = 0
platformSpeed = platformSpeed * -1
distanceTravelled = 0
end
end
function g_c2c_distance(x1,z1,x2,z2)
--get horiz distance from one set of coords to another
tPlayerDX = (x2-x1)
tPlayerDZ = (z2-z1)
return math.sqrt(math.abs(tPlayerDX^1)+math.abs(tPlayerDZ^1));
end
I have no clue what is wrong in this script
Can do you help me please ? I need to got the same flying height or to I can move my weapon up-down,
and the player can shoot it the enemy placed on that church.
Thanks in advance.
Here is a short video example where you can see the different flying height at every level restart:
Smile today, tomorrow could be worse
http://bestradiolarry.ro/fps/
"The best forum, game software, operating system or web platform, it's that software which can give you most of the features and speed, not just amazing graphics."