Quantcast

Jump to content

» «
Photo

[GTA SA] ~ CLEO Script Tutorial ~

631 replies to this topic
Rapier
  • Rapier

    Retired scripter

  • Members
  • Joined: 14 Aug 2005

#31

Posted 31 August 2009 - 04:05 AM

QUOTE (ZAZ @ Jun 5 2009, 18:34)
we can use the adress 0x00969110 as cheat key_press check

This memory address is for version 1.0, but, for version 1.01 which will be?
That's because my mods did not work anymore after I did the upgrade to version 1.01 and all are activated as a cheat.

Wesser
  • Wesser

    The complexity simplifier, the efficiency optimizer.

  • Feroci Racing
  • Joined: 19 Aug 2006
  • Unknown

#32

Posted 31 August 2009 - 07:21 AM

It's 0x96B790 for 1.1. smile.gif

markbaker
  • markbaker

    Player Hater

  • Members
  • Joined: 26 Aug 2009

#33

Posted 31 August 2009 - 04:56 PM

wow, thanks ZAZ! this is a god-send smile.gif

markbaker
  • markbaker

    Player Hater

  • Members
  • Joined: 26 Aug 2009

#34

Posted 31 August 2009 - 10:43 PM

One more question:

Is there a pathing tool out there like carrec, but for the Camera instead of for cars?

It would be nice if i could record a path for my camera to move along during cutscenes, for a cinematic feel.

Thanks

Rapier
  • Rapier

    Retired scripter

  • Members
  • Joined: 14 Aug 2005

#35

Posted 01 September 2009 - 12:18 AM

QUOTE (Wesser @ Aug 31 2009, 05:21)
It's 0x96B790 for 1.1. smile.gif

Thanks Wesser!

ZAZ
  • ZAZ

    Kernlochbohrer

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

#36

Posted 01 September 2009 - 04:37 PM Edited by ZAZ, 01 September 2009 - 04:40 PM.

QUOTE (markbaker @ Aug 31 2009, 22:43)
One more question:

Is there a pathing  tool out there like carrec, but for the Camera instead of for cars?

It would be nice if i could record a path for my camera to move along during cutscenes, for a cinematic feel.

Thanks

No, there isn't way to make camera paths.
For camera exist a lot of opcodes to realize your plan.
One way could be to record a carrec with heli and use then any vehicle to attach the carrec path.
Then put the camera on vehicle
CODE
00A5: 1@ = create_car #INFERNUS at 2487.5  -1660.5  13.35
0679: put_camera_on_car 1@ with_offset 0.0 -5.0 1.5 rotation 0.0 0.0 0.0 0.0 2//view trunk

0679: put_camera_on_car 1@ with_offset 0.0 -5.0 1.5 <--xyz position relativ to car
xyz point to view relativ to car-->> 0.0 0.0 0.0 rotation -->> 0.0 2 <--mode


the equivalent for the actor is opcode 067C:
The exemple above is from a cutsene which I made to move the camera nearer to the viewpoint
CODE
0007: 6@ =  0.5  // floating-point values
0007: 7@ =  0.0  // floating-point values
0007: 8@ =  0.0  // floating-point values

:Loop
wait 0
067C: $PLAYER_ACTOR  8@  6@ 0.7  7@  13.5 0.5 0.0  2
000B: 6@ +=  0.03  // floating-point values
000B: 7@ +=  0.01  // floating-point values
000B: 8@ +=  0.01  // floating-point values
jump @Loop

If you put the cam to player the player-walk-movement will be buggy


In connection with opcode 015F: you can set the camera view to follow an actor automaticly
CODE
015F: set_camera_position -2248.2187 -79.441 37.7686 rotation 0.0 0.0 0.0
0159: camera_on_ped 80@ 15 2



markbaker
  • markbaker

    Player Hater

  • Members
  • Joined: 26 Aug 2009

#37

Posted 03 September 2009 - 02:00 AM

ZAZ:

I've got a heli flying along a carrec path with a camera attached to the heli.


What I want to do is: the heli-mounted camera automatically 'point at' a parked or moving car while the heli is flying along the path. Is this possible?


ZAZ
  • ZAZ

    Kernlochbohrer

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

#38

Posted 03 September 2009 - 06:52 PM Edited by ZAZ, 03 September 2009 - 07:57 PM.

QUOTE (markbaker @ Sep 3 2009, 02:00)
I've got a heli flying along a carrec path with a camera attached to the heli.
What I want to do is:  the heli-mounted camera automatically 'point at' a parked or moving car while the heli is flying along the path. Is this possible?


Camera on carrec path

Only the combination of opcode 015F: and 0159: let the camera follow automaticly a moving target point
But we have enough codes in SA to do everything.
We can read the car positions as variable values and and insert this variables as parameter in the standart camera position opcode

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
But we can simple use the same coords to insert it in the standart camera target opcode


The script below spawns a NRG500 and follows the carrec path carrec899.rrr by keypress 8
The camera shows a fix XYZcoordpoint
(I placed a Monster at SFAirport and drove around and inserted the coords of the parked_car #monster in the script)
//-init_parked_car_generator #MONSTER color -1 -1 1 alarm 0 door_lock 0 0 10000 at -1355.7821 -71.4736 14.1462 angle 86.0
0160: set_camera_point_at -1355.7821 -71.4736 14.1462 mode 2
CODE
{$CLEO .cs}
:CameraDrive_1
03A4: name_thread 'DRVCARC'

:CameraDrive_11
0001: wait 0 ms
00D6: if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @CameraDrive_11
if
0AB0:   key_pressed 56//----------- key 8
004D: jump_if_false @CameraDrive_11
0247: request_model #NRG500

:CameraDrive_13
0001: wait  0 ms
00D6: if  0
0248:   model #NRG500 available
004D: jump_if_false @CameraDrive_13

00A5: 0@ = create_car #NRG500 at 0.0  0.0  100.0
0175: set_car 0@ z_angle_to 0.0
02AC: set_car 0@ immunities BP 1 FP 1 EP 1 CP 1 MP 1
0249: release_model #NRG500
0006: 8@ = 899
07C0: load_path 8@

:CameraDrive_17
0001: wait 0 ms
00D6: if
07C1:   path 8@ available
004D: jump_if_false @CameraDrive_17
00D6: if
8119:   not car 0@ wrecked
004D: jump_if_false @CameraDrive_50
0001: wait 500 ms
05EB: assign_car 0@ to_path 8@

:CameraDrive_21
0001: wait 0 ms
00D6: if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @CameraDrive_50
00D6: if or
00E1:   key_pressed  0  15//Enter/Exit
0119:   car 0@ wrecked
004D: jump_if_false @CameraDrive_25
0002: jump @CameraDrive_50

:CameraDrive_25
0407: create_coordinate 11@ 12@ 13@ from_car 0@ with_offset 0.0 0.0 1.0
015F: set_camera_position 11@ 12@ 13@ rotation 0.0 0.0 0.0
//init_parked_car_generator #MONSTER at -1355.7821 -71.4736 14.1462
0160: set_camera_point_at -1355.7821 -71.4736 14.1462 mode 2
0002: jump @CameraDrive_21

:CameraDrive_50
0001: wait 0 ms
00D6: if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @CameraDrive_50
0373: set_camera_directly_behind_player
02EB: restore_camera_with_jumpcut
05EC: release_car 0@ from_path
0873: release_path 8@
01C3: remove_references_to_car 0@ // Like turning a car into any random car
0001: wait 1000 ms
0002: jump @CameraDrive_11



To view a moving target from a moving vehicle is a bit more complicate because we need a script for the moving target and a script for the camera on carrec path.
I merged the CarDrive script and the CameraDrive script

Script below spawns the car Infernus in Grovestreet with two homies inthere,
if player goes into red marker(sphere)
additional it spawns a NRG500 and follows the carrec path carrec899.rrr
The camera shows a moving XYZcoords of the driving Infernus
CODE
{$CLEO .cs}
:CarrecCamCarDrive_1
03A4: name_thread 'CRCMCDR'

:CarrecCamCarDrive_2
0001: wait  0 ms
if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @CarrecCamCarDrive_2
if
00FE:   actor $PLAYER_ACTOR  1 (in-sphere)near_point 2491.5  -1667.5  13.35 radius  1.0  1.0  1.0
004D: jump_if_false @CarrecCamCarDrive_2

0247: request_model #INFERNUS
0247: request_model #fam1
0247: request_model #fam2
0247: request_model #NRG500

:CarrecCamCarDrive_3
0001: wait  0 ms
if  and
0248:   model #INFERNUS available
0248:   model #fam1 available
0248:   model #fam2 available
0248:   model #NRG500 available
004D: jump_if_false @CarrecCamCarDrive_3

00A5: 1@ = create_car #INFERNUS at 2487.5  -1660.5  13.35
0175: set_car 1@ z_angle_to 90.0
0129: 2@ = create_actor  8 #fam1 in_car 1@ driverseat
01C8: 3@ = create_actor  8 #fam2 in_car 1@ passenger_seat  0
0186: 4@ = create_marker_above_car 1@
07E0: set_marker 4@ type_to 1

00A5: 0@ = create_car #NRG500 at 0.0  0.0  100.0
0175: set_car 0@ z_angle_to 0.0
02AC: set_car 0@ immunities BP 1 FP 1 EP 1 CP 1 MP 1

0006: 8@ = 899
07C0: load_path 8@

:CarrecCamCarDrive_5
0001: wait 0 ms
00D6: if
07C1:   path 8@ available
004D: jump_if_false @CarrecCamCarDrive_5
00D6: if
8119:   not car 0@ wrecked
004D: jump_if_false @CarrecCamCarDrive_50
0001: wait 500 ms
05EB: assign_car 0@ to_path 8@

////////////////////  the drive-to commands --vv----

0615: define_action_sequences 5@
05D1: AS_actor -1 drive_car 1@ to  2353.1528 -1658.6493 13.384 speed  20.0  0  0  5
05D1: AS_actor -1 drive_car 1@ to  2431.7739 -1674.7444 13.6643 speed  20.0  0  0  5
05D1: AS_actor -1 drive_car 1@ to  2431.5864 -1628.0818 13.698 speed  20.0  2  0  5
0616: define_action_sequences_end 5@
0618: assign_actor 2@ to_action_sequences 5@
061B: remove_references_to_AS_pack 5@

////////////////////  the drive-to commands --^^----



:CarrecCamCarDrive_13
0001: wait  0 ms
if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @CarrecCamCarDrive_13

////////////////////  the the camera codes must run in a Loop --vv----
0407: create_coordinate 11@ 12@ 13@ from_car 0@ with_offset 0.0 0.0 1.5
015F: set_camera_position 11@ 12@ 13@ rotation 0.0 0.0 0.0
0407: create_coordinate 14@ 15@ 16@ from_car 1@ with_offset 0.0 0.0 1.0
0160: set_camera_point_at 14@ 15@ 16@ mode 2
////////////////////  the the camera codes must run in a Loop --vv----

if  or
00E1:     key_pressed  0  15//Enter/Exit
0119:     car 0@ wrecked
0119:     car 1@ wrecked
01F4:     car 1@ flipped
8202:   not actor $PLAYER_ACTOR near_car 1@ radius 500.0 500.0 flag 0
004D: jump_if_false @CarrecCamCarDrive_13

:CarrecCamCarDrive_50
0001: wait 0 ms
00D6: if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @CarrecCamCarDrive_50
0373: set_camera_directly_behind_player
02EB: restore_camera_with_jumpcut
05EC: release_car 0@ from_path
0873: release_path 8@
01C3: remove_references_to_car 0@ // Like turning a car into any random car
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@
0249: release_model #INFERNUS
0249: release_model #fam1
0249: release_model #fam2
0249: release_model #NRG500
0001: wait 1000 ms
0002: jump @CarrecCamCarDrive_2



Chuka
  • Chuka

    3&7'

  • Members
  • Joined: 08 Apr 2009

#39

Posted 11 September 2009 - 03:57 PM

ZAZ!! in Spanish! please!! inlove.gif

ZAZ
  • ZAZ

    Kernlochbohrer

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

#40

Posted 11 September 2009 - 05:03 PM

QUOTE (Chuka @ Sep 11 2009, 15:57)
ZAZ!! in Spanish! please!!  inlove.gif

try google translation, but don't use the translated scripts tounge2.gif

Rapier
  • Rapier

    Retired scripter

  • Members
  • Joined: 14 Aug 2005

#41

Posted 12 September 2009 - 05:00 PM Edited by Rapier, 12 September 2009 - 05:04 PM.

Important information (I think...):
Memory address to check if exist a target on the map ( red mark) for SA 1.01: 0x00BA8DF7 .

markbaker
  • markbaker

    Player Hater

  • Members
  • Joined: 26 Aug 2009

#42

Posted 12 September 2009 - 05:43 PM

ZAZ

Much thanks! I am making great progress on my project! icon14.gif


I'm wondering if it is possible to assign a vehicle directly to a path contained in an rrr file - without having to close GTA:SA & open the R3D tool and add it to carrec.img?

It would be a HUGE timesaver if I could record a path, and then immediately playback my recorded paths with a simple keypress to see how it looks

ZAZ
  • ZAZ

    Kernlochbohrer

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

#43

Posted 12 September 2009 - 05:56 PM Edited by ZAZ, 12 September 2009 - 06:00 PM.

QUOTE (markbaker @ Sep 12 2009, 17:43)

I'm wondering if it is possible to assign a vehicle directly to a path contained in an rrr file -  without having to close GTA:SA &  open the R3D tool and add it to carrec.img?

Not possible i think but what is R3D tool?
IMG is loaded by startup
Start game with menue button of sannybuilder is faster

kmasdmk
  • kmasdmk

    Crackhead

  • Members
  • Joined: 12 Sep 2009

#44

Posted 12 September 2009 - 07:50 PM

Hi all.
I need help with my small anim.
I have this anim in file dancing.ifp
And i want use this anim in air.
And idk how.
Here is my cleo code.
CODE
...   Player.Defined($PLAYER_CHAR)
else_jump @RASK14_MOD_21
04ED: load_animation "DANCING"

:RASK14_MOD_52
wait 10
if and
0AB0:   key_pressed 49
8818:   not actor $PLAYER_ACTOR in_air
84AD:   not actor $PLAYER_ACTOR in_water
8449:   not actor $PLAYER_ACTOR in_a_car
847A:   not actor $PLAYER_ACTOR driving_bike
84A7:   not actor $PLAYER_ACTOR driving_boat
84C8:   not actor $PLAYER_ACTOR driving_flying_vehicle
84A9:   not actor $PLAYER_ACTOR driving_heli
else_jump @RASK14_MOD_150
0605: actor $PLAYER_ACTOR perform_animation_sequence "BD_CLAP" IFP_file "DANCING" 4.0 loop 1 1 1 0 time 700 // versionA
wait 1500 ...

What i need edit or add ?
With this player use anim on earth.
Thanks.
(sorry when i write this post to bad topic.i am new on this forum.)

ZAZ
  • ZAZ

    Kernlochbohrer

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

#45

Posted 14 September 2009 - 05:03 AM Edited by ZAZ, 14 September 2009 - 04:37 PM.

QUOTE (Xforceman @ Sep 12 2009, 19:50)
(sorry when i write this post to bad topic.i am new on this forum.)

No problem but the forum to post such question is here

QUOTE
I need help with my small anim.
I have this anim in file dancing.ifp
And i want use this anim in air.
And idk how.
Here is my cleo code.


What i need edit or add ?
With this player use anim on earth.
Thanks.


What means in air? While falling or should the actor fly?
Have you seen the Airswim script in chapter CLEO Script Tutorial/Additional Themes : Animations ?

press Backspace to dance in air
CODE
{$CLEO .cs}
:Airdance
03A4: name_thread 'AirDnce'

:AirDance_01
0001: wait  0 ms
00D6: if  0
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @AirDance_01
00D6: if 0
0AB0:   key_pressed 8
004D: jump_if_false @AirDance_01

04ED: load_animation "DANCING"

:AirDance_03
0001: wait  0 ms
if
04EE:   animation "DANCING" loaded
004D: jump_if_false @AirDance_03
083C: set_actor $PLAYER_ACTOR velocity_in_direction_XYZ 0.0 0.0 20.0
0001: wait  1000 ms
0812: unknown_action_sequence $PLAYER_ACTOR "BD_CLAP" from_file "DANCING"  1.0  1  1  1  1 -2

:AirDance_05
0001: wait  0 ms
00D6: if  0
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @AirDance_05
083C: set_actor $PLAYER_ACTOR velocity_in_direction_XYZ 0.0 2.0 2.0
if  and
8AB0:   not key_pressed 8
0611:  actor $PLAYER_ACTOR animation == "BD_CLAP"
004D: jump_if_false @AirDance_07
0002: jump @AirDance_05

:AirDance_07
0792: disembark_instantly_actor $PLAYER_ACTOR
04EF: release_animation "DANCING"
0001: wait  1000 ms
0002: jump @AirDance_01

bull.04
  • bull.04

    :D

  • Members
  • Joined: 11 Apr 2008

#46

Posted 18 September 2009 - 10:37 PM

How do you make a timer?

ZAZ
  • ZAZ

    Kernlochbohrer

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

#47

Posted 19 September 2009 - 05:41 AM

QUOTE (bull.04 @ Sep 18 2009, 22:37)
How do you make a timer?

Look at CLEO Script Tutorial/Give access with math coding : Time check for milliseconds in real time

bull.04
  • bull.04

    :D

  • Members
  • Joined: 11 Apr 2008

#48

Posted 19 September 2009 - 10:48 PM

I mean one that counts down on screen like in the mission where you steal weapons from Colonel Fuhrberger's house.

Glenstorm
  • Glenstorm

    Strive to be different

  • Members
  • Joined: 19 Sep 2009

#49

Posted 20 September 2009 - 04:44 AM

sorry if this was covered earlier in the tutorial... but pls help..

how to create a script which uses a parked car generator, which does not save the car if the game is saved?

in other words, i want the car to be there, if the .cs script is in the CLEO folder, and not to be there when it is removed, regardless of the user saving his game in between...

currently im trying with enable_thread_saving thing.... i removed the line and it still gets saved in the savegame... how to remove this stupid functionality?

ZAZ
  • ZAZ

    Kernlochbohrer

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

#50

Posted 20 September 2009 - 10:56 AM Edited by ZAZ, 20 September 2009 - 11:14 AM.

QUOTE (Glenstorm @ Sep 20 2009, 04:44)
sorry if this was covered earlier in the tutorial... but pls help..

how to create a script which uses a parked car generator, which does not save the car if the game is saved?

in other words, i want the car to be there, if the .cs script is in the CLEO folder, and not to be there when it is removed, regardless of the user saving his game in between...

currently im trying with enable_thread_saving thing.... i removed the line and it still gets saved in the savegame... how to remove this stupid functionality?

This function is a parked_car_generator and not a car.
The savegame don't stores a placed car. It stores a parked_car_generator funktion
You can set that the generator don't places cars with ciro as last parameter in opcode 014C:
CODE
014C: set_parked_car_generator $PARKED_BMX_GLEN_PARK cars_to_generate_to 0

but it's not possible to remove the generator funktion


Also enable_thread_saving can not prevent that.
The opcode 0A95: enable_thread_saving should prevent duplicates of parked_car_generators, pickups or placed objects by making savgames, load that save, save it again and so on.

bull.04
  • bull.04

    :D

  • Members
  • Joined: 11 Apr 2008

#51

Posted 21 September 2009 - 12:25 AM

can you make an example script that shows how to make a timer to show up on the screen?

ZAZ
  • ZAZ

    Kernlochbohrer

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

#52

Posted 22 September 2009 - 04:58 PM

QUOTE (bull.04 @ Sep 21 2009, 00:25)
can you make an example script that shows how to make a timer to show up on the screen?


The game supports opcodes to show automatic timers but it needs to insert global variables
and because global can cause bugs and crashes in Cleo I will show first how to display
timers in scripted variation.
This needs to calculate the values of 33@ or 32@ to show minutes and seconds,
for the text number display can be used text_draw opcodes, text_high_priority opcodes or text_style opcodes

I made a little script which invite you to run with your player_actor around the SF-garage in Doherty
Go into the red marker (not that to start the mission) then run to the next red marker and so on
A yellow blip on radar shows you where to run
The first script shows the simple value of 33@
text_draw opcodes are used to show the value
CODE

{$CLEO .cs}
:Timeout_1// --- 32@ and 33@ are allways running as script timer in ms and you can catch its value
thread 'Timeout'
018A: 1@ = create_checkpoint_at -2026.2032 139.4361 28.8

:Timeout_3//------------------------------------------------------- first loop
wait 0
if
0256:   player $PLAYER_CHAR defined
jf @Timeout_3
03F0: enable_text_draw 1
045A: text_draw_1number  500.0  200.0 'NUMBER' 33@
if
00FE:   actor $PLAYER_ACTOR  1 (in-sphere)near_point -2026.2032 139.4361 28.83 radius  2.5  2.5  5.5
jf @Timeout_3
Marker.Disable(1@)
018A: 1@ = create_checkpoint_at -2057.0911 139.3797 28.83
33@ = 0// set the timer to 0

:Timeout_5//------------------------------------------------------- second loop
wait 0
if
0256:   player $PLAYER_CHAR defined
jf @Timeout_repeat
03F0: enable_text_draw 1
045A: text_draw_1number  500.0  200.0 'NUMBER' 33@
if
33@ >  4000// check if timer is bigger than 4000ms
jf @Timeout_7
jump @Timeout_repeat

:Timeout_7
if
00FE:   actor $PLAYER_ACTOR  1 (in-sphere)near_point -2057.0911 139.3797 28.83 radius  2.5  2.5  5.5
jf @Timeout_5
Marker.Disable(1@)
018A: 1@ = create_checkpoint_at -2063.8882 184.6683 28.843
33@ = 0// set the timer to 0


:Timeout_9//------------------------------------------------------- third loop
wait 0
if
0256:   player $PLAYER_CHAR defined
jf @Timeout_repeat
03F0: enable_text_draw 1
045A: text_draw_1number  500.0  200.0 'NUMBER' 33@
if
33@ >  5000// check if timer is bigger than 4000ms
jf @Timeout_11
jump @Timeout_repeat

:Timeout_11
if
00FE:   actor $PLAYER_ACTOR  1 (in-sphere)near_point -2063.8882 184.6683 28.843 radius  2.5  2.5  5.5
jf @Timeout_9
Marker.Disable(1@)
018A: 1@ = create_checkpoint_at -2024.1184 180.6013 28.8359
33@ = 0// set the timer to 0

:Timeout_13//------------------------------------------------------- fourth loop
wait 0
if
0256:   player $PLAYER_CHAR defined
jf @Timeout_repeat
03F0: enable_text_draw 1
045A: text_draw_1number  500.0  200.0 'NUMBER' 33@
if
33@ >  5000// check if timer is bigger than 5000ms
jf @Timeout_15
jump @Timeout_repeat

:Timeout_15
if
00FE:   actor $PLAYER_ACTOR  1 (in-sphere)near_point -2024.1184 180.6013 28.8359 radius  2.5  2.5  5.5
jf @Timeout_13
00BA: show_text_styled GXT 'M_PASSD' time 5000 style 1
Marker.Disable(1@)
03F0: enable_text_draw 0
0A93: end_custom_thread//- end by success

:Timeout_repeat//-----------------------refresh
00BA: show_text_styled GXT 'M_FAIL' time 5000 style 1
03F0: enable_text_draw 0
Marker.Disable(1@)
018A: 1@ = create_checkpoint_at -2026.2032 139.4361 28.8
0002: jump @Timeout_3

The next script shows the calculated values of 33@ as seconds and 1/100 of a second
text_draw opcodes are used to show the time
Use the fxt below and insert it into your fxt file
CODE
Showt01 SHOWTime: ~1~:~1~

Run again around the SF-garage in Doherty
CODE
{$CLEO .cs}
:Showtime_1
thread 'Showtime'
018A: 1@ = create_checkpoint_at -2026.2032 139.4361 28.8

:Showtime_3//------------------------------------------------------- first loop
wait 0
if
0256:   player $PLAYER_CHAR defined
jf @Showtime_3
if
00FE:   actor $PLAYER_ACTOR  1 (in-sphere)near_point -2026.2032 139.4361 28.83 radius  2.5  2.5  5.5
jf @Showtime_3
Marker.Disable(1@)
018A: 1@ = create_checkpoint_at -2057.0911 139.3797 28.83
33@ = 0
26@ = 4000//----countdownt start value in ms

:Showtime_5//------------------------------------------------------- second loop
wait 0
if
0256:   player $PLAYER_CHAR defined
jf @Showtime_repeat
gosub @Showtime_text_draw//---------- gosub to the display setting
if
33@ >  4000//-- must be equal to the previous countdownt start value
jf @Showtime_7
jump @Showtime_repeat

:Showtime_7
if
00FE:   actor $PLAYER_ACTOR  1 (in-sphere)near_point -2057.0911 139.3797 28.83 radius  2.5  2.5  5.5
jf @Showtime_5
Marker.Disable(1@)
018A: 1@ = create_checkpoint_at -2063.8882 184.6683 28.843
33@ = 0
26@ = 5000//----countdownt start value in ms

:Showtime_9//------------------------------------------------------- third loop
wait 0
if
0256:   player $PLAYER_CHAR defined
jf @Showtime_repeat
gosub @Showtime_text_draw//---------- gosub to the display setting
if
33@ >  5000//-- must be equal to the previous countdownt start value
jf @Showtime_11
jump @Showtime_repeat

:Showtime_11
if
00FE:   actor $PLAYER_ACTOR  1 (in-sphere)near_point -2063.8882 184.6683 28.843 radius  2.5  2.5  5.5
jf @Showtime_9
Marker.Disable(1@)
018A: 1@ = create_checkpoint_at -2024.1184 180.6013 28.8359
33@ = 0
26@ = 5000//----countdownt start value in ms

:Showtime_13//------------------------------------------------------- fourth loop
wait 0
if
0256:   player $PLAYER_CHAR defined
jf @Showtime_repeat
gosub @Showtime_text_draw//---------- gosub to the display setting
if
33@ >  5000//-- must be equal to the previous countdownt start value
jf @Showtime_15
jump @Showtime_repeat

:Showtime_15
if
00FE:   actor $PLAYER_ACTOR  1 (in-sphere)near_point -2024.1184 180.6013 28.8359 radius  2.5  2.5  5.5
jf @Showtime_13
00BA: show_text_styled GXT 'M_PASSD' time 5000 style 1
Marker.Disable(1@)
03F0: enable_text_draw 0
0A93: end_custom_thread//- end by success

:Showtime_repeat//-----------------------refresh
00BA: show_text_styled GXT 'M_FAIL' time 5000 style 1
03F0: enable_text_draw 0
Marker.Disable(1@)
018A: 1@ = create_checkpoint_at -2026.2032 139.4361 28.8
0002: jump @Showtime_3





:Showtime_text_draw//------------------------------- subscript
0085: 31@ = 33@ // make a local equal to the timer 33@
0085: 30@ = 33@ // make one more local equal to the timer 33@  

0085: 28@ = 26@ // make a local equal to the countdownt start value which show the seconds
28@ /= 1000
31@ /= 1000
0062: 28@ -= 31@

0085: 27@ = 26@ // make one more local equal to the countdownt start value which show parts of seconds
27@ /= 10
30@ /= 10
0062: 27@ -= 30@

03F0: enable_text_draw 1
0340: set_text_draw_RGBA 0 64 255 255
033F: set_text_draw_letter_size 0.5 3.0
0343: set_text_draw_linewidth 640.0
045B: draw_text_2numbers 450.0 200.0 GXT 'SHOWT01' numbers 28@ 27@

return

Instead text_draw opcodes can also be used text_high_priority opcodes
replace
CODE
03F0: enable_text_draw 1
0340: set_text_draw_RGBA 0 64 255 255
033F: set_text_draw_letter_size 0.5 3.0
0343: set_text_draw_linewidth 640.0
045B: draw_text_2numbers 450.0 200.0 GXT 'SHOWT01' numbers 28@ 27@

with
CODE
02FD: show_text_2numbers_lowpriority GXT 'Showt01' numbers 28@ 27@ time 10 flag 1

or use text_style opcodes and replace it with
CODE
036D: show_text_2numbers_styled GXT 'Showt01' numbers 28@ 27@ time 5 style 6



As I said above can also be used an automatic timer but it needs to use global variables
You need first to declare the value then start the timer.
Use stop timer at the end to remove the reference of the timer and of the variable
type 1 counts in descending order and type 0 counts in ascending order
CODE
{$CLEO .cs}
:Timer_1
thread 'TIMER'
0004: $time2 =  90000  // integer values
014E: set_timer_to $time2 type  1

:Timer_2
wait 0
if
$time2 == 0
jf @Timer_2
014F: stop_timer $time2
00BA: show_text_styled GXT 'fem_off' time 1000 style 1
0A93: end_custom_thread

For the timer exist also a version which show a text
replace
CODE
014E: set_timer_to $time2 type  1

with
CODE
03C3: set_timer_to $time2 type 1 GXT 'Showt01' // global_variable  // Time



To make it complete I show also how to use the StatusText or StatusBar opcode
But it needs also to use global variables
At first the StatusText opcode which displays only a value as numbers
It displays not the time but it displays automaticly the value of the global variable
CODE
{$CLEO .cs}
:Status_1
thread 'STATUS'
0004: $time2 =  1000  // integer values
03C4: set_status_text $time2 type 0 GXT 'Showt01' // global_variable  // Score ~1~

:Status_2
wait 0
$time2 -= 1
if
$time2 == 0
jf @Status_2
0151: remove_status_text $time2
00BA: show_text_styled GXT 'fem_off' time 1000 style 1
0A93: end_custom_thread

type 0 shows the value as numbers
type 1 shows the value as an bar

also there exist other opcodes to displays more StatusTexts or StatusBars
in more rows among each other

for the statusBar you must consider that a full bar have allways the value 100
and to show the correct bar needs to calculate the value relativ to 100
in other words: the bar shows percents
CODE
{$CLEO .cs}
:Status2_1
thread 'STATUS2'
0004: $time1 =  100  // integer values
0004: $time2 =  1000  // integer values
04F7: status_text $time1 type 1 line 1 GXT 'Showt01' // global_variable  // Score
04F7: status_text $time2 type 0 line 2 GXT 'Showt01' // global_variable  // Score

:Status2_2
wait 0
$time2 -= 1
0084: $time1 = $time2
$time1 /= 10
if
$time2 == 0
jf @Status2_2
0151: remove_status_text $time1
0151: remove_status_text $time2
00BA: show_text_styled GXT 'fem_off' time 1000 style 1
0A93: end_custom_thread

larvaz
  • larvaz

    Player Hater

  • Members
  • Joined: 17 Jul 2009

#53

Posted 28 October 2009 - 05:59 PM Edited by larvaz, 28 October 2009 - 06:07 PM.

Wusup!

hello 2 Everyone...

well im new here, at the forum, i think ive been coding from the last month XD..

i was reading ZAZ car drive tut..
i took the examle code, the one that uses

CODE
07E7: AS_assign_scmpath_to_actor


im planing a race script around the city, NFS style jojo..

but ive troubles with my code... everythings fine when makin the cars, the "oponent" perfectly follows my desired path...

then i decide to make a winnin condition, cheking if any of the cars reached the final race chekpoint, near the train station.. heres the whole code
CODE

{$CLEO .cs}
:scmpath_1
03A4: name_thread 'SCMP'

:scmpath_3
0001: wait 0 ms
if
0256: player $PLAYER_CHAR defined
jf @scmpath_3
077E: 0@ = active_interior
if  and
0038:   0@ ==  0  // integer values
0AB0:   key_pressed 8//----------------------------------------Backspace  
jf @scmpath_3
016A: fade  0 ()  250 ms
0001: wait 250 ms
01B4: set_player $PLAYER_CHAR frozen_state  0 (frozen)
0362: remove_actor $PLAYER_ACTOR from_car_and_place_at -1338.5  -408.1  14.1
0173: set_actor $PLAYER_ACTOR z_angle_to  90.8
0001: wait  500 ms
0247: request_model #INFERNUS
0247: request_model #MAFFA

:scmpath_5
0001: wait  0 ms
if  and
0248:   model #INFERNUS available                    
0248:   model #MAFFA available
jf @scmpath_5
00C0: set_current_time_hours_to 1 minutes_to 0    // i prefer raciin at nite jojo
00A5: 1@ = create_car #INFERNUS at 2639.6252 2097.3906 10.6558 //put car racestart
0175: set_car 1@ z_angle_to  191.0
0224: set_car 1@ health_to  2000
00A5: 7@ = create_car #INFERNUS at 2634.3599 2097.4692 10.6499  //put opponent racestart
0175: set_car 7@ z_angle_to  191.0
0224: set_car 7@ health_to  2000
020A: set_car  7@ door_status_to 4
02AC: set_car 7@ immunities  1  1  1  1  1
01EC: make_car 7@ very_heavy  1
0129: 9@ = create_actor  24 #MAFFA in_car 7@ driverseat
0223: set_actor 9@ health_to  3000
04E4: unknown_refresh_game_renderer_at  2639.6252 2097.3906
03CB: set_camera  2639.6252 2097.3906 10.6558
029B: 23@ = init_object 1655 at -1576.02  -202.34  13.76
0177: set_object 23@ z_angle_to  270.0
01C7: remove_object_from_mission_cleanup_list 23@
0382: set_object 23@ collision_detection  1
029B: 24@ = init_object 1655 at -1597.9  -506.5  21.7
0177: set_object 24@ z_angle_to  270.0
01C7: remove_object_from_mission_cleanup_list 24@
0382: set_object 24@ collision_detection  1
029B: 25@ = init_object 1655 at -1375.9  -581.5  13.69
0177: set_object 25@ z_angle_to  270.0
01C7: remove_object_from_mission_cleanup_list 25@
0382: set_object 25@ collision_detection  1
029B: 26@ = init_object 1655 at -1374.9  -585.5  13.69
0177: set_object 26@ z_angle_to  270.0
01C7: remove_object_from_mission_cleanup_list 26@

0382: set_object 26@ collision_detection  1
0177: set_object 23@ z_angle_to  135.0
0177: set_object 24@ z_angle_to  225.0
0177: set_object 25@ z_angle_to  280.0
0177: set_object 26@ z_angle_to  280.0
0186: 29@ = create_marker_above_car 7@
07E0: set_marker 29@ type_to 1

0249: release_model #INFERNUS
0249: release_model #MAFFA
Car.LockInCurrentPosition(7@) = True
Car.LockInCurrentPosition(1@) = True
04e0: car 7@ abandon_path_radius 200
00AD: set_car 7@ max_speed_to  100.0
04BA: set_car 7@ speed_instantly  30.0
00AF: set_car 7@ driver_behaviour_to  1
00AE: unknown_set_car 7@ to_ignore_traffic_lights  2
0001: wait  250 ms
036A: put_actor $PLAYER_ACTOR in_car 1@
0001: wait  250 ms
016A: fade  1 ()  1000 ms
0001: wait  1000 ms
0373: set_camera_directly_behind_player
02EB: restore_camera_with_jumpcut
01B4: set_player $PLAYER_CHAR frozen_state  1 (unfrozen)
0006: 15@ =  0  // integer values
0006: 16@ =  0  // integer values
0006: 20@ =  20000  // floating-point values
0006: 19@ =  0  // integer values                                
0007: 11@ =  2647.3511  // floating-point values
0007: 12@ =  2069.1543  // floating-point values       2647.8835 2068.5312 9.7085
0007: 13@ =  10.1373  // floating-point values
0006: $win =  0
0006: $lose =  0
wait  3000 ms
Car.LockInCurrentPosition(1@) = False
Car.LockInCurrentPosition(7@) = False
00A7: car 7@ drive_to  11@ 12@ 13@
00AD: set_car 7@ max_speed_to  100.0
04e0: car 7@ abandon_path_radius 250
08C6: set_actor 9@  stay_on_bike 1
06D5: $check = create_racing_checkpoint_at 2866.5557 1279.0804 15.0 point_to 2866.5557 1279.0804 10.763 type 1 radius 15.0
                                 //heres the checkpoint coords



:scmpath_7
0001: wait 0 ms
if
0256: player $PLAYER_CHAR defined
jf @scmpath_7

0050: gosub @scmpath_sub_3

if  and
8119:   NOT   car 1@ wrecked
8119:   NOT   car 7@ wrecked
8118:   NOT   actor 9@ dead
jf @scmpath_7
if
00FE:   actor $PLAYER_ACTOR  0 ()near_point 2639.6252 2097.3906 10.6558 radius  1000.5  1000.5  50.5
jf @scmpath_12
//
//    heres where i put the $PLAYER_ACTOR´s car winnin condition...
//
//
:checkwin
wait 0
if
80EC:  actor $PLAYER_ACTOR 0 near_point 2866.5557 1279.0804 10.763 radius 8.0 8.0  //check if youve reach tha finish line
jf @scmpath_7
:putwin          //true?  winnin gets 1 value
0006: $win =  1
jump @chekloop    //and jumps to make the check, otherwise it continues with normal script

//  end of winnin condition

jump @scmpath_7

:scmpath_12
0164: disable_marker 29@
01C3: remove_references_to_car 1@  // Like turning a car into any random car
01C3: remove_references_to_car 7@  // Like turning a car into any random car
01C2: remove_references_to_actor 9@  // Like turning an actor into a random pedestrian
0108: destroy_object 23@
0108: destroy_object 24@
0108: destroy_object 25@
0108: destroy_object 26@
jump @scmpath_3


:scmpath_sub_3
if
8119:   NOT   car 7@ wrecked
jf @scmpath_sub_109
if
00DB:   actor 9@ in_car 7@
jf @scmpath_sub_99
if
0039:   19@ ==  1  // integer values
jf @scmpath_sub_10
0006: 19@ =  0  // integer values
jump @scmpath_sub_100

:scmpath_sub_10
if
0039:   15@ ==  0  // integer values
jf @scmpath_sub_11
if
01AF:   car 7@  0 ()near_point 11@ 12@ 13@ radius  5.2  5.2  5.0
jf @scmpath_sub_11
0006: 15@ =  1  // integer values
05D6: clear_scmpath
0007: 11@ =  2690.3149  // floating-point values
0007: 12@ =  2003.0887  // floating-point values
0007: 13@ =  6.6397  // floating-point values
000A: 16@ +=  0  // integer values                      
0007: 17@ =  100.0  // floating-point values
0007: 18@ =  20.0  // floating-point values
05D7: add_point_to_scmpath 11@ 12@ 13@
jump @scmpath_sub_100

:scmpath_sub_11
if
0039:   15@ ==  1  // integer values
jf @scmpath_sub_12
if
01AF:   car 7@  0 ()near_point 11@ 12@ 13@ radius  15.2  15.2  5.0
jf @scmpath_sub_12
00AD: set_car 7@ max_speed_to  10.0
0006: 15@ =  2  // integer values
05D6: clear_scmpath
0007: 11@ =  2705.8157  // floating-point values
0007: 12@ =  1937.0188  // floating-point values      
0007: 13@ =  6.6761  // floating-point values
000A: 16@ +=  0  // integer values
0007: 17@ =  100.0  // floating-point values
0007: 18@ =  20.0  // floating-point values
05D7: add_point_to_scmpath 11@ 12@ 13@
jump @scmpath_sub_100


:scmpath_sub_12
if
0039:   15@ ==  2  // integer values
jf @scmpath_sub_13
if
01AF:   car 7@  0 ()near_point 11@ 12@ 13@ radius  15.2  15.2  5.0
jf @scmpath_sub_13
00AD: set_car 7@ max_speed_to  25.0
0006: 15@ =  3  // integer values
05D6: clear_scmpath
0007: 11@ =  2726.5459  // floating-point values
0007: 12@ =  1887.1978  // floating-point values            
0007: 13@ =  6.6737  // floating-point values
000A: 16@ +=  0  // integer values
0007: 17@ =  100.0  // floating-point values
0007: 18@ =  20.0  // floating-point values
05D7: add_point_to_scmpath 11@ 12@ 13@
jump @scmpath_sub_100

:scmpath_sub_13
if
0039:   15@ ==  3  // integer values
jf @scmpath_sub_14
if
01AF:   car 7@  0 ()near_point 11@ 12@ 13@ radius  8.2  8.2  5.0
jf @scmpath_sub_14
00AD: set_car 7@ max_speed_to  25.0
0006: 15@ =  4  // integer values
05D6: clear_scmpath
0007: 11@ =  2737.7283  // floating-point values
0007: 12@ =  1763.1494  // floating-point values
0007: 13@ =  6.8209  // floating-point values        
000A: 16@ +=  0  // integer values
0007: 17@ =  100.0  // floating-point values
0007: 18@ =  20.0  // floating-point values
05D7: add_point_to_scmpath 11@ 12@ 13@
jump @scmpath_sub_100



:scmpath_sub_14
if
0039:   15@ ==  4  // integer values
jf @scmpath_sub_15
if
01AF:   car 7@  0 ()near_point 11@ 12@ 13@ radius  5.2  5.2  5.0
jf @scmpath_sub_15
0006: 15@ =  5  // integer values
05D6: clear_scmpath
0007: 11@ =  2747.7874  // floating-point values
0007: 12@ =  1691.6516  // floating-point values
0007: 13@ =  8.8271  // floating-point values          
000A: 16@ +=  0  // integer values
0007: 17@ =  100.0  // floating-point values
0007: 18@ =  20.0  // floating-point values
05D7: add_point_to_scmpath 11@ 12@ 13@
jump @scmpath_sub_100

:scmpath_sub_15
if
0039:   15@ ==  5  // integer values
jf @scmpath_sub_16
if
01AF:   car 7@  0 ()near_point 11@ 12@ 13@ radius  15.2  15.2  5.0
jf @scmpath_sub_16
00AD: set_car 7@ max_speed_to  10.0
0006: 15@ =  6  // integer values
05D6: clear_scmpath
0007: 11@ =  2844.8591  // floating-point values
0007: 12@ =  1537.704  // floating-point values
0007: 13@ =  10.7916  // floating-point values
000A: 16@ +=  0  // integer values
0007: 17@ =  40.0  // floating-point values                
0007: 18@ =  10.0  // floating-point values
05D7: add_point_to_scmpath 11@ 12@ 13@
00AE: unknown_set_car 7@ to_ignore_traffic_lights  2
jump @scmpath_sub_100

:scmpath_sub_16
if
0039:   15@ ==  6  // integer values
jf @scmpath_sub_17
if
01AF:   car 7@  0 ()near_point 11@ 12@ 13@ radius  8.2  8.2  5.0
jf @scmpath_sub_17
00AD: set_car 7@ max_speed_to  0.0
0006: 15@ =  7  // integer values
05D6: clear_scmpath
0007: 11@ =  2867.3679  // floating-point values
0007: 12@ =  1490.7612  // floating-point values
0007: 13@ =  10.7581  // floating-point values
000A: 16@ +=  0  // integer values                      
0007: 17@ =  100.0  // floating-point values      
0007: 18@ =  0.0  // floating-point values
05D7: add_point_to_scmpath 11@ 12@ 13@
00AE: unknown_set_car 7@ to_ignore_traffic_lights  2
jump @scmpath_sub_100

:scmpath_sub_17
if
0039:   15@ ==  7  // integer values
jf @scmpath_sub_18
if
01AF:   car 7@  0 ()near_point 11@ 12@ 13@ radius  15.2  15.2  5.0
jf @scmpath_sub_18
00AD: set_car 7@ max_speed_to  5.0
01EB: set_car_density_to  0.0
0006: 15@ =  8  // integer values
05D6: clear_scmpath
0007: 11@ =  2862.9255  // floating-point values
0007: 12@ =  1298.3546  // floating-point values
0007: 13@ =  10.5398  // floating-point values                 last checkpoint!!!!!
000A: 16@ +=  0  // integer values                  
0007: 17@ =  100.0  // floating-point values
0007: 18@ =  20.0  // floating-point values
05D7: add_point_to_scmpath 11@ 12@ 13@
jump @scmpath_sub_100


:scmpath_sub_18
if
0039:   15@ ==  8  // integer values
jf @scmpath_sub_109
if
01AF:   car 7@  0 ()near_point 11@ 12@ 13@ radius  25.2  25.2  5.0

jf @scmpath_sub_109
     // aand heres the oponnent´s car winnin condition
if
01AF:   car 7@  0 ()near_point 2866.5557 1279.0804 10.763 radius  8.2  8.2  5.0
jf @scmpath_sub_109  // if 7@ reached tha finish line, $lose becomes 1
0006: $lose =  1
:chekloop
wait 0
if
0039: $win ==  1   //checkin if $PLAYER_ACTOR´s car already reached finish line
jump @winner        //so make me the winner
                   //if false checks if oponents reached finish
if
0039: $lose ==  1
jump @loserace     //if true, youre a loser ha-hA


:winner
00AD: set_car 7@ max_speed_to  0.0
0006: 15@ =  1  // integer values             //winnin text
00BC: text_highpriority 'BJ_WIN'  5000 ms  1
jump @scmpath_12

:loserace
00AD: set_car 7@ max_speed_to  0.0
0006: 15@ =  1  // integer values                   //loser text
00BC: text_highpriority 'BJ_LOSE'  5000 ms  1

// end of condition

jump @scmpath_12
000A: 16@ +=  1  // integer values
05D6: clear_scmpath
0007: 11@ =  -1181.78  // floating-point values
0007: 12@ =  -331.30  // floating-point values
0007: 13@ =  13.76  // floating-point values
0007: 17@ =  100.0  // floating-point values
0007: 18@ =  20.0  // floating-point values
05D7: add_point_to_scmpath 11@ 12@ 13@

if
0039:   16@ ==  2  // integer values
jf @scmpath_sub_100
00BC: text_highpriority 'BJ_LOSE'  5000 ms  1
jump @scmpath_sub_100


:scmpath_sub_99
if
0039:   19@ ==  0  // integer values
jf @scmpath_sub_109
00AD: set_car 7@ max_speed_to  0.0
05CB: actor_goto_and_enter_car 9@ 7@  5000
0006: 19@ =  1  // integer values
jump @scmpath_sub_109

:scmpath_sub_100
07E7: AS_assign_scmpath_to_actor 9@ in_car 7@ speed 17@ flags 2 0 3
03F0: text_draw_toggle  0
0006: 33@ =  0  // integer values
jump @scmpath_sub_109



:scmpath_sub_102
if
01F3:   car 7@ airborne
jf @scmpath_sub_103
0007: 18@ =  0.0  // floating-point values
04BA: set_car 7@ speed_instantly  18@
07E7: AS_assign_scmpath_to_actor 9@ in_car 7@ speed 17@ flags 2 0 3
jump @scmpath_sub_103

:scmpath_sub_103
if
01AF:   car 7@  0 ()near_point 11@ 12@ 13@ radius  30.2  30.2  5.0
jf @scmpath_sub_104
jump @scmpath_sub_105

:scmpath_sub_104
02E3: 20@ = car 7@ speed
if
81F3:   NOT   car 7@ airborne
jf @scmpath_sub_106
if  and
0021:   20@ >  30.0  // floating-point values
0019:   33@ >  700  // integer values
jf @scmpath_sub_105
04BA: set_car 7@ speed_instantly  50.0

:scmpath_sub_105
if
0019:   33@ >  2000  // integer values
jf @scmpath_sub_109

:scmpath_sub_106
0006: 33@ =  0  // integer values


:scmpath_sub_109
0051: return


let me remember u, i used ZAZ example script

the F@kin prob is that when i press backspace to start tha race, the cars are placed as normal
but it seems the winnin condition is broken, and the text You win is showed since the
beginning of the race... it nevers check if the car´s at finish line...

i dunno whers my code error haha...


heres my code without the winnin checks, runs perfectly...

CODE
{$CLEO .cs}
:scmpath_1
03A4: name_thread 'SCMP'

:scmpath_3
0001: wait 0 ms
if
0256: player $PLAYER_CHAR defined
jf @scmpath_3
077E: 0@ = active_interior
if  and
0038:   0@ ==  0  // integer values
0AB0:   key_pressed 8//----------------------------------------Backspace  
jf @scmpath_3
016A: fade  0 ()  250 ms
0001: wait 250 ms
01B4: set_player $PLAYER_CHAR frozen_state  0 (frozen)
0362: remove_actor $PLAYER_ACTOR from_car_and_place_at -1338.5  -408.1  14.1
0173: set_actor $PLAYER_ACTOR z_angle_to  90.8
0001: wait  500 ms
0247: request_model #INFERNUS
0247: request_model #MAFFA

:scmpath_5
0001: wait  0 ms
if  and
0248:   model #INFERNUS available                    
0248:   model #MAFFA available
jf @scmpath_5
00C0: set_current_time_hours_to 1 minutes_to 0    // i prefer raciin at nite jojo
00A5: 1@ = create_car #INFERNUS at 2639.6252 2097.3906 10.6558 //put car racestart
0175: set_car 1@ z_angle_to  191.0
0224: set_car 1@ health_to  2000
00A5: 7@ = create_car #INFERNUS at 2634.3599 2097.4692 10.6499  //put opponent racestart
0175: set_car 7@ z_angle_to  191.0
0224: set_car 7@ health_to  2000
020A: set_car  7@ door_status_to 4
02AC: set_car 7@ immunities  1  1  1  1  1
01EC: make_car 7@ very_heavy  1
0129: 9@ = create_actor  24 #MAFFA in_car 7@ driverseat
0223: set_actor 9@ health_to  3000
04E4: unknown_refresh_game_renderer_at  2639.6252 2097.3906
03CB: set_camera  2639.6252 2097.3906 10.6558
029B: 23@ = init_object 1655 at -1576.02  -202.34  13.76
0177: set_object 23@ z_angle_to  270.0
01C7: remove_object_from_mission_cleanup_list 23@
0382: set_object 23@ collision_detection  1
029B: 24@ = init_object 1655 at -1597.9  -506.5  21.7
0177: set_object 24@ z_angle_to  270.0
01C7: remove_object_from_mission_cleanup_list 24@
0382: set_object 24@ collision_detection  1
029B: 25@ = init_object 1655 at -1375.9  -581.5  13.69
0177: set_object 25@ z_angle_to  270.0
01C7: remove_object_from_mission_cleanup_list 25@
0382: set_object 25@ collision_detection  1
029B: 26@ = init_object 1655 at -1374.9  -585.5  13.69
0177: set_object 26@ z_angle_to  270.0
01C7: remove_object_from_mission_cleanup_list 26@

0382: set_object 26@ collision_detection  1
0177: set_object 23@ z_angle_to  135.0
0177: set_object 24@ z_angle_to  225.0
0177: set_object 25@ z_angle_to  280.0
0177: set_object 26@ z_angle_to  280.0
0186: 29@ = create_marker_above_car 7@
07E0: set_marker 29@ type_to 1

0249: release_model #INFERNUS
0249: release_model #MAFFA
Car.LockInCurrentPosition(7@) = True
Car.LockInCurrentPosition(1@) = True
04e0: car 7@ abandon_path_radius 200
00AD: set_car 7@ max_speed_to  100.0
04BA: set_car 7@ speed_instantly  30.0
00AF: set_car 7@ driver_behaviour_to  1
00AE: unknown_set_car 7@ to_ignore_traffic_lights  2
0001: wait  250 ms
036A: put_actor $PLAYER_ACTOR in_car 1@
0001: wait  250 ms
016A: fade  1 ()  1000 ms
0001: wait  1000 ms
0373: set_camera_directly_behind_player
02EB: restore_camera_with_jumpcut
01B4: set_player $PLAYER_CHAR frozen_state  1 (unfrozen)
0006: 15@ =  0  // integer values
0006: 16@ =  0  // integer values
0006: 20@ =  20000  // floating-point values
0006: 19@ =  0  // integer values                                
0007: 11@ =  2647.3511  // floating-point values
0007: 12@ =  2069.1543  // floating-point values       2647.8835 2068.5312 9.7085
0007: 13@ =  10.1373  // floating-point values
0006: $win =  0
0006: $lose =  0
wait  3000 ms
Car.LockInCurrentPosition(1@) = False
Car.LockInCurrentPosition(7@) = False
00A7: car 7@ drive_to  11@ 12@ 13@
00AD: set_car 7@ max_speed_to  100.0
04e0: car 7@ abandon_path_radius 250
08C6: set_actor 9@  stay_on_bike 1
06D5: $check = create_racing_checkpoint_at 2866.5557 1279.0804 15.0 point_to 2866.5557 1279.0804 10.763 type 1 radius 15.0
                                 //heres the checkpoint coords



:scmpath_7
0001: wait 0 ms
if
0256: player $PLAYER_CHAR defined
jf @scmpath_7

0050: gosub @scmpath_sub_3

if  and
8119:   NOT   car 1@ wrecked
8119:   NOT   car 7@ wrecked
8118:   NOT   actor 9@ dead
jf @scmpath_7
if
00FE:   actor $PLAYER_ACTOR  0 ()near_point 2639.6252 2097.3906 10.6558 radius  1000.5  1000.5  50.5
jf @scmpath_12

jump @scmpath_7

:scmpath_12
0164: disable_marker 29@
01C3: remove_references_to_car 1@  // Like turning a car into any random car
01C3: remove_references_to_car 7@  // Like turning a car into any random car
01C2: remove_references_to_actor 9@  // Like turning an actor into a random pedestrian
0108: destroy_object 23@
0108: destroy_object 24@
0108: destroy_object 25@
0108: destroy_object 26@
jump @scmpath_3


:scmpath_sub_3
if
8119:   NOT   car 7@ wrecked
jf @scmpath_sub_109
if
00DB:   actor 9@ in_car 7@
jf @scmpath_sub_99
if
0039:   19@ ==  1  // integer values
jf @scmpath_sub_10
0006: 19@ =  0  // integer values
jump @scmpath_sub_100

:scmpath_sub_10
if
0039:   15@ ==  0  // integer values
jf @scmpath_sub_11
if
01AF:   car 7@  0 ()near_point 11@ 12@ 13@ radius  5.2  5.2  5.0
jf @scmpath_sub_11
0006: 15@ =  1  // integer values
05D6: clear_scmpath
0007: 11@ =  2690.3149  // floating-point values
0007: 12@ =  2003.0887  // floating-point values
0007: 13@ =  6.6397  // floating-point values
000A: 16@ +=  0  // integer values                      
0007: 17@ =  100.0  // floating-point values
0007: 18@ =  20.0  // floating-point values
05D7: add_point_to_scmpath 11@ 12@ 13@
jump @scmpath_sub_100

:scmpath_sub_11
if
0039:   15@ ==  1  // integer values
jf @scmpath_sub_12
if
01AF:   car 7@  0 ()near_point 11@ 12@ 13@ radius  15.2  15.2  5.0
jf @scmpath_sub_12
00AD: set_car 7@ max_speed_to  10.0
0006: 15@ =  2  // integer values
05D6: clear_scmpath
0007: 11@ =  2705.8157  // floating-point values
0007: 12@ =  1937.0188  // floating-point values      
0007: 13@ =  6.6761  // floating-point values
000A: 16@ +=  0  // integer values
0007: 17@ =  100.0  // floating-point values
0007: 18@ =  20.0  // floating-point values
05D7: add_point_to_scmpath 11@ 12@ 13@
jump @scmpath_sub_100


:scmpath_sub_12
if
0039:   15@ ==  2  // integer values
jf @scmpath_sub_13
if
01AF:   car 7@  0 ()near_point 11@ 12@ 13@ radius  15.2  15.2  5.0
jf @scmpath_sub_13
00AD: set_car 7@ max_speed_to  25.0
0006: 15@ =  3  // integer values
05D6: clear_scmpath
0007: 11@ =  2726.5459  // floating-point values
0007: 12@ =  1887.1978  // floating-point values            
0007: 13@ =  6.6737  // floating-point values
000A: 16@ +=  0  // integer values
0007: 17@ =  100.0  // floating-point values
0007: 18@ =  20.0  // floating-point values
05D7: add_point_to_scmpath 11@ 12@ 13@
jump @scmpath_sub_100

:scmpath_sub_13
if
0039:   15@ ==  3  // integer values
jf @scmpath_sub_14
if
01AF:   car 7@  0 ()near_point 11@ 12@ 13@ radius  8.2  8.2  5.0
jf @scmpath_sub_14
00AD: set_car 7@ max_speed_to  25.0
0006: 15@ =  4  // integer values
05D6: clear_scmpath
0007: 11@ =  2737.7283  // floating-point values
0007: 12@ =  1763.1494  // floating-point values
0007: 13@ =  6.8209  // floating-point values        
000A: 16@ +=  0  // integer values
0007: 17@ =  100.0  // floating-point values
0007: 18@ =  20.0  // floating-point values
05D7: add_point_to_scmpath 11@ 12@ 13@
jump @scmpath_sub_100



:scmpath_sub_14
if
0039:   15@ ==  4  // integer values
jf @scmpath_sub_15
if
01AF:   car 7@  0 ()near_point 11@ 12@ 13@ radius  5.2  5.2  5.0
jf @scmpath_sub_15
0006: 15@ =  5  // integer values
05D6: clear_scmpath
0007: 11@ =  2747.7874  // floating-point values
0007: 12@ =  1691.6516  // floating-point values
0007: 13@ =  8.8271  // floating-point values          
000A: 16@ +=  0  // integer values
0007: 17@ =  100.0  // floating-point values
0007: 18@ =  20.0  // floating-point values
05D7: add_point_to_scmpath 11@ 12@ 13@
jump @scmpath_sub_100

:scmpath_sub_15
if
0039:   15@ ==  5  // integer values
jf @scmpath_sub_16
if
01AF:   car 7@  0 ()near_point 11@ 12@ 13@ radius  15.2  15.2  5.0
jf @scmpath_sub_16
00AD: set_car 7@ max_speed_to  10.0
0006: 15@ =  6  // integer values
05D6: clear_scmpath
0007: 11@ =  2844.8591  // floating-point values
0007: 12@ =  1537.704  // floating-point values
0007: 13@ =  10.7916  // floating-point values
000A: 16@ +=  0  // integer values
0007: 17@ =  40.0  // floating-point values                
0007: 18@ =  10.0  // floating-point values
05D7: add_point_to_scmpath 11@ 12@ 13@
00AE: unknown_set_car 7@ to_ignore_traffic_lights  2
jump @scmpath_sub_100

:scmpath_sub_16
if
0039:   15@ ==  6  // integer values
jf @scmpath_sub_17
if
01AF:   car 7@  0 ()near_point 11@ 12@ 13@ radius  8.2  8.2  5.0
jf @scmpath_sub_17
00AD: set_car 7@ max_speed_to  0.0
0006: 15@ =  7  // integer values
05D6: clear_scmpath
0007: 11@ =  2867.3679  // floating-point values
0007: 12@ =  1490.7612  // floating-point values
0007: 13@ =  10.7581  // floating-point values
000A: 16@ +=  0  // integer values                      
0007: 17@ =  100.0  // floating-point values      
0007: 18@ =  0.0  // floating-point values
05D7: add_point_to_scmpath 11@ 12@ 13@
00AE: unknown_set_car 7@ to_ignore_traffic_lights  2
jump @scmpath_sub_100

:scmpath_sub_17
if
0039:   15@ ==  7  // integer values
jf @scmpath_sub_18
if
01AF:   car 7@  0 ()near_point 11@ 12@ 13@ radius  15.2  15.2  5.0
jf @scmpath_sub_18
00AD: set_car 7@ max_speed_to  5.0
01EB: set_car_density_to  0.0
0006: 15@ =  8  // integer values
05D6: clear_scmpath
0007: 11@ =  2862.9255  // floating-point values
0007: 12@ =  1298.3546  // floating-point values
0007: 13@ =  10.5398  // floating-point values                 last checkpoint!!!!!
000A: 16@ +=  0  // integer values                  
0007: 17@ =  100.0  // floating-point values
0007: 18@ =  20.0  // floating-point values
05D7: add_point_to_scmpath 11@ 12@ 13@
jump @scmpath_sub_100


:scmpath_sub_18
if
0039:   15@ ==  8  // integer values
jf @scmpath_sub_109
if
01AF:   car 7@  0 ()near_point 11@ 12@ 13@ radius  25.2  25.2  5.0

jf @scmpath_sub_109


00AD: set_car 7@ max_speed_to  0.0
0006: 15@ =  1  // integer values                   //loser text
00BC: text_highpriority 'BJ_LOSE'  5000 ms  1

// end of condition

jump @scmpath_12
000A: 16@ +=  1  // integer values
05D6: clear_scmpath
0007: 11@ =  -1181.78  // floating-point values
0007: 12@ =  -331.30  // floating-point values
0007: 13@ =  13.76  // floating-point values
0007: 17@ =  100.0  // floating-point values
0007: 18@ =  20.0  // floating-point values
05D7: add_point_to_scmpath 11@ 12@ 13@

if
0039:   16@ ==  2  // integer values
jf @scmpath_sub_100
00BC: text_highpriority 'BJ_LOSE'  5000 ms  1
jump @scmpath_sub_100


:scmpath_sub_99
if
0039:   19@ ==  0  // integer values
jf @scmpath_sub_109
00AD: set_car 7@ max_speed_to  0.0
05CB: actor_goto_and_enter_car 9@ 7@  5000
0006: 19@ =  1  // integer values
jump @scmpath_sub_109

:scmpath_sub_100
07E7: AS_assign_scmpath_to_actor 9@ in_car 7@ speed 17@ flags 2 0 3
03F0: text_draw_toggle  0
0006: 33@ =  0  // integer values
jump @scmpath_sub_109



:scmpath_sub_102
if
01F3:   car 7@ airborne
jf @scmpath_sub_103
0007: 18@ =  0.0  // floating-point values
04BA: set_car 7@ speed_instantly  18@
07E7: AS_assign_scmpath_to_actor 9@ in_car 7@ speed 17@ flags 2 0 3
jump @scmpath_sub_103

:scmpath_sub_103
if
01AF:   car 7@  0 ()near_point 11@ 12@ 13@ radius  30.2  30.2  5.0
jf @scmpath_sub_104
jump @scmpath_sub_105

:scmpath_sub_104
02E3: 20@ = car 7@ speed
if
81F3:   NOT   car 7@ airborne
jf @scmpath_sub_106
if  and
0021:   20@ >  30.0  // floating-point values
0019:   33@ >  700  // integer values
jf @scmpath_sub_105
04BA: set_car 7@ speed_instantly  50.0

:scmpath_sub_105
if
0019:   33@ >  2000  // integer values
jf @scmpath_sub_109

:scmpath_sub_106
0006: 33@ =  0  // integer values


:scmpath_sub_109
0051: return


please help !!

last question, i dont understand last script part, that airborne checks, i dunno whats an airborn jajaja....



i hope mi post is readeable... kus im from mexiko, i speak spanish..

asi que si igual hay algun hispano que me ayude, estaria genial jeje...
chidoo pzz..

PD: heey ZAZ your tutorials are greaat.. helped me a lot.... icon14.gif

peace out

ZAZ
  • ZAZ

    Kernlochbohrer

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

#54

Posted 29 October 2009 - 06:47 PM Edited by ZAZ, 29 October 2009 - 06:50 PM.

QUOTE (larvaz @ Oct 28 2009, 17:59)


but ive troubles with my code... everythings fine when makin the cars, the "oponent" perfectly follows my desired path... 

then i decide to make a winnin condition, cheking if any of the cars reached the final race chekpoint, near the train station.. heres the whole code

the F@kin prob is that when i press backspace to start tha race, the cars are placed as normal
but it seems the winnin condition is broken, and the text You win is showed since the
beginning of the race...  it nevers check if the car´s at finish line...

welcome larvaz
the reason of your problem is that the location check is a not-version
CODE

this means: if player_actor is not near_point 2639.6252 2097.3906 10.6558
because of the opcodes

if
80EC:  actor $PLAYER_ACTOR 0 near_point 2866.5557 1279.0804 10.763 radius 8.0 8.0  //check if youve reach tha finish line
jf @scmpath_7


The most question codes can be changed into the opposite question
by changing the ciro of the opcode into 8 and insert "not" into the code line

exemble:
CODE
00E1: key_pressed 0 10

and
CODE
80E1: NOT key_pressed 0 11


the correct check:
CODE
if
00EC:  actor $PLAYER_ACTOR 0 near_point 2866.5557 1279.0804 10.763 radius 8.0 8.0  //
jf @scmpath_7


QUOTE
last question, i dont understand last script part, that airborne checks, i dunno whats an airborn jajaja....

airborn means, the vehicle is in air
for example the vehicle jumps over a ramp and is for same seconds in air
in this case it loose the information of the destination and needs to get it again


Jur1zz
  • Jur1zz

    Playa

  • Members
  • Joined: 16 Jul 2009

#55

Posted 31 October 2009 - 08:31 PM

Hi

How can I attach vehicle sound for added "not replaced" cars, with CLEO not "VehicleAudioEditorUltimate"

Example

ZAZ
  • ZAZ

    Kernlochbohrer

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

#56

Posted 31 October 2009 - 09:04 PM Edited by ZAZ, 31 October 2009 - 09:58 PM.

QUOTE (Jur1zz @ Oct 31 2009, 20:31)
Hi

How can I attach vehicle sound for added "not replaced" cars, with CLEO not "VehicleAudioEditorUltimate"

Example

there're no scriptcodes to play egine sounds and the cleo script function to play mp3 is unstable
maybe a trick can help: place a car in background
test the script below by driving a bicycle
CODE
{$CLEO .cs}
:CarsoundDummy
03A4: name_thread 'CSDUMMY'

:CarsoundDummy_1
0001: wait 0 ms
00D6: if 0
0256: player $PLAYER_CHAR defined
004D: jump_if_false @CarsoundDummy_1
if
00DF:   actor $PLAYER_ACTOR driving
004D: jump_if_false @CarsoundDummy_1
03C0: 0@ = actor $PLAYER_ACTOR car
0247: request_model #INFERNUS

:CarsoundDummy_3
0001: wait  0 ms
if
0248:   model #INFERNUS available
004D: jump_if_false @CarsoundDummy_3
00A5: 1@ = create_car #INFERNUS at 0.5  0.5  713.35
0249: release_model #INFERNUS
099A: set_car 1@ collision_detection 0
0338: set_car 1@ visibility 0
0683: attach_car 1@ to_car 0@ with_offset 0.0 0.0 4.5 rotation 0.0 0.0 0.0

:CarsoundDummy_5
0001: wait 500 ms
00D6: if 0
0256: player $PLAYER_CHAR defined
004D: jump_if_false @CarsoundDummy_15
if   and
8119:   NOT   car 0@ wrecked
8119:   NOT   car 1@ wrecked
00DF:   actor $PLAYER_ACTOR driving
004D: jump_if_false @CarsoundDummy_15
if
0686:   car 1@ attached
004D: jump_if_false @CarsoundDummy_15
04C4: create_coordinate 11@ 12@ 13@ from_actor $PLAYER_ACTOR offset 0.0  100.0  0.0
02E3: 5@ = car 0@ speed
00A7: car 1@ drive_to 11@ 12@ 13@//---simple drive-to command
00AD: set_car 1@ max_speed_to  5@//---speed declaration, important!!
0002: jump @CarsoundDummy_5

:CarsoundDummy_15
01C3: remove_references_to_car 0@  // Like turning a car into any random car
00A6: destroy_car 1@
0002: jump @CarsoundDummy_1



Jur1zz
  • Jur1zz

    Playa

  • Members
  • Joined: 16 Jul 2009

#57

Posted 31 October 2009 - 09:11 PM

QUOTE (ZAZ @ Oct 31 2009, 23:04)
QUOTE (Jur1zz @ Oct 31 2009, 20:31)
Hi

How can I attach vehicle sound for added "not replaced" cars, with CLEO not "VehicleAudioEditorUltimate"

Example

there're no scriptcodes to play egine sounds and the cleo script function to play mp3 is unstable
maybe a trick can help: place a car with actor in background

Look at this
MOTO IGiNe v0.2

ZAZ
  • ZAZ

    Kernlochbohrer

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

#58

Posted 01 November 2009 - 07:30 AM

QUOTE (Jur1zz @ Oct 31 2009, 21:11)
QUOTE (ZAZ @ Oct 31 2009, 23:04)
QUOTE (Jur1zz @ Oct 31 2009, 20:31)
Hi

How can I attach vehicle sound for added "not replaced" cars, with CLEO not "VehicleAudioEditorUltimate"

Example

there're no scriptcodes to play egine sounds and the cleo script function to play mp3 is unstable
maybe a trick can help: place a car with actor in background

Look at this
MOTO IGiNe v0.2


Yes, I did, but I don't know what you want.

Note: This is a script tutorial and not a request topic
so please don't post again here

If you want that I do the script then visit my Homepage, vistit every site and click on every avertising, then post in my cleo mod showroom topic to request the script.


markjaysongalang
  • markjaysongalang

    MarkJ-0699

  • Members
  • Joined: 31 May 2009

#59

Posted 01 November 2009 - 08:58 AM

Yey! Thanks for this tutorial. I'm making my Fast and Slowmotion Mod! I'll post updates soon.

Jur1zz
  • Jur1zz

    Playa

  • Members
  • Joined: 16 Jul 2009

#60

Posted 01 November 2009 - 09:26 AM

QUOTE (ZAZ @ Nov 1 2009, 09:30)
QUOTE (Jur1zz @ Oct 31 2009, 21:11)
QUOTE (ZAZ @ Oct 31 2009, 23:04)
QUOTE (Jur1zz @ Oct 31 2009, 20:31)
Hi

How can I attach vehicle sound for added "not replaced" cars, with CLEO not "VehicleAudioEditorUltimate"

Example

there're no scriptcodes to play egine sounds and the cleo script function to play mp3 is unstable
maybe a trick can help: place a car with actor in background

Look at this
MOTO IGiNe v0.2


Yes, I did, but I don't know what you want.

Note: This is a script tutorial and not a request topic
so please don't post again here

If you want that I do the script then visit my Homepage, vistit every site and click on every avertising, then post in my cleo mod showroom topic to request the script.

I just want know how they get sounds for bikes




5 user(s) are reading this topic

1 members, 4 guests, 0 anonymous users