atheoang3l0_old Posted August 14, 2014 Share Posted August 14, 2014 (edited) Is it possible to disable sub-missions like Taxi Driver and Vigilante via a CLEO script? I'm currently working on a "Disguise" mod, where I'm hoping to make it so that the player needs a specific outfit to unlock and play a specific sub-mission, e.g. the Cop outfit is required to unlock and play Vigilante. This is more of a personal mod of mine made to work alongside other mods by myself and others, so I'm not sure if I'd want to release this. Edited August 17, 2014 by Darchang310 Link to comment Share on other sites More sharing options...
ZAZ Posted August 14, 2014 Share Posted August 14, 2014 with 0459: is it possible with a cleo script to terminate a running thread of main.scm but you can't start a script of main.scm, so it will problematical, because... if you terminate the mission starter script you can't play anymore the submissions if you terminate the running mission script, then the created stuff remains, like timer, actors, vehicles, markers It's easier to set the onmission var to 1, which prevent the ability to start any mission script or, if it's just for your own use, just give your player the desired outfit and play then the mission CLEO MODS CLEO Script Tutorial Link to comment Share on other sites More sharing options...
OrionSR Posted August 14, 2014 Share Posted August 14, 2014 (edited) I'm not convinced that shutting down and relaunching the R3 thread is the best solution, but if you wanted to go this route it should be possible. Threads in main.scm can be launched by calling their global offset. I've been using this trick for quite a while to launch the race and school threads early in the game, and also to repair saves of people who tweaked the cities unlocked stat too soon. // Repair for altering City Unlocked during LA1 mission strand0629: change_integer_stat 181 to 0//004F: create_thread @MOB_LA1_180158004F: create_thread 180158 // @MOB_LA1 PCv1//004F: create_thread 180137 // @MOB_LA1 PCv2 The tricky part for the R3 mission however is finding the correct global offset. Usually all I need to do is decompile with the thread+global offset option, but the R3 thread has an unusual label -- ":MS_Vehicle_SubMissions" with no global offset despite the correct setting. I'm sure it's still possible to launch it anyway but you'll have to tease out the correct address. Edited August 14, 2014 by OrionSR Link to comment Share on other sites More sharing options...
Seemann Posted August 14, 2014 Share Posted August 14, 2014 but the R3 thread has an unusual label -- ":MS_Vehicle_SubMissions" with no global offset despite the correct setting.that offset is defined in the CustomLabels.ini 76402=MS_Vehicle_SubMissions Sanny Builder 3 • SA Memory Handling • OpenIV • gtamodding.com CLEO.li - The CLEO Library - Official site Link to comment Share on other sites More sharing options...
OrionSR Posted August 14, 2014 Share Posted August 14, 2014 I figured it was something like that but I suspect this strategy may not be the best solution to the problem so I didn't follow through to the end. But... does CustomLabels.ini allow the use of 004F: create_thread @MS_Vehicle_SubMissions in cleo scripts (if the v1 scripts are installed)? Link to comment Share on other sites More sharing options...
Seemann Posted August 16, 2014 Share Posted August 16, 2014 I figured it was something like that but I suspect this strategy may not be the best solution to the problem so I didn't follow through to the end. But... does CustomLabels.ini allow the use of 004F: create_thread @MS_Vehicle_SubMissions in cleo scripts (if the v1 scripts are installed)?nope, you cant use any label that's not present in the source file. however it's an interesting idea. Sanny Builder 3 • SA Memory Handling • OpenIV • gtamodding.com CLEO.li - The CLEO Library - Official site Link to comment Share on other sites More sharing options...
atheoang3l0_old Posted August 17, 2014 Author Share Posted August 17, 2014 (edited) Hmm. So disabling missions is more complicated than I thought.. Here's a code I came up with using Zaz's idea (setting $ONMISSION to 1). How is it? Will it break any missions? :COPNARMYwait 0if or 0500: player $PLAYER_CHAR skin == "POLICETR" on_bodypart 17 0500: player $PLAYER_CHAR skin == "FIELD" on_bodypart 0then Player.WantedLevel($PLAYER_CHAR) = 0else if $ONMISSION == 0 then if or 00DD: actor $PLAYER_ACTOR driving_car_with_model 427 00DD: actor $PLAYER_ACTOR driving_car_with_model 490 00DD: actor $PLAYER_ACTOR driving_car_with_model 523 00DD: actor $PLAYER_ACTOR driving_car_with_model 596 00DD: actor $PLAYER_ACTOR driving_car_with_model 597 00DD: actor $PLAYER_ACTOR driving_car_with_model 598 00DD: actor $PLAYER_ACTOR driving_car_with_model 599 then $ONMISSION = 1 repeat wait 0 until 80DF: not actor $PLAYER_ACTOR driving $ONMISSION = 0 end end end Note that this code is set to loop, so as long as CJ is wearing either the cop uniform or the combat jacket, Wanted Level is always set to 0. How about just disabling the Submission key? Is it possible? It would be much simpler and mission-friendly if it is.You know, I may just release a variant of this mod, anyway, to give those "special" outfits some purpose (apart from the paramedic uniform, which Zaz's mod has already covered) Edited August 17, 2014 by Darchang310 Link to comment Share on other sites More sharing options...
OrionSR Posted August 17, 2014 Share Posted August 17, 2014 Another imperfect option is set $390 bit 1. This flag indicates that CJ is on a date, which disables the submissions, but obviously it'll mess with the girlfriends, probably the airport tickets, and I'm not sure what else. Still, with careful flag management you might be able to get it to work without too many consequences. Link to comment Share on other sites More sharing options...
Seemann Posted August 17, 2014 Share Posted August 17, 2014 An overkill solution is to use 09BD: 1to forbid all text boxes to be shown. The R3 thread has this check in its very beginning: 89BE: not are_text_boxes_locked_to_any_threadwhich will fail due to 09BD. So, no submissions will be allowed. To make all things work again use 09BD: 0 Sanny Builder 3 • SA Memory Handling • OpenIV • gtamodding.com CLEO.li - The CLEO Library - Official site Link to comment Share on other sites More sharing options...
OrionSR Posted August 17, 2014 Share Posted August 17, 2014 I'm still stuck on vigilante but for the other R3 missions try adjusting these variables to turn the submissions on or off as required. 0004: $ONMISSION_TAXI = 10004: $ONMISSION_Paramedic = 1 0004: $ONMISSION_Firefighter = 1 0004: $ONMISSION_Burglary = 10004: $160 = 1 // On Freight Train Sub-Mission(?)0004: $159 = 1 // On Pimping Sub-Mission(?) Link to comment Share on other sites More sharing options...
atheoang3l0_old Posted August 18, 2014 Author Share Posted August 18, 2014 (edited) Those may just be the codes I'm looking for. Will most likely make things easier. Thanks, OrionSR. I hope that you may also find out the one for Vigilante. Edited August 18, 2014 by Darchang310 Link to comment Share on other sites More sharing options...
OrionSR Posted August 18, 2014 Share Posted August 18, 2014 I looked. I couldn't find anything in the R3 trigger thread that looked like it would do the trick and hasn't already been mentioned. How about, if the vigilante mission is started and the cop outfit isn't equipped then end the vigilante thread before it has a chance to spawn any actors, vehicles, or markers that might want to stick around and display a mission abort message specifying the new requirement? Maybe even give CJ a 3 start wanted level. If you wanted to go this route there are probably more elegant ways to coax the vigilante mission into shutting down properly so you don't need to worry about mission cleanup. Link to comment Share on other sites More sharing options...
Guest Posted August 18, 2014 Share Posted August 18, 2014 Vigilante is mission started with opcode 0417 {78369} 0417: start_mission COPCAR // Vigilante Sub-Mission {78660} 0417: start_mission COPCAR // Vigilante Sub-Mission Disable vigilante 0A8C: write_memory 0xA5CB81 size 4 value 0 virtual_protect 10A8C: write_memory 0xA5CCA4 size 4 value 0 virtual_protect 1 Enable vigilante 0A8C: write_memory 0xA5CB81 size 4 value 0x7C040417 virtual_protect 10A8C: write_memory 0xA5CCA4 size 4 value 0x7C040417 virtual_protect 1 This will replace opcode 0417 with 0000 (NOP) so game will simply ignore it. You will still get "VIGILANTE" text but we can remove that easily later. This requires original main.scm and GTA San Andreas v1.0 [uS] HOODLUM EXE. Link to comment Share on other sites More sharing options...
Seemann Posted August 18, 2014 Share Posted August 18, 2014 (edited) You can use advantage of CLEO scripting and hook the R3 thread, its wakeup value. The game will think you use a wait opcode, and the R3 thread loop will wait long enough for the next iteration. To make it normal, just reset the timer value. {$cleo}0000:while true wait 250 if 0AB0: key_pressed 45 // Insert then [email protected] = 99999999 gosub @UpdateR3Thread end if 0AB0: key_pressed 46 // Home then [email protected] = 0 gosub @UpdateR3Thread endend:UpdateR3Thread0AAA: [email protected] = thread 'R3' pointerif [email protected] > 0then [email protected] += 0xCC 0A8C: write_memory [email protected] size 4 value [email protected] virtual_protect 0endwait 1000 return Edited August 18, 2014 by Seemann Sanny Builder 3 • SA Memory Handling • OpenIV • gtamodding.com CLEO.li - The CLEO Library - Official site Link to comment Share on other sites More sharing options...
OrionSR Posted August 18, 2014 Share Posted August 18, 2014 (edited) Ooh! I think we have a winner. This would eliminate most of my concerns about modifications persisting in the save if your mod is removed or altered. One last thing - the wakeup timer will be saved, which could leave the R3 missions bugged indefinitely unless,,, Instead of setting a really high wakeup timer, set it a few seconds ahead of the current time (I think this will work, I haven't used it quite this way) as part of your loop. When the script stops running the R3 thread will quickly heal itself. Suggestion: Let it sleep. Copy the entire R3 thread into your script, modify it as required, and manage the launching of missions within your script. Edited August 18, 2014 by OrionSR Link to comment Share on other sites More sharing options...
atheoang3l0_old Posted August 19, 2014 Author Share Posted August 19, 2014 Thanks for the help, guys. Really appreciate the ideas. For now, setting $ONMISSION to 1 works just fine. It's yet to break any of the missions I've tested so far. Link to comment Share on other sites More sharing options...
Wesser Posted September 3, 2014 Share Posted September 3, 2014 A proper way requires hooking the main "r3" script code and injecting a check which tests the untruthfulness of the $ONMISSION_VIGILANTE variable, declared by yourself, in order to start "Vigilante" mission, just like the other submission triggers. This code takes advantage of DMA to read the value of our switcher variable owned by the hooking script: {$CLEO}const LOCALID = 0endconst _CTheScripts__ScriptSpace = 0x00A49960endconst _memcmp = [email protected]: script_name 'R3HOOK'0A8D: [email protected] = read_process_memory 0x008E3070 size 4 vp 00A8E: [email protected] = [email protected] + 0x01150A8E: [email protected] = [email protected] + 0x01190A8D: [email protected] = read_process_memory [email protected] size 4 vp 00A8E: _memcmp = [email protected] + [email protected]_memcmp -= 0xB8// Check if "r3" has been started and by the main script.0AAA: [email protected] = get_script_with_this_name 'R3' pointerif or [email protected] == 0 [email protected] < 0x00A8B430 // CTheScripts::ScriptsArray[0] [email protected] >= 0x00A90830 // CTheScripts::ScriptsArray[96]then 0A93: terminate_this_custom_scriptend0A9F: [email protected] = get_script_pointer0A8E: [email protected] = [email protected] + 0x10 // CRunningScript.m_pBaseAddress0A8D: [email protected] = read_process_memory [email protected] size 4 vp 00A8F: [email protected] = [email protected] - @_aR3CommandScriptNamegosub @GetR3ScriptCodeAddr0A8F: [email protected] = [email protected] - _CTheScripts__ScriptSpace0A8E: [email protected] = [email protected] + 0x065B // r3+65Bh0A8E: [email protected] = [email protected] + 0x08DD // r3+8DDh0A8F: [email protected] = [email protected] - @_HOOK_OFF_00000654_r30A8F: [email protected] = [email protected] - _CTheScripts__ScriptSpace0A8E: [email protected] = [email protected] + 0x3C // CRunningScript.m_aLocals0A90: [email protected] = LOCALID * 4005A: [email protected] += [email protected]@ -= [email protected] /= 4// 00000654 GOTO HOOK_OFF_00000654_r30A8E: [email protected] = [email protected] + 0x0654 // r3.thread.ba+654h0A8C: write_process_memory [email protected] size 2 value 0x0002 vp [email protected] += 20A8C: write_process_memory [email protected] size 1 value 0x01 vp [email protected] += 10A8C: write_process_memory [email protected] size 4 value [email protected] vp 00A8E: [email protected] = [email protected] + 3 // r3hook.thread.ba+30A8C: write_process_memory [email protected] size 4 value [email protected] vp 00A8E: [email protected] = [email protected] + 0x0D // r3hook.thread.ba+0Dh0A8C: write_process_memory [email protected] size 4 value [email protected] vp 00A8E: [email protected] = [email protected] + 0x23 // r3hook.thread.ba+23h0A8C: write_process_memory [email protected] size 4 value [email protected] vp 00A8E: [email protected] = [email protected] + 0x2A // r3hook.thread.ba+2Ah0A8C: write_process_memory [email protected] size 4 value [email protected] vp 0while true wait 0 // [email protected] = false/true - Vigilante enabled/disabledend:GetR3ScriptCodeAddr0A8E: [email protected] = [email protected] + 0x14 // CRunningScript.m_iIP0A8D: [email protected] = read_process_memory [email protected] size 4 vp 00A8E: [email protected] = [email protected] + 0xCC // CRunningScript.m_uiWakeTime0A8D: [email protected] = read_process_memory [email protected] size 4 vp 001BD: [email protected] = get_game_timer0062: [email protected] -= [email protected] [email protected] == 70then 0A8F: [email protected] = [email protected] - 0x0F 0AA7: call_function _memcmp num_params 3 pop 3 num 6 ptr2 [email protected] ptr1 [email protected] ret [email protected] if [email protected] == 0 then 0085: [email protected] = [email protected] return end [email protected] += 0x0F 0A8D: [email protected] = read_process_memory [email protected] size 4 vp 0 [email protected] -= 4 [email protected] += _CTheScripts__ScriptSpaceelse if [email protected] <> 5000 then [email protected] = 0 return end [email protected] += 3end0A8D: [email protected] = read_process_memory [email protected] size 4 vp [email protected] -= [email protected] += _CTheScripts__ScriptSpacereturn:_aR3CommandScriptNamehex A403 09 "R3" 00end:_HOOK_OFF_00000654_r3hex 4D00 01 00000000 // 00000000 GOTO_IF_FALSE r3+8DDh // 00000007 { // 00000007 LVAR_INT var_index 0600 03 0000 01 00000000 // 00000007 SET_LVAR_INT var_index r3hook.thread.tls[LOCALID]-scrblock D600 04 00 // 00000011 ANDOR 0 3800 07 0000 0000 01 00 04 00 // 00000015 IS_INT_VAR_EQUAL_TO_NUMBER DMA[var_index] 0 4D00 01 00000000 // 00000020 GOTO_IF_FALSE r3+8DDh 0200 01 00000000 // 00000027 GOTO r3+65Bh // 0000002E }end Seemann 1 012 345 678 9A BCD EFG HIJK LMN OPQR STUV WX YZ Link to comment Share on other sites More sharing options...
NTAuthority Posted September 3, 2014 Share Posted September 3, 2014 >actually exposing a lack of range checks as a feature I know early Sanny is to blame for this, but really, are III modders this bad? Inactive in GTA/R* title modification indefinitely pursuant to a court order obtained by TTWO. Good job acting against modding! Link to comment Share on other sites More sharing options...
Wesser Posted September 4, 2014 Share Posted September 4, 2014 (edited) Where are they missed? I forgot to say the code works on a modified main script and an untouched "r3" script. Anyway, what does SB matters? Edited September 4, 2014 by Wesser 012 345 678 9A BCD EFG HIJK LMN OPQR STUV WX YZ Link to comment Share on other sites More sharing options...
Silent Posted September 4, 2014 Share Posted September 4, 2014 What's wrong with the constant tiny wait applied to the script from another script? This way is simpler and not to mention, compatible with modified SCMs Link to comment Share on other sites More sharing options...
NTAuthority Posted September 4, 2014 Share Posted September 4, 2014 Where are they missed? I forgot to say the code works on a modified main script and an untouched "r3" script.talking about this 'dma' thing What's wrong with the constant tiny wait applied to the script from another script? This way is simpler and not to mention, compatible with modified SCMsbut doesn't Wesser's code scan for the script name command, and therefore work with anything having r3.sc? Inactive in GTA/R* title modification indefinitely pursuant to a court order obtained by TTWO. Good job acting against modding! Link to comment Share on other sites More sharing options...
Silent Posted September 4, 2014 Share Posted September 4, 2014 but doesn't Wesser's code scan for the script name command, and therefore work with anything having r3.sc? as if I could read code conveniently here. Link to comment Share on other sites More sharing options...
Wesser Posted September 4, 2014 Share Posted September 4, 2014 Don't know if you noticed, we are dealing with workarounds, not definitive solutions. 012 345 678 9A BCD EFG HIJK LMN OPQR STUV WX YZ Link to comment Share on other sites More sharing options...
Silent Posted September 4, 2014 Share Posted September 4, 2014 A definitive solution would be to apply changes to main.scm, and I don't think the OP wants it. Your code behaves the same way as if the changes were applied to the SCM directly, but if there's a WAY less complex solution which behaves the same way to the end user and, what's important, has no side effects, why not use it and save hassle? Link to comment Share on other sites More sharing options...
Wesser Posted September 4, 2014 Share Posted September 4, 2014 (edited) The point is they do not behave in the same way, they just aim to achieve the same thing, each one has its own side effects (excluding those stated to demonize my script). If you believe that changing the wake time is a reliable method it's just your opinion I do not approve. EDIT: You led me to confusion. The OP asked for a way to enable a specific submission trigger only when the player wears a particular outfit which fits the job he is going to carry out. My script gives the ability to selectively allow/disallow doing the "Vigilante" submission, not simply disable the whole "r3" script temporarily. Edited September 5, 2014 by Wesser 012 345 678 9A BCD EFG HIJK LMN OPQR STUV WX YZ Link to comment Share on other sites More sharing options...
turbocoder32 Posted September 24, 2014 Share Posted September 24, 2014 (edited) Hey guys , use $390 I read over the post. This works and tested , tried and true. {$CLEO .cs}//0735: is_keyboard_key_pressed 49//0736: is_keyboard_key_just_pressed 32//00E1: player 0 pressed_key 19thread 'MISSIONTEST':MISSIONTEST_11wait 0if //AND Player.Defined($PLAYER_CHAR)// $ONMISSION == 0 jf @MISSIONTEST_11:MISSIONTEST_14if or Actor.DrivingTaxiVehicle($PLAYER_ACTOR) Actor.DrivingVehicleType($PLAYER_ACTOR, #AMBULAN) Actor.DrivingVehicleType($PLAYER_ACTOR, #FIRETRUK) Actor.DrivingVehicleType($PLAYER_ACTOR, #HUNTER) Actor.DrivingVehicleType($PLAYER_ACTOR, #BOXBURG) Actor.DrivingPoliceVehicle($PLAYER_ACTOR)jf @MISSIONTEST_15IF AND8500: not player $PLAYER_CHAR skin == "POLICETR" on_bodypart 178500: not player $PLAYER_CHAR skin == "MEDICTR" on_bodypart 17jf @MISSIONTEST_1108BA: set $390 bit 1jump @MISSIONTEST_11:MISSIONTEST_15if or Actor.DrivingTaxiVehicle($PLAYER_ACTOR) Actor.DrivingVehicleType($PLAYER_ACTOR, #AMBULAN) Actor.DrivingVehicleType($PLAYER_ACTOR, #FIRETRUK) Actor.DrivingVehicleType($PLAYER_ACTOR, #HUNTER) Actor.DrivingVehicleType($PLAYER_ACTOR, #BOXBURG) Actor.DrivingPoliceVehicle($PLAYER_ACTOR)jf @MISSIONTEST_16IF AND0500: player $PLAYER_CHAR skin == "POLICETR" on_bodypart 170500: player $PLAYER_CHAR skin == "MEDICTR" on_bodypart 17jf @MISSIONTEST_11$390 = 0jump @MISSIONTEST_11:MISSIONTEST_16IF8449: not actor $PLAYER_ACTOR in_a_carjf @MISSIONTEST_11$390 = 0 jump @MISSIONTEST_11end_thread Edited September 24, 2014 by turbocoder32 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