Scripts / Question about doors

Author
Message
=VX=Doggy
14
Years of Service
User Offline
Joined: 29th Nov 2009
Location: USA NC
Posted: 15th May 2022 06:04
Ive imported a fridge with animation for the door to open and shut. The animation playes on loop, found out to change playanimation in editor to stop that. I can use a door script to open it , but it auto closes . Ive tried during the importing to break the animations into 2 parts and have tried changing the animations in the fpe but it always auto closes. Its animations are 0 to 45 to open and 45 to 89 to close . I simply want to press e to open it and press e to close it . Any idea what im doing wrong? Ty
PM
Pirate Myke
Forum Support
13
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 15th May 2022 06:10
Does your door have a bone rotation for the movement, or just the object at its pivot point?
Which exact script are you using?
Intel(R) Core(TM) i9-10900 CPU @ 2.81GHz, 32GB RAM, Nvidia RTX 2060 super 8gb, Windows 10 Home 64bit, Screen resolution 1920 x 1080

Intel(R) Core(TM) i5-8400 CPU @ 2.81GHz, 32GB RAM, Nvidia gtx1050ti 4gb, Windows 10 Home 64bit, Screen resolution 1920 x 1080. System Passmark 3774




=VX=Doggy
14
Years of Service
User Offline
Joined: 29th Nov 2009
Location: USA NC
Posted: 15th May 2022 06:23
it has an animation just for the door part itself. It works but runs through the entire animation and closes very quickly.
PM
=VX=Doggy
14
Years of Service
User Offline
Joined: 29th Nov 2009
Location: USA NC
Posted: 15th May 2022 06:26
im using an alternate door script, as the default script didn't work.

-- DESCRIPTION: Better Door.


function door2_init(e)
end

function door2_main(e)
if PlayerLooking(e,100,30) == 1 and g_PlayerHealth > 0 then
GetEntityPlayerVisibility(e)
if 1 then
if g_Entity[e]['activated'] == 0 then
if g_Entity[e]['haskey'] == -1 then
SetActivated(e,1)
else
if g_Entity[e]['plrvisible'] == 1 then
if g_Entity[e]['haskey'] == 1 then
if GetGamePlayerStateXBOX() == 1 then
Prompt("The door is locked. Press Y button to unlock door")
else
Prompt("The door is locked. Press E key to unlock door")
end
if g_KeyPressE == 1 then
SetActivated(e,1)
end
else
Prompt("The door is locked. Find a key to unlock door")
end
end
end
else
if g_Entity[e]['activated'] == 1 then
-- door is unlocked and closed
if g_Entity[e]['plrvisible'] == 1 then
if GetGamePlayerStateXBOX() == 1 then
Prompt("Press Y button to open door")
else
Prompt("Press E to open door")
end
if g_KeyPressE == 1 and g_Entity[e]['animating'] == 0 and door_pressed == 0 then
SetAnimation(0)
PlayAnimation(e)
g_Entity[e]['animating'] = 1
SetActivated(e,2)
ActivateIfUsed(e)
PlaySound(e,0)
StartTimer(e)
g_Entity[e]['timer'] = g_Time
door_pressed = 1
end
end
else
if g_Entity[e]['activated'] == 2 then
-- door is open
if g_Entity[e]['plrvisible'] == 1 then
if g_KeyPressE == 1 and g_Entity[e]['animating'] == 0 and door_pressed == 0 then
SetAnimation(1)
PlayAnimation(e)
g_Entity[e]['animating'] = 1
SetActivated(e,1)
PlaySound(e,1)
CollisionOn(e)
door_pressed = 1
end
end
end
end
end
end
end
if g_Entity[e]['activated'] == 2 then
-- door collision off after 1 second
if GetTimer(e)>1000 then
CollisionOff(e)
end
end
if g_KeyPressE == 0 then
door_pressed = 0
end
end
PM

Login to post a reply

Server time is: 2024-04-26 11:52:59
Your offset time is: 2024-04-26 11:52:59