skatefilter5 Posted August 4, 2017 Share Posted August 4, 2017 I was wondering how do I put a timer when my homie dies until being revived like in saints row. But in the opcode I only see these: 014E: start_timer_at $7234 count_in_direction 1 // global_variable 014F: stop_timer $1923 0890: enable_sound_when_timer $253 reach 3 seconds // global_variable 03C3: set_timer_to $1923 type 1 GXT 'BB_19' // global_variable // Time If I add like that, when there's no start of "$782 = timer" it will crash when I use these. I type "timer" and that's it shows. SPACE + 4 VVVVVVVV //-------------MAIN---------------0000: NOP :NONAME_2wait 0 if and0AB0: key_pressed 32 0AB0: key_pressed 52 else_jump @NONAME_2 wait 0 Model.Load(#MP5LNG)Model.Load(#CHROMEGUN)Model.Load(#AK47)Model.Load(#SAWNOFF)Model.Load(#DESERT_EAGLE)Model.Load(#BAT)Model.Load(#KNIFECUR)Model.Load(#SILENCED)Model.Load(#SHOTGSPA)Model.Load(#M4)Model.Load(#MICRO_UZI)Model.Load(#VWMYCD)04ED: load_animation "MEDIC" 04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 0.0 2.0 -1.0 038B: load_requested_models [email protected] = Actor.Create(Gang2, #VWMYCD, [email protected], [email protected], [email protected])jump @NONAME_174 :[email protected] = Actor.Create(Gang2, #VWMYCD, [email protected], [email protected], [email protected]):[email protected] = Marker.CreateAboveActor([email protected])Marker.SetColor([email protected], 2)018B: set_marker [email protected] radar_mode 2 Actor.Health([email protected]) = 180007AF: $PLAYER_GROUP = player $PLAYER_CHAR group 0631: put_actor [email protected] in_group $PLAYER_GROUP 0630: put_actor [email protected] in_group $PLAYER_GROUP as_leader 04D8: set_actor [email protected] drowns_in_water 0 060F: set_actor [email protected] melee_accuracy_to 60.0 Actor.WeaponAccuracy([email protected]) = 6507DD: set_actor [email protected] attack_rate 75 // previously known as temper_to 087E: set_actor [email protected] weapon_droppable 0 0446: set_actor [email protected] dismemberment_possible 0 Actor.GiveWeaponAndAmmo([email protected], Shotgun, 9999)wait 800 :NONAME_288wait 0 if Actor.Dead([email protected])else_jump @NONAME_578 else_jump @NONAME_288 04C4: store_coords_to [email protected] [email protected] [email protected] from_actor [email protected] with_offset 0.0 0.0 -1.0 wait 1000 Marker.SetColor([email protected], 4)018B: set_marker [email protected] radar_mode 3 0ACD: show_text_highpriority "You have to revive your ~p~homie~w~." time 3500 :NONAME_406wait 0 if 00F3: actor $PLAYER_ACTOR near_actor [email protected] radius 1.0 1.0 sphere 0 on_foot else_jump @NONAME_406 0ACD: show_text_highpriority "Press F/Enter to revive your ~p~homie~w~." time 3500 :NONAME_489wait 0 if 00E1: player 0 pressed_key 15 else_jump @NONAME_406 else_jump @NONAME_489 00BE: text_clear_all 0605: actor $PLAYER_ACTOR perform_animation "CPR" IFP "MEDIC" framedelta 4.0 loop 0 lockX 0 lockY 0 lockF 0 time 9200 wait 4850 Marker.Disable([email protected])Actor.DestroyInstantly([email protected])wait 0 jump @NONAME_155 :NONAME_578wait 0 if and0AB0: key_pressed 32 0AB0: key_pressed 52 else_jump @NONAME_288 else_jump @NONAME_578 Marker.Disable([email protected])Actor.DestroyInstantly([email protected])wait 1000 jump @NONAME_2 Link to comment Share on other sites More sharing options...
kosticn101 Posted August 4, 2017 Share Posted August 4, 2017 (edited) If I add like that, when there's no start of "$782 = timer" it will crash when I use these. What did you mean by this? Nevermind, if you're going to use timers you should now that these opcodes work only with global variables and that it's not a good idea to create a global variable in a CLEO script. Seemann wrote some functions that allow you to create a timer or a counter without global variables, so if you want you can use them instead. I wrote an example: {$CLEO}0000:/****** EXAMPLE ******/:loopwait 0if 0ADC: test_cheat "TIMERS"jf @[email protected] = 11000 //[email protected] = 100 //[email protected] = 0 //timerb0AB1: call_scm_func @SetTimer 3 VARNUMBER = 0 TYPE = 1 GXT = @GXT0AB1: call_scm_func @SetStatusText 4 VARNUMBER = 33 TYPE = 0 GXT = @GXT LINE = 0 0AB1: call_scm_func @SetStatusText 4 VARNUMBER = 1 TYPE = 1 GXT = @GXT LINE = [email protected] = 0while [email protected] > 0 wait 0 if [email protected] > 0 then //i decrease status bar each second if [email protected] >= 1000 then [email protected] -= 10 [email protected] = 0 end else 0AB1: call_scm_func @RemoveStatusText 1 ( VARNUMBER = 1 ) endend0AB1: call_scm_func @StopTimer 1 ( VARNUMBER = 0 )0AB1: call_scm_func @RemoveStatusText 1 ( VARNUMBER = 33 )jump @loop0A93: end_custom_thread/****** COPY AND PASTE THESE FUNCTIONS ******/:SetStatusText //03C4: set_status_text 0AB1: call_scm_func @__VarToOffset 1 [email protected] [email protected]: call_scm_func @__LabelToOffset 1 [email protected] [email protected]: call_method 0x0044CDA0 struct 0x00BA1788 num_params 4 pop 0 ( LINE = [email protected] GXT = [email protected] TYPE = [email protected] VARNUMBER = [email protected] )0AB2: ret 0 :RemoveStatusText //0151: remove_status_text0AB1: call_scm_func @__VarToOffset 1 [email protected] [email protected]: call_method 0x0044CE80 struct 0x00BA1788 num_params 1 pop 0 ( VARNUMBER = [email protected] )0AB2: ret 0 :SetTimer //03C3: set_timer_to0AB1: call_scm_func @__VarToOffset 1 [email protected] [email protected]: call_scm_func @__LabelToOffset 1 [email protected] [email protected]: call_method 0x0044CD50 struct 0x00BA1788 num_params 3 pop 0 ( TYPE = [email protected] GXT = [email protected] VARNUMBER = [email protected] )0AB2: ret 0 :StopTimer //014F: stop_timer0AB1: call_scm_func @__VarToOffset 1 [email protected] [email protected]: call_method 0x0044CE60 struct 0x00BA1788 num_params 1 pop 0 ( VARNUMBER = [email protected] )0AB2: ret 0 :__VarToOffset0A90: [email protected] = [email protected] * 40AC7: [email protected] = var [email protected] offset005A: [email protected] += [email protected] // (int)[email protected] -= 0xA499600AB2: ret 1 [email protected]:__LabelToOffsetif [email protected] == 0then 0AB2: ret 1 0end0AC6: [email protected] = label [email protected] [email protected] += 30AB2: ret 1 [email protected]//:GXT1//0900: 'BB_18'//etc... you can add more:GXT0900: 'BB_19' //You can change this value.0000: VARNUMBER Number of a variable that should store the time/count, for example 2, 33, ... TYPE SetStatusText: - 0 show number - 1 show status bar SetTimer: - 0 increasing - 1 decreasing GXT GXT key of text that you want to show (eg. 'BB_19' = TIME). If you don't want text, set 0. To set GXT you need to use label and 0900 like shown in this example. LINE You can use up to 4 counters. So LINE can have values 0, 1, 2, 3. - You can have only one timer. Edited August 4, 2017 by kosticn101 deltaCJ 1 Link to comment Share on other sites More sharing options...
deltaCJ Posted August 10, 2017 Share Posted August 10, 2017 I feel like if you still use global variables in CLEO scripts when told not to, you should really start studying how to code... 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