guferr Posted September 25, 2014 Share Posted September 25, 2014 (edited) So, i've done some experimenting using car paths on some missions, i've been editing missions to do this, and so far now it was fine.Then i tried to do it on a CLEO script, and it crashed.I decided to remove everything from the script and reduce it to the most simple script, but it still crashes.I've tried different paths and vehicles, all of them crash (and all of them work fine on missions). Note that i used the correct opcodes, the same ones used on the missions, and i also used the same routines (load paths, check if loaded, check if player is driving, getting the car handle and then assigning). I've also tried cleaning my CLEO folder, i rebooted my PC, but the problem is on the script, i just can't find where and how.The code goes below.Thanks {$CLEO .cs}thread 'PATH' Int [email protected] //Car Handle07C0: load_path 289 //Load path :PATH_1if87C1: not path 289 availableelse_jump @PATH_2 //Code only proceeds if path is loaded, it wouldn't even crash if it didn't loadwait 100jump @PATH_1 :PATH_2 wait 40 //Game doesn't load without a minimum wait time on this loop (load bar freezes when full)if Actor.Driving($PLAYER_ACTOR) else_jump @PATH_2 //Check player is driving, repeat if not wait 5000 //Wait 5s just so i can have time to see it enter the car03C0: [email protected] = actor $PLAYER_ACTOR car //Set car handle05EB: assign_car [email protected] to_path 289 //Assign car to pathwait 10000 //Let it ride on it for 10s 05EC: release_car [email protected] from_path //Release itjump @PATH_2 Edited September 25, 2014 by guferr Link to comment Share on other sites More sharing options...
killer_bigpoint Posted September 25, 2014 Share Posted September 25, 2014 check if you have the newest sanny builder and the newest cleo installed Link to comment Share on other sites More sharing options...
Node Posted September 25, 2014 Share Posted September 25, 2014 (edited) :PATH_1if87C1: not path 289 availableelse_jump @PATH_2 //Code only proceeds if path is loaded, it wouldn't even crash if it didn't loadwait 100jump @PATH_1 The 'wait' should be before the 'if' not after it? Edited September 25, 2014 by ChopTheDog. Link to comment Share on other sites More sharing options...
guferr Posted September 25, 2014 Author Share Posted September 25, 2014 (edited) The position of this wait doesn't make any difference, the code only crashes after i press the key combination, so the path was loaded. Also, the wait was before the 'if' before, i put it there just to make clear that it's in case of the path wasn't loaded yet. And yes, i have the newest CLEO and Sanny Builder. I re-installed both past week, i'm using a fresh installation of win7, and everything is fine and working. There are no bugs or problems except for this one. Edited September 25, 2014 by guferr Link to comment Share on other sites More sharing options...
DK22Pac Posted September 25, 2014 Share Posted September 25, 2014 (edited) {$CLEO .cs} thread 'PATH' 07C0: load_path 289 while true wait 0 if and player.Defined(0) 07C1: path 289 available then if actor.Driving($PLAYER_ACTOR) then break end end end 03C0: [email protected] = actor $PLAYER_ACTOR car 05EB: assign_car [email protected] to_path 289 wait 10000 if 056E: car [email protected] defined then 05EC: release_car [email protected] from_path end 0873: release_path 289 0A93: Edited September 25, 2014 by _DK Link to comment Share on other sites More sharing options...
guferr Posted September 25, 2014 Author Share Posted September 25, 2014 (edited) {$CLEO .cs}thread 'PATH' (...)0873: release_path 2890A93:    So, apart from using a different structure and putting checks to verify if the player is defined and the actor is driving, what did you do to prevent it from crashing? I also used those checks before, i removed them to simplify the code, once i would assure those things for myself.  I tried editing it a little bit and it become even more fishy. Now it sometimes crash, and other times it doesn't even load. I've put a teleporting function just to verify when the first check loop finished (and if the car handle works), the car is teleported to 0,0,5. Then, 3s after, it should assign it to the path, but it crashes. And some times it doesn't even teleport, and doesn't crash too.  Here's the code  {$CLEO .cs}thread 'PATH'Int [email protected] 5000 //Just to avoid the intro while i skip it07C0: load_path 289while true wait 50 //little wait time to slow it down if and 07C1: path 289 available Player.Defined($PLAYER_CHAR) Actor.Driving($PLAYER_ACTOR) then break //Only breaks the loop if all the conditions are true endendwait 3000 //Wait 3s, just to have enough time to finish the entering animation and close the doors03C0: [email protected] = actor $PLAYER_ACTOR carCAr.PutAt([email protected], 0.0, 0.0, 5.0) //Teleport car. It also shows that the car handle is ok, otherwise it wouldn't teleportwait 3000 //Wait 3s again05EB: assign_car [email protected] to_path 289 //Assign car to path (Where it crashes)wait 10000 //Let it ride on it for 10 seconds05EC: release_car [email protected] from_path //Release car from path0873: release_path 289 //Release path0A93: end_custom_thread //End thread Edited September 25, 2014 by guferr Link to comment Share on other sites More sharing options...
turbocoder32 Posted September 26, 2014 Share Posted September 26, 2014 Hi ,I fixed this for you.This loops around.Always going down path. I made it simple for next time. Â Â Â {$CLEO .cs}$TEMPVAR_ACTOR_CAR = Actor.CurrentCar($PLAYER_ACTOR) /////////////////////////////////////////////////////0811: $TEMPVAR_ACTOR_CAR = actor $PLAYER_ACTOR used_carthread 'PATH':PATHTEST_1wait 0if AND Player.Defined($PLAYER_CHAR) $ONMISSION == 0 jf @PATHTEST_1if Player.Controllable($PLAYER_CHAR)jf @PATHTEST_1:PATHTEST_2IF ACTOR.Driving($PLAYER_ACTOR)jf @PATHTEST_1if not Car.Wrecked($TEMPVAR_ACTOR_CAR)jf @PATHTEST_1if not Actor.Dead($PLAYER_ACTOR)jf @PATHTEST_107C0: load_path 289:PATHTEST_3if87C1: not path 289 availablejf @PATHTEST_4wait 0jump @PATHTEST_3:PATHTEST_405EB: assign_car $TEMPVAR_ACTOR_CAR to_path 289WAIT 100000873: release_path 289:PATHTEST_1001jump @PATHTEST_1END_THREAD Â Â Â Link to comment Share on other sites More sharing options...
DK22Pac Posted September 26, 2014 Share Posted September 26, 2014 (edited) You need to be more accurate with WAIT opcodes.  wait 3000 //Wait 3s, just to have enough time to finish the entering animation and close the doors03C0: [email protected] = actor $PLAYER_ACTOR carWhat if player will leave the car in these 3 seconds? 07C1: path 289 availablePlayer.Defined($PLAYER_CHAR)Actor.Driving($PLAYER_ACTOR)Use Player.Defined() before accessing to $PLAYER_ACTOR. wait 10000 //Let it ride on it for 10 seconds05EC: release_car [email protected] from_path //Release car from pathCheck if object/car/actor is available if you want to access it after WAIT opcode. Edited September 26, 2014 by _DK 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