--[[ LUA Script converted from FPSC to GameGuru by M.Fowler (c) 2017 Original FPI file can be found under: C:\Program Files (x86)\The Game Creators\FPS Creator\Files\scriptbank\lift1.fpi added TransportToIfUsed(e) to if... liftstate == 1 and if ... liftstate == 4 lines modified GetPlayerDistance(e) < 30 ->> GetPlayerDistance(e) < 50 modified MoveUp(e,1) ->> MoveUp(e,50) modified MoveUp(e,-1) ->> MoveUp(e,-50) modified liftstate to liftliftstate ]] --[[ desc = Auto Lift (Up and Down) (activate brings lift to plr) ]] liftstate = {} ; function lift1_init(e) liftstate[e] = 0 ; end function lift1_main(e) if liftstate[e] ~=nil then if liftstate[e] == 0 and (g_PlayerPosY - g_Entity[e]['y']) > 10 and GetPlayerDistance(e) < 50 then liftstate[e] = 6 CollisionOff(e) end if liftstate[e] == 1 then TransportToIfUsed(e) -- added MoveUp(e,50) -- modified from 1 end if liftstate[e] == 1 and RAYCASTUP(e, g_Entity[e]['x'], g_Entity[e]['y'], g_Entity[e]['z'], 20, 100, e)==1 then CollisionOn(e) -- added liftstate[e] = 2 end if liftstate[e] == 2 and GetPlayerDistance(e) > 85 and PLAYERASSOCIATED(e)==1 then -- modified from 35 to 85 liftstate[e] = 3 UNASSOCIATEPLAYER(e) CollisionOn(e) end if liftstate[e] == 3 and (g_PlayerPosY - g_Entity[e]['y']) > 30 and GetPlayerDistance(e) < 50 then -- modified from 10 to 30 liftstate[e] = 7 CollisionOff(e) end if liftstate[e] == 4 then TransportToIfUsed(e) -- added MoveUp(e,-50) -- modified from -1 to -50 end if liftstate[e] == 4 and RAYCASTUP(e, g_Entity[e]['x'], g_Entity[e]['y'], g_Entity[e]['z'], 20, 0, e)==1 then CollisionOn(e) -- added liftstate[e] = 5 end if liftstate[e] == 5 and GetPlayerDistance(e) > 85 and PLAYERASSOCIATED(e)==1 then -- modified from 35 to 85 liftstate[e] = 0 UNASSOCIATEPLAYER(e) CollisionOn(e) end if liftstate[e] == 6 and GetPlayerDistance(e) < 40 then -- modified from 30 to 40 --PlaySound(e,"audiobank\\scifi\\scenery\\lifts\\up.wav") -- replaced with PlaySount(e,0) and .wav specified in entity properties GG editor PlaySound(e,0) liftstate[e] = 1 ASSOCIATEPLAYER(e) end if liftstate[e] == 6 and GetPlayerDistance(e) > 85 and PLAYERASSOCIATED(e)==1 then -- modifed from 35 ro 85 liftstate[e] = 0 CollisionOn(e) end if liftstate[e] == 7 and GetPlayerDistance(e) < 80 then -- modified from 30 to 80 --PlaySound(e,"audiobank\\scifi\\scenery\\lifts\\down.wav") -- replaced with PlaySount(e,1) and .wav specified in entity properties GG editor PlaySound(e,1) liftstate[e] = 4 ASSOCIATEPLAYER(e) end if liftstate[e] == 7 and GetPlayerDistance(e) > 85 and PLAYERASSOCIATED(e)==1 then -- modified from 35 to 85 liftstate[e] = 3 CollisionOn(e) end --[[ if g_Entity[e]['activated'] == 1 then liftstate[e] = 11 SetEntityActivated(e,0) end if liftstate[e] == 11 and (g_PlayerPosY - g_Entity[e]['y']) > 100 then liftstate[e] = 21 end if liftstate[e] == 11 then liftstate[e] = 31 end if liftstate[e] == 21 and RAYCASTUP(e, g_Entity[e]['x'], g_Entity[e]['y'], g_Entity[e]['z'], 20, 100, e)==1 then CollisionOn(e) -- added liftstate[e] = 3 end if liftstate[e] == 21 then liftstate[e] = 1 end if liftstate[e] == 31 and RAYCASTUP(e, g_Entity[e]['x'], g_Entity[e]['y'], g_Entity[e]['z'], 20, 0, e)==1 then CollisionOn(e) -- added liftstate[e] = 0 end if liftstate[e] == 31 then liftstate[e] = 4 end --]] PromptLocal (e,'liftstate=' .. liftstate[e] ) Prompt('e=' .. e .. ' liftstate=' .. liftstate[e] .. ' Player X,Y,Z=' .. math.ceil(g_PlayerPosX) .. ' ' .. math.ceil(g_PlayerPosY) .. ' ' .. math.ceil(g_PlayerPosZ) ) -- added end end function lift1_exit(e) end --FPSC legacy conditional command->RAYCASTUP function RAYCASTUP(e,x,y,z,val1,val2,excobj) if IntersectAll(x, y+val1, z, x, y+val2, z, excobj) >0 then return 1 else return 0 end end --FPSC legacy conditional command->PLAYERASSOCIATED function PLAYERASSOCIATED(e) return isplayerisassociated end --FPSC legacy action command->UNASSOCIATEPLAYER function UNASSOCIATEPLAYER(e) isplayerisassociated = 0 end --FPSC legacy action command->ASSOCIATEPLAYER function ASSOCIATEPLAYER(e) isplayerisassociated = 1 end --*** ALL FPSC CONDITION/ACTION KEYWORDS CONVERTED :-) ***