Limiter Posted December 12, 2010 Share Posted December 12, 2010 How to I make an elevator that opens only when CJ comes near it (in a sliding method like most elevators outside). The elevator should proceed to move up if CJ is on ground floor, or down when CJ is on top floor. But not moving up or down if no one uses it. I searched movable objects tutorial but I am not sure that it covers the guidelines that I said above, is there a tutorial that covers this specifically, Thank you guys, you have been a helpful community. Makes modding way funner!! Link to comment https://gtaforums.com/topic/464986-elevator-and-sliding-door/ Share on other sites More sharing options...
NTAuthority Posted December 12, 2010 Share Posted December 12, 2010 You could easily wrap the code to start moving an object in a check using command 0x01A6 (IS_CHAR_IN_AREA_ON_FOOT_3D?) like this, where the coordinates are the active range of the two parts of your elevator: 01A6: actor $PLAYER_ACTOR sphere 0 in_cube_cornerA -777.827 510.0 1369.0 cornerB -797.0 494.0 1373.0 on_foot However, I don't know if moving an object upwards will cause a player to move along smoothly if standing on it. Link to comment https://gtaforums.com/topic/464986-elevator-and-sliding-door/#findComment-1060242645 Share on other sites More sharing options...
Limiter Posted December 12, 2010 Author Share Posted December 12, 2010 Sorry, I am a modeller so I don't read codings that fast... So does the code take care to move objects only when CJ use it...and....does it include sliding doors?? Link to comment https://gtaforums.com/topic/464986-elevator-and-sliding-door/#findComment-1060242689 Share on other sites More sharing options...
ZAZ Posted December 12, 2010 Share Posted December 12, 2010 try the script below the object may not move faster otherwise it won't work {$CLEO .cs}:LIFT_TEST// press Backspace to spawn a51_jetdoor as lift plattform//and and put player_actor on it// lift moves upward and downward// press Backspace to remove the object//------------------------------thread 'LIFTEST' :LIFTEST_1wait 0 if Player.Defined($PLAYER_CHAR)jf @LIFTEST_1 if 0AB0: key_pressed 8 jf @LIFTEST_1 Model.Load(3095):LIFTEST_2wait 0 if Model.Available(3095)jf @LIFTEST_2 04C4: store_coords_to 11@ 12@ 13@ from_actor $PLAYER_ACTOR with_offset 0.0 10.5 400.0 1@ = Object.Create(3095, 11@, 12@, 400.0)wait 1000 Actor.PutAt($PLAYER_ACTOR, 11@, 12@, 402.0)wait 1000 3@ = 0 :LIFTEST_3wait 0 if Player.Defined($PLAYER_CHAR)jf @LIFTEST_8 if 8AB0: not key_pressed 8 jf @LIFTEST_8 Object.StorePos(1@, 11@, 12@, 13@)if 3@ == 0 jf @LIFTEST_6 if 520.0 > 13@ jf @LIFTEST_5 034E: move_object 1@ to 11@ 12@ 520.5 speed 0.0 0.0 0.9 flag 0 jump @LIFTEST_3 :LIFTEST_53@ = 1 :LIFTEST_6if 3@ == 1 jf @LIFTEST_3 if 13@ > 500.5 jf @LIFTEST_7 034E: move_object 1@ to 11@ 12@ 500.0 speed 0.0 0.0 0.2 flag 0 jump @LIFTEST_3 :LIFTEST_73@ = 0 jump @LIFTEST_3 :LIFTEST_8Object.Destroy(1@)wait 1000 jump @LIFTEST_1 Link to comment https://gtaforums.com/topic/464986-elevator-and-sliding-door/#findComment-1060243096 Share on other sites More sharing options...
Deji Posted December 12, 2010 Share Posted December 12, 2010 Why not just attach the player ot the object? Link to comment https://gtaforums.com/topic/464986-elevator-and-sliding-door/#findComment-1060243630 Share on other sites More sharing options...
Limiter Posted December 13, 2010 Author Share Posted December 13, 2010 Thank you expert modders, I will give this a try... I noticed another point, take for example this code works. Then... CJ walks to the elevator, the sliding doors open when CJ comes near. CJ enters the elevator, but the door wouldn't close while the elevator moves up because CJ is inside the elevator which in essence is putting CJ in close proximity with the doors. Is there a bypass... Link to comment https://gtaforums.com/topic/464986-elevator-and-sliding-door/#findComment-1060244575 Share on other sites More sharing options...
ZAZ Posted December 14, 2010 Share Posted December 14, 2010 (edited) Why not just attach the player ot the object? it switch into FPcam it seems possible to coreect that cam view after putting in turret set player frozen 1 wait 250 set player frozen 0 but this seems to be depending from pc performance or whatever if you remember that i tested your surfboard i posted that it won't work correct for me it worked correct as i added waits at the player frozen codes http://www.gtaforums.com/index.php?showtop...st&p=1059748619 i did it in this way in the script: 04F4: put_actor $PLAYER_ACTOR into_turret_on_object 1@ offset_from_object_origin -0.5 0.0 0.2 orientation 3 both_side_angle_limit 360.0 lock_weapon 00858: set_player $PLAYER_CHAR scan_horizon_to_angle 2@ rotation_speed 300.00001: wait 0 ms 01B4: set_player $PLAYER_CHAR can_move 0 01B4: set_player $PLAYER_CHAR can_move 1 0001: wait 0 ms Edited December 14, 2010 by ZAZ Link to comment https://gtaforums.com/topic/464986-elevator-and-sliding-door/#findComment-1060245008 Share on other sites More sharing options...
ZAZ Posted December 14, 2010 Share Posted December 14, 2010 sorry double post Thank you expert modders, I will give this a try... I noticed another point, take for example this code works. Then... CJ walks to the elevator, the sliding doors open when CJ comes near. CJ enters the elevator, but the door wouldn't close while the elevator moves up because CJ is inside the elevator which in essence is putting CJ in close proximity with the doors. Is there a bypass... it's possible without problems to script a nice elevator but that's your job take my template and enlarge it you must understand the simple math coding to organize the several functions in a working script if and 13@ == 0 player is near point x,y,z then object_door1 move to x,y,z object_door2 move to x,y,z end if and 13@ == 0 object_door1 is near point x,y,z object_door2 is near point x,y,z then 13 = 1 end Link to comment https://gtaforums.com/topic/464986-elevator-and-sliding-door/#findComment-1060245060 Share on other sites More sharing options...
Deji Posted December 14, 2010 Share Posted December 14, 2010 Ah, the wait thing could be resolved with the frame delay address I've used in the Stream Ini Extender. As NTA informed me, it was made to resolve cover up issues Rockstar had with physics being unable to process fast enough on high-end PC's and menu bugs which occured in III and VC. They didn't fix it completely, which leaves us with this nice little problem The wait doesn't need to be so much as 250 milleseconds, though. When the value of 0001 is anything over 0, the time is synched to the nearest time that the computer can render a frame. So if the wait is 4 milleseconds, there's still a chance that it would be 8 milleseconds until the script continues, because the computer was too slow. Eventually there's a value which all computers that can run GTASA must be able to achieve, which I'd guess to be around 50ms. Link to comment https://gtaforums.com/topic/464986-elevator-and-sliding-door/#findComment-1060245136 Share on other sites More sharing options...
Silent Posted December 14, 2010 Share Posted December 14, 2010 Umm, maybe using a frame delta time thingy would be more flexible? Link to comment https://gtaforums.com/topic/464986-elevator-and-sliding-door/#findComment-1060245511 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now