Quantcast

Jump to content

» «
Photo

[GTA SA] ~ CLEO Script Tutorial ~

631 replies to this topic
gtasite1
  • gtasite1

    Player Hater

  • Members
  • Joined: 24 Dec 2010

#181

Posted 14 February 2011 - 02:06 PM

My question is how you can change the color of the cleo blue, red, green and yellow box and text in the game

EdUaRdO - Brazil
  • EdUaRdO - Brazil

    Brazilian Scripter

  • Members
  • Joined: 14 Nov 2010

#182

Posted 17 February 2011 - 11:22 PM

QUOTE (gtasite1 @ Feb 14 2011, 14:06)
My question is how you can change the color of the cleo blue, red, green and yellow box and text in the game

One way to do this is by FXT, putting some letters before the words ... for example:
CODE

TEXT ~y~Text Example~y~ //Y yellow
TEXT ~r~Text Example~r~ //R Red

kmlwin.1996
  • kmlwin.1996

    Hold up™

  • BUSTED!
  • Joined: 11 May 2010

#183

Posted 18 February 2011 - 04:32 AM

I have still questions....

How do you calculate offsets?
How to make search lights?
How to make a particle like smoke?

Please help me!
rampage_ani.gif rampage_ani.gif

EdUaRdO - Brazil
  • EdUaRdO - Brazil

    Brazilian Scripter

  • Members
  • Joined: 14 Nov 2010

#184

Posted 18 February 2011 - 11:19 PM Edited by EdUaRdO - Brazil, 22 April 2011 - 10:18 PM.

QUOTE
(kmlwin.1996 @ Feb 18 2011, 04:32)
I have still questions....

How do you calculate offsets?
How to make search lights?
How to make a particle like smoke?

Please help me!
rampage_ani.gif   rampage_ani.gif


Offset is virtually a creation of a coordinated from an imaginary object, car or pedestrian ex ...

CODE

04C4: store_coords_to $CORDX $CORDY $CORDZ from_actor $PLAYER_ACTOR with_offset 1.0 3.0 1.0



The ofsset 1.0 3.0 1.0 be namely a more coordinated in X, 3 more coordinated in a Y and Z in the most coordinated in relation to the CJ ... getting this:



X = East/West dimension
Y = North/South dimension
Z = Height dimension



QUOTE

How to make search lights?


CODE

06B1: $LIGHT = create_searchlight_at 0.0 0.0 0.0 radius 0.0 target 0.0 0.0 0.0 radius 1.0
06B3:   searchlight $LIGHT active



1st parameter = name of the light
2nd parameter = coordinate that will be the beginning of the light
3rd parameter = Radius of the beginning of the light
4rd parameter = coordinate that will be the focus of the light
5rd parameter Radius of focus light



QUOTE

How to make a particle like smoke?


CODE
CODE
064B: $SMOKE = create_particle 'smoke50lit' at $x $y $z type 1
064C: make_particle $SMOKE visible



1st parameter = Name of the particle parameter
2nd parameter = name of the game particle
3rd parameter = Radius of the beginning of the light
4rd parameter = coordinate that will be the particle
5rd parameter = type of particle (1 default)
icon14.gif

gtasite1
  • gtasite1

    Player Hater

  • Members
  • Joined: 24 Dec 2010

#185

Posted 19 February 2011 - 02:32 PM

I have a serious problem. I want to write text to a file in code:
CODE
CAMERA.SETPOSITION(-986.487, 17.0653, 10.2857, 0.0, 0.0, 0.0)
CAMERA.POINTAT(-987.243, 17.6505, 10.5804, 2)


But the file in CLEO 4 saves this code in the form:
CODE
CAMERA.SETPOSITION(-986.487, 17.0653, 10.2857, 0.0, 0.0, 0.0)CAMERA.POINTAT(-987.243, 17.6505, 10.5804, 2)


And here is my script in the CLEO4.
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 'CAM'

:CAM_11
wait 0
068D: get_camera_position_to 0@ 1@ 2@
068E: get_camera_target_point_to 3@ 4@ 5@
if
0AB0:   key_pressed 88
else_jump @CAM_11
if
  Player.Defined($PLAYER_CHAR)
else_jump @CAM_11
if
File.Open(10@, "CLEO\CAM.INI", 119)
else_jump @CAM_11
0AD9: write_formatted_text "CAMERA.SETPOSITION(%G, %G, %G, 0.0, 0.0, 0.0)" 10@ 0@ 1@ 2@  
0AD9: write_formatted_text "CAMERA.POINTAT(%G, %G, %G, 2)" 10@ 3@ 4@ 5@  
File.Close(10@)
0ACE: show_formatted_text_box "FILE SAVED TO CLEO\CAM.INI DIRECTORY." 2766  
jump @CAM_11

When you press the X writes the code in the directory CLEO



ZAZ
  • ZAZ

    Kernlochbohrer

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

#186

Posted 19 February 2011 - 09:18 PM

QUOTE (gtasite1 @ Feb 19 2011, 14:32)
I have a serious problem. I want to write text to a file in code:
CODE
CAMERA.SETPOSITION(-986.487, 17.0653, 10.2857, 0.0, 0.0, 0.0)
CAMERA.POINTAT(-987.243, 17.6505, 10.5804, 2)


a new line? don't know if possible
ask >here<

gtasite1
  • gtasite1

    Player Hater

  • Members
  • Joined: 24 Dec 2010

#187

Posted 21 February 2011 - 02:23 PM

I have a question. Recently I did a little race for gta sa, but I miss the black screen-icon in the lower right corner of the screen, which displays the position of the player. Does anyone know how to do it?
user posted image

ZAZ
  • ZAZ

    Kernlochbohrer

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

#188

Posted 21 February 2011 - 05:03 PM

QUOTE (gtasite1 @ Feb 21 2011, 14:23)
I have a question. Recently I did a little race for gta sa, but I miss the black screen-icon in the lower right corner of the screen, which displays the position of the player. Does anyone know how to do it?

I assume it's 038E:
CODE
:MTBIKER_11790
038E: draw_box_position 40@ 47@ size 54@ 61@ RGBA 0 0 0 255
038E: draw_box_position 39@ 46@ size 53@ 60@ RGBA 134 155 184 255
038E: draw_box_position 34@ 41@ size 48@ 55@ RGBA 0 0 0 255

gtasite1
  • gtasite1

    Player Hater

  • Members
  • Joined: 24 Dec 2010

#189

Posted 23 February 2011 - 08:58 AM

I put the actor with a marker, and what do you do that, as things are going to kill him, this marker? Here is my code.

CODE
:AA
wait 0
if
0AB0:  key_pressed 63
jf @AA
Model.Load(#LSV1)
Model.Load(#MICRO_UZI)
038B: load_requested_models

:CARL2_921
if and
  not Model.Available(#MICRO_UZI)
  not Model.Available(#LSV1)
jf @CARL2_953
jump @CARL2_921

:CARL2_953
561@ = Actor.Create(Mission1, #LSV1, 2411.647, -1308.872, 24.6667)
Actor.Angle(561@) = 181.9409
01B2: give_actor 561@ weapon 28 ammo 30000 // Load the weapon model before using this
0568: set_actor 561@ targetable 1
Actor.Armour(561@) = 100
077A: set_actor 561@ acquaintance 0 to_actors_pedtype 24 // see ped.dat
02A9: set_actor 561@ immune_to_nonplayer 1
0446: set_actor 561@ immune_to_headshots 0
060B: set_actor 561@ decision_maker_to 266@
0638: AS_actor 561@ stay_put 1
347@ = Marker.CreateAboveActor(561@)
018B: set_marker 347@ radar_mode 2
Marker.SetIconSize(347@, 2)
Model.Destroy(#MICRO_UZI)
Model.Destroy(#LSV1)

ZAZ
  • ZAZ

    Kernlochbohrer

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

#190

Posted 23 February 2011 - 06:05 PM Edited by ZAZ, 24 February 2011 - 05:30 PM.

QUOTE (gtasite1 @ Feb 23 2011, 08:58)
I put the actor with a marker, and what do you do that, as things are going to kill him, this marker? Here is my code.

Your code isn't complete and it isn't from you. Post your own complete script to get help.
Furthermore is the discussion section for such themes >here<

Check if actor is dead to can remove the marker.
If there are more actors with markers, it needs additional checks to remove the marker only at one time and at the correct moment.
Either use math coding and check the value of a variable which will be changed when the marker will be removed.
or use the check
if
075C: marker 12@ enabled

2 examples below
version1 use math coding and check the value of a variable
version2 use opcode 075C:

CODE
{$CLEO .cs}
:Actors_check_dead_marker_version_1
03A4: name_thread 'ACTDDMK'

:ACTDDMK_1
0001: wait  0 ms
if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @ACTDDMK_1
if
0AB0:   key_pressed 8//-------------------------- key Backspace
004D: jump_if_false @ACTDDMK_1

0247: request_model #VMAFF1
0247: request_model #VMAFF2
0247: request_model #VMAFF3
0247: request_model #DESERT_EAGLE

:ACTDDMK_3
0001: wait  0 ms
if  and
0248:   model #VMAFF1 available
0248:   model #VMAFF2 available
0248:   model #VMAFF3 available
0248:   model #DESERT_EAGLE available
004D: jump_if_false @ACTDDMK_3

04C4: create_coordinate 21@ 22@ 23@ from_actor $PLAYER_ACTOR offset 0.0  4.0  0.2

009A: 1@ = create_actor  24 #VMAFF1 at  21@ 22@ 23@
21@ += 2.0
009A: 2@ = create_actor  24 #VMAFF2 at  21@ 22@ 23@
21@ -= 4.0
009A: 3@ = create_actor  24 #VMAFF3 at  21@ 22@ 23@

01B2: give_actor 1@ weapon  24 ammo  99999  // Load the weapon model before using this
02E2: set_actor 1@ weapon_accuracy_to  30
05E2: AS_actor 1@ kill_actor $PLAYER_ACTOR
01B2: give_actor 2@ weapon  24 ammo  99999  // Load the weapon model before using this
02E2: set_actor 2@ weapon_accuracy_to  30
05E2: AS_actor 2@ kill_actor $PLAYER_ACTOR
01B2: give_actor 3@ weapon  24 ammo  99999  // Load the weapon model before using this
02E2: set_actor 3@ weapon_accuracy_to  30
05E2: AS_actor 3@ kill_actor $PLAYER_ACTOR

0187: 11@ = create_marker_above_actor 1@
0187: 12@ = create_marker_above_actor 2@
0187: 13@ = create_marker_above_actor 3@

15@ = 0
16@ = 0
17@ = 0

0249: release_model #VMAFF1
0249: release_model #VMAFF2
0249: release_model #VMAFF3
0249: release_model #DESERT_EAGLE

:ACTDDMK_13
0001: wait  0 ms
if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @ACTDDMK_23_cleanup
if
0118:   actor 1@ dead
004D: jump_if_false @ACTDDMK_15
if
15@ == 0
004D: jump_if_false @ACTDDMK_15
0164: disable_marker 11@
15@ = 1

:ACTDDMK_15
if
0118:   actor 2@ dead
004D: jump_if_false @ACTDDMK_17
if
16@ == 0
004D: jump_if_false @ACTDDMK_17
0164: disable_marker 12@
16@ = 1

:ACTDDMK_17
if
0118:   actor 3@ dead
004D: jump_if_false @ACTDDMK_19
if
17@ == 0
004D: jump_if_false @ACTDDMK_19
0164: disable_marker 13@
17@ = 1

:ACTDDMK_19
if  and
0118:   actor 1@ dead
0118:   actor 2@ dead
0118:   actor 3@ dead
004D: jump_if_false @ACTDDMK_13

:ACTDDMK_23_cleanup
if
15@ == 0
004D: jump_if_false @ACTDDMK_25
0164: disable_marker 11@

:ACTDDMK_25
if
16@ == 0
004D: jump_if_false @ACTDDMK_27
0164: disable_marker 12@

:ACTDDMK_27
if
17@ == 0
004D: jump_if_false @ACTDDMK_30
0164: disable_marker 13@

:ACTDDMK_30
01C2: remove_references_to_actor 1@
01C2: remove_references_to_actor 2@
01C2: remove_references_to_actor 3@
0002: jump @ACTDDMK_1



CODE
{$CLEO .cs}
:Actors_check_dead_marker_version_2
03A4: name_thread 'ACTDDMK'

:ACTDDMK_1
0001: wait  0 ms
if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @ACTDDMK_1
if
0AB0:   key_pressed 8//-------------------------- key Backspace
004D: jump_if_false @ACTDDMK_1

0247: request_model #VMAFF1
0247: request_model #VMAFF2
0247: request_model #VMAFF3
0247: request_model #DESERT_EAGLE

:ACTDDMK_3
0001: wait  0 ms
if  and
0248:   model #VMAFF1 available
0248:   model #VMAFF2 available
0248:   model #VMAFF3 available
0248:   model #DESERT_EAGLE available
004D: jump_if_false @ACTDDMK_3

04C4: create_coordinate 21@ 22@ 23@ from_actor $PLAYER_ACTOR offset 0.0  4.0  0.2

009A: 1@ = create_actor  24 #VMAFF1 at  21@ 22@ 23@
21@ += 2.0
009A: 2@ = create_actor  24 #VMAFF2 at  21@ 22@ 23@
21@ -= 4.0
009A: 3@ = create_actor  24 #VMAFF3 at  21@ 22@ 23@

01B2: give_actor 1@ weapon  24 ammo  99999  // Load the weapon model before using this
02E2: set_actor 1@ weapon_accuracy_to  30
05E2: AS_actor 1@ kill_actor $PLAYER_ACTOR
01B2: give_actor 2@ weapon  24 ammo  99999  // Load the weapon model before using this
02E2: set_actor 2@ weapon_accuracy_to  30
05E2: AS_actor 2@ kill_actor $PLAYER_ACTOR
01B2: give_actor 3@ weapon  24 ammo  99999  // Load the weapon model before using this
02E2: set_actor 3@ weapon_accuracy_to  30
05E2: AS_actor 3@ kill_actor $PLAYER_ACTOR

0187: 11@ = create_marker_above_actor 1@
0187: 12@ = create_marker_above_actor 2@
0187: 13@ = create_marker_above_actor 3@

0249: release_model #VMAFF1
0249: release_model #VMAFF2
0249: release_model #VMAFF3
0249: release_model #DESERT_EAGLE

:ACTDDMK_13
0001: wait  0 ms
if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @ACTDDMK_23_cleanup
if
0118:   actor 1@ dead
004D: jump_if_false @ACTDDMK_15
if
075C:   marker 11@ enabled
004D: jump_if_false @ACTDDMK_15
0164: disable_marker 11@

:ACTDDMK_15
if
0118:   actor 2@ dead
004D: jump_if_false @ACTDDMK_17
if
075C:   marker 12@ enabled
004D: jump_if_false @ACTDDMK_17
0164: disable_marker 12@

:ACTDDMK_17
if
0118:   actor 3@ dead
004D: jump_if_false @ACTDDMK_19
if
075C:   marker 13@ enabled
004D: jump_if_false @ACTDDMK_19
0164: disable_marker 13@

:ACTDDMK_19
if  and
0118:   actor 1@ dead
0118:   actor 2@ dead
0118:   actor 3@ dead
004D: jump_if_false @ACTDDMK_13

:ACTDDMK_23_cleanup
if
075C:   marker 11@ enabled
004D: jump_if_false @ACTDDMK_25
0164: disable_marker 11@

:ACTDDMK_25
if
075C:   marker 12@ enabled
004D: jump_if_false @ACTDDMK_27
0164: disable_marker 12@

:ACTDDMK_27
if
075C:   marker 13@ enabled
004D: jump_if_false @ACTDDMK_30
0164: disable_marker 13@

:ACTDDMK_30
01C2: remove_references_to_actor 1@
01C2: remove_references_to_actor 2@
01C2: remove_references_to_actor 3@
0002: jump @ACTDDMK_1

gtasite1
  • gtasite1

    Player Hater

  • Members
  • Joined: 24 Dec 2010

#191

Posted 01 March 2011 - 11:38 AM Edited by gtasite1, 01 March 2011 - 11:48 AM.

I wanted to be appeared after the mission but I am more interested in the one with the VCS but here I wrote a script with a pager with gta 3 and then starts flashing (CLEO 4)

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 'PAGER'
0000: NOP
wait 5000
0@ = -64.0
1@ = 64.0
0390: load_txd_dictionary 'PAGER'
038F: load_texture "PAGER" as 1 // Load dictionary with 0390 first
Audiostream.Load($PAGER, "CLEO\GTA3PAGER.MP3")
Audiostream.PerformAction($PAGER, PLAY)

:PAGER_92
03F0: enable_text_draw 1
038D: draw_texture 1 position 0@ 60.67 size 128.0 119.47 RGBA 255 255 255 255
03E3: set_texture_to_be_drawn_antialiased 1

:PAGER_134
wait 0
if
 not 0@ > 64.0
jf @PAGER_181
0@ += 2.0
jump @PAGER_92
0AB2: ret 0

:PAGER_181
wait 0
if
 not 0@ == 64.0
jf @PAGER_218
jump @PAGER_92
0AB2: ret 0

:PAGER_218
jump @PAGER_134
0A93: end_custom_thread


here it is: http://www.megaupload.com/?d=SFXSCD4B

kmlwin.1996
  • kmlwin.1996

    Hold up™

  • BUSTED!
  • Joined: 11 May 2010

#192

Posted 01 March 2011 - 01:07 PM

What this opcode means?

0407: create_coordinate 11@ 12@ 13@ from_car 1@ offset -10.0 15.0 0.0

And what is coordinate? How to create it? How to calculate it?

ZAZ
  • ZAZ

    Kernlochbohrer

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

#193

Posted 01 March 2011 - 06:31 PM Edited by ZAZ, 01 March 2011 - 06:58 PM.

QUOTE (gtasite1 @ Mar 1 2011, 11:38)
I wanted to be appeared after the mission but I am more interested in the one with the VCS but here I wrote a script with a pager with gta 3 and then starts flashing (CLEO 4)

don't use globals in cleoscripts and write your script in a simple and clear manner

CODE

{$CLEO .cs}

//-------------MAIN---------------
thread 'PAGER'
0000: NOP
wait 5000
0@ = -64.0
1@ = 64.0
0390: load_txd_dictionary 'LD_BEAT'
038F: load_texture "upr" as 1 // Load dictionary with 0390 first
Audiostream.Load(25@, "CLEO\GTA3PAGER.MP3")
Audiostream.PerformAction(25@, PLAY)

:PAGER_92
wait 0
03F0: enable_text_draw 1
038D: draw_texture 1 position 0@ 60.67 size 128.0 119.47 RGBA 255 255 255 255
03E3: set_texture_to_be_drawn_antialiased 1
if
64.0 > 0@
jf @PAGER_92
0@ += 2.0
jump @PAGER_92











QUOTE (kmlwin.1996 @ Mar 1 2011, 13:07)
What this opcode means?

0407: create_coordinate 11@ 12@ 13@ from_car 1@ offset  -10.0  15.0  0.0

And what is coordinate? How to create it? How to calculate it?

Read about Coordinate_system at Wikipedia
and select your language at the left navigationmenue

user posted image
The coordsystem allows to define a point in the 3-dimension space as well in the virtual space
by definition of the x-value, y-value and z-value
user posted image
The San Andreas gameworld is also allocated to a coordssystem
The corners of the border are
in North-West at x= -3000.0, y= 3000.0
in North-East at x= 3000.0, y= 3000.0
in South-West at x= -3000.0, y= -3000.0
in South-East at x= 3000.0, y= -3000.0
In the z-dimension is the map placed between 0.0 and 300.0,
the interiors are placed at z= 1000.0
If you fall under the ground and reach z= -100.0 the exe will bring you back to the map

Each model have it's own coordssystem. Buildings, objects, actors as well as the cars
user posted imageuser posted imageuser posted image
Now let's place a pyramid at the top of the car like in picture below
user posted image
You can do it ingame with script by using this opcode:
CODE
0407: create_coordinate 11@ 12@ 13@ from_car 0@ offset  0.0  2.0  0.0
0107: 25@ = create_object 1240 at 11@ 12@ 13@

The offset parameter are refering to the coordssystem of the car
offset x, y, z
offset 0.0 2.0 0.0
the pyramid is placed 2.0 units at the y-axis
at the center of the x-axis and at the center of the z-axis

to attach an object to car use this opcode
CODE
0681: attach_object 25@ to_car 0@ with_offset 0.0 2.0 0.0 rotation 0.0 0.0 90.0

the offset parameter have the same meaning like in opcode 0407:
and it have further parameter to define the orientaion (rotation)



gtasite1
  • gtasite1

    Player Hater

  • Members
  • Joined: 24 Dec 2010

#194

Posted 05 March 2011 - 09:52 AM Edited by gtasite1, 05 March 2011 - 10:31 AM.

Nothing. Post must be deleted.

Fatalpipe
  • Fatalpipe

    Pipeworker

  • Members
  • Joined: 02 May 2010

#195

Posted 08 March 2011 - 07:30 PM Edited by Fatalpipe, 09 March 2011 - 05:31 AM.

I dont want double post,so,can you say to us if this is a possible thing to do?Thank you!!

>>>EDIT<<< I'm reading all stuff,and closest I got is this:

CODE
{$CLEO .cs}

//-------------MAIN---------------
03A4: name_thread 'CDRIVE'

:CDRIVE_11
0001: wait 1000 ms
0A95: enable_thread_saving
07D0: 5@ = weekday
00BF: 6@ = current_time_hours, 7@ = current_time_minutes
0006: 8@ = 899
00D6: if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @CDRIVE_11
00D6: if and
0039:   5@ == 2
0039:   6@ == 6
0039:   7@ == 20
004D: jump_if_false @CDRIVE_452
0247: load_model #CORVETT
0247: load_model #CROGRL3
0247: load_model #SBFYPRO
07C0: load_path 8@

:CDRIVE_105
0001: wait 0 ms
00D6: if and
0248:   model #CORVETT available
0248:   model #CROGRL3 available
0248:   model #SBFYPRO available
004D: jump_if_false @CDRIVE_105
009A: 2@ = create_actor_pedtype 24 model #CROGRL3 at -1983.4121 154.3342 27.6875
0173: set_actor 2@ Z_angle_to 90.0
009A: 3@ = create_actor_pedtype 24 model #SBFYPRO at -1985.1122 138.0835 27.6875
0173: set_actor 3@ Z_angle_to 90.0
00A5: 1@ = create_car #CORVETT at -1990.812 145.1061 27.3718
0175: set_car 1@ Z_angle_to 0.0
0186: 4@ = create_marker_above_car 1@
0187: 11@ = create_marker_above_actor 2@
0187: 12@ = create_marker_above_actor 3@
07E0: set_marker 4@ type_to 2
07E0: set_marker 11@ type_to 3
07E0: set_marker 12@ type_to 4
0249: release_model #CORVETT
0249: release_model #CROGRL3
0249: release_model #SBFYPRO
05CB: AS_actor 2@ enter_car 1@ as_driver 10000 ms
05CA: AS_actor 3@ enter_car 1@ passenger_seat 0 10000 ms

:CDRIVE_286
0001: wait 0 ms
00D6: if and
00DB:   actor 2@ in_car 1@
00DB:   actor 3@ in_car 1@
07C1:   path 8@ available
004D: jump_if_false @CDRIVE_286
05EB: assign_car 1@ to_path 8@
004D: jump_if_false @CDRIVE_286

:CDRIVE_361
0001: wait 0 ms
00BF: 9@ = current_time_hours, 10@ = current_time_minutes
00D6: if and
0256:   player $PLAYER_CHAR defined
0039:   9@ == 8
0039:   10@ == 30
004D: jump_if_false @CDRIVE_361
0633: AS_actor 2@ exit_car 1@
0633: AS_actor 3@ exit_car 1@

:CDRIVE_363
0001: wait 1000 ms
00D6: if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @CDRIVE_363
05F5: AS_actor 2@ goto_point -2624.6763 1412.7266 7.0937 mode 4 5500 ms // versionB
0637: AS_actor 3@ goto -2624.6763 1412.7266 7.0937 mode 6 turn_radius 0.5 stop_radius 5.0 look_at_actor $PLAYER_ACTOR

004D: jump_if_false @CDRIVE_363


:CDRIVE_362
0001: wait 1000 ms
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @CDRIVE_362
05EC: release_car 1@ from_path
0873: release_path 8@
01C3: remove_references_to_car 1@ // Like turning a car into any random car
01C2: remove_references_to_actor 2@ // Like turning an actor into a random pedestrian
01C2: remove_references_to_actor 3@ // Like turning an actor into a random pedestrian
0164: disable_marker 4@
0164: disable_marker 11@
0164: disable_marker 12@

:CDRIVE_452
0002: jump @CDRIVE_11
0A93: end_custom_thread


This create a car in front of Doherty Garage/Station ,and two female peds every monday at 6:20AM.

Righ,but the car is not geting damaged by collisions on traffic...I know something about this with carrec,can someone confirm that is impossible damage a car using carrec?
Also,everything ok,but until the very end,the two peds exits the car,but dont go to the predefined point,I still can't figure why.

Another thing is that this only work when I use the 00A5(create_car) opcode,if I use the 014B(init_parked_car_generator) the game crashes after load screen.You know why,whats the diference?

ZAZ
  • ZAZ

    Kernlochbohrer

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

#196

Posted 09 March 2011 - 06:23 PM Edited by ZAZ, 09 March 2011 - 06:26 PM.

QUOTE (Fatalpipe @ Mar 8 2011, 19:30)
I dont want double post,so,can you say to us if this is a possible thing to do?Thank you!!
when I use the 00A5(create_car) opcode,if I use the 014B(init_parked_car_generator) the game crashes after load screen.You know why,whats the diference?

The placing of cars by using parked_car_generator dont allows the using of its variable name in vehicle associated opcodes
because its not a car but a car_generator
The Cleo scripts with extension .cs are started allways from new by loading a save game or start new game,
If such a script includes for exemble a parked car generator and execute it and after this a save game is made,
and then this save game is loaded,
will be created a duplicate of the item, in this case a duplicate of a parked car generator.
This happens with parked car generator, pickups as well as placed objects.

To prevent this or to read the script state by using special special Cleo-variable
must be used following Cleo opcode:
0A95: enable_thread_saving
This instruct Cleo to store the script state by making a savegame

but you didn't use a parked_car_generator in your script above
then you don't need 0A95: enable_thread_saving
QUOTE
>>>EDIT<<< I'm reading all stuff,and closest I got is this:
This create a car in front of Doherty Garage/Station ,and two female peds every monday at 6:20AM.
Righ,but the car is not geting damaged by collisions on traffic...I know something about this with carrec,

good work so far
QUOTE
can someone confirm that is impossible damage a car using carrec?

i confirm that is impossible damage a car using carrec
u don't need carrecs if you wanna let the car drive in the streets because you then have paths
use car drive to opcode
or without paths in a smaller range use abandon_path_radius
read car-drive-tutorial


QUOTE
Also,everything ok,but until the very end,the two peds exits the car,but dont go to the predefined point,I still can't figure why.

The timecheck is bad, I took it away because it complicate the teaching
more about the timecheck at the end
You forgot to check the location. It should not happen if you're in Vegas.
furthermore it needs to check if the actors are dead and the car not wrecked
I used infernus because i havn't a CORVETT
and i havn't the carrecs
they will spawn at SF station, enter the car and drive on carrecs and after 5 seconds they stop and go away
I would it write in this way, don't know if carrecs make sense, i don't know your plan
CODE
{$CLEO .cs}
:CDRIVE
03A4: name_thread 'CDRIVE'

:CDRIVE_11
wait 0
00D6: if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @CDRIVE_11
if
00FE:   actor $PLAYER_ACTOR  0 ()near_point_on_foot -1983.4121 154.3342 27.6875 radius  38.0  38.0  38.0
004D: jump_if_false @CDRIVE_11
004D: jump_if_false @CDRIVE_452


0247: load_model #INFERNUS
0247: load_model #CROGRL3
0247: load_model #SBFYPRO
07C0: load_path 8@

:CDRIVE_105
0001: wait 0 ms
00D6: if and
0248:   model #INFERNUS available
0248:   model #CROGRL3 available
0248:   model #SBFYPRO available
004D: jump_if_false @CDRIVE_105
009A: 2@ = create_actor_pedtype 24 model #CROGRL3 at -1983.4121 154.3342 27.6875
0173: set_actor 2@ Z_angle_to 90.0
009A: 3@ = create_actor_pedtype 24 model #SBFYPRO at -1985.1122 138.0835 27.6875
0173: set_actor 3@ Z_angle_to 90.0
00A5: 1@ = create_car #INFERNUS at -1990.812 145.1061 27.3718
0175: set_car 1@ Z_angle_to 0.0
0186: 4@ = create_marker_above_car 1@
0187: 11@ = create_marker_above_actor 2@
0187: 12@ = create_marker_above_actor 3@
07E0: set_marker 4@ type_to 2
07E0: set_marker 11@ type_to 3
07E0: set_marker 12@ type_to 4
0249: release_model #INFERNUS
0249: release_model #CROGRL3
0249: release_model #SBFYPRO
05CB: AS_actor 2@ enter_car 1@ as_driver 10000 ms
05CA: AS_actor 3@ enter_car 1@ passenger_seat 0 10000 ms

:CDRIVE_286
0001: wait 0 ms
00D6: if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @CDRIVE_370
if
00FE:   actor $PLAYER_ACTOR  0 ()near_point_on_foot -1983.4121 154.3342 27.6875 radius  68.0  68.0  68.0
004D: jump_if_false @CDRIVE_370
if and
8118:   NOT   actor 2@ dead
8118:   NOT   actor 3@ dead
8119:   NOT   car 1@ wrecked
004D: jump_if_false @CDRIVE_370
00D6: if and
00DB:   actor 2@ in_car 1@
00DB:   actor 3@ in_car 1@
07C1:   path 8@ available
004D: jump_if_false @CDRIVE_286
05EB: assign_car 1@ to_path 8@
004D: jump_if_false @CDRIVE_286
33@ = 0

:CDRIVE_361
0001: wait 0 ms
00D6: if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @CDRIVE_370
if
00FE:   actor $PLAYER_ACTOR  0 ()near_point_on_foot -1983.4121 154.3342 27.6875 radius  68.0  68.0  68.0
004D: jump_if_false @CDRIVE_370
if and
8118:   NOT   actor 2@ dead
8118:   NOT   actor 3@ dead
8119:   NOT   car 1@ wrecked
004D: jump_if_false @CDRIVE_370
if
33@ == 5000
004D: jump_if_false @CDRIVE_361
0633: AS_actor 2@ exit_car 1@
0633: AS_actor 3@ exit_car 1@

:CDRIVE_363
0001: wait 0 ms
00D6: if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @CDRIVE_370
if
00FE:   actor $PLAYER_ACTOR  0 ()near_point_on_foot -1983.4121 154.3342 27.6875 radius  68.0  68.0  68.0
004D: jump_if_false @CDRIVE_370
if and
8118:   NOT   actor 2@ dead
8118:   NOT   actor 3@ dead
004D: jump_if_false @CDRIVE_370
05F5: AS_actor 2@ goto_point -2624.6763 1412.7266 7.0937 mode 4 5500 ms // versionB
0637: AS_actor 3@ goto -2624.6763 1412.7266 7.0937 mode 6 turn_radius 0.5 stop_radius 5.0 look_at_actor $PLAYER_ACTOR
004D: jump_if_false @CDRIVE_363


:CDRIVE_370
05EC: release_car 1@ from_path
0873: release_path 8@
01C3: remove_references_to_car 1@ // Like turning a car into any random car
01C2: remove_references_to_actor 2@ // Like turning an actor into a random pedestrian
01C2: remove_references_to_actor 3@ // Like turning an actor into a random pedestrian
0164: disable_marker 4@
0164: disable_marker 11@
0164: disable_marker 12@

:CDRIVE_452
0002: jump @CDRIVE_11
0A93: end_custom_thread


the timecheck
Using math symbols like "if greater than" > or "if greater than or equal" >=
let check a duration of the game time

The script below enables the thermal_vision in the night between 22 o`clock and 2 o`clock
The variable 3@ prevent that the opcode 08B2: will be read permanently
The time check gets the duration which should view the thermal_vision
It doesnt matter if you arrived at midnight after loading a savegame
or if you are present before the view change and can experience the change

CODE
{$CLEO .cs}
:GameTime_1
thread "GTIME"
3@ = 0

:GameTime_2
wait 0
00BF: 0@ = current_time_hours, 1@ = current_time_minutes
if or
0@ >= 22
2 > 0@
jf @GameTime_3  
if
3@ == 0
jf @GameTime_3
08B2: enable_thermal_vision 1
3@ = 1

:GameTime_3
if and
0@ > 1
22 > 0@
3@ == 1
jf @GameTime_2
08B2: enable_thermal_vision 0
3@ = 0
jump @GameTime_2

read more in MATH CODING

Fatalpipe
  • Fatalpipe

    Pipeworker

  • Members
  • Joined: 02 May 2010

#197

Posted 10 March 2011 - 12:37 AM

Thanl you very much ZAZ,now I finish the basics of I wanted,here is the code:

CODE
{$CLEO .cs}

//-------------MAIN---------------
03A4: name_thread 'CDRIVE'

:CDRIVE_11
0001: wait 1000 ms
07D0: 5@ = weekday
00BF: 6@ = current_time_hours, 7@ = current_time_minutes  
00D6: if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @CDRIVE_11
if and
0039:   5@ == 2
0039:   6@ == 6
0039:   7@ == 20
004D: jump_if_false @CDRIVE_452
0247: load_model #INFERNUS
0247: load_model #CROGRL3
0247: load_model #SBFYPRO

:CDRIVE_105
0001: wait 0 ms
if and
0248:   model #INFERNUS available
0248:   model #CROGRL3 available
0248:   model #SBFYPRO available
004D: jump_if_false @CDRIVE_105
009A: 2@ = create_actor_pedtype 24 model #CROGRL3 at -1983.4121 154.3342 27.6875
0173: set_actor 2@ Z_angle_to 90.0
009A: 3@ = create_actor_pedtype 24 model #SBFYPRO at -1985.1122 138.0835 27.6875
0173: set_actor 3@ Z_angle_to 90.0
00A5: 1@ = create_car #INFERNUS at -1990.7504 145.0000 27.2389
0175: set_car 1@ Z_angle_to 0.0
0186: 4@ = create_marker_above_car 1@
0187: 11@ = create_marker_above_actor 2@
0187: 12@ = create_marker_above_actor 3@
07E0: set_marker 4@ type_to 2
07E0: set_marker 11@ type_to 3
07E0: set_marker 12@ type_to 4
0249: release_model #INFERNUS
0249: release_model #CROGRL3
0249: release_model #SBFYPRO
05CB: AS_actor 2@ enter_car 1@ as_driver 10000 ms
05CA: AS_actor 3@ enter_car 1@ passenger_seat 0 10000 ms

:CDRIVE_286
0001: wait 0 ms
if and
00DB:   actor 2@ in_car 1@
00DB:   actor 3@ in_car 1@  
004D: jump_if_false @CDRIVE_286
0615: define_action_sequences 8@
05D1: AS_actor -1 drive_car 1@ to  -2000.0087 311.5435 35.0156 speed  20.0  0  0  5
05D1: AS_actor -1 drive_car 1@ to  -2136.1233 322.64 35.1622 speed  20.0  0  0  5
05D1: AS_actor -1 drive_car 1@ to  -2155.6082 118.341 35.1719 speed  20.0  0  0  5
05D1: AS_actor -1 drive_car 1@ to  -2017.871 105.7274 27.5937 speed  20.0  0  0  5
05D1: AS_actor -1 drive_car 1@ to  -1998.5907 450.4262 35.0595 speed  40.0  0  0  5
05CD: AS_actor -1 exit_car 1@
0616: define_action_sequences_end 8@
0618: assign_actor 2@ to_action_sequences 8@
061B: remove_references_to_AS_pack 8@
004D: jump_if_false @CDRIVE_286

:CDRIVE_361
0001: wait 0 ms
if and
0256:   player $PLAYER_CHAR defined
0206:   actor 2@ near_car 1@ radius 5.0 5.0 3.0 flag 0 on_foot
004D: jump_if_false @CDRIVE_361
0633: AS_actor 3@ exit_car

:CDRIVE_362
0001: wait 1000 ms
if and
0256:   player $PLAYER_CHAR defined
0206:   actor 3@ near_car 1@ radius 5.0 5.0 3.0 flag 0 on_foot
004D: jump_if_false @CDRIVE_362
07CD: AS_actor 2@ walk_to -1962.2249 439.3388 35.1719 stop_with_angle 270.0 within_radius 4.0
07CD: AS_actor 3@ walk_to -1962.2249 439.3388 35.1719 stop_with_angle 270.0 within_radius 4.0


:CDRIVE_363
0001: wait 30000 ms
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @CDRIVE_363
01C3: remove_references_to_car 1@ // Like turning a car into any random car
01C2: remove_references_to_actor 2@ // Like turning an actor into a random pedestrian
01C2: remove_references_to_actor 3@ // Like turning an actor into a random pedestrian
0164: disable_marker 4@
0164: disable_marker 11@
0164: disable_marker 12@

:CDRIVE_452
0002: jump @CDRIVE_11
0A93: end_custom_thread


Only thing is that I needed to put 0001: wait 30000 ms in the end,otherwise the peds was released before they perform the 07CD: AS_actor 3@ walk_to.

I just need to change the values of peds,coords etc. in each script,to make various things that I've planned to the game.

As you asked before,my goal was to make people drive cars that I added(not replaced),and this cars aren't in normal traffic behavior,only predefined peds will own this predefined cars.
I think sometimes we will be doing a mission,or even drive here and there,and suddenly can see a ped getting or driving somekind of car.As most of this peds will follow a daily routine,others will perform actions like kidnapping people,hijacking,or even hooking pros on the alleys.All this unusual things linked to unusual/rare cars.
Maybe this will lead player to pay attention on a certain ped behavior,making player start to follow him to home,or work to get his car,if for some reason(I plan to think about this reasons) this car can't be hijacked.
Of course,I know what I'm doing,but this is for my son,he have 10yr,loves this game and dont make any idea that what I've been doing to the game,so,I'm sure he will like it,even with GTAIV installed.Thank you again ZAZ.As I've learned something this week,I will stay trying to do things with script,I really liked this.

kal-el5676
  • kal-el5676

    Zombie Killa

  • Members
  • Joined: 02 Nov 2008

#198

Posted 10 March 2011 - 01:51 AM

Not to distract Zaz's attention too much, but i have a question as well. Speaking of coordinates and offsets on objects, i have some coding idea's for the predator plasma caster for the pred mod i am working on. If it's possible in cleo then no prob, but if it can only be SCM also no prob. wink.gif

I would like to know is it possible to create a script that utilizes the auto aim lock on system without a weapon selected? To take it even further, fire a missile from an offset of the actor similar to ryosukes missile man mod? And to take it even further attach an additional particle to the missile? Or even one step FURTHER and attaching a second particle to the actor with an offset to create the laser targeting beam effect? smile.gif

Any advice is of course greatly appreciated.

ZAZ
  • ZAZ

    Kernlochbohrer

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

#199

Posted 11 March 2011 - 04:13 PM

QUOTE (Fatalpipe @ Mar 10 2011, 00:37)
Thanl you very much ZAZ,now I finish the basics of I wanted,here is the code:

Only thing is that I needed to put 0001: wait 30000 ms in the end,otherwise the peds was released before they perform the 07CD: AS_actor 3@ walk_to.

I just need to change the values of peds,coords etc. in each script,to make various things that I've planned to the game.

As you asked before,my goal was to make people drive cars that I added(not replaced),and this cars aren't in normal traffic behavior,only predefined peds will own this predefined cars.
I think sometimes we will be doing a mission,or even drive here and there,and suddenly can see a ped getting or driving somekind of car.As most of this peds will follow a daily routine,others will perform actions like kidnapping people,hijacking,or even hooking pros on the alleys.All this unusual things linked to unusual/rare cars.
Maybe this will lead player to pay attention on a certain ped behavior,making player start to follow him to home,or work to get his car,if for some reason(I plan to think about this reasons) this car can't be  hijacked.
Of course,I know what I'm doing,but this is for my son,he have 10yr,loves this game and dont make any idea that what I've been doing to the game,so,I'm sure he will like it,even with GTAIV installed.Thank you again ZAZ.As I've learned something this week,I will stay trying to do things with script,I really liked this.

Well, you ignored everything what i tried to teach
anyway, how old is your son? 10? please talk with him about the difference of virtuality and reality

QUOTE (kal-el5676 @ Mar 10 2011, 01:51)
Not to distract Zaz's attention too much, but i have a question as well. Speaking of coordinates and offsets on objects, i have some coding idea's for the predator plasma caster for the pred mod i am working on. If it's possible in cleo then no prob, but if it can only be SCM also no prob. wink.gif

I would like to know is it possible to create a script that utilizes the auto aim lock on system without a weapon selected? To take it even further, fire a missile from an offset of the actor similar to ryosukes missile man mod? And to take it even further attach an additional particle to the missile? Or even one step FURTHER and attaching a second particle to the actor with an offset to create the laser targeting beam effect? smile.gif

Any advice is of course greatly appreciated.

which auto aim lock on system?
mp, asault, bazooka, sniper?
the Grenadeflowerlauncher-weapon-data-modification utilizesed the camera and animation
no, not without weapon
if you player_actor attach to object, it switch into firstperson view

with script you can just simulate the projectile, doesen't matter if cleo or main or write your own utilizing the camera, animation and demage

Fatalpipe
  • Fatalpipe

    Pipeworker

  • Members
  • Joined: 02 May 2010

#200

Posted 12 March 2011 - 10:13 PM

QUOTE (ZAZ @ Mar 11 2011, 13:13)
Well, you ignored everything what i tried to teach
anyway, how old is your son? 10? please talk with him about the difference of virtuality and reality

I think that was more easy extend the wait time than make another check if the peds are on right coords.I deleted the time check and carrec,just did things from car_drive_tutorial.Tried the match coding thing creating a variable "25@= coords XYX values " ,then check if "25@== my desired XYZ coords values",but doesnt work.
And yes,he knows what he should know...

You know any way to check weather conditions?Eg.: If current weather is cloudy SF?

And I dont understand the "IGNORE UNKNOW" option on SannyBuilder/Debug Options.
I got some error messages when I was looking inside other finished scripts and this option was unchecked,but my point is: If the opcode is unknow,how people put this in script without making any idea of what this opcode does/means?

ZAZ
  • ZAZ

    Kernlochbohrer

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

#201

Posted 13 March 2011 - 11:42 AM

QUOTE (Fatalpipe @ Mar 12 2011, 22:13)
I deleted the time check and carrec,just did things from car_drive_tutorial.Tried the  match coding thing creating a variable "25@= coords XYX values " ,then check if "25@== my desired XYZ coords values",but doesnt work.

post your script

QUOTE
You know any way to check weather conditions?Eg.: If current weather is cloudy SF?

CODE
0A8D: 1@ = read_memory 13112096 size 4 virtual_protect 1
00D6: if or
0039:   1@ == 8//rainy
0039:   1@ == 16//rainy
004D: jump_if_false @L


QUOTE
And I dont understand the "IGNORE UNKNOW" option on SannyBuilder/Debug Options.
I got some error messages when I was looking inside other finished scripts and this option was unchecked,but my point is: If the opcode is unknow,how people put this in script without making any idea of what this opcode does/means?

don't know i have my hook allways only at constant indexes
decompiled scripts can have unsued opcodes and unknown opcodes as well as failcode because of invalid decompilation
they can be modified after compilation with hexeditor
sanny supoorts highlevel syntax but the recompilation translate the code in the classic gta scm code
sanny supports also hexcode

gtasite1
  • gtasite1

    Player Hater

  • Members
  • Joined: 24 Dec 2010

#202

Posted 14 March 2011 - 05:07 PM

How to create corona with array

CODE
:PCJONDOCKS_1330
wait 0
if
 27 > 30@
jf @aa
04D5: create_corona_at $5610(30@,27f) $5639(30@,27f) $5668(30@,27f) radius 1.0 type 2 flare 2 RGB 0 255 0
024F: create_corona_with_radius 1.0 type 0 lensflares 0 with_color 237 130 180 at $5610(30@,27f) $5639(30@,27f) $5668(30@,27f)
30@ += 1
jump @PCJONDOCKS_1330

:aa
30@ = 0


but i don't know which does not appear

ZAZ
  • ZAZ

    Kernlochbohrer

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

#203

Posted 14 March 2011 - 07:53 PM Edited by ZAZ, 14 March 2011 - 08:01 PM.

QUOTE (gtasite1 @ Mar 14 2011, 17:07)
How to create corona with array

CODE
:PCJONDOCKS_1330
wait 0
if
 27 > 30@
jf @aa
04D5: create_corona_at $5610(30@,27f) $5639(30@,27f) $5668(30@,27f) radius 1.0 type 2 flare 2 RGB 0 255 0
024F: create_corona_with_radius 1.0 type 0 lensflares 0 with_color 237 130 180 at $5610(30@,27f) $5639(30@,27f) $5668(30@,27f)
30@ += 1
jump @PCJONDOCKS_1330

:aa
30@ = 0


but i don't know which does not appear


you must define first the coords for the arrays

in this way with globals:
CODE
0005: $5610[0] = 2495.53
0005: $5639[0] = -1711.88
0005: $5668[0] = 1014.24

0005: $5610[1] = 1263.05
0005: $5639[1] = -773.67
0005: $5668[1] = 1091.39

0005: $5610[2] = 416.9548
0005: $5639[2] = 2538.813
0005: $5668[2] = 9.5077

0005: $5610[3] = 2367.192
0005: $5639[3] = -1121.518
0005: $5668[3] = 1050.382

:PCJONDOCKS_1330
wait 0
if
27 > 30@
jf @aa
04D5: create_corona_at $5610(30@,27f) $5639(30@,27f) $5668(30@,27f) radius 1.0 type 2 flare 2 RGB 0 255 0



in this way with locals
CODE
0@ = 2495.53
10@ = -1711.88
20@ = 1014.24

1@ = 1263.05
11@ = -773.67
21@ = 1091.39

2@ = 416.9548
12@ = 2538.813
22@ = 9.5077

3@ = 2367.192
13@ = -1121.518
23@ = 1050.382

:PCJONDOCKS_1330
wait 0
if
27 > 30@
jf @aa
04D5: create_corona_at 0@(30@,27f) 10@(30@,27f) 20@(30@,27f) radius 1.0 type 2 flare 2 RGB 0 255 0



or in this way, be reading coords in same loop
CODE
:PCJONDOCKS_1330
wait 0
if
27 > 30@
jf @aa
04C4: create_coordinate 0@(30@,27f) 10@(30@,27f) 20@(30@,27f) from_actor $PLAYER_ACTOR offset 0.0  31@  0.2
04D5: create_corona_at 0@(30@,27f) 10@(30@,27f) 20@(30@,27f) radius 1.0 type 2 flare 2 RGB 0 255 0
000B: 31@ +=  2.0  // add 2.0 to the y offset for spawn coords
000A: 30@ +=  1  // Array index

but it don't makes much sense because corona don't need to create an script instance
so you can have the same effect with this way, without arrays:
CODE
:PCJONDOCKS_1330
wait 0
if
27 > 30@
jf @aa
04C4: create_coordinate 11@ 12@ 13@ from_actor $PLAYER_ACTOR offset 0.0  31@  0.2
04D5: create_corona_at 11@ 12@ 13@ radius 1.0 type 2 flare 2 RGB 0 255 0
000B: 31@ +=  2.0  // add 2.0 to the y offset for spawn coords
000A: 30@ +=  1  // Array index
0002: jump @ArrayAct_4


gtasite1
  • gtasite1

    Player Hater

  • Members
  • Joined: 24 Dec 2010

#204

Posted 15 March 2011 - 05:52 PM

I create this code, but corona not working.

CODE
30@ = 0
$6062(30@,27i) = 2
$6063(30@,27i) = 0
$6090(30@,27i) = 0

:PCJONDOCKS_1290
wait 0
if
 $6062(30@,27i) == 0
jf @PCJONDOCKS_1338
$6059 = 255
$6060 = 0
$6061 = 0

:PCJONDOCKS_1338
wait 0
if
 $6062(30@,27i) == 1
jf @PCJONDOCKS_1386
$6059 = 0
$6060 = 255
$6061 = 0

:PCJONDOCKS_1386
wait 0
if
 $6062(30@,27i) == 2
jf @PCJONDOCKS_1434
$6059 = 0
$6060 = 0
$6061 = 255

:PCJONDOCKS_1434
024F: create_corona_with_radius 1.0 type 2 lensflares 0 with_color $6059 $6060 $6061 at $5610(30@,27f) $5639(30@,27f) $5668(30@,27f)
if
 $6090(30@,27i) == 0
jf @PCJONDOCKS_1527
018A: $5891(30@,27i) = create_checkpoint_at $5610(30@,27f) $5639(30@,27f) $5668(30@,27f)

:PCJONDOCKS_1527
30@ += 1
 30@ >= 27
jf @PCJONDOCKS_1290
return
30@ = 0
$5451(30@,27i) = 0

:PCJONDOCKS_1568
wait 0
if
 27 > 30@
jf @PCJONDOCKS_2070
if
 $6063(30@,27i) == 0
jf @PCJONDOCKS_2056
if
 $6062(30@,27i) == 0
jf @PCJONDOCKS_1656
$6059 = 255
$6060 = 0
$6061 = 0

:PCJONDOCKS_1656
wait 0
if
 $6062(30@,27i) == 1
jf @PCJONDOCKS_1704
$6059 = 0
$6060 = 255
$6061 = 0

:PCJONDOCKS_1704
wait 0
if
 $6062(30@,27i) == 2
jf @PCJONDOCKS_1752
$6059 = 0
$6060 = 0
$6061 = 255

:PCJONDOCKS_1752
024F: create_corona_with_radius 1.0 type 2 lensflares 0 with_color $6059 $6060 $6061 at $5610(30@,27f) $5639(30@,27f) $5668(30@,27f)
if
 $5451(30@,27i) == 0
jf @PCJONDOCKS_1845
018A: $5891(30@,27i) = create_checkpoint_at $5610(30@,27f) $5639(30@,27f) $5668(30@,27f)

:PCJONDOCKS_1845
wait 0
if
00FE:   actor $PLAYER_ACTOR sphere 0 in_sphere $5610(30@,27f) $5639(30@,27f) $5668(30@,27f) radius 4.0 4.0 4.0
jf @PCJONDOCKS_2056
if
  Actor.DrivingVehicleType($PLAYER_ACTOR, #PCJ600)
jf @PCJONDOCKS_2056
if
 $6062(30@,27i) == 0
jf @PCJONDOCKS_1964
Marker.Disable($5891(30@,27i))
$6063(30@,27i) = 1

:PCJONDOCKS_1964
wait 0
if
 $6062(30@,27i) == 1
jf @PCJONDOCKS_2010
Marker.Disable($5891(30@,27i))
$6063(30@,27i) = 1

:PCJONDOCKS_2010
wait 0
if
 $6062(30@,27i) == 2
jf @PCJONDOCKS_2056
Marker.Disable($5891(30@,27i))
$6063(30@,27i) = 1

:PCJONDOCKS_2056
0@ += 1
jump @PCJONDOCKS_1568

:PCJONDOCKS_2070
return

ZAZ
  • ZAZ

    Kernlochbohrer

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

#205

Posted 15 March 2011 - 08:26 PM Edited by ZAZ, 22 March 2011 - 03:48 PM.

QUOTE (gtasite1 @ Mar 15 2011, 17:52)
I create this code, but corona not working.

post the whole script, the coords definitions are missing

Fatalpipe
  • Fatalpipe

    Pipeworker

  • Members
  • Joined: 02 May 2010

#206

Posted 20 March 2011 - 01:39 AM Edited by Fatalpipe, 20 March 2011 - 01:41 AM.

Again with the rare car script.Last one I did with two peds,and needed to check if one ped is close to another to get them to walk to destination.
But now,with only one ped inside car,isn't working.The driver exits the car and do nothing,stay there and the thread is not ending...I've tried a lot of conditions checks to make the driver walk,but none of them worked.

CODE
//-------------MAIN---------------
03A4: name_thread 'RICHMAN'

:RICHMAN_11
0001: wait 1000 ms
07D0: 5@ = weekday
00BF: 6@ = current_time_hours, 7@ = current_time_minutes  
00D6: if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @RICHMAN_452
00D6: if and
0039:   5@ == 2
0039:   6@ == 6
0039:   7@ == 20
004D: jump_if_false @RICHMAN_452
0247: load_model #INFERNUS
0247: load_model #HMORI

:RICHMAN_105
0001: wait 0 ms
00D6: if and
0248:   model #INFERNUS available
0248:   model #HMORI available
004D: jump_if_false @RICHMAN_105
009A: 2@ = create_actor_pedtype 24 model #HMORI at 645.902 -1117.5109 44.207
0173: set_actor 2@ Z_angle_to 90.0
00A5: 1@ = create_car #INFERNUS at 636.3992 -1122.2133 44.6699
0175: set_car 1@ Z_angle_to 40.0
0186: 4@ = create_marker_above_car 1@
0187: 11@ = create_marker_above_actor 2@
07E0: set_marker 4@ type_to 2
07E0: set_marker 11@ type_to 3
0249: release_model #INFERNUS
0249: release_model #HMORI  

:RICHMAN_286
0001: wait 0 ms
00D6: if and
0256:   player $PLAYER_CHAR defined
8119:   NOT   car 1@ wrecked
8118:   NOT   actor 2@ dead  
004D: jump_if_false @RICHMAN_452
0615: define_action_sequences 8@
05CB: AS_actor 2@ enter_car 1@ as_driver 10000 ms
05D1: AS_actor -1 drive_car 1@ to  627.5103 -1112.3221 46.3197 speed  10.0  0  0  5
05D1: AS_actor -1 drive_car 1@ to  1238.5304 -1575.3459 12.928 speed  25.0  0  0  5
05CD: AS_actor -1 exit_car 1@
0616: define_action_sequences_end 8@
0618: assign_actor 2@ to_action_sequences 8@
061B: remove_references_to_AS_pack 8@
004D: jump_if_false @RICHMAN_286

:RICHMAN_287
0001: wait 0 ms
00D6: if and
8119:   NOT   car 1@ wrecked
8118:   NOT   actor 2@ dead
01AE:   car 1@ sphere 0 near_point 1238.5304 -1575.3459 radius 3.0 3.0 stopped
0206:   actor 2@ near_car 1@ radius 5.0 5.0 3.0 flag 0 on_foot
004D: jump_if_false @RICHMAN_452
07CD: AS_actor 2@ walk_to 1217.1807 -1584.7091 13.5531 stop_with_angle 40.0 within_radius 1.0
07A1: set_walk_speed 4
034F: destroy_actor_with_fade 3@  // The actor fades away like a ghost
004D: jump_if_false @RICHMAN_287

:RICHMAN_363
0001: wait 30000 ms
00D6: if and
8119:   NOT   car 1@ wrecked
8118:   NOT   actor 2@ dead
004D: jump_if_false @RICHMAN_452
01C3: remove_references_to_car 1@ // Like turning a car into any random car
01C2: remove_references_to_actor 2@ // Like turning an actor into a random pedestrian
0164: disable_marker 4@
0164: disable_marker 11@

:RICHMAN_452
0002: jump @RICHMAN_11
0A93: end_custom_thread


Also I tried to put the "07CD: AS_actor 2@ walk_to" inside the "actions_sequence 8@" ,but doesn't work either.

Sasukers
  • Sasukers

    Player Hater

  • Members
  • Joined: 08 Dec 2010

#207

Posted 20 March 2011 - 02:42 AM

SPAWN A OBJECT AND PICK IT

Hello'

I know how to spawn a object but i want pick it (like CJ raise the TV)

Can you make a script to Spawn a Beachball and pick it ?
i want target the object (like target the Peds') object targetable
and i want kick the object (like soccer) yes... i want to move the object when i point the object with a weapon and shot! (and when i point the ball without weapons to kick it)

can you help me? or can you make a mod to release it?

ZAZ
  • ZAZ

    Kernlochbohrer

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

#208

Posted 20 March 2011 - 08:00 AM Edited by ZAZ, 11 August 2012 - 08:49 PM.

Interactive MENUE

I can't explain everything, there are a lot of codes depending to the menue and you can do it with different methods.

The essential codes:

1. opcode 08D4: defines the menue with a var handle,
with title entry, x/y-positions entries, width, amount of tables, if interactiv or not, with or without background, alignment
CODE
08D4: 1@ = create_panel_with_title 'CHEAT7' position  340.0  120.0 width  240.0 columns  1 interactive  1 background  1 alignment  0

ignore at moment the parameters of amount of tables, if interactiv or not, with or without background, alignment
and use just the values of the example above

2. opcode 08DB: adds the true content to the menue
CODE
08DB: set_panel 1@ column  0 header 'PLA_19' data 'DEBW1' 'DEBW4' 'DEBW5' 'DEBW8' 'DEBW9' 'DEBW10' 'DEBW12' 'DEBW14' 'DEBW16' 'DEBW17' 'DEBW18' 'WEATH0'

column 0 is the first table, use this also like in example above
at header string parameter is it possible to show one more title or a description
then there are 12 string parameter to insert gxt entries, these are the names for the buttons

Important: all parameters must have an entry, also the gxt entries for the names of the buttons

If you wanna use only 3 buttons, then insert "dummy" in all other string parameter
CODE
08DB: set_panel 1@ column  0 header 'PLA_19' data 'DEBW1' 'DEBW4' 'DEBW5' 'dummy' 'dummy' 'dummy' 'dummy' 'dummy' 'dummy' 'dummy' 'dummy' 'dummy'

then the buttons will not be shown
same for the header
(also if wrong gxt entries are inserted, the buttons will not be shown)

Important: the function to skip from button to button, later ingame, is working automatically with the keys UP/DOWN as well with W/S and also G/H
But nothing else
To let something happen, when a button is selected needs to press another key to confirm the selection and this requires to script a keypress-check
therefor we need the button ID

3. opcode 08D7: submits the button number of selected button into a variable
CODE
08D7: 2@ = panel 1@ active_row


4. The menue must be removed with opcode 08DA: before the user continues playing or before another menue should be shown.
CODE
08DA: remove_panel 1@

If it happens because of any reason, that 2 interactiv menues should be shown, will you get a heavy bug and needs to terminate the game to fix that bug.




Recommanded script construct:
CODE
Loop 1 with keypress-check, to show menue


08D4: 1@ = create_panel_with_title 'CHEAT7' position  340.0  120.0 width  240.0 columns  1 interactive  1 background  1 alignment  0
08DB: set_panel 1@ column  0 header 'PLA_19' data 'DEBW1' 'DEBW4' 'DEBW5' 'DEBW8' 'DEBW9' 'DEBW10' 'DEBW12' 'DEBW14' 'DEBW16' 'DEBW17' 'DEBW18' 'WEATH0'

Loop 2 , while menue is shown including every neccesary checks

08DA: remove_panel 1@
back to Loop 1


To let something happen, when a button is selected needs to press another key to confirm the selection
So we need a keypress-check
and if the keypress-check is passed, it should get the button ID
then you have a variable and it's value must be checked to select into several scriptparts, each what you wanna do
Example below let you set the weather
CODE
{$CLEO .cs}
:WETHERMENUE
03A4: name_thread 'WHELP'

:MenueTempW_01
wait  0
if
0256:   player $PLAYER_CHAR defined
jf @MenueTempW_01
if
0AB0:   key_pressed 8//--- key = Backspace  
jf @MenueTempW_01

08D4: 1@ = create_panel_with_title 'CHEAT7' position  340.0  120.0 width  240.0 columns  1 interactive  1 background  1 alignment  0
08DB: set_panel 1@ column  0 header 'PLA_19' data 'DEBW1' 'DEBW4' 'DEBW5' 'DEBW8' 'DEBW9' 'DEBW10' 'DEBW12' 'DEBW14' 'DEBW16' 'DEBW17' 'DEBW18' 'WEATH0'
090E: set_panel 1@ active_row  0

:MenueTempW_1
wait  0
if
0256:   player $PLAYER_CHAR defined
jf @MenueTempW_21
if
00E1:   key_pressed  0  15//--- key = Enter/Exit
jf @MenueTempW_2
jump @MenueTempW_21//--jump to menue exit

:MenueTempW_2
if
00E1:   key_pressed  0  16//--- key = Ped SPRINT
jf @MenueTempW_1
03E6: remove_text_box
08D7: 2@ = panel 1@ active_row//-- submit number of the highlighted button into variable
if
0039:   2@ ==  0  // integer values
jf @MenueTempW_3
01B6: set_weather  1// = SUNNY_LA
jump @MenueTempW_1

:MenueTempW_3
if
0039:   2@ ==  1  // integer values
jf @MenueTempW_4
01B6: set_weather  4// = CLOUDY_LA
jump @MenueTempW_1

:MenueTempW_4
if
0039:   2@ ==  2  // integer values
jf @MenueTempW_5
01B6: set_weather  5// = SUNNY_SF
jump @MenueTempW_1

:MenueTempW_5
if
0039:   2@ ==  3  // integer values
jf @MenueTempW_6
01B6: set_weather  8// = RAINY_SF
jump @MenueTempW_1

:MenueTempW_6
if
0039:   2@ ==  4  // integer values
jf @MenueTempW_7
01B6: set_weather  9// = FOGGY_SF
jump @MenueTempW_1

:MenueTempW_7
if
0039:   2@ ==  5  // integer values
jf @MenueTempW_8
01B6: set_weather  10// = SUNNY_VEGAS
jump @MenueTempW_1

:MenueTempW_8
if
0039:   2@ ==  6  // integer values
jf @MenueTempW_9
01B6: set_weather  12// = CLOUDY_VEGAS
jump @MenueTempW_1

:MenueTempW_9
if
0039:   2@ ==  7  // integer values
jf @MenueTempW_10
01B6: set_weather  14// = SUNNY_COUNTRYSIDE
jump @MenueTempW_1

:MenueTempW_10
if
0039:   2@ ==  8  // integer values
jf @MenueTempW_11
01B6: set_weather  16// = RAINY_COUNTRYSIDE
jump @MenueTempW_1

:MenueTempW_11
if
0039:   2@ ==  9  // integer values
jf @MenueTempW_12
01B6: set_weather  17// = EXTRASUNNY_DESERT
jump @MenueTempW_1

:MenueTempW_12
if
0039:   2@ ==  10  // integer values
jf @MenueTempW_13
01B6: set_weather  19// = SANDSTORM_DESERT
jump @MenueTempW_1

:MenueTempW_13
if
0039:   2@ ==  11  // integer values
jf @MenueTempW_1
01B7: release_weather
jump @MenueTempW_21

:MenueTempW_21
08DA: remove_panel 1@
jump @MenueTempW_01


The script have one more keypress-check to remove the menue:
CODE
if
00E1:   key_pressed  0  15//--- key = Enter/Exit
jf @MenueTempW_2
jump @MenueTempW_21//--jump to menue exit



and then there's this code:
CODE
090E: set_panel 1@ active_row  0

It selects a button when the menue is shown.







Another script construct:
CODE
Only 1 Loop with var value check to select script blocks

if  and
0AB0:   key_pressed 8//--- key = Backspace  
5@ == 0
jf @Menue_1
08D4: 1@ = create_panel_with_title 'CHEAT7' position  340.0  120.0 width  240.0 columns  1 interactive  1 background  1 alignment  0
08DB: set_panel 1@ column  0 header 'PLA_19' data 'DEBW1' 'DEBW4' 'DEBW5' 'DEBW8' 'DEBW9' 'DEBW10' 'DEBW12' 'DEBW14' 'DEBW16' 'DEBW17' 'DEBW18' 'WEATH0'
090E: set_panel 1@ active_row  0
5@ = 1

if
5@ == 1
jf @Menue_01
get button ID while menue is shown to let something happen


:Menue_21
if
5@ == 1
jf @Menue_01
08DA: remove_panel 1@
5@ = 0
jump @Menue_01



Example:
CODE
{$CLEO .cs}
:Menue
03A4: name_thread 'Menue'
5@ = 0

:Menue_01
wait  0
if
0256:   player $PLAYER_CHAR defined
jf @Menue_21
if  and
0AB0:   key_pressed 8//--- key = Backspace  
5@ == 0
jf @Menue_1

08D4: 1@ = create_panel_with_title 'CHEAT7' position  340.0  120.0 width  240.0 columns  1 interactive  1 background  1 alignment  0
08DB: set_panel 1@ column  0 header 'PLA_19' data 'DEBW1' 'DEBW4' 'DEBW5' 'DEBW8' 'DEBW9' 'DEBW10' 'DEBW12' 'DEBW14' 'DEBW16' 'DEBW17' 'DEBW18' 'WEATH0'
090E: set_panel 1@ active_row  0
5@ = 1

:Menue_1
wait  0
if
5@ == 1
jf @Menue_01
if
00E1:   key_pressed  0  15//--- key = Enter/Exit
jf @Menue_2
jump @Menue_21//--jump to menue exit

:Menue_2
if
00E1:   key_pressed  0  16//--- key = Ped SPRINT
jf @Menue_1
03E6: remove_text_box
08D7: 2@ = panel 1@ active_row//-- submit number of the highlighted button into variable
if
0039:   2@ ==  0  // integer values
jf @Menue_3
01B6: set_weather  1// = SUNNY_LA
jump @Menue_1

:Menue_3
if
0039:   2@ ==  1  // integer values
jf @Menue_1
01B6: set_weather  4// = CLOUDY_LA
jump @Menue_1



:Menue_21
if
5@ == 1
jf @Menue_01
08DA: remove_panel 1@
5@ = 0
jump @Menue_01







High Level script construct with var value check, menue subscripts and jumptables:
(R* menues are mostly done in that way)
CODE
{$CLEO .cs}
:MENUE_AND_JUMPTABLE_TEMPLATE
03A4: name_thread 'MENUEJP'

const  
L_PANEL_VAR = 0@
L_ACTIVE_ROW_VAR = 1@
L_PANEL_IS_SHOWN_VAR = 2@
end

while true
wait 0
   if
       0256:   player $PLAYER_CHAR defined
   then
           if
               L_PANEL_IS_SHOWN_VAR  == 0
           then    
                   if  and
                       00E1:   key_pressed  0  9//--- key = GROUP_CONTROL_BWD
                       80DF:   not actor $PLAYER_ACTOR driving
                   then
                       gosub @MENU_1
                   end
           else// if menue is shown, if L_PANEL_IS_SHOWN_VAR  == 1
                   if
                       00E1:   key_pressed  0  16//--- key = Ped SPRINT
                   then
                       gosub @Selection_1
                   end
                   if
                       00E1:   key_pressed  0  15//--- key = Enter/Exit
                   then
                       gosub @Remove_panel
                   end
           end
   else//if player dies or gets arrested
           if
               L_PANEL_IS_SHOWN_VAR  == 1
           then
               gosub @Remove_panel//if player dies or gets arrested while meue is shown
           end    
   end
end

:MENU_1
08D4: L_PANEL_VAR = create_panel_with_title 'CHEAT7' position  340.0  120.0 width  240.0 columns  1 interactive  1 background  1 alignment  0
08DB: set_panel L_PANEL_VAR column 0 header 'PLA_19' data 'DEBW1' 'DEBW2' 'DEBW3' 'DEBW4' 'DEBW5' 'DEBW6' 'DEBW7' 'DEBW8' 'DEBW9' 'DEBW10' 'DEBW11' 'DEBW12'
L_PANEL_IS_SHOWN_VAR = 1
return

:Remove_panel
08DA: remove_panel L_PANEL_VAR
L_PANEL_IS_SHOWN_VAR = 0  
return


:Selection_1
08D7: L_ACTIVE_ROW_VAR = panel L_PANEL_VAR active_row
0871: init_jump_table L_ACTIVE_ROW_VAR total_jumps  12  0 @Sel_T00 jumps  0 @Sel_T01  1 @Sel_T11  2 @Sel_T22  3 @Sel_T33  4 @Sel_T44  5 @Sel_T55 6 @Sel_T66
0872: jump_table_jumps  7 @Sel_T77  8 @Sel_T88  9 @Sel_T99  10 @Sel_T101  11 @Sel_T111  -1 @Sel_T00  -1 @Sel_T00  -1 @Sel_T00  -1 @Sel_T00

:Sel_T00// here goes the code if the value of the variable not exist in the jumptable
00BA: text_styled 'fem_off'  1000 ms  4
wait 1000
jump @Sel_EXIT

:Sel_T01
set_weather  0// = Extra Sunny LA
jump @Sel_EXIT

:Sel_T11
set_weather  1// = Sunny LA
jump @Sel_EXIT

:Sel_T22
set_weather  2// = Sunny LA
jump @Sel_EXIT

:Sel_T33
set_weather  3// = Sunny Smog LA
jump @Sel_EXIT

:Sel_T44
set_weather  4// = Cloudy LA
jump @Sel_EXIT

:Sel_T55
set_weather  5// = Sunny SF
jump @Sel_EXIT

:Sel_T66
set_weather  6// = Extra Sunny SF
jump @Sel_EXIT

:Sel_T77
set_weather  7// = Cloudy SF
jump @Sel_EXIT

:Sel_T88
set_weather  8// = Rainy SF
jump @Sel_EXIT

:Sel_T99
set_weather  9// = Foggy SF
jump @Sel_EXIT

:Sel_T101
set_weather  10// = Sunny LV
jump @Sel_EXIT

:Sel_T111
set_weather  11// Extra Sunny LV
jump @Sel_EXIT

:Sel_EXIT
return


gtasite1
  • gtasite1

    Player Hater

  • Members
  • Joined: 24 Dec 2010

#209

Posted 28 March 2011 - 04:15 PM

How to use opcodes:
CODE
0494: get_joystick 0 data_to $MOVE_AXIS_X $MOVE_AXIS_Y $SPECIAL_AXIS_X $SPECIAL_AXIS_Y
0871: init_jump_table $VIDEO_GAME total_jumps 8 default_jump 0 @END_CASE_VIDEO_GAME jumps 0 @MS_GAME_THEYCRAWLEDFROMURANUS 1 @MS_GAME_DUALITY 2 @MS_GAME_GOGOSPACEMONKEY 3 @MS_GAME_LETSGETREADYTOBUMBLE 4 @MS_GAME_TRACKBETTING 5 @MS_GAME_POOL 6 @MS_GAME_LOWRIDER


ZAZ
  • ZAZ

    Kernlochbohrer

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

#210

Posted 29 March 2011 - 06:07 PM Edited by ZAZ, 11 August 2012 - 08:25 PM.

JumpTable

define a variable
CODE
1@ = 3

the value of the variable decides where the code should jump to
CODE
0871: init_jump_table 1@ total_jumps  7  0 @JPTABL_T00 jumps  0 @JPTABL_T01  1 @JPTABL_T11  2 @JPTABL_T22  3 @JPTABL_T33  4 @JPTABL_T44  5 @JPTABL_T55 6 @JPTABL_T66

the meaning:
<opcode> <description> <jumpvariable> <description> <total-amount-of-jumpinstructions> <description> <jumpinstruction to exit if the value of the variable not exist in the jumptable> <7 x jumpinstruction>

again, let's remove the opcode and description
1. parameter 2. parameter 3.+4.parameter 5.-14.parameter
jumpvariable
total-amount-of-jumpinstructions
jumpinstruction to exit if the value of the variable not exist in the jumptable
7 x jumpinstruction
total-amount-of-jumpinstructions:
the table of opcode 0871: can have max 7 jumps
the table of opcode 0872: can have max 9 jumps

the exit-jumpinstruction(3.+4.parameter) don't counts for the total-amount-of-jumpinstructions

adding more lines of opcode 0872: to the opcode 0871:-line can increase the total-amount-of-jumpinstructions
max. 75 jumps

CODE
0871: init_jump_table 1@ total_jumps  23  0 @JPTABL_T00 jumps  0 @JPTABL_T01  1 @JPTABL_T11  2 @JPTABL_T22  3 @JPTABL_T33  4 @JPTABL_T44  5 @JPTABL_T55 6 @JPTABL_T66

0872: jump_table_jumps  7 @JPTABL_T77  8 @JPTABL_T88  9 @JPTABL_T99  10 @JPTABL_T101  11 @JPTABL_T111  12 @JPTABL_T122  13 @JPTABL_T133  14 @JPTABL_T144  15 @JPTABL_T155

0872: jump_table_jumps  16 @JPTABL_T166  17 @JPTABL_T177  18 @JPTABL_T188  19 @JPTABL_T199  20 @JPTABL_T201  21 @JPTABL_T211  22 @JPTABL_T222  -1 @JPTABL_T00  -1 @JPTABL_T00



7 x jumpinstruction
0 @JPTABL_T01 1 @JPTABL_T11 2 @JPTABL_T22 3 @JPTABL_T33 4 @JPTABL_T44 5 @JPTABL_T55 6 @JPTABL_T66

a jumpinstruction have 2 parameter
0 @JPTABL_T01
first the value which must be equal with the value of the jumpvariable to allocate the jump adress
second the allocated jump adress if the value infront is equal to the jumpvariable

Examplescript below:
change the weather by keypress SHIFT
the variable 1@ decides where the code should jump to
1@ will be changed at the end of the table by adding 1
if 1@ is bigger than 6 then it jumps to the
<"jumpinstruction to exit if the value of the variable not exist in the jumptable">,
to @JPTABL_T00

CODE
{$CLEO .cs}
:JUMPTABLE
03A4: name_thread 'JPTABL'
1@ = 0

:JPTABL_1
0001: wait  0 ms
if
0256:   player $PLAYER_CHAR defined
jf @JPTABL_1
03F0: enable_text_draw 1
045A: text_draw_1number  400.0  50.0 'NUMBER' 1@    // value
if
0AB0:   key_pressed 16 // -- shift
jf @JPTABL_1

:JPTABL_Table
0871: init_jump_table 1@ total_jumps  7  0 @JPTABL_T00 jumps  0 @JPTABL_T01  1 @JPTABL_T11  2 @JPTABL_T22  3 @JPTABL_T33  4 @JPTABL_T44  5 @JPTABL_T55 6 @JPTABL_T66

:JPTABL_T00// here goes the code if the value of the variable not exist in the jumptable
00BA: text_styled 'fem_off'  1000 ms  4
wait 1000
0002: jump @JPTABL_1

:JPTABL_T01
01B6: set_weather  0// = Extra Sunny LA
0002: jump @JPTABL_EXIT

:JPTABL_T11
01B6: set_weather  1// = Sunny LA
0002: jump @JPTABL_EXIT

:JPTABL_T22
01B6: set_weather  2// = Sunny LA
0002: jump @JPTABL_EXIT

:JPTABL_T33
01B6: set_weather  3// = Sunny Smog LA
0002: jump @JPTABL_EXIT

:JPTABL_T44
01B6: set_weather  4// = Cloudy LA
0002: jump @JPTABL_EXIT

:JPTABL_T55
01B6: set_weather  5// = Sunny SF
0002: jump @JPTABL_EXIT

:JPTABL_T66
01B6: set_weather  6// = Extra Sunny SF
0002: jump @JPTABL_EXIT

:JPTABL_EXIT
1@ +=  1
0001: wait  1000 ms
0002: jump @JPTABL_1


Examplescript below is the extended version of script above
by adding 16 jumps with opcode 0872:
CODE
{$CLEO .cs}
:JUMPTABLE
03A4: name_thread 'JPTABL'
1@ = 0

:JPTABL_1
0001: wait  0 ms
if
0256:   player $PLAYER_CHAR defined
jf @JPTABL_1
03F0: enable_text_draw 1
045A: text_draw_1number  400.0  50.0 'NUMBER' 1@    // value
if
0AB0:   key_pressed 16 // -- shift
jf @JPTABL_1

:JPTABL_Table
0871: init_jump_table 1@ total_jumps  23  0 @JPTABL_T00 jumps  0 @JPTABL_T01  1 @JPTABL_T11  2 @JPTABL_T22  3 @JPTABL_T33  4 @JPTABL_T44  5 @JPTABL_T55 6 @JPTABL_T66
0872: jump_table_jumps  7 @JPTABL_T77  8 @JPTABL_T88  9 @JPTABL_T99  10 @JPTABL_T101  11 @JPTABL_T111  12 @JPTABL_T122  13 @JPTABL_T133  14 @JPTABL_T144  15 @JPTABL_T155
0872: jump_table_jumps  16 @JPTABL_T166  17 @JPTABL_T177  18 @JPTABL_T188  19 @JPTABL_T199  20 @JPTABL_T201  21 @JPTABL_T211  22 @JPTABL_T222  -1 @JPTABL_T00  -1 @JPTABL_T00


:JPTABL_T00// here goes the code if the value of the variable not exist in the jumptable
00BA: text_styled 'fem_off'  1000 ms  4
wait 1000
0002: jump @JPTABL_1

:JPTABL_T01
01B6: set_weather  0// = Extra Sunny LA
0002: jump @JPTABL_EXIT

:JPTABL_T11
01B6: set_weather  1// = Sunny LA
0002: jump @JPTABL_EXIT

:JPTABL_T22
01B6: set_weather  2// = Sunny LA
0002: jump @JPTABL_EXIT

:JPTABL_T33
01B6: set_weather  3// = Sunny Smog LA
0002: jump @JPTABL_EXIT

:JPTABL_T44
01B6: set_weather  4// = Cloudy LA
0002: jump @JPTABL_EXIT

:JPTABL_T55
01B6: set_weather  5// = Sunny SF
0002: jump @JPTABL_EXIT

:JPTABL_T66
01B6: set_weather  6// = Extra Sunny SF
0002: jump @JPTABL_EXIT

:JPTABL_T77
01B6: set_weather  7// = Cloudy SF
0002: jump @JPTABL_EXIT

:JPTABL_T88
01B6: set_weather  8// = Rainy SF
0002: jump @JPTABL_EXIT

:JPTABL_T99
01B6: set_weather  9// = Foggy SF
0002: jump @JPTABL_EXIT

:JPTABL_T101
01B6: set_weather  10// = Sunny LV
0002: jump @JPTABL_EXIT

:JPTABL_T111
01B6: set_weather  11// Extra Sunny LV
0002: jump @JPTABL_EXIT

:JPTABL_T122
01B6: set_weather  12// Cloudy LV
0002: jump @JPTABL_EXIT

:JPTABL_T133
01B6: set_weather  13// Extra Sunny Country
0002: jump @JPTABL_EXIT

:JPTABL_T144
01B6: set_weather  14// Sunny Country
0002: jump @JPTABL_EXIT

:JPTABL_T155
01B6: set_weather  15// Cloudy Country
0002: jump @JPTABL_EXIT

:JPTABL_T166
01B6: set_weather  16// Rainy Country
0002: jump @JPTABL_EXIT

:JPTABL_T177
01B6: set_weather  17// Extra Sunny Desert
0002: jump @JPTABL_EXIT

:JPTABL_T188
01B6: set_weather  18// Sunny Desert
0002: jump @JPTABL_EXIT

:JPTABL_T199
01B6: set_weather  19// Sandstorm Desert
0002: jump @JPTABL_EXIT

:JPTABL_T201
01B6: set_weather  20// Underwater
0002: jump @JPTABL_EXIT

:JPTABL_T211
01B6: set_weather  21// Extracolours 1
0002: jump @JPTABL_EXIT

:JPTABL_T222
01B6: set_weather  22// Extracolours 2
0002: jump @JPTABL_EXIT


:JPTABL_EXIT
1@ +=  1
0001: wait  1000 ms
0002: jump @JPTABL_1




______________________________________________________________


0494: get_joystick_data 0 1@ 2@ 3@ 4@

this opcode reads values of the presetted movement controle of keyboard, joystick or gamepad
depending to the settings which are done in Pause menue>options>controler settings
of <left/right> <forward/backward>

1.param: playervalue, player 1 = 0, player 2 = 1
2.param: values of <left/right>
3.param: values of <forward/backward>
4.param: unknown
5.param: unknown

2. and 3. param returns either negativ or positiv values each which button is pressed
so you need to check if the value is smaller or bigger than 0 to differ if the player use forward or backward
left or right

script below shows the values which opcode 0494: returns by pressing left or right or forward or backward
CODE
{$CLEO .cs}
:Joystick_data
03A4: name_thread 'JOYDATA'

:JOYDATA_1
wait 0
0494: get_joystick_data  0 1@ 2@ 3@ 4@
if
1@ >  0
004D: jump_if_false @JOYDATA_04
03F0: enable_text_draw 1
045A: text_draw_1number  250.0  250.0 'NUMBER' 1@    // value
0002: jump @JOYDATA_07

:JOYDATA_04
if
0 > 1@
004D: jump_if_false @JOYDATA_07
03F0: enable_text_draw 1
045A: text_draw_1number  350.0  250.0 'NUMBER' 1@    // value
0002: jump @JOYDATA_07

:JOYDATA_07
if
2@ >  0
004D: jump_if_false @JOYDATA_09
03F0: enable_text_draw 1
045A: text_draw_1number  300.0  200.0 'NUMBER' 2@    // value
0002: jump @JOYDATA_10

:JOYDATA_09
if
0 > 2@
004D: jump_if_false @JOYDATA_10
03F0: enable_text_draw 1
045A: text_draw_1number  300.0  300.0 'NUMBER' 2@    // value
0002: jump @JOYDATA_10

:JOYDATA_10
0002: jump @JOYDATA_1






______________________________________________________________


0A4A: store_joystick_X_offset_to 1@ Y_offset_to 2@


opcode 0A4A: gives also the mouse movement
try this script to see which values this opcode returns
CODE
{$CLEO .cs}
:Mousecontrole
03A4: name_thread 'MOUSXY'

:MControl_01
wait 0
0A4A: store_joystick_X_offset_to 1@ Y_offset_to 2@
0092: 4@ = float_to_integer 1@  
0092: 5@ = float_to_integer 2@
03F0: enable_text_draw 1
045A: text_draw_1number  200.0  50.0 'NUMBER' 4@    // value
045A: text_draw_1number  350.0  50.0 'NUMBER' 5@    // value
0002: jump @MControl_01




2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users