Product Chat / moveunseen.lua script acting not like it should

Author
Message
Duchenkuke
GameGuru VBOTB Developer
8
Years of Service
User Offline
Joined: 7th Jun 2016
Location: Germany
Posted: 7th Jun 2016 16:58
Hey Guys,

so I discovered GameGuru 2 Weeks ago, and I decided to make an advanced Horror Game.
I don't want to bother you with this stuff so I get to the point:

I watched LeeBambers Weeping Stone Babies Video yesterday, and I was fascinated with the Idea of Moving Statues.
Now I watched the Video severall Times, and did exactly what Lee did... but somehow in my Game, the Statues sometimes move when I look at them..
And now my Question: Can someone send me the moveunseen.lua script ? Maybe there is a mistake in mine.

I'll post it here so you can check it out:

-- LUA Script - precede every function and global member with lowercase name of script

g_StatueWait = {}

function ai_moveunseen_init(e)
g_StatueWait[e] = 0
end

function ai_moveunseen_main(e)
-- finds the viewing angle differene to the entity
dx = g_Entity[e]['x'] - g_PlayerPosX
dz = g_Entity[e]['z'] - g_PlayerPosZ
da = math.atan2(dx,dz) / 6.28 * 360.0
plra = g_PlayerAngY
if plra < 0 then
plra = plra + 360
end
if plra >=360 then
plra = plra - 360
end
diffa = plra - da
if diffa < 0 then
diffa = diffa + 360
end
if plra > 180 then
diffa = diffa - 360
end
PlayerDist = GetPlayerDistance(e)
if diffa<-45 or diffa>45 then
-- move the creature towards the player
if PlayerDist > 50 then
RotateToPlayerSlowly (e, 10.0)
MoveForward ( e, 100.0 )
end
else
if PlayerDist<= 50 then
--kill the player!!
if GetTimer(e) > g_StatueWait[e] then
HurtPlayer (e, 10 )
g_StatueWait[e] = GetTimer(e) + 100
end
end
end
--Prompt ( "plra=" .. plra .. " da=" .. math.floor(da .." diffa=" .. diffa
end


smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 7th Jun 2016 18:16
probably just the way they check the angle, it looks similar to the one in the weapon.lua script which is also wrong, try mine and see if it works for you.
https://forum.game-guru.com/thread/207801?page=12#msg2539986
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Duchenkuke
GameGuru VBOTB Developer
8
Years of Service
User Offline
Joined: 7th Jun 2016
Location: Germany
Posted: 7th Jun 2016 18:21
I will try it Thanks !
Duchenkuke
GameGuru VBOTB Developer
8
Years of Service
User Offline
Joined: 7th Jun 2016
Location: Germany
Posted: 7th Jun 2016 19:21
It worke perfectly Thank you very much ! Now I got goosebumps even TESTING my OWN Level hahaha!

Login to post a reply

Server time is: 2024-06-26 08:18:38
Your offset time is: 2024-06-26 08:18:38