Covernant Posted February 23, 2007 Share Posted February 23, 2007 (edited) Ok now i got it to work... but... It starts normal then doubles after awhile. And it doesn't use its secondary weapon. :HunAtk03A4: name_thread 'HunAtk':HunAtk_loop0001: wait 60000 ms00D6: if 00256: player $PLAYER_CHAR defined010F: player $PLAYER_CHAR wanted_level > 5004D: jump_if_false @HunAtk_loop:HunAtkAct0001: wait 0 ms0247: request_model #HUNTER0247: request_model #MAFBOSS038B: load_requested_models00D6: if and0248: model #MAFBOSS available0248: model #HUNTER available004D: jump_if_false @HunAtk_loop00a5: 1@ = create_car #HUNTER at 2677.8608 -1516.2247 76.49060129: 0@ = create_actor 5 #MAFBOSS in_car 1@ driverseat004D: jump_if_false @HunAtk_loop0001: wait 20 ms0724: flying_vehicle 1@ follow_and_attack_player $PLAYER_ACTOR radius 400.00841: flying_vehicle 1@ use_secondary_gun 1 Edited February 24, 2007 by Covernant Link to comment https://gtaforums.com/topic/267973-hunter-chasezz/ Share on other sites More sharing options...
space_einstein Posted February 23, 2007 Share Posted February 23, 2007 Everytime you create something, you have to load the model. Link to comment https://gtaforums.com/topic/267973-hunter-chasezz/#findComment-4065861 Share on other sites More sharing options...
Covernant Posted February 23, 2007 Author Share Posted February 23, 2007 (edited) Everytime you create something, you have to load the model. Atm you posted that... i already had it fixed but forgot to change the CODE. Now i have a different problem... Heli won't shoot and it doubles once. Do i have to make it hostile or something? EDIT: Hmm it seams that it spawns 2 helicopters z.z if they go airborne and move slightly differently then they split. Changed a little 0724: flying_vehicle 1@ follow_and_attack_player $PLAYER_ACTOR radius 400.0 But it still doubles the heli... how can i only make 1 ... Edited February 23, 2007 by Covernant Link to comment https://gtaforums.com/topic/267973-hunter-chasezz/#findComment-4065896 Share on other sites More sharing options...
ceedj Posted February 24, 2007 Share Posted February 24, 2007 What's with the funky if's without numbers (if 0, if 1, etc)? Even if it's a Sanny Builder thing, I think you need the if AND/OR for more than one condintional. But besides that, what is the last if checking? The opcodes that follow it are not conditional opcodes. Wacho tryin' to do? Link to comment https://gtaforums.com/topic/267973-hunter-chasezz/#findComment-4067104 Share on other sites More sharing options...
Covernant Posted February 24, 2007 Author Share Posted February 24, 2007 Oh yeah ooops... lol (Someone wrote somewhere that IFs can be random z.z) But it still doubles... maybe i have some jumps false. So it loads Hunter twice... but why? I have other similar codes and thay dont double. Link to comment https://gtaforums.com/topic/267973-hunter-chasezz/#findComment-4067305 Share on other sites More sharing options...
PLPynton Posted February 24, 2007 Share Posted February 24, 2007 (edited) use "end_thread" opcode at the very end of your code to ensure that it doesn't get double executed at the vfirst stage of game. you used wrong opcode if you are after "hostile" hunter that attacks (look for 0724). in your case the vfirst wait could be more than 0 (try 500 for example). it might be that your create_thread command is executed more than once. you might use some kind of triggering to trigger hunter spawn- like IF something occurs (button pressed, wanted level increased or in other words some conditions are present). then release loaded models (0249) after they are no longer needed, then look for methods to check if that pilot still "lives" and if not then release it as well (01C2) same with the heli (01C3). then if it works you could finally re-write your code several times to master your own technique. after all, all you have to do is practice and practice. take care. Edited February 24, 2007 by PLPynton Link to comment https://gtaforums.com/topic/267973-hunter-chasezz/#findComment-4067339 Share on other sites More sharing options...
Covernant Posted February 24, 2007 Author Share Posted February 24, 2007 (edited) Do these check their alive stance? lol 04F0=1, unknown_actor_check %1d% 04F1=1, unknown_vehicle_check %1d% And woah.. Thank you. Oh i have all buttons already assigned everywhere... and I'm not a combination fan. Oh well.. ill look more. Hmm even with end_thread it doubles. Spawns 2 Hunters. Ok now the code is like this :HunAtk03A4: name_thread 'HunAtk':HunAtk_loop0001: wait 60000 ms00D6: if 00256: player $PLAYER_CHAR defined010F: player $PLAYER_CHAR wanted_level > 5004D: jump_if_false @HunAtk_loop:HunAtkAct0001: wait 0 ms0247: request_model #HUNTER0247: request_model #MAFBOSS038B: load_requested_models00D6: if and 0248: model #MAFBOSS available0248: model #HUNTER available004D: jump_if_false @HunAtk_loop00a5: 1@ = create_car #HUNTER at 2677.8608 -1516.2247 76.49060129: 0@ = create_actor 5 #MAFBOSS in_car 1@ driverseat004D: jump_if_false @HunAtk_loop0001: wait 20 ms0724: flying_vehicle 1@ follow_and_attack_player $PLAYER_ACTOR radius 400.00841: flying_vehicle 1@ use_secondary_gun 1 But it still spawns 2... instead of 1. Edited February 24, 2007 by Covernant Link to comment https://gtaforums.com/topic/267973-hunter-chasezz/#findComment-4067445 Share on other sites More sharing options...
space_einstein Posted February 24, 2007 Share Posted February 24, 2007 You either created the thread twice or the code above this code is messed up. Link to comment https://gtaforums.com/topic/267973-hunter-chasezz/#findComment-4067655 Share on other sites More sharing options...
Covernant Posted February 24, 2007 Author Share Posted February 24, 2007 No i think i didn't create it twice ;D But C'mon... that code can't be so messed that nobody knows what's wrong with it. Would it help if id post my full main.scm... Maybe i have something wrong.. elsewhere. Link to comment https://gtaforums.com/topic/267973-hunter-chasezz/#findComment-4067702 Share on other sites More sharing options...
space_einstein Posted February 24, 2007 Share Posted February 24, 2007 :HunAtk 03A4: name_thread 'HunAtk' :HunAtk_loop 0001: wait 250 ms 00D6: if 0 0256: player $PLAYER_CHAR defined 004D: jump_if_false @HunAtk_loop 00D6: if 0 010F: player $PLAYER_CHAR wanted_level > 5 004D: jump_if_false @HunAtk_loop 0247: request_model #HUNTER 0247: request_model #MAFBOSS 038B: load_requested_models :HunAtkAct 0001: wait 0 ms 00D6: if and 0248: model #MAFBOSS available 0248: model #HUNTER available 004D: jump_if_false @HunAtkAct 00a5: 1@ = create_car #HUNTER at 2677.8608 -1516.2247 76.4906 0129: 0@ = create_actor 5 #MAFBOSS in_car 1@ driverseat 0724: flying_vehicle 1@ follow_and_attack_player $PLAYER_ACTOR radius 400.0 0841: flying_vehicle 1@ use_secondary_gun 1 end_thread Link to comment https://gtaforums.com/topic/267973-hunter-chasezz/#findComment-4067805 Share on other sites More sharing options...
Shadow-Link Posted February 24, 2007 Share Posted February 24, 2007 Ok now the code is like this :HunAtk03A4: name_thread 'HunAtk':HunAtk_loop0001: wait 60000 ms00D6: if 00256: player $PLAYER_CHAR defined010F: player $PLAYER_CHAR wanted_level > 5004D: jump_if_false @HunAtk_loop:HunAtkAct0001: wait 0 ms0247: request_model #HUNTER0247: request_model #MAFBOSS038B: load_requested_models00D6: if and 0248: model #MAFBOSS available0248: model #HUNTER available004D: jump_if_false @HunAtk_loop00a5: 1@ = create_car #HUNTER at 2677.8608 -1516.2247 76.49060129: 0@ = create_actor 5 #MAFBOSS in_car 1@ driverseat004D: jump_if_false @HunAtk_loop <<< Why did you use that?0001: wait 20 ms0724: flying_vehicle 1@ follow_and_attack_player $PLAYER_ACTOR radius 400.00841: flying_vehicle 1@ use_secondary_gun 1 But it still spawns 2... instead of 1. Why did you use "Jump_if_false" after "0129: 0@ = create_actor 5 #MAFBOSS in_car 1@ driverseat"? Create_actor isn't conditional so it can't be true or false (I think) Maybe it creates two hunters because because it jumps back to ":HunAtk_loop" and executes the create_car code again.. Not sure if that's the problem.. Link to comment https://gtaforums.com/topic/267973-hunter-chasezz/#findComment-4067806 Share on other sites More sharing options...
Covernant Posted February 24, 2007 Author Share Posted February 24, 2007 (edited) Thank you both Lol still doubles! ;D I'm getting an headache... and irritated... starting to chew my nails ;D Everything i try either crashes san or just doesn't help... Edited February 24, 2007 by Covernant Link to comment https://gtaforums.com/topic/267973-hunter-chasezz/#findComment-4067833 Share on other sites More sharing options...
PLPynton Posted February 24, 2007 Share Posted February 24, 2007 it was tricky because we have not seen the rest of the code. anyway the answer is short: place always 004E: end_thread at the end of one thread to avoid multiple executions of next thread. instead you could always place a jump but that if you want to keep this thread running without self-termination. the thing is that you could miss that 'cause the previous thread has ie. some special conditions, but if you make a small mistake in IF statement (work on it a bit)... these conditions are no longer valid and it means that the code will go to the end of the thread. now if in this point there is no termanate/jump it will start to execute code of next thread thinking that it is working still on the same thread. then you have a copy, working already in the memory and then the original thread of helis and that is why you have 2 chasing you instead of 1. Link to comment https://gtaforums.com/topic/267973-hunter-chasezz/#findComment-4068111 Share on other sites More sharing options...
Covernant Posted February 24, 2007 Author Share Posted February 24, 2007 (edited) I tried end_thread but it still spawned 2 helis. I guess ill try again Oh nvm ... you said PLACE ALWAYS LOL... i should read more ;D Ok thank you.. Will test right away. YAY now this code :HUNATK03A4: name_thread 'HunAtk':HUNATK_loop0001: wait 10000 ms00D6: if 00256: player $PLAYER_CHAR defined004D: jump_if_false @HunAtk_loop00D6: if 0010F: is_player $PLAYER_CHAR wanted_level > 5004D: jump_if_false @HUNATK_loop0247: request_modelID #HUNTER0247: request_modelID #MAFBOSS038B: load_requested_models:HUNATKAct0001: wait 0 ms00D6: if and0248: has_modelID_loaded #MAFBOSS0248: has_modelID_loaded #HUNTER004D: jump_if_false @HUNATKAct04C4: get_actor $PLAYER_ACTOR position_3D_coord_with_offset 0.0 0.0 40.0 store_to 3@ 4@ 5@00a5: create_vehicle_with_modelID #HUNTER at_3D_coord 3@ 4@ 5@ handle_as 1@0129: create_driver_in_vehicle 1@ with_pedtype 5 with_modelID #MAFBOSS handle_as 0@04BA: set_vehicle 1@ speed_to 10.0 0724: set_hunter 1@ follow_and_attack_player $PLAYER_ACTOR radius 400.00841: flying_vehicle 1@ use_secondary_gun 10001: wait 30000 msjump @HUNATK_loop Will spawn hunters when wanted level 6. Now i have to figure out how the release model thingy works... Tried it with like ... let's see 6 different things and nothing. Basically i should be able to do that with 810F: NOT is_player $PLAYER_CHAR wanted_level > 50249: mark_modelID_as_no_longer_needed #HUNTER0249: mark_modelID_as_no_longer_needed #MAFBOSS Am i right? Edited February 24, 2007 by Covernant Link to comment https://gtaforums.com/topic/267973-hunter-chasezz/#findComment-4068146 Share on other sites More sharing options...
PLPynton Posted February 25, 2007 Share Posted February 25, 2007 (edited) i assume that you added end_thread just above these lines (in previous thread) and it stopped doubling. somewhere here END_THREAD:HUNATK03A4: name_thread 'HunAtk':HUNATK_loop0001: wait 10000 ms.... in your case models are no longer needed just after you created heli and actor so it can be like: ...04C4: get_actor $PLAYER_ACTOR position_3D_coord_with_offset 0.0 0.0 40.0 store_to 3@ 4@ 5@00a5: create_vehicle_with_modelID #HUNTER at_3D_coord 3@ 4@ 5@ handle_as 1@0129: create_driver_in_vehicle 1@ with_pedtype 5 with_modelID #MAFBOSS handle_as 0@0249: mark_modelID_as_no_longer_needed #HUNTER0249: mark_modelID_as_no_longer_needed #MAFBOSS04BA: set_vehicle 1@ speed_to 10.0 ... now you have to realize that if code for every 40 seconds of gameplay with wanted>5 creates a hunter chasing you the game can crash after about 20 minutes of gameplay. that is because there is a limit of vehicles and actors the game can handle at the same instance. you have to use 01C2,01C3 in order to get rid of the heli and its pilot (after they are marked as no longer needed they will dissapear if game requires memory place they have taken). try to find some clever solution. Edited February 25, 2007 by PLPynton Link to comment https://gtaforums.com/topic/267973-hunter-chasezz/#findComment-4068264 Share on other sites More sharing options...
Covernant Posted February 25, 2007 Author Share Posted February 25, 2007 (edited) Woah you've helped... a lot ;D Thank you again! ;D I thought that setting 0249: mark_modelID_as_no_longer_needed #HUNTER0249: mark_modelID_as_no_longer_needed #MAFBOSS will cancel all commands. z.z Cause the models won't be needed anymore. But instead it marks them for release. z.z Oh god... and i erase 4 long threads cause of this release thing... Yes i need help once more Now i made this code :HunModlwait 0 msif 0810F: not is_player $PLAYER_CHAR wanted_level > 5004D: jump_if_false @HUNATK_loop04C4: get_actor $PLAYER_ACTOR position_3D_coord_with_offset 500.0 200.0 40.0 store_to 6@ 7@ 8@00A7: set_vehicle 1@ drive_to_3D_coord 6@ 7@ 8@01c3: mark_vehicle_as_no_longer_needed 1@01c2: mark_actor_as_no_longer_needed 0@ 00A6: delete_vehicle 1@ 009B: delete_actor 0@jump @HUNATK_loop But i need to but if 0810F: not is_player $PLAYER_CHAR wanted_level > 5 Somewhere so it would check it when i have lost wanted lv 6. But if i but it after "if wanted level higher then 5" then it won't read cause the code wont go pass "if wanted level higher then 5". Maybe i should have took something even more easier Edited February 25, 2007 by Covernant Link to comment https://gtaforums.com/topic/267973-hunter-chasezz/#findComment-4068330 Share on other sites More sharing options...
PLPynton Posted February 25, 2007 Share Posted February 25, 2007 in your previous code after you created them you have to make some loop in your code to put something similar as you just wrote. handling 1 hunter should be easy however handling bunch of them will be quite difficult without reorganizing the whole code. make your experiments and let us know. Link to comment https://gtaforums.com/topic/267973-hunter-chasezz/#findComment-4069055 Share on other sites More sharing options...
Covernant Posted February 26, 2007 Author Share Posted February 26, 2007 (edited) YAY ;D Now it works... well almost.. ;D Hunter disappears after after lowering wanted level. And it flies away! YAY :HUNATK03A4: name_thread 'HunAtk':HUNATK_loop0001: wait 10000 ms00D6: if 0010F: is_player $PLAYER_CHAR wanted_level > 5004D: jump_if_false @HUNATK_loop0247: request_modelID #HUNTER0247: request_modelID #MAFBOSS038B: load_requested_models:HUNATKAct0001: wait 10000 ms00D6: if and0248: has_modelID_loaded #MAFBOSS0248: has_modelID_loaded #HUNTER004D: jump_if_false @HUNATKAct04C4: get_actor $PLAYER_ACTOR position_3D_coord_with_offset 0.0 20.0 40.0 store_to 3@ 4@ 5@00a5: create_vehicle_with_modelID #HUNTER at_3D_coord 3@ 4@ 5@ handle_as 1@0129: create_driver_in_vehicle 1@ with_pedtype 5 with_modelID #MAFBOSS handle_as 0@0249: mark_modelID_as_no_longer_needed #HUNTER0249: mark_modelID_as_no_longer_needed #MAFBOSS04BA: set_vehicle 1@ speed_to 10.0 0724: set_hunter 1@ follow_and_attack_player $PLAYER_ACTOR radius 300.00841: flying_vehicle 1@ use_secondary_gun 1:HunModl_loopwait 0 msif 0810F: not is_player $PLAYER_CHAR wanted_level > 5004D: jump_if_false @HunModl_loop:HunModl0841: flying_vehicle 1@ use_secondary_gun 004C4: get_actor $PLAYER_ACTOR position_3D_coord_with_offset 5000.0 2000.0 40.0 store_to 6@ 7@ 8@0743: helicopter 1@ fly_to_coordinates 6@ 7@ 8@ altitude 0.0 8@wait 20000 ms01c3: mark_vehicle_as_no_longer_needed 1@01c2: mark_actor_as_no_longer_needed 0@ 00A6: delete_vehicle 1@ 009B: delete_actor 0@jump @HUNATK_loop Edited February 26, 2007 by Covernant Link to comment https://gtaforums.com/topic/267973-hunter-chasezz/#findComment-4070217 Share on other sites More sharing options...
PLPynton Posted February 26, 2007 Share Posted February 26, 2007 nice progress, carry on like that man! Link to comment https://gtaforums.com/topic/267973-hunter-chasezz/#findComment-4070549 Share on other sites More sharing options...
Covernant Posted February 26, 2007 Author Share Posted February 26, 2007 Yeah ;D Already working on another practice mod ;D K.I.T.T. Powers! lol And thank you! Link to comment https://gtaforums.com/topic/267973-hunter-chasezz/#findComment-4070570 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