hmvartak Posted May 23, 2007 Share Posted May 23, 2007 Can someone tell me, how to check if CJ is in the car or not. I want to disable blue marker above car when CJ enters in that car. In opcode list I found this one, 00DB:actor $PLAYER_ACTOR in_car [email protected] It is asking for car handle which is stored in local variable, where my car handle is stored in global variable. Can I create car handle in local variable? If yes, How? what is the opcode? and if no, then my question is why do we need to create car handle in global variable even if we are not going to use it outside that mission? or is there any way to check that condition? I tried to put global variable in 00DB code. Sanny Builder is not showing me any compilation error but that code isn't working. My code is :CML0001: wait 0 0247: request_model #PATRIOT 038B: load_requested_models 00D6: if and 0248: model #PATRIOT available 004D: jump_if_false @CML 00a5:$mycar = create_car #PATRIOT at 2436.018 -1660.946 13.37673 :MARKwait 0 ms0186:$mymark = create_marker_above_car $mycar07E0:set_marker $mymark type_to 1if00DB:actor $PLAYER_ACTOR in_car $mycarjf @MARK0164:disable_marker $mymark:spherewait 0 msif 00FE: actor $PLAYER_ACTOR 1 near_point_3d 2359.875 -1658.351 13.38281 radius 5.0 5.0 6.0 jf @sphere Please, someone improve this code. Link to comment Share on other sites More sharing options...
grovespaz Posted May 23, 2007 Share Posted May 23, 2007 Can someone tell me, how to check if CJ is in the car or not. I want to disable blue marker above car when CJ enters in that car.In opcode list I found this one, 00DB:actor $PLAYER_ACTOR in_car [email protected] It is asking for car handle which is stored in local variable, where my car handle is stored in global variable. Can I create car handle in local variable? If yes, How? what is the opcode? and if no, then my question is why do we need to create car handle in global variable even if we are not going to use it outside that mission? or is there any way to check that condition? I tried to put global variable in 00DB code. Sanny Builder is not showing me any compilation error but that code isn't working. My code is :CML0001: wait 0 0247: request_model #PATRIOT 038B: load_requested_models 00D6: if and 0248: model #PATRIOT available 004D: jump_if_false @CML 00a5:$mycar = create_car #PATRIOT at 2436.018 -1660.946 13.37673 :MARKwait 0 ms0186:$mymark = create_marker_above_car $mycar07E0:set_marker $mymark type_to 1if00DB:actor $PLAYER_ACTOR in_car $mycarjf @MARK0164:disable_marker $mymark:spherewait 0 msif 00FE: actor $PLAYER_ACTOR 1 near_point_3d 2359.875 -1658.351 13.38281 radius 5.0 5.0 6.0 jf @sphere Please, someone improve this code. Just at first glimpse.. :CML00a5:$mycar = create_car #PATRIOT at 2436.018 -1660.946 13.37673 0186:$mymark = create_marker_above_car $mycar07E0:set_marker $mymark type_to 1:MARK //No need to create a marker everyframe.. Crash garantee..wait 0 msif00DB:actor $PLAYER_ACTOR in_car $mycarjf @MARK0164:disable_marker $mymark Haven't tested it tho.. Link to comment Share on other sites More sharing options...
Bigun Posted May 23, 2007 Share Posted May 23, 2007 Only math and set opcodes require distinction between local and global vars. No other opcodes have different versions for that and most can be used with both locals or globals. Link to comment Share on other sites More sharing options...
hmvartak Posted May 24, 2007 Author Share Posted May 24, 2007 Just at first glimpse.. :CML00a5:$mycar = create_car #PATRIOT at 2436.018 -1660.946 13.37673 0186:$mymark = create_marker_above_car $mycar07E0:set_marker $mymark type_to 1:MARK //No need to create a marker everyframe.. Crash garantee..wait 0 msif00DB:actor $PLAYER_ACTOR in_car $mycarjf @MARK0164:disable_marker $mymark Haven't tested it tho.. I have tested similar code before posting to this forum. That code works only once. Then it permanently disables the marker. Marker must appear whenever you are out of the car and must be disabled whenever you are in the car. That's why I tried to make marker in a loop. Link to comment Share on other sites More sharing options...
PatrickW Posted May 24, 2007 Share Posted May 24, 2007 Code it like this.. not tested, but you'll get the idea. 0247: request_model #PATRIOT038B: load_requested_models:CML0001: wait 000D6: if 0248: model #PATRIOT available004D: jump_if_false @CML00a5:$mycar = create_car #PATRIOT at 2436.018 -1660.946 13.37673$my_mark_flag = 0 // 1 means the marker is visible:loopwait 0 msif00DB:actor $PLAYER_ACTOR in_car $mycarjf @MARKif $my_mark_flag == 1jf @sphere0164:disable_marker $mymark$my_mark_flag = 0jump @sphere:MARKif $my_mark_flag == 0jf @sphere0186:$mymark = create_marker_above_car $mycar07E0:set_marker $mymark type_to 1$my_mark_flag = 1:sphereif00FE: actor $PLAYER_ACTOR 1 near_point_3d 2359.875 -1658.351 13.38281 radius 5.0 5.0 6.0jf @loop Link to comment Share on other sites More sharing options...
hmvartak Posted May 25, 2007 Author Share Posted May 25, 2007 (edited) Code it like this.. not tested, but you'll get the idea. 0247: request_model #PATRIOT038B: load_requested_models:CML0001: wait 000D6: if 0248: model #PATRIOT available004D: jump_if_false @CML00a5:$mycar = create_car #PATRIOT at 2436.018 -1660.946 13.37673$my_mark_flag = 0 // 1 means the marker is visible:loopwait 0 msif00DB:actor $PLAYER_ACTOR in_car $mycarjf @MARKif $my_mark_flag == 1jf @sphere0164:disable_marker $mymark$my_mark_flag = 0jump @sphere:MARKif $my_mark_flag == 0jf @sphere0186:$mymark = create_marker_above_car $mycar07E0:set_marker $mymark type_to 1$my_mark_flag = 1:sphereif00FE: actor $PLAYER_ACTOR 1 near_point_3d 2359.875 -1658.351 13.38281 radius 5.0 5.0 6.0jf @loop Your code is working nicely. Actually I wanted to disable sphere while marker is appearing and vice versa. This lets you to enter the sphere through your vehicle only. Your code works very well when I enter the sphere through the car. But when I do it on foot, my mission gets passed but marker on car remain intact. Some improvement is needed in the code that I thonk I can do. Thanks for your help! Edited July 23, 2007 by hmvartak Link to comment 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