IMG

 
IMG
IMG   IMG
  Welcome to GTAForums! Be sure to check out the Grand Theft Auto V Forum.

You are not registered! (If you are, click here to login) Registering is fast, free and easy and allows you to instantly reply to any topic on GTAForums.
Why wait? Click here to register your own unique username and become part of the ever-growing community!


( Log In | Register | Revalidate Validation E-mail )
Quick Log-In:
  IMG
       
>
Forum Rules GTA Modification Forums

Please post mod releases in the Mod Showroom

GTAGarage.com
free mod hosting from GTANet, simply login with your GTAForums account details

GTAModding.com
GTANet's modding wiki

GTA Modding Chatroom
provided by irc.gtanet.com (Don't have an IRC client? Click here)


  Reply to this topicStart new topicStart Poll

 Need help with a CLEO script

 
AlexTMjugador  
Posted: Monday, Apr 9 2012, 14:20
Quote Post


Hi!
Group Icon
Group: Members
Joined: Aug 12, 2011

es.gif

XXXXX



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.

This post has been edited by AlexTMjugador on Tuesday, Apr 10 2012, 16:30
PMMSN
  Top
 

 
ZAZ  
Posted: Monday, Apr 9 2012, 17:53
Quote Post


Kernlochbohrer
Group Icon
Group: Members
Joined: Jan 10, 2005

eu.gif

Member Award




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
Users WebsitePM
  Top
 

 
AlexTMjugador  
Posted: Tuesday, Apr 10 2012, 14:25
Quote Post


Hi!
Group Icon
Group: Members
Joined: Aug 12, 2011

es.gif

XXXXX



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 .

This post has been edited by AlexTMjugador on Tuesday, Apr 10 2012, 14:43
PMMSN
  Top
 

 
SilentPL  
Posted: Tuesday, Apr 10 2012, 14:38
Quote Post


Senior File Manager
Group Icon
Group: Members
Joined: Feb 1, 2010

pl.gif

Member Award




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.
Users WebsitePMMSNXbox Live
  Top
 

 
AlexTMjugador  
Posted: Tuesday, Apr 10 2012, 14:39
Quote Post


Hi!
Group Icon
Group: Members
Joined: Aug 12, 2011

es.gif

XXXXX



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

This post has been edited by AlexTMjugador on Tuesday, Apr 10 2012, 14:42
PMMSN
  Top
 

 
Deji  
Posted: Tuesday, Apr 10 2012, 15:24
Quote Post


Coding like a Rockstar!
Group Icon
Group: Members
Joined: Dec 24, 2007

ja.gif

XXXXX



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

 
AlexTMjugador  
Posted: Tuesday, Apr 10 2012, 15:27
Quote Post


Hi!
Group Icon
Group: Members
Joined: Aug 12, 2011

es.gif

XXXXX



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

This post has been edited by AlexTMjugador on Tuesday, Apr 10 2012, 15:34
PMMSN
  Top
 

 
Ashwin the new boy  
Posted: Tuesday, Apr 10 2012, 16:20
Quote Post


I am The Most Confused Person
Group Icon
Group: Members
Joined: Nov 14, 2010

ia.gif

XXXXX



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,
Users WebsitePM
  Top
 

 
Deji  
Posted: Tuesday, Apr 10 2012, 18:20
Quote Post


Coding like a Rockstar!
Group Icon
Group: Members
Joined: Dec 24, 2007

ja.gif

XXXXX



400 must be the smoke stage, then.
Users WebsitePM
  Top
 

 
AlexTMjugador  
Posted: Sunday, May 6 2012, 15:32
Quote Post


Hi!
Group Icon
Group: Members
Joined: Aug 12, 2011

es.gif

XXXXX



...

I need help, and nobody answers this cryani.gif
PMMSN
  Top
 

 

0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)

0 Members:

Topic Options Reply to this topicStart new topicStart Poll
Search topic for posted by (exact match)



 
IMG IMG