Quantcast

Jump to content

» «
Photo

[GTA SA] ~ CLEO Script Tutorial ~

631 replies to this topic
gtasite1
  • gtasite1

    Player Hater

  • Members
  • Joined: 24 Dec 2010

#211

Posted 31 March 2011 - 09:26 AM

I have never used this opcode
CODE
0494: get_joystick 0 data_to $MOVE_AXIS_X $MOVE_AXIS_Y $SPECIAL_AXIS_X $SPECIAL_AXIS_Y

so I do not know how to use the arrows on the screen to be able to scroll right to the left
http://img848.images...i/99130826.jpg/

ZAZ
  • ZAZ

    Kernlochbohrer

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

#212

Posted 31 March 2011 - 03:13 PM

QUOTE (gtasite1 @ Mar 31 2011, 09:26)
I have never used this opcode
CODE
0494: get_joystick 0 data_to $MOVE_AXIS_X $MOVE_AXIS_Y $SPECIAL_AXIS_X $SPECIAL_AXIS_Y

so I do not know how to use the arrows on the screen to be able to scroll right to the left
http://img848.images...i/99130826.jpg/

I explained 0494 above
the arrows in your screenshot are just a grafic help to press left/right
left/right means the left/right controle which can be changed in the controler setup

kal-el5676
  • kal-el5676

    Zombie Killa

  • Members
  • Joined: 02 Nov 2008

#213

Posted 13 April 2011 - 06:59 PM

A quick question if you would be so kind Zaz. A friend and i have been trying to implement the tlaser2 effect done by funtion x to a cleo laser vision mod as a superman add on. I suggested this in Funtion x's effect topic as well. I'd like it to have a masterspark effect, but without the coronas or animation. At first we tried editing the masterspark code to no avail. Now we have just this simple code my friend did, and i fine tuned the placement of the particle. The code works, but the damage it inflicts seems to be all around the player and not focusable, nor aimable. Any suggestions of assisting in this would be amazing.
Also, the particle is attached to the player, can it be attached to the head bone?

Also if you happen to know what value in the effects.fxp defines the distance between the two lasers that would also be helpful. Here's a video and some pics of the effect, and also the code.

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 'SUPERMAAAAAAN'

:SUPERMAAAAAAN_19
wait 0
if and
0AB0:   key_pressed 101
  not Actor.Driving($PLAYER_ACTOR)
else_jump @SUPERMAAAAAAN_19
0669: 11@ = attach_particle "TLASER2" to_actor $PLAYER_ACTOR with_offset 0.25 12.1 0.8 flag 1
0669: 12@ = attach_particle "TLASER2" to_actor $PLAYER_ACTOR with_offset -0.25 12.1 0.8 flag 1
064C: make_particle 11@ visible
064C: make_particle 12@ visible
wait 500
Actor.StorePos($PLAYER_ACTOR, 1@, 2@, 3@)
Actor.StorePos($PLAYER_ACTOR, 4@, 5@, 6@)
7@ = Actor.Angle($PLAYER_ACTOR)
7@ += 180.0
02F6: 8@ = sine 7@ // (float)
02F7: 9@ = cosine 7@ // (float)
10@ = 50

:SUPERMAAAAAAN_195
 10@ >= 0
else_jump @SUPERMAAAAAAN_291
wait 1
005B: 4@ += 8@ // (float)
005B: 5@ += 9@ // (float)
if
86BD:   not no_obstacles_between 1@ 2@ 3@ and 4@ 5@ 6@ solid 1 car 1 actor 1 object 1 particle 0
else_jump @SUPERMAAAAAAN_277
jump @SUPERMAAAAAAN_291

:SUPERMAAAAAAN_277
10@ -= 1
jump @SUPERMAAAAAAN_195

:SUPERMAAAAAAN_291
0565: create_soundless_explosion_at 4@ 5@ 6@ type 7
0565: create_soundless_explosion_at 4@ 5@ 6@ type 7
0565: create_soundless_explosion_at 4@ 5@ 6@ type 7
wait 1000
jump @SUPERMAAAAAAN_19
0A93: end_custom_thread



user posted image

Need to move the lasers closer together.
user posted image

Also not sure why, but after using it about a dozen times, the particles switches to only 1 laser o_O

ZAZ
  • ZAZ

    Kernlochbohrer

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

#214

Posted 13 April 2011 - 09:21 PM

QUOTE (kal-el5676 @ Apr 13 2011, 18:59)
A quick question if you would be so kind Zaz. A friend and i have been trying to implement the tlaser2 effect done by funtion x to a cleo laser vision mod as a superman add on. I suggested this in Funtion x's effect topic as well. I'd like it to have a masterspark effect, but without the coronas or animation. At first we tried editing the masterspark code to no avail. Now we have just this simple code my friend did, and i fine tuned the placement of the particle. The code works, but the damage it inflicts seems to be all around the player and not focusable, nor aimable. Any suggestions of assisting in this would be amazing.
Also, the particle is attached to the player, can it be attached to the head bone?

Also if you happen to know what value in the effects.fxp defines the distance between the two lasers that would also be helpful. Here's a video and some pics of the effect, and also the code.


The effect havn't a source or target. It have only a size because it's a stretched image.
And the spawnpoint in the script is the center of the image. The values of the size are written in the size part of the effect.

The most exactly method to find the target where the laser could hit anything is Wessers method, integrated in his Laser sight script
But it's depending to the camera view, it's means it works fine by aiming because the player will have the same orientation like the camera if he aims with a weapon.

If the script should ignore the camera view and work without aiming like in your vid there is only one chance:
It needs to throw an object which collide on the way of the laserbeam
read Object - COLLISION - check

To attach an effect to actor bone needs the supportive opcode 0883:
CODE
066A: 0@ = attach_particle "spraycan" to_actor $PLAYER_ACTOR with_offset -0.301  -0.2  0.17 rotation -5.5  -3.5  0.0 flag 1  
0883: attach_particle 0@ to_actor $PLAYER_ACTOR on_bone 26
064C: make_particle 0@ visible

You must find out yourself the number for the head

Sasukers
  • Sasukers

    Player Hater

  • Members
  • Joined: 08 Dec 2010

#215

Posted 18 April 2011 - 04:50 PM

What are the bones to particles?

what is the number of the:

left hand

right hand

left foot

right foot

i want to attach a particle in that zones

can you help me?

Silent
  • Silent

    Moderating Cookie Monster

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

#216

Posted 18 April 2011 - 04:55 PM

See Coding Bible II. It's here.

ZAZ
  • ZAZ

    Kernlochbohrer

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

#217

Posted 21 April 2011 - 09:44 PM


QUOTE (SilentPL @ Apr 18 2011, 16:55)
See Coding Bible II. It's here.

the numbers for hands are not listed



QUOTE (Sasukers @ Apr 18 2011, 16:50)
What are the bones to particles?

what is the number of the:

left hand

right hand

left foot

right foot

i want to attach a particle in that zones

can you help me?

test this:
CODE
{$CLEO .cs}
:Spraycan_at_Actor_bone
03A4: name_thread 'SPRAYWP'

:SPRAYWP_01
0001: wait  0 ms
if
0256: player $PLAYER_CHAR defined
004D: jump_if_false @SPRAYWP_01
if
0AB0:   key_pressed 48//-----------------------press 0
004D: jump_if_false @SPRAYWP_01



066A: 0@ = attach_particle "spraycan" to_actor $PLAYER_ACTOR with_offset -0.1  -0.22  0.13 rotation -1.5  -3.5  0.0 flag 1  
0883: attach_particle 0@ to_actor $PLAYER_ACTOR mode 26// right hand
064C: make_particle 0@ visible
0001: wait  2000 ms

{
066A: 0@ = attach_particle "spraycan" to_actor $PLAYER_ACTOR with_offset 0.0  -0.5  0.0 rotation 0.0  -3.5  0.0 flag 1  
0883: attach_particle 0@ to_actor $PLAYER_ACTOR mode 23// right hand
064C: make_particle 0@ visible
0001: wait  2000 ms

066A: 0@ = attach_particle "spraycan" to_actor $PLAYER_ACTOR with_offset 0.0  0.5  0.0 rotation 0.0  3.5  0.0 flag 1  
0883: attach_particle 0@ to_actor $PLAYER_ACTOR mode 24//left Hand
064C: make_particle 0@ visible
0001: wait  2000 ms

066A: 0@ = attach_particle "spraycan" to_actor $PLAYER_ACTOR with_offset 0.0  0.5  0.0 rotation 0.0  3.5  0.0 flag 1  
0883: attach_particle 0@ to_actor $PLAYER_ACTOR mode 25//?
064C: make_particle 0@ visible
0001: wait  2000 ms
}



:SPRAYWP_03
0001: wait  0 ms
if
0256: player $PLAYER_CHAR defined
004D: jump_if_false @SPRAYWP_03
if
0AB0:   key_pressed 48//-----------------------press 0
004D: jump_if_false @SPRAYWP_03
0976: destroy_particle 0@  
0001: wait  1000 ms
0002: jump @SPRAYWP_01

Silent
  • Silent

    Moderating Cookie Monster

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

#218

Posted 22 April 2011 - 10:13 AM

This list is better than Coding Bible one, I think.

http://gtag.gtagamin...p?showtopic=383

ZAZ
  • ZAZ

    Kernlochbohrer

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

#219

Posted 22 April 2011 - 03:03 PM

QUOTE (SilentPL @ Apr 22 2011, 10:13)
This list is better than Coding Bible one, I think.

http://gtag.gtagamin...p?showtopic=383

Silent my dear, it belongs to objects

Silent
  • Silent

    Moderating Cookie Monster

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

#220

Posted 22 April 2011 - 03:56 PM

Okay, I didn't know what these IDs are different.

EdUaRdO - Brazil
  • EdUaRdO - Brazil

    Brazilian Scripter

  • Members
  • Joined: 14 Nov 2010

#221

Posted 22 April 2011 - 09:09 PM Edited by EdUaRdO - Brazil, 22 April 2011 - 09:11 PM.

Hello ZAZ, I was watching your tutorial about memory addresses, and saw some examples of CHEATS,
how to spawn a car, etc ... you use hexadecimal characters. Has the following:


CODE

0A8D: $CHEAT = read_memory 0x00969110 size 4 virtual_protect 0
if
04A4:   $CHEAT == 0x4A554D50 //JUMP


My question is: What is the address 0x00969110?
And another example (Ramp Jump) use another address 0x00969114 with 0x00969110.



CODE

0A8D: 1@ = read_memory 0x00969110 size 4 virtual_protect 0 //
0A8D: 2@ = read_memory 0x00969114 size 4 virtual_protect 0 //
if  and
04A4:   1@ == 0x52414D50 //checks if 1@ = RAMP
04A4:   2@ == 0x4A554D50 //checks if 2@ = JUMP
004D: jump_if_false @Cheatcode_1  // example
03E5: text_box 'CHEAT1'
0109: player $PLAYER_CHAR money += 1000000
0A8C: write_memory 0x00969110 size 4 value 0 virtual_protect 0 //clear the buffer
0A8C: write_memory 0x00969114 size 4 value 0 virtual_protect 0 //clear the buffer
.....
// script funtions


Their function would only differentiate digits or give different variables and to use the same address?
What would be the function of the addresses 0x00969110 and 0x00969114, because both serve the same purpose for check keys?

And what is the function of upcode 0A8C address 0x00969110 with the value 0? It would be like releasing the address or something?

Sorry so many questions, and make you lose your time, but do I script a long time, but do not have much knowledge about memory addresses
Tnks
icon14.gif

ZAZ
  • ZAZ

    Kernlochbohrer

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

#222

Posted 23 April 2011 - 04:36 AM

QUOTE (SilentPL @ Apr 22 2011, 15:56)
Okay, I didn't know what these IDs are different.

np, you're always welcome to help me here

ZAZ
  • ZAZ

    Kernlochbohrer

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

#223

Posted 23 April 2011 - 10:54 AM

QUOTE (EdUaRdO - Brazil @ Apr 22 2011, 21:09)
Hello ZAZ, I was watching your tutorial about memory addresses, and saw some examples of CHEATS,
how to spawn a car, etc ... you use hexadecimal characters. Has the following:
CODE

0A8D: $CHEAT = read_memory 0x00969110 size 4 virtual_protect 0
if
04A4:   $CHEAT == 0x4A554D50 //JUMP

no, not a car but an object


QUOTE
What is the address 0x00969110?
And another example (Ramp Jump) use another address 0x00969114 with 0x00969110.

it's the memadress which stores the keypresses
the adress can store 4 bytes
a letter like M will be 4D in hex charackter of ASCII Table and needs 1 byte
so you can check for one key in this way:
CODE
//size 1 of adress 0x00969110
0A8D: $CHEAT = read_memory 0x00969110 size 1 virtual_protect 0
if
04A4:   $CHEAT == 0x4D //M

if you wanna check 8 keys you need 2 memadresses which store 8 bytes alltogether
this 0x00969110 and this 0x00969114 adress but the order will be inverted then
these adresses are working for GTASA V1
for V1.1 i know only this adress: 0x96B790

QUOTE
And what is the function of upcode 0A8C address 0x00969110 with the value 0? It would be like releasing the address or something?

yes, otherwise it will still store the pressed keys and let the code pass for the next time

QUOTE
I script a long time, but do not have much knowledge about memory addresses

i also not and i don't like it tounge2.gif

EdUaRdO - Brazil
  • EdUaRdO - Brazil

    Brazilian Scripter

  • Members
  • Joined: 14 Nov 2010

#224

Posted 23 April 2011 - 04:01 PM

QUOTE
no, not a car but an object


It is possible to do spawn car, look at this script I made:

cookie.gif


CODE

{$CLEO .cs}

03A4: name_thread 'Spawn_test'

:Spawn_test
0001: wait 0 ms
0A8D: $CHEAT = read_memory 0x00969110 size 4 virtual_protect 0  
00D6: if 1                  
04A4:   $CHEAT == 0x42494B45 // Type BIKE
004D: jump_if_false @Spawn_test
0247:  request_model #NRG500

:check
0001: wait 0 ms
00D6: if and
0248:   model #NRG500 available
jf @check
03E5: text_box 'CHEAT1'  // Cheat Ativado
04C4: store_coords_to $COORD_X $DCOORD_Y $COORD_Z from_actor $PLAYER_ACTOR with_offset 0.0 5.0 0.0
00A5: $CAR = create_car #NRG500 at $COORD_X $DCOORD_Y $COORD_Z
0172: $ANGLE = actor $PLAYER_ACTOR Z_angle
if
0175: set_car $CAR Z_angle_to $ANGLE
0224: set_car $CAR health_to 3500
wait 2000
0249: release_model #NRG500
0A8C: write_memory 0x00969110 size 4 value 0 virtual_protect 0
end_thread  



Or use the ddresses, for example, 0x969141 , 0x969147 , 0x969146 , 0x969144 , to spawn other cars
without the upcodes 0247 , 00A5 , but I could not make it work sad.gif


icon14.gif But I understand
Very Thanks man and keep working

cookie.gif

Silent
  • Silent

    Moderating Cookie Monster

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

#225

Posted 23 April 2011 - 04:58 PM

Nah, you just read from 0x969110 all the time.

QUOTE
to spawn other cars
without the upcodes 0247, 00A5, but I could not make it work


You mean spawning a car like a cheat does? Well, you can make it by CLEO4 opcode:

CODE
0ADD: spawn_car_with_model #RHINO like_a_cheat


It don't need 0247 and 00A5, just spawns a car.

Also, if you want to do it in CLEO3, use function call:

CODE
0AA5: call 0x43A0B0 num_params 1 pop 0 #RHINO

ZAZ
  • ZAZ

    Kernlochbohrer

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

#226

Posted 23 April 2011 - 07:24 PM Edited by ZAZ, 23 April 2011 - 07:41 PM.

or in this way
i think he means with Function_Memory_Addresses
0x0043A4A0
CCheat::CreateCar432

CODE
{$CLEO}
thread 'MEMCAR'

:MEMCAR_1
wait 0
if
  Player.Defined($PLAYER_CHAR)
jf @MEMCAR_1
0A8D: 1@ = read_memory 0x0043A4A0 size 4 virtual_protect 1
03F0: enable_text_draw 1
045A: draw_text_1number 250.0 40.0 GXT 'NUMBER' number 1@  // ~1~
if
0AB0:   key_pressed 8//-backspace
jf @MEMCAR_1
if
0AA9:   is_game_version_original
jf @MEMCAR_1
0AA5: call 0x0043A4A0 1 pop 1 1
wait 1000
jump @MEMCAR_1




but EdUaRdO, your conditional check is wrong

00D6: if and<-----------------------------
0248: model #NRG500 available
jf @check

00D6: if 1<---------------------------- if 1 means if and
04A4: $CHEAT == 0x42494B45 // Type BIKE

EdUaRdO - Brazil
  • EdUaRdO - Brazil

    Brazilian Scripter

  • Members
  • Joined: 14 Nov 2010

#227

Posted 23 April 2011 - 08:26 PM Edited by EdUaRdO - Brazil, 23 April 2011 - 08:46 PM.

QUOTE
but EdUaRdO, your conditional check is wrong  00D6: if and<----------------------------- 0248: model #NRG500 available jf @check  00D6: if 1<---------------------------- if 1 means if and 04A4: $CHEAT == 0x42494B45 // Type BIKE


Oh yes, I use if 1 , but I post IF AND biggrin.gif

I tried another script using 0x00407851 , which is not an expensive model set, and it worked tounge.gif , like this:


CODE
{$CLEO .cs}

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

:ROMERO_11
0001: wait 0 ms
00D6: if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @ROMERO_11
00D6: if
0AB0:   key_pressed 9     // -------TAB
004D: jump_if_false @ROMERO_11
0247: load_model #ROMERO    //---model

:ROMERO_51
0001: wait 0 ms
00D6: if and
0248:   model #ROMERO available //---model
004D: jump_if_false @ROMERO_51
0AA5: call 4225105 1 pop 1 442  // Addresses :CreateCar
0001: wait 1000 ms
0002: jump @ROMERO_11


I made another (I think it is not the right way), without the 0247 and 0248 , using the direct 0AA5 , and works perfectly

CODE
{$CLEO .cs}

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

:ROMERO_11
0001: wait 0 ms
00D6: if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @ROMERO_11
00D6: if
0AB0:   key_pressed 9     // -------TAB
004D: jump_if_false @ROMERO_11
0AA5: call 4225105 1 pop 1 442  // Addresses :CreateCar
0001: wait 1000 ms
0002: jump @ROMERO_11


And thanks for script example
This is very helpful for me icon14.gif icon14.gif

ZAZ
  • ZAZ

    Kernlochbohrer

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

#228

Posted 24 April 2011 - 07:35 PM

again a failure in your check
CODE
00D6: if and <-------------------------------- you have only one condition!
0248:   model #ROMERO available //---model
004D: jump_if_false @ROMERO_51

and please write in normal fond otherwise it looks like a book for children

EdUaRdO - Brazil
  • EdUaRdO - Brazil

    Brazilian Scripter

  • Members
  • Joined: 14 Nov 2010

#229

Posted 24 April 2011 - 09:23 PM

Sorry again .. I forgot to change IF AND to IF biggrin.gif
Thanks again icon14.gif
But my question is: I need to load model ( 0247 and 0248 ) when I use 0AA5 ??Because of two ways works...


I look like a noob suicidal.gif

Silent
  • Silent

    Moderating Cookie Monster

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

#230

Posted 24 April 2011 - 09:26 PM

Nah, you don't have to. This function (at least this shown by me) loads model by itself.

EdUaRdO - Brazil
  • EdUaRdO - Brazil

    Brazilian Scripter

  • Members
  • Joined: 14 Nov 2010

#231

Posted 24 April 2011 - 09:30 PM

icon14.gif

pringston2010
  • pringston2010

    Player Hater

  • Members
  • Joined: 02 Oct 2010

#232

Posted 12 May 2011 - 01:57 AM

Good job! thanks for tutorial need a tutorial for make a cleo teleport in spheres.

EdUaRdO - Brazil
  • EdUaRdO - Brazil

    Brazilian Scripter

  • Members
  • Joined: 14 Nov 2010

#233

Posted 13 May 2011 - 11:40 PM Edited by EdUaRdO - Brazil, 13 May 2011 - 11:52 PM.

QUOTE (pringston2010 @ May 12 2011, 01:57)
Good job! thanks for tutorial need a tutorial for make a cleo teleport in spheres.

This is one example for teleport:

CODE
{$CLEO .cs}
:MODLSUB_1
03A4: name_thread 'TELEPORT'

:Teleport_Example
0001: wait  0 ms
00D6: if  0
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @Teleport_Example
00D6: if  0
00FF:   actor $PLAYER_ACTOR  1 (in-sphere)near_point_on_foot X Y Z radius  1.0  1.0  1.0 //<===put your coords here
004D: jump_if_false @Teleport_Example
016A: fade 0 time 1500// <=== fade effect
0050: jump @Teleport_Example2

:Teleport_Example2
0001: wait 2000 ms
if
04E4: unknown_refresh_game_renderer_at X Y Z // <=== out here the exit coords
03CB: set_rendering_origin_at X Y Z // <=== out here the exit coords
00A1: put_actor $PLAYER_ACTOR at X Y Z // <=== out here the exit coords
0001: wait 2000 ms
if
016A: fade 1 time 1500
jump @Teleport_Example



The lines:

CODE
00FF:   actor $PLAYER_ACTOR  1 (in-sphere)near_point_on_foot X Y Z radius  1.0  1.0  1.0


1 st parameter: The actor ($PLAYER_ACTOR)
2 nd parameter: Enable sphere 1 or off 0
3º rd parameter: The entrance maker (red maker) Coords X, Y and Z
4º th parameter: Sphere Radius

CODE
04E4: unknown_refresh_game_renderer_at X Y Z // <=== out here the exit coords
03CB: set_rendering_origin_at X Y Z // <=== out here the exit coords


These lines are used to load the map when the CJ is teleported to the new coordinate
Note: Use the same coordinates output

CODE
00A1: put_actor $PLAYER_ACTOR at X Y Z // <=== out here the exit coords


Finally, in the second parameter, the coordinate that will appear CJ

ZAZ
  • ZAZ

    Kernlochbohrer

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

#234

Posted 14 May 2011 - 06:46 AM Edited by ZAZ, 14 May 2011 - 07:18 AM.

Nice Example, EdUaRdO but basicly is a teleport more simple (and the ifs are wrong)
fades and render codes are just to make it nicer
QUOTE
016A: fade 0 time 1500// <=== fade effect
0001: wait 2000 ms
04E4: unknown_refresh_game_renderer_at X Y Z // <=== out here the exit coords
03CB: set_rendering_origin_at X Y Z // <=== out here the exit coords
00A1: put_actor $PLAYER_ACTOR at X Y Z // <=== out here the exit coords
0001: wait 2000 ms
016A: fade 1 time 1500


Teleport, Sphere (red marker), Location Check

Simple example,
red marker in Grovestreet teleports on to roof of CJ's house
CODE
{$CLEO .cs}
:Teleport_1
03A4: name_thread 'TELE'

:Teleport_2
wait 0
if
0256:   player $PLAYER_CHAR defined
jf @Teleport_2
if
00FF:   actor $PLAYER_ACTOR sphere 1 in_sphere 2493.5 -1682.5 13.35 radius 1.0 1.0 1.0 on_foot
jf @Teleport_2
00A1: put_actor $PLAYER_ACTOR at 2524.5  -1677.5  19.95
jump @Teleport_2


The red marker (sphere) will be displayed by opcode 00FF:, 2. parameter: sphere 1 (sphere 0 don't show a red sphere)
Furthermore is it very important to have 0 ms wait time as maximum in the Loop
With more than 0 ms wait time it won't display a red sphere
Example:
CODE
:Teleport_2
wait 10
now the sphere won't be shown


Also is it important to know that there are limits for spheres
Look in Sanny Builder Help: SCM Documentation: GTA Limits

There are several opcodes which show a sphere

Just to create a sphere
CODE
03BC: 1@ = create_sphere_at 2493.5  -1682.5  13.35 radius 1.0
//eventual needs to remove the sphere at any time
03BD: destroy_sphere 1@

Radarmarker with sphere
CODE
02A7: 0@ = create_icon_marker_and_sphere 35 at 2493.5  -1682.5  13.35
//as well as
0570: 1@ = create_asset_radar_marker_with_icon  35 at -2007.8 189.1 27.5
//eventual needs to remove the marker at any time
0164: disable_marker 0@
0164: disable_marker 1@

Location checks for actor
CODE
00FE:   actor $PLAYER_ACTOR sphere 1 in_sphere 2493.5  -1682.5  13.35 radius 15.0 15.0 15.0
00FF:   actor $PLAYER_ACTOR sphere 1 in_sphere 2493.5  -1682.5  13.35 radius 1.0 1.0 2.0 on_foot
0100:   actor $PLAYER_ACTOR in_sphere 2493.5  -1682.5  13.35 radius 4.0 4.0 4.0 sphere 1 in_car
0101:   actor $PLAYER_ACTOR in_sphere 2493.5  -1682.5  13.35 radius 5.0 5.0 3.0 sphere 1 stopped
0102:   actor $PLAYER_ACTOR in_sphere 2493.5  -1682.5  13.35 radius 1.2 1.2 3.0 sphere 1 stopped_on_foot
0103:   actor $PLAYER_ACTOR in_sphere 2493.5  -1682.5  13.35 radius 4.0 4.0 6.0 sphere 1 stopped_in_car

0104:   actor $PLAYER_ACTOR near_actor 1@ radius 15.0 15.0 15.0 sphere 1
0105:   actor $PLAYER_ACTOR near_actor 1@ radius 5.0 5.0 2.0 sphere 1 on_foot

Location checks for car
CODE
01AD:   car 1@ sphere 1 near_point 2493.5  -1682.5 radius 6.0 6.0
01AE:   car 1@ sphere 1 near_point 2493.5  -1682.5 radius 3.0 3.0 stopped
01AF:   car 1@ sphere 1 in_sphere 2493.5  -1682.5 radius 0.2 0.2 1.0
01B0:   car 1@ sphere 1 in_sphere 2493.5  -1682.5  13.35 radius 4.0 4.0 4.0 stopped


The location checks with integrated sphereparameter are more useful in praxis but consider to have 0 ms wait time as maximum in the Loop

Now we can extend the simple script from above to have more teleports in the script by binding the location checks in a chain
4 teleports in Grovestreet:
CODE
{$CLEO .cs}
:Teleport_1
03A4: name_thread 'TELE'

:Teleport_2
wait 0
if
0256:   player $PLAYER_CHAR defined
jf @Teleport_2
if
00FF:   actor $PLAYER_ACTOR sphere 1 in_sphere 2493.5 -1682.5 13.35 radius 1.0 1.0 1.0 on_foot
jf @Teleport_3
00A1: put_actor $PLAYER_ACTOR at 2524.5  -1677.5  19.95
jump @Teleport_2

:Teleport_3
if
00FF:   actor $PLAYER_ACTOR sphere 1 in_sphere 2530.5 -1678.5 19.95 radius 1.0 1.0 1.0 on_foot
jf @Teleport_4
00A1: put_actor $PLAYER_ACTOR at 2512.5  -1670.5  13.5
jump @Teleport_2

:Teleport_4
if
00FF:   actor $PLAYER_ACTOR sphere 1 in_sphere 2507.5 -1673.5 13.4 radius 1.0 1.0 1.0 on_foot
jf @Teleport_5
00A1: put_actor $PLAYER_ACTOR at 2490.5  -1717.5  18.6
jump @Teleport_2

:Teleport_5
if
00FF:   actor $PLAYER_ACTOR sphere 1 in_sphere 2504.5 -1719.5 18.6 radius 1.0 1.0 1.0 on_foot
jf @Teleport_2
00A1: put_actor $PLAYER_ACTOR at 2497.5  -1681.5  13.4
jump @Teleport_2

ZAZ
  • ZAZ

    Kernlochbohrer

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

#235

Posted 14 May 2011 - 07:06 AM Edited by ZAZ, 28 May 2011 - 07:19 AM.

Teleport into interior:

The Entrances with yellow triangle are done by Enex lines in the IPL files
read here about that method:
gtamodding-ENEX
CODE
enex
823.629, -1588.9, 12.5764, 0, 2, 2, 8, 822.629, -1590.4, 12.5784, -1297.58, 0, 4, "BARBER2", 0, 2, 0, 24

To modify or add enex entries requires to start a new game otherwise you will get buggy interior accesses
Or use the GTASA SaveGame ENEX Updater tool

With script is it possible to simulate it.
The simpliest way is make a red marker and teleport the player to the desired location when the player is gone into the red marker.
Additional you can also show a yellow trinangle and disable the red marker.


Interior teleport very simple, just one way
find the red entrance spot in Grovestreet
CODE
{$CLEO .cs}
:Interior_entrance_verysimple
03A4: name_thread 'INTENTS'

:INTENTS_2
0001: wait  0 ms
if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @INTENTS_2
if
00FF:   actor $PLAYER_ACTOR  1 (in-sphere)near_point_on_foot 2491.5  -1667.5  13.35 radius  1.0  1.0  1.0
004D: jump_if_false @INTENTS_2
016A: fade 0 time 1000
0001: wait 1000 ms
04BB: select_interior 3
04E4: unknown_refresh_game_renderer_at 962.17 -48.8
03CB: set_rendering_origin_at 962.17 -48.8 1001.2
0860: link_actor $PLAYER_ACTOR to_interior 3
00A1: put_actor $PLAYER_ACTOR at 962.356 -53.17 1001.2
0173: set_actor $PLAYER_ACTOR Z_angle_to 84.0
0001: wait 500 ms
016A: fade 1 time 1000
0002: jump @INTENTS_2


Interior teleport and back teleport
CODE
{$CLEO .cs}
:Interior_entrance_Exit_simple
03A4: name_thread 'INTENTS'

:INTENTS_2
0001: wait  0 ms
if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @INTENTS_2
if
00FF:   actor $PLAYER_ACTOR  1 (in-sphere)near_point_on_foot 2491.5  -1667.5  13.35 radius  1.0  1.0  1.0
004D: jump_if_false @INTENTS_2
016A: fade 0 time 1000
0001: wait 1000 ms
04BB: select_interior 3
04E4: unknown_refresh_game_renderer_at 962.17 -48.8
03CB: set_rendering_origin_at 962.17 -48.8 1001.2
0860: link_actor $PLAYER_ACTOR to_interior 3
00A1: put_actor $PLAYER_ACTOR at 962.356 -53.17 1001.2
0173: set_actor $PLAYER_ACTOR Z_angle_to 84.0
0001: wait 500 ms
016A: fade 1 time 1000


:EXIT_3
0001: wait  0 ms
if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @EXIT_3
if
00FF:   actor $PLAYER_ACTOR  1 (in-sphere)near_point_on_foot 965.5  -53.2  1001.2 radius  1.0  1.0  1.0
004D: jump_if_false @EXIT_3
016A: fade 0 time 1000
0001: wait 1000 ms
04BB: select_interior 0//--------------------- outside world is interior 0
04E4: unknown_refresh_game_renderer_at 1126.3 -2037.1
03CB: set_rendering_origin_at 1126.3 -2037.1 69.88
0860: link_actor $PLAYER_ACTOR to_interior 0//------------ link player to interior 0
00A1: put_actor $PLAYER_ACTOR at 1126.3 -2037.1 69.88
0173: set_actor $PLAYER_ACTOR Z_angle_to 84.0
0001: wait 500 ms
016A: fade 1 time 1000
0002: jump @INTENTS_2//-- jumps to scriptbeginn



Interior teleport needs to insert the interior number
This don't means a room number but a identifier for the interior level
look for interior numbers and names at list of interiors




Make an interior teleport and create therefor an entrance_marker
opcode to show a yelleow triangle
CODE
0A40: 1@ = create_entrance_marker_at 2493.5  -1682.5  13.35 color 14
//eventual needs to remove the entrance_marker at any time
0A41: destroy_entrance_marker 1@



Try script below then go to Grovestreet to find the entrance_marker with teleport
CODE
{$CLEO .cs}
:Entrance_marker_1
03A4: name_thread 'ENTRMK'
0A95: enable_thread_saving
0A40: 1@ = create_entrance_marker_at 2493.9 -1670.8 14.5 color 6
0A40: 2@ = create_entrance_marker_at 2527.6 -1679.5 1016.5 color 6

:Entrance_marker_3
0001: wait 0 ms
if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @Entrance_marker_3
if
00FF:   actor $PLAYER_ACTOR  0 (in-sphere)near_point_on_foot 2493.9 -1670.8 13.4 radius  2.0  2.0  2.0
004D: jump_if_false @Entrance_marker_5
016A: fade 0 time 1000
0001: wait 1000 ms
04E4: unknown_refresh_game_renderer_at  2535.8301 -1674.6753
03CB: set_camera  2535.8301 -1674.6753 1015.4986
00A1: put_actor $PLAYER_ACTOR at 2535.8301 -1674.6753 1015.4986
0860: link_actor $PLAYER_ACTOR to_interior 1
04BB: select_interior 1
0001: wait 500 ms
016A: fade 1 time 1000
0002: jump @Entrance_marker_3

:Entrance_marker_5
if
00FF:   actor $PLAYER_ACTOR  0 (in-sphere)near_point_on_foot 2527.6 -1679.5 1015.5 radius  2.0  2.0  2.0
004D: jump_if_false @Entrance_marker_3
016A: fade 0 time 1000
0001: wait 1000 ms
04E4: unknown_refresh_game_renderer_at  2494.5 -1679.2
03CB: set_camera  2494.5 -1679.2 13.4
00A1: put_actor $PLAYER_ACTOR at 2494.5 -1679.2 13.4
0860: link_actor $PLAYER_ACTOR to_interior 0
04BB: select_interior 0
0001: wait 500 ms
016A: fade 1 time 1000
0002: jump @Entrance_marker_3

Sasukers
  • Sasukers

    Player Hater

  • Members
  • Joined: 08 Dec 2010

#236

Posted 15 May 2011 - 07:20 PM

HELLO ZAZ

i want to throw MULTIPLE objects

but

I want throw Infinite objects and create explosions when objects collided (sorry for my English)

can you help me?

before object collided i want to throw another object and Infinite objects

ZAZ
  • ZAZ

    Kernlochbohrer

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

#237

Posted 15 May 2011 - 08:07 PM Edited by ZAZ, 15 May 2011 - 08:10 PM.

QUOTE (Sasukers @ May 15 2011, 19:20)
HELLO ZAZ

i want to throw MULTIPLE objects

but

I want throw Infinite objects and create explosions when objects collided (sorry for my English)

can you help me?

before object collided i want to throw another object and Infinite objects

Have you read this chapter: Object - COLLISION - check?
So you could post your throw object script

Anyway, how to throw multible objects

One method is to create objects in arrays like i did for the GrenadeFireweapon mod
Read here about arrays
Such a script requires a lot of local vars which are limited in threads of an *.cs file, so the GrenadeFireweapon mod throws max 3 objects at same time
With cleo4 is it possible to create more locals or you could write a mission script as *.cm file

Another method is to start multible threads inside the same *.cs file like i did for the SMGshootRockets mod
Opcode 0A92: create_custom_thread with parameter can start another thread inside the same cleo script with *.cs extension
The method:
CODE
// this script must become this name: MultiThread.cs
{$CLEO .cs}
:MultiThread
if
0@ == 0
jf @MultiThread_20

03A4: name_thread 'MULTHRD'
0A92: create_custom_thread "MultiThread.cs" 1  

:MultiThread_11
wait 0
jump @MultiThread_11


:MultiThread_20
03A4: name_thread 'SECONDT'

:MultiThread_50
wait 0
jump @MultiThread_50


The example below starts a second thread by keypress Backspace
and displays the values of 1@, 2@, 3@, 4@
CODE
// this script must become this name: MultiThread.cs
{$CLEO .cs}
:MultiThread//-- 0@ = 0 by default
if
0@ == 0
jf @MultiThread_20

03A4: name_thread 'MULTHRD'  

:MultiThread_10
wait 0
03F0: enable_text_draw 1  
045A: draw_text_1number 200.0 40.0 GXT 'NUMBER' number 0@  // ~1~  
if
0AB0:   key_pressed 8//---------------------- Backspace
004D: jump_if_false @MultiThread_10
0A92: create_custom_thread "MultiThread.cs" 1 2 3 4

//The started(second)thread assignes now the first param of 0A92: to 0@, the second param to 1@ and so on
// the second thread beginns also with
//:MultiThread//-- but 0@ = 1 because of the  first param of 0A92:
//if
//0@ == 0
//jf @MultiThread_20


:MultiThread_11
wait 0
03F0: enable_text_draw 1  
045A: draw_text_1number 200.0 40.0 GXT 'NUMBER' number 0@  // ~1~  
jump @MultiThread_11

/////////////////////////////////////////////////////////
////// second thread


:MultiThread_20
if
0@ == 1
jf @MultiThread_50
03A4: name_thread 'SECONDT'

:MultiThread_21
wait 0
03F0: enable_text_draw 1  
045A: draw_text_1number 200.0 60.0 GXT 'NUMBER' number 0@  // ~1~
045A: draw_text_1number 240.0 60.0 GXT 'NUMBER' number 1@  // ~1~
045A: draw_text_1number 260.0 60.0 GXT 'NUMBER' number 2@  // ~1~
045A: draw_text_1number 280.0 60.0 GXT 'NUMBER' number 3@  // ~1~
jump @MultiThread_21

:MultiThread_50
0A93: end_custom_thread

Sasukers
  • Sasukers

    Player Hater

  • Members
  • Joined: 08 Dec 2010

#238

Posted 15 May 2011 - 08:54 PM



--

OK i'm understand
I can use the arrays for the multiples objects biggrin.gif its more easy

THANK YOU ZAZ

ZAZ
  • ZAZ

    Kernlochbohrer

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

#239

Posted 15 May 2011 - 09:01 PM Edited by ZAZ, 30 December 2013 - 05:53 PM.

QUOTE (Sasukers @ May 15 2011, 20:54)




I can use the arrays for the multiples objects biggrin.gifits more easy




multithreading is easier

Sasukers
  • Sasukers

    Player Hater

  • Members
  • Joined: 08 Dec 2010

#240

Posted 15 May 2011 - 09:03 PM

Now

I use the throw beachball example

then

I want to throw the beachball and When the beachball collides, the beach ball is attached in ANY surface

I want to throw an object... an attach the objects in the walls ( like the remote control bombs )

SOMETHING EXACTLY LIKE THIS

|
|
V

http://media.moddb.c...0x150/Kunai.jpg

http://www.instructa...rowing-star.jpg

I have this to create a ninja star script





2 user(s) are reading this topic

0 members, 2 guests, 0 anonymous users