barking Posted February 11, 2011 Share Posted February 11, 2011 what is the code that will allow me to loop an act? ty Link to comment https://gtaforums.com/topic/469459-how-to-do-a-loop/ Share on other sites More sharing options...
ZAZ Posted February 11, 2011 Share Posted February 11, 2011 (edited) what is the code that will allow me to loop an act?ty Loop means that a jump instruction can send the reading process to a previous adress I call such an adress "Loop-adress" Important: The first opcode after such a Loop-adress must be the wait opcode mostly wait 0 millisecond the jump instruction can be a jump instruction by negation or also a normal jump instruction :akt03A4: name_thread 'AKT':akt01//----------------------------1.Loop Adress0001: wait 0 msif0256: player $PLAYER_CHAR defined004D: jump_if_false @akt01if00DF: actor $PLAYER_ACTOR driving004D: jump_if_false @akt0103C0: 1@ = actor $PLAYER_ACTOR car0229: set_car 1@ color_to 17 002AC: set_car 1@ immunities BP 1 FP 1 EP 1 CP 1 MP 1053F: set_car 1@ tires_vulnerability 0:akt03//----------------------------2.Loop Adress0001: wait 0 msif0256: player $PLAYER_CHAR defined004D: jump_if_false @akt03if80DF: not actor $PLAYER_ACTOR driving004D: jump_if_false @akt0301C3: remove_references_to_car 1@0002: jump @akt01//--------Normal jump instruction to 1.LoopAdress Edited February 11, 2011 by ZAZ Link to comment https://gtaforums.com/topic/469459-how-to-do-a-loop/#findComment-1060335070 Share on other sites More sharing options...
fireguy109 Posted February 11, 2011 Share Posted February 11, 2011 Don't you need a "wait 0 ms" entry every string, or is that just for checking if conditions are met in looped form? Link to comment https://gtaforums.com/topic/469459-how-to-do-a-loop/#findComment-1060335071 Share on other sites More sharing options...
Deji Posted February 12, 2011 Share Posted February 12, 2011 Don't you need a "wait 0 ms" entry every string, or is that just for checking if conditions are met in looped form? Think about how the game would run... * Process timers* Process input * Process models * Process other stuff * Process scripts * Process other stuff * Process camera * Process other stuff Et cetera. Each of these "process" steps is a call to a function, which calls other functions etc. Inside "Process scripts" there is a loop, which goes through every assigned script in the game, including the .scm and CLEO Scripts. The parser keeps running the scripts until it meets a "non-existant" opcode or 0001. Then it continues processing the rest of the game. If 0001 is never met, the rest of the game will never be parsed. So 0001 only needs to be used when the game needs to be parsed, which would be at least once in most loops. However, in loops where the break condition depends on something that isn't handled by another function in the game (as in, the script will change the outcome), wait's don't have to be used. Link to comment https://gtaforums.com/topic/469459-how-to-do-a-loop/#findComment-1060336248 Share on other sites More sharing options...
fireguy109 Posted February 13, 2011 Share Posted February 13, 2011 Ohh, okay. Thanks Deji. I've been working on my own custom III missions lately and I've been adding waits at the start of each thread. Maybe that's why I got a little lag (that or my antivirus, which thinks GTA III is a trojan or something b/c it's an exe). Link to comment https://gtaforums.com/topic/469459-how-to-do-a-loop/#findComment-1060337310 Share on other sites More sharing options...
Node Posted February 18, 2011 Share Posted February 18, 2011 deji you blow my mind Link to comment https://gtaforums.com/topic/469459-how-to-do-a-loop/#findComment-1060344427 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