Quantcast

Jump to content

» «
Photo

Need help with a CLEO script

9 replies to this topic
AlexTMjugador
  • AlexTMjugador

    Hi!

  • Members
  • Joined: 12 Aug 2011

#1

Posted 09 April 2012 - 02:20 PM Edited by AlexTMjugador, 10 April 2012 - 04:30 PM.

Hi! smile.gif

I'm doing a new version of one of my mods, and it worked fine without errors until I changed something. The game doesn't crashes, but the script jumps to an incorrect label. Here's the script:

CODE
// This file was decompiled using sascm.ini published by Seemann (http://sannybuilder.com/files/SASCM.rar) on 13.10.2007

{$VERSION 3.1.0027}
{$CLEO .cs}

//-------------MAIN---------------
thread 'SWITCHCJ'
0661: NOP "SWITCH MOD V1.1 (BUG FIXES & IMPROVEMENTS)"
0661: NOP "THIS VERSION FEATURES SMART AI - IF THE TARGET MARKER DOESN'T EXIST, THE CAR WON'T GET STUCK."
0661: NOP "YOU CAN READ THE SCRIPT, BUT PLASE DON'T EDIT THIS MOD WITHOUT MY PERMISSION."
0661: NOP "TELL ME ANY NEW BUG :)"

:SWITCHCJ_269
wait 0
if and
  Player.Defined($PLAYER_CHAR)
  Player.Controllable($PLAYER_CHAR)
 $ONMISSION == 0
else_jump @SWITCHCJ_269
if and
  Actor.Driving($PLAYER_ACTOR)
84C8:   not actor $PLAYER_ACTOR driving_flying_vehicle
84A7:   not actor $PLAYER_ACTOR driving_boat
else_jump @SWITCHCJ_269
if
09AE:   actor $PLAYER_ACTOR driving_train
else_jump @SWITCHCJ_350
jump @SWITCHCJ_269

:SWITCHCJ_350
03C0: 0@ = actor $PLAYER_ACTOR car
046C: 1@ = car 0@ driver
if
003B:   1@ == $PLAYER_ACTOR // (int)
else_jump @SWITCHCJ_269
01E9: 29@ = car 0@ num_passengers
if and
  not 29@ > 1
8431:   not car 0@ passenger_seat_free 0
else_jump @SWITCHCJ_269
0432: 3@ = get_actor_handle_from_car 0@ passenger_seat 0
if or
  Actor.Model(3@) == #FAM1
  Actor.Model(3@) == #FAM2
  Actor.Model(3@) == #FAM3
else_jump @SWITCHCJ_269

:SWITCHCJ_460
wait 0
if
0AB0:   key_pressed 9
else_jump @SWITCHCJ_460
0AB6: store_target_marker_coords_to 4@ 5@ 6@ // IF and SET
07AF: 20@ = player $PLAYER_CHAR group
07B3: set_group 20@ give_command 2
0632: release_group 20@
Player.CanMove($PLAYER_CHAR) = False
if and
 4@ == 0.0
 5@ == 0.0
 6@ == 0.0
else_jump @SWITCHCJ_702
00BE: text_clear_all
03E6: remove_text_box
fade 0 1000

:SWITCHCJ_569
wait 0
if
  not fading
else_jump @SWITCHCJ_569
068B: set_car 0@ all_disembark
Player.CanMove($PLAYER_CHAR) = True
0430: put_actor $PLAYER_ACTOR into_car 0@ passenger_seat 0
072A: put_actor 3@ into_car 0@ driverseat
0A30: repair_car 0@
fade 1 1000
06C7: AS_actor 3@ driver_of_car 0@ perform_action 6 timelimit 2000000
0423: set_car 0@ improved_handling_to 1.6 // (float)
Car.SetMaxSpeed(0@, 20.0)
07CC: set_player $PLAYER_CHAR button_15 0
Car.DoorStatus(0@) = 2
0526: set_actor 3@ stay_in_car 1
03E5: show_text_box 'SWITCH'
jump @SWITCHCJ_874

:SWITCHCJ_702
00BE: text_clear_all
03E6: remove_text_box
fade 0 1000

:SWITCHCJ_713
wait 0
if
  not fading
else_jump @SWITCHCJ_713
068B: set_car 0@ all_disembark
04D3: get_nearest_car_path_coords_from 4@ 5@ 6@ type 2 store_to 4@ 5@ 6@
Player.CanMove($PLAYER_CHAR) = True
0430: put_actor $PLAYER_ACTOR into_car 0@ passenger_seat 0
072A: put_actor 3@ into_car 0@ driverseat
0A30: repair_car 0@
fade 1 1000
05D1: AS_actor 3@ drive_car 0@ to 4@ 5@ 6@ speed 20.0 1 model #NULL 2
0423: set_car 0@ improved_handling_to 1.6 // (float)
Car.SetMaxSpeed(0@, 20.0)
07CC: set_player $PLAYER_CHAR button_15 0
Car.DoorStatus(0@) = 2
0526: set_actor 3@ stay_in_car 1
03E5: show_text_box 'SWITCH'

:SWITCHCJ_874
wait 0
if and
8185:   not car 0@ health >= 100
82BF:   not car 0@ sunk
else_jump @SWITCHCJ_1050
if
018F:   car 0@ flipped_for_2_seconds
else_jump @SWITCHCJ_924
jump @SWITCHCJ_1050

:SWITCHCJ_924
if
0AB0:   key_pressed 9
else_jump @SWITCHCJ_946
jump @SWITCHCJ_1154

:SWITCHCJ_946
if
0AB0:   key_pressed 68
else_jump @SWITCHCJ_968
jump @SWITCHCJ_1429

:SWITCHCJ_968
if
0AB0:   key_pressed 83
else_jump @SWITCHCJ_990
jump @SWITCHCJ_1252

:SWITCHCJ_990
if
0AB0:   key_pressed 65
else_jump @SWITCHCJ_874
jump @SWITCHCJ_1269

:SWITCHCJ_1012
wait 0
0423: set_car 0@ improved_handling_to 1.0 // (float)
Car.DoorStatus(0@) = 1
Car.RemoveReferences(0@)
Actor.RemoveReferences(3@)
jump @SWITCHCJ_269

:SWITCHCJ_1050
Car.SetDriverBehaviour(0@, Nowhere)
Car.SetSpeedInstantly(0@, 0.0)
Car.DoorStatus(0@) = 1
07CC: set_player $PLAYER_CHAR button_15 1
0633: AS_actor 3@ exit_car
04C4: store_coords_to 22@ 23@ 24@ from_actor 3@ with_offset 0.0 0.0 0.0
wait 1000
05DA: AS_actor 3@ run_away_in_panic_from 22@ 23@ 24@ away_radius 9.0 timelimit 6000
wait 6000
jump @SWITCHCJ_1012

:SWITCHCJ_1154
wait 0
Car.SetDriverBehaviour(0@, Nowhere)
Car.SetSpeedInstantly(0@, 0.0)
00BE: text_clear_all
03E6: remove_text_box
fade 0 1000

:SWITCHCJ_1186
wait 0
if
  not fading
else_jump @SWITCHCJ_1186
068B: set_car 0@ all_disembark
0430: put_actor 3@ into_car 0@ passenger_seat 0
072A: put_actor $PLAYER_ACTOR into_car 0@ driverseat
fade 1 1000
07CC: set_player $PLAYER_CHAR button_15 1
wait 1000
jump @SWITCHCJ_1012

:SWITCHCJ_1252
Car.SetSpeedInstantly(0@, 0.0)
jump @SWITCHCJ_874

:SWITCHCJ_1269
wait 0
0AB6: store_target_marker_coords_to 4@ 5@ 6@ // IF and SET
if and
 4@ == 0.0
 5@ == 0.0
 6@ == 0.0
else_jump @SWITCHCJ_1356
03E5: show_text_box 'RENEW_ERR'
wait 250
jump @SWITCHCJ_874

:SWITCHCJ_1356
04D3: get_nearest_car_path_coords_from 4@ 5@ 6@ type 2 store_to 4@ 5@ 6@
05D1: AS_actor 3@ drive_car 0@ to 4@ 5@ 6@ speed 20.0 1 model #NULL 2
03E5: show_text_box 'RENEW'
wait 250
jump @SWITCHCJ_874

:SWITCHCJ_1429
wait 0
wait 50
0563: set_player $PLAYER_CHAR driveby_ammo_to 1E11
0713: actor $PLAYER_ACTOR driveby_actor -1 car -1 point 0.0 0.0 0.0 radius 300.0 4 0 firing_rate 100
wait 1000

:SWITCHCJ_1487
wait 0
if and
8185:   not car 0@ health >= 100
82BF:   not car 0@ sunk
else_jump @SWITCHCJ_1050
if
018F:   car 0@ flipped_for_2_seconds
else_jump @SWITCHCJ_1537
jump @SWITCHCJ_1050

:SWITCHCJ_1537
if
0AB0:   key_pressed 9
else_jump @SWITCHCJ_1559
jump @SWITCHCJ_1154

:SWITCHCJ_1559
wait 0
if
0AB0:   key_pressed 68
else_jump @SWITCHCJ_1487
jump @SWITCHCJ_1585

:SWITCHCJ_1585
072B: put_actor $PLAYER_ACTOR into_car 0@ passengerseat 0
wait 1000
jump @SWITCHCJ_874


The problem it's when the script reach the label called "SWITCHCJ_874" (I'm not sure if the script reach this), because it goes to the label "SWITCHCJ_1050", which it hasn't sense, because this label is for dangerous situation and cleanup.

Thank you VERY MUCH for helping me with this! tounge2.gif

P.D: Here is the download page of the mod: click here.

ZAZ
  • ZAZ

    Kernlochbohrer

  • Feroci
  • Joined: 10 Jan 2005
  • European-Union

#2

Posted 09 April 2012 - 05:53 PM

QUOTE (AlexTMjugador @ Monday, Apr 9 2012, 14:20)
Hi!  smile.gif

I'm doing a new version of one of my mods, and it worked fine without errors until I changed something. The game don't crashes, but the script jumps to an incorrect label. Here's the script:


The problem it's when the script reach the label called "SWITCHCJ_874" (I'm not sure if the script reach this), because it goes to the label "SWITCHCJ_1050", which it hasn't sense, because this label is for dangerous situation and cleanup.

Thank you VERY MUCH for helping me with this!  tounge2.gif

P.D: Here is the download page of the mod: click here.

This check is wrong
CODE
8185:   not car 0@ health >= 100

must be the the opposite
CODE
0185:    car 0@ health >= 100

at 2 lines in your script

AlexTMjugador
  • AlexTMjugador

    Hi!

  • Members
  • Joined: 12 Aug 2011

#3

Posted 10 April 2012 - 02:25 PM Edited by AlexTMjugador, 10 April 2012 - 02:43 PM.

QUOTE (ZAZ @ Monday, Apr 9 2012, 17:53)
This check is wrong
CODE
8185:   not car 0@ health >= 100

must be the the opposite
CODE
0185:    car 0@ health >= 100

at 2 lines in your script

Good idea, and thank you for answering, but correct me if I'm wrong: I want to check if the car health it's less than 100, so I used negative version of the opcode, beacuse the original one says: "If car health it's greater than 100, ...", and i want to check "If the car health it's not greater than 100, ...".

I don't know if there is an opcode to check if the car it's on flames (because I want to check that insthead of the car health), because I searched in the Opcode Search tool and I didn't find anything.

Do you have any other suggestion, please? cryani.gif

P.D: I tried to fix this myself, so I changed the "if and" check in the problematic label to "if or", in case that I did an error in the script, but then, when I start my game and try the mod, it freezes when fading, and I din't change anything of the fade and fade check section, so I'm suspecting if it's problem of my game (or a bug in the "opcodes.ini" or something like that) sad.gif .

Silent
  • Silent

    Moderating Cookie Monster

  • Feroci
  • Joined: 01 Feb 2010
  • Poland
  • Most Helpful [GTA] 2013
    Most Helpful [Modding] 2013
    Most Talented [Modding] 2013
    Best Map 2013 "ViceCityStories PC Edition"
    Best Vehicle 2013 "III Aircraft"
    Most Helpful [Modding] 2012
    Modder of the Year 2012

#4

Posted 10 April 2012 - 02:38 PM

QUOTE (AlexTMjugador @ Tuesday, Apr 10 2012, 16:25)
I don't know if there is an opcode to check if the car it's on flames

CODE
0495:   car 78@ burning

does the trick.

AlexTMjugador
  • AlexTMjugador

    Hi!

  • Members
  • Joined: 12 Aug 2011

#5

Posted 10 April 2012 - 02:39 PM Edited by AlexTMjugador, 10 April 2012 - 02:42 PM.

QUOTE (SilentPL @ Tuesday, Apr 10 2012, 14:38)
QUOTE (AlexTMjugador @ Tuesday, Apr 10 2012, 16:25)
I don't know if there is an opcode to check if the car it's on flames

CODE
0495:   car 78@ burning

does the trick.

Thank you, that'll fix bugs in the script... if I could try it ingame turn.gif

Deji
  • Deji

    Coding like a Rockstar!

  • Feroci
  • Joined: 24 Dec 2007
  • None

#6

Posted 10 April 2012 - 03:24 PM

FYI, the car will burn when the health is under 400. It's also commonly used to test if the car is ablaze.

AlexTMjugador
  • AlexTMjugador

    Hi!

  • Members
  • Joined: 12 Aug 2011

#7

Posted 10 April 2012 - 03:27 PM Edited by AlexTMjugador, 10 April 2012 - 03:34 PM.

QUOTE (Deji @ Tuesday, Apr 10 2012, 15:24)
FYI, the car will burn when the health is under 400. It's also commonly used to test if the car is ablaze.

mercie_blink.gif

Sobeit Mod and his car health bar indicate that the cars burn when the health it's under 200... OMG! Anyway, I prefer the "if burning" opcode, it's safer for my coding level, because I don't know anything about car damage system rolleyes.gif

Ashwin.Star
  • Ashwin.Star

    Back for Next ♪♫

  • Members
  • Joined: 14 Nov 2010
  • India

#8

Posted 10 April 2012 - 04:20 PM

actually, in VC the Car catch Fire when the Health is 250 or less, 100 or less mean Almost explode lol.gif
but 0495: is best Way to check,

Deji
  • Deji

    Coding like a Rockstar!

  • Feroci
  • Joined: 24 Dec 2007
  • None

#9

Posted 10 April 2012 - 06:20 PM

400 must be the smoke stage, then.

AlexTMjugador
  • AlexTMjugador

    Hi!

  • Members
  • Joined: 12 Aug 2011

#10

Posted 06 May 2012 - 03:32 PM

...

I need help, and nobody answers this cryani.gif




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users