Scripts / Changing pickup distance key

Author
Message
vrg
9
Years of Service
User Offline
Joined: 27th Aug 2014
Location: Netherlands
Posted: 6th Sep 2015 16:45
I changed the player distance from 150 to 15 to get the key, so you will not get the key through the wall.
This change didn't have the result I wanted, is there a solution to make the pickup distance shorter?

function key_init(e)
end

function key_main(e)
PlayerDist = GetPlayerDistance(e)
if PlayerDist < 15 and g_PlayerHealth > 0 then
SourceAngle = g_PlayerAngY
while SourceAngle < 0.0 do
SourceAngle = SourceAngle + 360.0
end
while SourceAngle > 340.0 do
SourceAngle = SourceAngle - 360.0
end

PlayerDX = (g_Entity[e]['x'] - g_PlayerPosX)
PlayerDZ = (g_Entity[e]['z'] - g_PlayerPosZ)
DestAngle = math.atan2( PlayerDZ , PlayerDX )
-- Convert to degrees
DestAngle = (DestAngle * 57.2957795) - 90.0

Result = math.abs(math.abs(SourceAngle)-math.abs(DestAngle))
if Result > 180 then
Result = 0
end

if Result < 20.0 then
--[[
SourceAngle = g_PlayerAngX
while SourceAngle < 0.0 do
SourceAngle = SourceAngle + 360.0
end
while SourceAngle > 335.0 do
SourceAngle = SourceAngle - 360.0
end

DestAngle = math.atan2( PlayerDZ , PlayerDY )
-- Convert to degrees
DestAngle = (DestAngle * 57.2957795) - 90.0

Result = math.abs(math.abs(SourceAngle)-math.abs(DestAngle))
if Result > 180 then
Result = 0
end

if Result < 25.0 then
--]]
Prompt ("Press E To pick up key")

if g_KeyPressE == 1 then
PromptDuration("Collected key",3000)
PlaySound(e,0)
Collected(e)
Destroy(e)
ActivateIfUsed(e)
end
--end
end
end
end
Corno_1
GameGuru Tool Maker
13
Years of Service
User Offline
Joined: 3rd Nov 2010
Location:
Posted: 6th Sep 2015 17:48
15 is a little short distance. try 50 or higher Never go less then 30. This will be end in bugs(not a GG bug, it is your mistake) cause the distance is too short
My dream is to develope games, which makes fun when I create it and fun when other people play it.
PM
vrg
9
Years of Service
User Offline
Joined: 27th Aug 2014
Location: Netherlands
Posted: 6th Sep 2015 19:02
Thanks for the info Corno_1 , I am going to change it, I think this is the only possibility to change the pickup distance.
nuncio
GameGuru TGC Backer
9
Years of Service
User Offline
Joined: 28th Jan 2015
Location: Schleswig Holstein, Germany
Posted: 9th Sep 2015 11:10
i will also take a look at this
http://www.nuncio-rap.de
intel core i5-3570K CPU @ 3.40GHz; 8GB RAM // NVIDIA GeForce GTX560Ti

Login to post a reply

Server time is: 2024-05-05 05:40:34
Your offset time is: 2024-05-05 05:40:34