Hi all
So I want to allow the player to go beyond the edge of the map in certain places,
as per this thread.
So I figured using a Zone to do it.
In PlayerControl_lua I have:
1) added global var
g_allowplayerbeyondmapboundary to control if player can leave edge of map or not
2) enclosed the code that prevents player walking off the map in an if statement
------
thanks cybernescence for pointing me to this code
3) edited a zone script to create
playeratboundary_control to use in a zone
------ which should change the
g_allowplayerbeyondmapboundary
function replacement_gameplayercontrol_init()
Hide(e)
g_allowplayerbeyondmapboundary = 0
end
function gameplayercontrol.control()
local allowbeyondboundary = g_allowplayerbeyondmapboundary
if allowbeyondboundary == 0 then
if ( GetPlrObjectPositionX()<100 ) then SetGamePlayerControlPushangle(90.0) SetGamePlayerControlPushforce(1.0) end
if ( GetPlrObjectPositionX()>51100 ) then SetGamePlayerControlPushangle(270.0) SetGamePlayerControlPushforce(1.0) end
if ( GetPlrObjectPositionZ()<100 ) then SetGamePlayerControlPushangle(0.0) SetGamePlayerControlPushforce(1.0) end
if ( GetPlrObjectPositionZ()>51100 ) then SetGamePlayerControlPushangle(180.0) SetGamePlayerControlPushforce(1.0) end
else
SetGamePlayerControlPushforce(0.0)
end
-- Reduce any player push force over time
if ( GetGamePlayerControlPushforce()>0 ) then
SetGamePlayerControlPushforce(GetGamePlayerControlPushforce()-(GetTimeElapsed()/2.0))
if ( GetGamePlayerControlPushforce()<0 ) then
SetGamePlayerControlPushforce(0.0)
end
end
function playeratboundary_control_init(e)
end
function playeratboundary_control_main(e)
if g_Entity[e]['plrinzone']==1 and PlrIsInWhichZone == 0 then
g_allowplayerbeyondmapboundary = 1
PlrIsInWhichZone = e
end
if g_Entity[e]['plrinzone']==0 and PlrIsInWhichZone == e then
g_allowplayerbeyondmapboundary = 0
PlrIsInWhichZone = 0
end
end
But I be missing something cause it doesn't work, maybe I am on the wrong track here
Any help would be appreciated
aka OldFlak
i7-4790 @ 3.2GHz. 8GB Ram. NVidia GeForce GTX 1060 6GB. M1: Acer 31.5" @1920x1080 M2: Samsung 31.5" @ 1920 x 1080. M3: Acer 24" @ 1920 x 1080. OS: Windows 10 Pro 64-bit Insider.