Scripts / turning gravity off

Author
Message
user56
9
Years of Service
User Offline
Joined: 10th Jul 2015
Location:
Posted: 10th Jul 2015 21:22
hey im trying to make a trigger that turns gravity off with lua. I cant get it to work. so far I have

function GravityOff(e)
end

function spawnwhenclose_main(e)
PlayerDist = GetPlayerDistance(e)
if PlayerDist < 300 and g_PlayerHealth > 0 then
function GravityOff(e)
SendMessageI("setnogravity",e,1);
end

end
end

but i get an arror on startup saying: no fuction called GravityOff main

any help is welcome! thanks.
PM
!nullptr
Forum Support
9
Years of Service
User Offline
Joined: 27th Mar 2015
Location: Australia
Posted: 10th Jul 2015 22:52 Edited at: 10th Jul 2015 22:53
This should be all you need. I haven't tested it but you should be able to attach it to a trigger zone and it should work.



Note the structure used, ie: how it was written. Have a read of the LUA scripting guide, particularly the top section on "hard and fast rules".

https://forum.game-guru.com/thread/208970
AKA SisterMatic (Steam)
Development/ Gaming Rigs
Sys 1: i7-4770 (3.5)/16Gb/128 SSD/3Tb/970gtx/2 x 23, 1 x 27 LCD - Sys 2: i7/8Gb/670gtx/1.5Tb/1 x 23 LCD - Sys 3: Amd Quad/8Gb/645gtx/1Tb/30" LCD
PM

Login to post a reply

Server time is: 2024-12-22 01:21:45
Your offset time is: 2024-12-22 01:21:45