Scripts / help scifi door opening

Author
Message
code crusher
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: vienna , AT
Posted: 25th Feb 2015 19:23
have somebody script for doors ?? direction up and down...like sci fi doors

thx
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 25th Feb 2015 20:53
are they not animated? the standard door script just runs the animation so it should work if so
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
code crusher
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: vienna , AT
Posted: 25th Feb 2015 21:08
No i want use script to configure it self . My door ist not animated... function similar to lift Function. With variable like speed. It should be a automatic door. When player comming near it should be moving up and later down.... thanks for reply
Corno_1
GameGuru Tool Maker
14
Years of Service
User Offline
Joined: 3rd Nov 2010
Location:
Posted: 25th Feb 2015 22:21 Edited at: 25th Feb 2015 22:24
There is a command MoveUp(entity index,amount) use it. Before save the y position of the entity and set the collision off. Also set a max high limit. That´s all...

I could do it, but then there where no lesson for you

Try it and if it not work come back, we will help
My dream is to develope games, which makes fun when I create it and fun when other people play it.
PM
code crusher
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: vienna , AT
Posted: 25th Feb 2015 23:48 Edited at: 26th Feb 2015 11:47
thanks i willtry it

hmm i was too long on Dark (basic) Side
its not working
attached file is my code

copy paste function seem to not working correctly

Attachments

Login to view attachments
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 26th Feb 2015 13:25 Edited at: 26th Feb 2015 13:27
there's already a built in function called GetPlayerDistance(e) so you dont need that entire function at the bottom.
and you never referenced it in the script which is likely the issue, you also need to check the state for going up or down better, right now it'll go up but pretty much never come down (except a tiny bit when max height is reached)
try this instead

Quote: "- LUA Script - open door

local moveSpeedUp = 5 --Speed for move on y-axis

local door_alt=nil
local maxOpening =0
local Opening = 0
CollisionOff(e)
GravityOff(e)

function Open_door(e)
if door_alt == nil then
door_alt = g_Entity[e]['y']
maxOpening = 100 + door_alt
Opening = door_alt
end
if GetPlayerDistance(e) < 100 then
if Opening =< maxOpening then
MoveUp(e,moveSpeedUp)
Opening =Opening+moveSpeedUp
end
else
if Opening > door_alt
MoveUp(e,-moveSpeedUp)
Opening =Opening-moveSpeedUp
end

end
end "
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
code crusher
17
Years of Service
User Offline
Joined: 7th Apr 2007
Location: vienna , AT
Posted: 26th Feb 2015 18:48
Quote: "
-- LUA Script - open door

local moveSpeedUp = 5 --Speed for move on y-axis

local door_alt=nil
local maxOpening =0
local Opening = 0
CollisionOff(e)
GravityOff(e)

function Open_door(e)
if door_alt == nil then
door_alt = g_Entity[e]['y']
maxOpening = 100 + door_alt
Opening = door_alt
end
if GetPlayerDistance(e) < 100 then
if Opening =< maxOpening then
MoveUp(e,moveSpeedUp)
Opening =Opening+moveSpeedUp
end
else
if Opening > door_alt then
MoveUp(e,-moveSpeedUp)
Opening =Opening-moveSpeedUp
end

end
end
"


ok . sorry this no working for me.. i don't know what's the problem.

thanks anyways

Login to post a reply

Server time is: 2024-12-21 14:56:48
Your offset time is: 2024-12-21 14:56:48