Quantcast

Jump to content

» «
Photo

I've questions about CLEO!

98 replies to this topic
noalcohol
  • noalcohol

    Player Hater

  • Members
  • Joined: 15 Aug 2009

#61

Posted 13 April 2010 - 04:36 AM

How to attach a person on a car? colgate.gif It's like in Ryder's mission, he stand on his truck but don't fall. inlove.gif inlove.gif

ZAZ
  • ZAZ

    Kernlochbohrer

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

#62

Posted 13 April 2010 - 03:16 PM

QUOTE (noalcohol @ Apr 13 2010, 04:36)
How to attach a person on a car? colgate.gif It's like in Ryder's mission, he stand on his truck but don't fall. inlove.gif   inlove.gif

CODE
06A7: put_actor 22@ into_turret_on_car 0@ at_car_offset 1.1 0.5 0.2 position 1 shooting_angle 360.0 360.0 with_weapon 38

last parameter is the weapon number, you need to load first the weapon model

12jango
  • 12jango

    "This is not revenge! This is entertainment!"

  • Members
  • Joined: 08 Mar 2008

#63

Posted 14 April 2010 - 12:25 AM

QUOTE (12jango @ Apr 13 2010, 01:35)
It's said that any vehicles can have a weapon such as minigun/missile. icon14.gif
How to do that? smile.gif
Thanks! icon14.gif

EDIT :
Oh, I forgot! lol.gif
This is about Panel,

CODE
{$CLEO .cs}

thread ''

:Load
wait 0
if and
   Player.Defined($PLAYER_CHAR)
jf @Spawn

:Spawn
wait 0
if
   0AB0:  key_pressed 8
jf @Load
08D4: 0@ = create_panel_with_title 'Title' position 29.0 145.0 width 160.0 columns 1 interactive 1 background 1 alignment 0
08D6: set_panel 0@ column 0 alignment 1
08DB: set_panel 0@ column 0 header 'dummy' data 'T1' 'T2' 'dummy' 'dummy' 'dummy' 'dummy' 'dummy' 'dummy' 'dummy' 'dummy' 'dummy' 'dummy'
090E: set_panel 0@ active_row 0
0512:  show_permanent_text_box 'tatta'

repeat
wait  0 ms
if 00E1:   player 0 pressed_key 15
then
08DA: remove_panel 0@
03E6: remove text box
jump @Spawn
end
until 00E1:   player 0 pressed_key 16
end_thread


I tried to make the simplest one, there are a small panel box, with a title and also with 2 options. So far I only can make it always appear after pressing backspace and dissappear after pressing F. The problem is, I've no idea how to make the 2 options working, I wanna make them like this ; if I choose the first option it will start the first custom mission, then if I choose the second option, it will start the second custom mission.(Now if I choose one of them, the game will crash!)
Please help! icon14.gif

Anyone please? icon14.gif

TheSiggi
  • TheSiggi

    Surgeon

  • Members
  • Joined: 05 Jul 2009

#64

Posted 14 April 2010 - 09:21 AM Edited by The_Siggi, 14 April 2010 - 09:23 AM.



CODE
repeat//---------------------
wait  0 ms
if 00E1:   player 0 pressed_key 15
then
08DA: remove_panel 0@
03E6: remove text box
jump @Spawn
end
until 00E1:   player 0 pressed_key 16 //--------------
end_thread//---------------

that loop is sort of brocken?!?!?



have a look at ZAZs weathermenue,
Its very easy to understand and its really good example and template or menues at all
(source: zazmahall.de)

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---------------
03A4: name_thread 'WHELP'

:WHELP_11
0001: wait 20 ms
00D6: if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @WHELP_11
00D6: if
03EE:   player $PLAYER_CHAR controllable
004D: jump_if_false @WHELP_11
00D6: if and
80DF:   not actor $PLAYER_ACTOR driving
0AB0:   key_pressed 49
004D: jump_if_false @WHELP_11
00D6: if
0038:   $ONMISSION == 0
004D: jump_if_false @WHELP_11
00D6: if
0038:   $Active_Interior == 0
004D: jump_if_false @WHELP_11
0001: wait 1000 ms
0050: gosub @WHELP_819
0343: set_text_draw_linewidth 680.0
033E: set_draw_text_position 36.0 20.0 GXT 'TATTA'  // Use ~k~~GO_FORWARD~ and ~k~~GO_BACK~ to select an area.~N~~k~~PED_SPRINT~ Select~N~~k~~VEHICLE_ENTER_EXIT~ Quit
01B4: set_player $PLAYER_CHAR can_move 0
03BF: set_player $PLAYER_CHAR ignored_by_everyone 1
0826: enable_hud 0
03BF: set_player $PLAYER_CHAR ignored_by_everyone 1
08D4: $WETTER5 = create_panel_with_title 'CHEAT7' position 340.0 120.0 width 240.0 columns 1 interactive 1 background 1 alignment 0  // Weather cheat
08DB: set_panel $WETTER5 column 0 header 'PLA_19' data 'DEBW1' 'DEBW4' 'DEBW5' 'DEBW8' 'DEBW9' 'DEBW10' 'DEBW12' 'DEBW14' 'DEBW16' 'DEBW17' 'DEBW18' 'WEATH0'  // SELECT // SUNNY LA // CLOUDY LA // SUNNY SF // RAINY SF // FOGGY SF // SUNNY VEGAS // CLOUDY VEGAS // SUNNY COUNTRYSIDE // RAINY COUNTRYSIDE // EXTRA SUNNY DESERT // SANDSTORN DESERT // WEATHER NORMAL
090E: set_panel $WETTER5 active_row 0

:WHELP_336
0001: wait 0 ms
00D6: if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @WHELP_760
00D6: if
00E1:   player 0 pressed_key 15
004D: jump_if_false @WHELP_380
0002: jump @WHELP_760

:WHELP_380
00D6: if
00E1:   player 0 pressed_key 16
004D: jump_if_false @WHELP_336
03E6: remove_text_box
08D7: $WGO5 = panel $WETTER5 active_row
0008: $WGO5 += 1
00D6: if
0038:   $WGO5 == 1
004D: jump_if_false @WHELP_443
01B6: set_weather 1
0002: jump @WHELP_336

:WHELP_443
00D6: if
0038:   $WGO5 == 2
004D: jump_if_false @WHELP_472
01B6: set_weather 4
0002: jump @WHELP_336

:WHELP_472
00D6: if
0038:   $WGO5 == 3
004D: jump_if_false @WHELP_501
01B6: set_weather 5
0002: jump @WHELP_336

:WHELP_501
00D6: if
0038:   $WGO5 == 4
004D: jump_if_false @WHELP_530
01B6: set_weather 8
0002: jump @WHELP_336

:WHELP_530
00D6: if
0038:   $WGO5 == 5
004D: jump_if_false @WHELP_559
01B6: set_weather 9
0002: jump @WHELP_336

:WHELP_559
00D6: if
0038:   $WGO5 == 6
004D: jump_if_false @WHELP_588
01B6: set_weather 10
0002: jump @WHELP_336

:WHELP_588
00D6: if
0038:   $WGO5 == 7
004D: jump_if_false @WHELP_617
01B6: set_weather 12
0002: jump @WHELP_336

:WHELP_617
00D6: if
0038:   $WGO5 == 8
004D: jump_if_false @WHELP_646
01B6: set_weather 14
0002: jump @WHELP_336

:WHELP_646
00D6: if
0038:   $WGO5 == 9
004D: jump_if_false @WHELP_675
01B6: set_weather 16
0002: jump @WHELP_336

:WHELP_675
00D6: if
0038:   $WGO5 == 10
004D: jump_if_false @WHELP_704
01B6: set_weather 17
0002: jump @WHELP_336

:WHELP_704
00D6: if
0038:   $WGO5 == 11
004D: jump_if_false @WHELP_733
01B6: set_weather 19
0002: jump @WHELP_336

:WHELP_733
00D6: if
0038:   $WGO5 == 12
004D: jump_if_false @WHELP_336
01B7: release_weather
0002: jump @WHELP_760

:WHELP_760
08DA: remove_panel $WETTER5
0826: enable_hud 1
03BF: set_player $PLAYER_CHAR ignored_by_everyone 0
01B4: set_player $PLAYER_CHAR can_move 1
03F0: enable_text_draw 0
0002: jump @WHELP_11
08DA: remove_panel $WETTER5
01B4: set_player $PLAYER_CHAR can_move 1
03BF: set_player $PLAYER_CHAR ignored_by_everyone 0
03F0: enable_text_draw 0
0051: return

:WHELP_819
0340: set_text_draw_RGBA 180 180 180 255
033F: set_text_draw_letter_size 0.5 2.5
03E4: enable_text_draw_align_right 0
0341: unknown_text_draw_flag 0
0342: enable_text_draw_centered 0
0343: set_text_draw_linewidth 200.0
0348: enable_text_draw_proportional 1
0345: enable_text_draw_background 0
0051: return


I'll search for my source codes of the weapon menu mod which have clearly label names

12jango
  • 12jango

    "This is not revenge! This is entertainment!"

  • Members
  • Joined: 08 Mar 2008

#65

Posted 03 July 2010 - 03:10 AM

CODE
0819: 18@ = actor $PLAYER_ACTOR distance_from_ground

How to use this? For what?

ZAZ
  • ZAZ

    Kernlochbohrer

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

#66

Posted 03 July 2010 - 03:49 AM

QUOTE (12jango @ Jul 3 2010, 03:10)
CODE
0819: 18@ = actor $PLAYER_ACTOR distance_from_ground

How to use this? For what?

in the math coding part of my tut you'll find this example script:
CODE
{$CLEO .cs}
:ValueCheck_1
03A4: name_thread "VCHECK"
33@ = 0

:ValueCheck_2
0001: wait 0 ms
if
0256: player $PLAYER_CHAR defined
004D: jump_if_false @ValueCheck_2
077E: get_active_interior_to 29@
03F0: enable_text_draw 1
045A: text_draw_1number  250.0  40.0 'NUMBER' 33@
045A: text_draw_1number  250.0  50.0 'NUMBER' 29@
if
0039:   29@ ==  0
004D: jump_if_false @ValueCheck_3
0819: 3@ = actor $PLAYER_ACTOR distance_from_ground
0092: 4@ = float 3@ to_integer
03F0: enable_text_draw 1
045A: text_draw_1number  250.0  60.0 'NUMBER' 4@
if
0023:   25.0 > 3@
004D: jump_if_false @ValueCheck_3
00A1: put_actor $PLAYER_ACTOR at 0.0 0.0 500.0

:ValueCheck_3
if
33@ > 50000
jf @ValueCheck_2
00BA: text_styled 'FEM_OK'  1000 ms  1
33@ = 0
jump @ValueCheck_2

12jango
  • 12jango

    "This is not revenge! This is entertainment!"

  • Members
  • Joined: 08 Mar 2008

#67

Posted 01 November 2010 - 04:48 AM Edited by 12jango, 03 November 2010 - 04:04 AM.

Hey, is that possible to store coords when you aiming on something? I mean you aim on a wall then you'll get the coordinate of the wall. Please show me the example script for that. dozingoff.gif
Thanks! icon14.gif

EDIT:
Ow, I forgot about this. How to maintain the number of peds that walking in the city?
Thank you! icon14.gif

12jango
  • 12jango

    "This is not revenge! This is entertainment!"

  • Members
  • Joined: 08 Mar 2008

#68

Posted 18 December 2010 - 04:55 AM

Never mind, then... dontgetit.gif
Is there any opcodes that checks whether an actor seeing another actor? icon14.gif
Thank you! icon14.gif icon14.gif

BnB
  • BnB

    #OGAY_2014

  • The Yardies
  • Joined: 28 Jun 2010
  • Jamaica

#69

Posted 18 December 2010 - 10:11 AM

QUOTE (12jango @ Nov 1 2010, 06:48)
Hey, is that possible to store coords when you aiming on something? I mean you aim on a wall then you'll get the coordinate of the wall. Please show me the example script for that. dozingoff.gif
Thanks! icon14.gif

EDIT:
Ow, I forgot about this. How to maintain the number of peds that walking in the city?
Thank you! icon14.gif

There is a way but you have to search...
OR create the code on your own.

12jango
  • 12jango

    "This is not revenge! This is entertainment!"

  • Members
  • Joined: 08 Mar 2008

#70

Posted 18 January 2011 - 03:39 AM

How to change actor's angle to a coordinate, like store the coordinates then the actor's angle turn into that coordinates... blush.gif

TheSiggi
  • TheSiggi

    Surgeon

  • Members
  • Joined: 05 Jul 2009

#71

Posted 18 January 2011 - 10:21 AM

CODE
009A: 0@ = create_actor_pedtype 4 model #MALE01 at  [coordX] [coordY] [coordZ]
0337: set_actor 0@ visibility 0
0639: AS_actor $PLAYER_ACTOR rotate_to_actor 0@


extemporisation...

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

#72

Posted 18 January 2011 - 06:51 PM

Untested, but it should work more accurate. Based on ZAZs algorithm, and done as SCM func due to high var usage.

GPS Mod source ftw.

CODE
0AB1: call_scm_func @CalculateAngle 4 get_angle_from 0@ 1@ facing_to 3@ 4@ store_to 6@


CODE
:CalculateAngle
0087: 4@ = 0@ // (float)
0087: 5@ = 1@ // (float)  
0063: 4@ -= 2@ // (float)
0063: 5@ -= 3@ // (float)
005B: 0@ += 4@ // (float)
005B: 1@ += 5@ // (float)
0063: 0@ -= 2@ // (float)
0063: 1@ -= 3@ // (float)
0604: get_Z_angle_for_point 0@ 1@ store_to 6@
000F: 6@ -= 180.0
0656: get_angle 6@ absolute_degrees_to 6@
0AB2: ret 1 6@


If you want to make CJ face 0.0 0.0 0.0, then in code...

CODE
00A0: store_actor $PLAYER_ACTOR position_to 0@ 1@ 2@
0AB1: call_scm_func @CalculateAngle 4 get_angle_from 0@ 1@ facing_to 0.0 0.0 store_to 3@
0173: set_actor $PLAYER_ACTOR Z_angle_to 3@

12jango
  • 12jango

    "This is not revenge! This is entertainment!"

  • Members
  • Joined: 08 Mar 2008

#73

Posted 01 February 2011 - 05:03 AM Edited by 12jango, 01 February 2011 - 05:18 AM.

Thanks for the tricks! cookie.gif cookie.gif

fireguy109
  • fireguy109

    It's a long way to the top

  • The Connection
  • Joined: 30 Aug 2010
  • United-States

#74

Posted 02 February 2011 - 02:58 PM Edited by fireguy109, 02 February 2011 - 03:23 PM.

Sorry for bump and topic steal blush.gif , but I diddn't want to make a new topic for this. What opcode/entry do you need to make a car spawn in a certain color? Not a one-time deal, I'm talking about the car always being there. I'd probably need to do this in the main.scm file, but does anyone know? Drakic figured it out for one of his mods once, but I don't know how. Never mind, I read a tutorial and figured it out. blush.gif

Wesser
  • Wesser

    The complexity simplifier, the efficiency optimizer.

  • Feroci Racing
  • Joined: 19 Aug 2006
  • Unknown

#75

Posted 04 February 2011 - 07:53 PM

SilentPL, should it be just these couple of code lines?
CODE
00A0: store_actor $PLAYER_ACTOR position_to 1@ 2@ 3@
0AB1: call_scm_func @getAngleBetweenPoints 4 from_XY 1@ 2@ and_XY 0.0 0.0 store_to 4@
0173: set_actor $PLAYER_ACTOR Z_angle_to 4@

[...]

:getAngleBetweenPoints
{
 Parameters:
   Passed:
     0@ - 1st point X
     1@ - 1st point Y
     2@ - 2nd point X
     3@ - 2nd point Y
   Result:
     4@ - absolute angle

 Example:
   0AB1: call_scm_func @getAngleBetweenPoints 4 from_XY 0.0 0.0 and_XY 1.0 0.0 store_to 1@
}
0063: 0@ -= 2@
0063: 1@ -= 3@
0604: get_Z_angle_for_point 0@ 1@ store_to 4@
0AB2: ret 1 4@

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

#76

Posted 05 February 2011 - 02:35 PM

ZAZ wrote this, so I don't know, sorry. I didn't try to these math by myself.
However, ZAZ said that 0604 gets angle for 0.0 0.0. So we have to 'move' desired facing point and current actor's pos to 0.0 0.0 0.0, with keeping proportions.

Wesser
  • Wesser

    The complexity simplifier, the efficiency optimizer.

  • Feroci Racing
  • Joined: 19 Aug 2006
  • Unknown

#77

Posted 05 February 2011 - 05:20 PM

Yeah, so if we pass the offsets between 2 points, we'll let that opcode calculating the angle with coords just like they are from 0.0 0.0 0.0. colgate.gif

It works more accurate then ZAZ's algoritm, though. wink.gif

ZAZ
  • ZAZ

    Kernlochbohrer

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

#78

Posted 05 February 2011 - 08:48 PM

QUOTE (Wesser @ Feb 5 2011, 17:20)
Yeah, so if we pass the offsets between 2 points, we'll let that opcode calculating the angle with coords just like they are from 0.0 0.0 0.0. colgate.gif

It works more accurate then ZAZ's algoritm, though. wink.gif

Right, well done in the Laser sight script

12jango
  • 12jango

    "This is not revenge! This is entertainment!"

  • Members
  • Joined: 08 Mar 2008

#79

Posted 21 April 2011 - 03:42 AM

Hey, I got some questions :

* When catch an actor, how to check whether he is an enemy or not?

* How to make an actor to keep attacking the player even if I removerefferences him?

Thanks! icon14.gif

BnB
  • BnB

    #OGAY_2014

  • The Yardies
  • Joined: 28 Jun 2010
  • Jamaica

#80

Posted 21 April 2011 - 07:10 AM

QUOTE (12jango @ Apr 21 2011, 05:42)
* When catch an actor, how to check whether he is an enemy or not?

* How to make an actor to keep attacking the player even if I removerefferences him?


PedType.

12jango
  • 12jango

    "This is not revenge! This is entertainment!"

  • Members
  • Joined: 08 Mar 2008

#81

Posted 19 May 2011 - 03:52 AM Edited by 12jango, 19 May 2011 - 03:56 AM.

I got some questions ;

1. I knew how to create a car that would be appeared on the road, but still I couldn't face the car to the right angle as the other car have. How to do that? So I won't have my car crashing other car....

CODE
-----------------------------------------------------------------------------------------------------------                                                                    
                  O ===>  <=== A [Sometimes, it facing this way]                                          
                                               
====================================================================================================                                                                                
[Sometimes, it facing this way]  A ===>   <===  O
                           
-----------------------------------------------------------------------------------------------------------

The Opcodes I use
______________________________________________________________________________________________
04C4: store_coords_to 1@ 2@ 3@ from_actor $PLAYER_ACTOR with_offset -100.0 300.0 0.0

02C1: store_to 1@ 2@ 3@ car_path_coords_closest_to 1@ 2@ 3@

00A5: 0@ = create_car #INFERNUS at 1@ 2@ 3@
______________________________________________________________________________________________

A        = INFERNUS (The car I create)
O        = Car
===> = The car head this way
<=== = The car head this way



2.
CODE
0792: disembark_instantly_actor $PLAYER_ACTOR

What's this opcode use for?


3. When I tried a script, like this :

CODE
04C4: store_coords_to 1@ 2@ 3@ from_actor 4@ with_offset 0.0 5.0 -1.0

:Player_Move
wait 0
05D3: AS_actor $PLAYER_ACTOR goto_point 1@ 2@ 3@ mode 6 3000 ms // versionA
if
       00FF:   actor $PLAYER_ACTOR sphere 0 in_sphere 1@ 2@ 3@ radius 1.0 1.0 1.0 on_foot
jf @Player_Move
0187: 5@ = create_marker_above_actor $PLAYER_ACTOR
end_thread


This script supposed to make the player, to go the the coordinates, but sometimes (maybe often) the player only running around the coordinates again and again. This is just an example, I really need help about how to make sure an actor to go and stand on the desired coordinates no matter what happens. blush.gif (Of course without using Actor.Putat($PLAYER_ACTOR, 1@, 2@, 3@)

ZAZ
  • ZAZ

    Kernlochbohrer

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

#82

Posted 19 May 2011 - 07:05 AM

QUOTE (12jango @ May 19 2011, 03:52)
I got some questions ;

1. but still I couldn't face the car to the right angle as the other car have. How to do that? So I won't have my car crashing other car....

and what are you doing with z_angle opcode?
CODE
0175: set_car 0@ Z_angle_to 0.0

let me define your cars as 0@ and 1@

0@ = A = INFERNUS (The car I create)
1@ = O = Car
CODE
// cars have same angle
0175: set_car 0@ Z_angle_to 0.0
0175: set_car 1@ Z_angle_to 0.0

CODE
// 1@ becomes same angle like 0@
0174: 2@ = car 0@ Z_angle
0175: set_car 1@ Z_angle_to 2@

CODE
// cars are standing against each other
0174: 2@ = car 0@ Z_angle
2@ += 180.0
0175: set_car 1@ Z_angle_to 2@




QUOTE
2.
CODE
0792: disembark_instantly_actor $PLAYER_ACTOR

    What's this opcode use for?

it frees the actor from everything, removes from car imediately, make him normal if he is caught in an animation or if have the kill_actor_?@ command
i believe it removes also from turret mode but can't remember exatly and in addition is there an opcode to remove actor from turret mode


QUOTE
3. When I tried a script, like this :

CODE
04C4: store_coords_to 1@ 2@ 3@ from_actor 4@ with_offset 0.0 5.0 -1.0

:Player_Move
wait 0
05D3: AS_actor $PLAYER_ACTOR goto_point 1@ 2@ 3@ mode 6 3000 ms // versionA
if
       00FF:   actor $PLAYER_ACTOR sphere 0 in_sphere 1@ 2@ 3@ radius 1.0 1.0 1.0 on_foot
jf @Player_Move
0187: 5@ = create_marker_above_actor $PLAYER_ACTOR
end_thread


This script supposed to make the player, to go the the coordinates, but sometimes (maybe often) the player only running around the coordinates again and again. This is just an example, I really need help about how to make sure an actor to go and stand on the desired coordinates no matter what happens. blush.gif   (Of course without using Actor.Putat($PLAYER_ACTOR, 1@, 2@, 3@)

don't let the opcode 05D3: run in a loop and the z-offset of 04C4: is not good, better is with_offset 0.0 5.0 0.0

12jango
  • 12jango

    "This is not revenge! This is entertainment!"

  • Members
  • Joined: 08 Mar 2008

#83

Posted 02 June 2011 - 01:44 AM Edited by 12jango, 02 June 2011 - 05:19 AM.

@ZAZ : I thank you for your help with the get actor using call_scm_function, it really cool! icon14.gif
But anyway, that one only could catch 1 actor. Do you have any idea how to catch multiple actors? (Note: Of course I knew there's one opcode that can do that, but only affects pedestrians, not custom actors)

Is there also the way to catch car and object (also custom cars & objects)? Please tell me.

By the way, I've succed to show an txd texture on the screen, it appears pemanently and I can't remove it! turn.gif
How to remove it?

Thanks! icon14.gif

ZAZ
  • ZAZ

    Kernlochbohrer

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

#84

Posted 02 June 2011 - 06:04 AM

QUOTE (12jango @ Jun 2 2011, 01:44)
@ZAZ : I thank you for your help with the get actor using call_scm_function, it really cool! icon14.gif
But anyway, that one only could catch 1 actor. Do you have any idea how to catch multiple actors? (Note: Of course I knew there's one opcode that can do that, but only affects pedestrians, not custom actors)

It needs to shift the actor handles into arrays
This means that every actor reserves a local var
you can then handle max 28 actors because the the loacals in a cs file are limited to 32
now you wanna see that an actor is catched
try the script below it shows colored smoke above the actor
the script refreshes allways the actor catching because new peds appear and other peds disappear
CODE
{$CLEO .cs}
:RandomActor_RAFSTEP1
03A4: name_thread 'RAFSTEP'

:RAFSTEP_11
0001: wait 0 ms
00D6: if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @RAFSTEP_11
0@ = -1
1@ = -1
2@ = -1
3@ = -1
4@ = -1
5@ = -1
6@ = -1
7@ = -1
8@ = -1
9@ = -1
10@ = -1
11@ = -1
12@ = -1
13@ = -1
14@ = -1
15@ = -1
16@ = -1
17@ = -1
18@ = -1
19@ = -1
20@ = -1
21@ = -1
22@ = -1
23@ = -1
24@ = -1

0050: gosub @RAFSTEP_175
0001: wait 0 ms
0050: gosub @RAFSTEP_336


:RAFSTEP_12
//0A93: end_custom_thread
0002: jump @RAFSTEP_11

:RAFSTEP_175
0006: 31@ = 0
0006: 27@ = 0

:RAFSTEP_189
0085: 30@ = 31@ // (int)
0006: 29@ = 0

:RAFSTEP_204
00D6: if and
056D:   actor 30@ defined
803C:   not  $PLAYER_ACTOR == 30@ // (int)
004D: jump_if_false @RAFSTEP_270
0085: 0@(27@,32i) = 30@ // (int)
04C4: create_coordinate 25@ 26@ 28@ from_actor 30@ offset 0.0 0.0  1.2
095C: create_smoke_at 25@ 26@ 28@ velocity 0.0 0.0 1.0 RGBA 1.0 0.0  0.0  1.0 size 0.5 last_factor 0.1//red
095C: create_smoke_at 25@ 26@ 28@ velocity 0.0 0.0 3.0 RGBA 1.0 0.0  0.0  1.0 size 0.5 last_factor 0.1//red
095C: create_smoke_at 25@ 26@ 28@ velocity 0.0 0.0 5.0 RGBA 1.0 0.0  0.0  1.0 size 0.5 last_factor 0.1//red

000A: 27@ += 1
0002: jump @RAFSTEP_298

:RAFSTEP_270
000A: 30@ += 1
000A: 29@ += 1
0019:   29@ > 127
004D: jump_if_false @RAFSTEP_204

:RAFSTEP_298
000A: 31@ += 256
00D6: if or
0019:   27@ > 24
0019:   31@ > 35584
004D: jump_if_false @RAFSTEP_189
0051: return

:RAFSTEP_336
0006: 27@ = 0

:RAFSTEP_343
0001: wait 0 ms
00D6: if
001B:   25 > 27@
004D: jump_if_false @RAFSTEP_397
if
  not 0@(27@,32i) == -1
jf @RAFSTEP_345  
01C2: remove_references_to_actor 0@(27@,32i) // Like turning an actor into a random pedestrian

:RAFSTEP_345
000A: 27@ += 1
0002: jump @RAFSTEP_343

:RAFSTEP_397
0051: return


QUOTE
Is there also the way to  catch car and object (also custom cars & objects)? Please tell me.

objects? no, cleo4 supports such an opcode but it works not good

there are several get_random_car opcodes or use the methode from above and check if a actor is driving and get the car handle of the actor
the game becomes unstablety the more random cars the script catches as well as using some codes to the random car cause crashes

QUOTE
By the way, I've succed to show an txd texture on the screen, it  appears pemanently and I can't remove it! turn.gif
How to remove it?

post your script

12jango
  • 12jango

    "This is not revenge! This is entertainment!"

  • Members
  • Joined: 08 Mar 2008

#85

Posted 03 June 2011 - 12:15 PM Edited by 12jango, 09 June 2011 - 02:35 AM.

CODE
{$CLEO .cs}

thread 'txd'

:Load
wait 0
0390: load_txd_dictionary 'LD_BEAT'
038F: load_texture "DOWN" as 1 // Load dictionary with 0390 first
03F0: enable_text_draw 1


:Spawn
wait 0
if
   Player.Defined($PLAYER_CHAR)
jf @Load
038D: draw_texture 1 position 500.0 203.0 size 50.0 50.0 RGBA 128 128 128 255
end_thread


Here, I forgot about how was I made it. But it looks like this, I'm pretty sure... blush.gif

For last, I wondering whether we have to removerefferences everything that we get (actor, car, etc) after using them? dozingoff.gif
(Well, I tried to not to release an actor after I get him, so after I use him I just let him be. blush.gif And if I want to get another actor again, I still can do it. icon14.gif

12jango
  • 12jango

    "This is not revenge! This is entertainment!"

  • Members
  • Joined: 08 Mar 2008

#86

Posted 09 June 2011 - 02:38 AM

QUOTE (ZAZ @ Thursday, Jun 2 2011, 06:04)
QUOTE (12jango @ Jun 2 2011, 01:44)
@ZAZ : I thank you for your help with the get actor using call_scm_function, it really cool! icon14.gif
But anyway, that one only could catch 1 actor. Do you have any idea how to catch multiple actors? (Note: Of course I knew there's one opcode that can do that, but only affects pedestrians, not custom actors)

It needs to shift the actor handles into arrays
This means that every actor reserves a local var
you can then handle max 28 actors because the the loacals in a cs file are limited to 32
now you wanna see that an actor is catched
try the script below it shows colored smoke above the actor
the script refreshes allways the actor catching because new peds appear and other peds disappear
CODE
{$CLEO .cs}
:RandomActor_RAFSTEP1
03A4: name_thread 'RAFSTEP'

:RAFSTEP_11
0001: wait 0 ms
00D6: if
0256:   player $PLAYER_CHAR defined
004D: jump_if_false @RAFSTEP_11
0@ = -1
1@ = -1
2@ = -1
3@ = -1
4@ = -1
5@ = -1
6@ = -1
7@ = -1
8@ = -1
9@ = -1
10@ = -1
11@ = -1
12@ = -1
13@ = -1
14@ = -1
15@ = -1
16@ = -1
17@ = -1
18@ = -1
19@ = -1
20@ = -1
21@ = -1
22@ = -1
23@ = -1
24@ = -1

0050: gosub @RAFSTEP_175
0001: wait 0 ms
0050: gosub @RAFSTEP_336


:RAFSTEP_12
//0A93: end_custom_thread
0002: jump @RAFSTEP_11

:RAFSTEP_175
0006: 31@ = 0
0006: 27@ = 0

:RAFSTEP_189
0085: 30@ = 31@ // (int)
0006: 29@ = 0

:RAFSTEP_204
00D6: if and
056D:   actor 30@ defined
803C:   not  $PLAYER_ACTOR == 30@ // (int)
004D: jump_if_false @RAFSTEP_270
0085: 0@(27@,32i) = 30@ // (int)
04C4: create_coordinate 25@ 26@ 28@ from_actor 30@ offset 0.0 0.0  1.2
095C: create_smoke_at 25@ 26@ 28@ velocity 0.0 0.0 1.0 RGBA 1.0 0.0  0.0  1.0 size 0.5 last_factor 0.1//red
095C: create_smoke_at 25@ 26@ 28@ velocity 0.0 0.0 3.0 RGBA 1.0 0.0  0.0  1.0 size 0.5 last_factor 0.1//red
095C: create_smoke_at 25@ 26@ 28@ velocity 0.0 0.0 5.0 RGBA 1.0 0.0  0.0  1.0 size 0.5 last_factor 0.1//red

000A: 27@ += 1
0002: jump @RAFSTEP_298

:RAFSTEP_270
000A: 30@ += 1
000A: 29@ += 1
0019:   29@ > 127
004D: jump_if_false @RAFSTEP_204

:RAFSTEP_298
000A: 31@ += 256
00D6: if or
0019:   27@ > 24
0019:   31@ > 35584
004D: jump_if_false @RAFSTEP_189
0051: return

:RAFSTEP_336
0006: 27@ = 0

:RAFSTEP_343
0001: wait 0 ms
00D6: if
001B:   25 > 27@
004D: jump_if_false @RAFSTEP_397
if
  not 0@(27@,32i) == -1
jf @RAFSTEP_345  
01C2: remove_references_to_actor 0@(27@,32i) // Like turning an actor into a random pedestrian

:RAFSTEP_345
000A: 27@ += 1
0002: jump @RAFSTEP_343

:RAFSTEP_397
0051: return


QUOTE
Is there also the way to  catch car and object (also custom cars & objects)? Please tell me.

objects? no, cleo4 supports such an opcode but it works not good

there are several get_random_car opcodes or use the methode from above and check if a actor is driving and get the car handle of the actor
the game becomes unstablety the more random cars the script catches as well as using some codes to the random car cause crashes

QUOTE
By the way, I've succed to show an txd texture on the screen, it  appears pemanently and I can't remove it! turn.gif
How to remove it?

post your script

It works! icon14.gif icon14.gif
But, how do I manage the radius? This one is too large. whatsthat.gif

ZAZ
  • ZAZ

    Kernlochbohrer

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

#87

Posted 09 June 2011 - 06:30 PM

There isn't any radius defined
there's just a limit for the amount of peds to keep in the script while they are not dead
the script catches 25 different peds for a moment to read their coords and then it removes the reference of all
then it do the same again

12jango
  • 12jango

    "This is not revenge! This is entertainment!"

  • Members
  • Joined: 08 Mar 2008

#88

Posted 13 June 2011 - 03:12 AM

very well then, thanks. icon14.gif
@Deji : Remember GangRecruitmentSystem mod? It's so simple, but very well made! icon14.gif
I'm questioning about how do you made an texture to keeps following one's head? cool.gif
Thanks! icon14.gif icon14.gif

Still about creating coordinates using camera view (man, I'm stuck with this one turn.gif ) :

CODE
20@ = 4.0
00A0: store_actor $PLAYER_ACTOR position_to 1@ 2@ 3@

while true
  wait 0
  0AC7: 5@ = var 5@ offset
  0AC7: 6@ = var 8@ offset
  0AA6: call_method 0x514970 0xB6F028 num_params 6 pop 0 6@ 5@ 3@ 2@ 1@ 20@  
  if 0
  06BD:   no_obstacles_between 1@ 2@ 3@ and 8@ 9@ 10@ solid 1 car 1 actor 1 object 1 particle 0
  then
      inc(20@,3.0)
  gosub @GET
  else
      break
  end
end


As far as I know this one is the most understandable (for me) but, still this one's not enough! devil.gif
This one makes very short distance, 'cause when I tried to GET an actor (see that gosub part)
using this script, I had to move very closely to an actor, then move the camera to his place. dontgetit.gif
If you have a better script or if you can edit this one, please do.
Thank you! icon14.gif

Wesser
  • Wesser

    The complexity simplifier, the efficiency optimizer.

  • Feroci Racing
  • Joined: 19 Aug 2006
  • Unknown

#89

Posted 13 June 2011 - 10:06 AM

I've already gave you the answer here. Coordinates have to be taken from the camera, so you'll loop through obstacles from where the camera is pointing to.

Your script has some mistakes which should be solved in this way:
CODE
12@ = 5.0
00A0: store_actor $PLAYER_ACTOR position_to 1@ 2@ 3@

while true
 wait 0
 0AC7: 10@ = var 4@ offset
 0AC7: 11@ = var 7@ offset
 0AA6: call_method 0x514970 struct 0xB6F028 num_params 6 pop 0 pPoint 11@ pCamera 10@ fOriginZ 3@ fOriginY 2@ fOriginX 1@ fRange 12@
 if
 06BD:  no_obstacles_between 4@ 5@ 6@ and 7@ 8@ 9@ solid 1 car 1 actor 1 object 1 particle 0
 then
   inc(12@, 2.5)
   gosub @GET
 else
   break
 end
end

You can also use a more powerful but complex way as shown here.

12jango
  • 12jango

    "This is not revenge! This is entertainment!"

  • Members
  • Joined: 08 Mar 2008

#90

Posted 26 June 2011 - 01:53 AM

Hey, how do I place 2 watches in both hands (I tried to change) the bodyparts number but it crashes....




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users