Quantcast

Jump to content

» «
Photo

Scripting Tutorials

24 replies to this topic
l3mmy
  • l3mmy

    Administrator of my own world.

  • Members
  • Joined: 19 Mar 2006

#1

Posted 07 May 2007 - 10:02 PM

Ok, i thought i'd make this to make it Easyer for people to find what they need scripting wise, i will add a Few San Andreas Opcodes for you to Chew on for now smile.gif

$2 is Equal to $PLAYER_CHAR

Lets Make the Player Appear 'Drunk' Like i was when i posted tounge.gif
CODE
052C: set_player $PLAYER_CHAR drunk_visuals  100


CellPhone Animations
CODE
0247: request_model #CELLPHONE;Get the Cellphone
0729: unknown_action_sequence $PLAYER_ACTOR 1;Start Mobile Call
0729: unknown_action_sequence $PLAYER_ACTOR 0;End Mobile Call
0249: release_model #CELLPHONE

As you can See, the 0729: lines are the Same, apart from the 1 and the 0, 1 is to turn it on and 0 is to turn it off smile.gif Try them

Now, How about giving the Player a Jetpack.
CODE
07A7: put_jetpack_on_actor $PLAYER_ACTOR


Keep your Weapons etc after you are Killed/Arrested:
CODE
08DE: keep_stuff_after_busted 0 (0=on/1=off)
08DD: keep_stuff_after_wasted 0 (0=on/1=off)


Ok, Let's Move on.

Now we will Create a Marker, and make it Detect the Player, if the Player is In the Area, he will get $10,000 every few seconds.

Add

CODE
02A7: $439 = create_icon_marker_and_sphere $441 at X Y Z

Replace X Y and Z with your Own Co ords (this is where the Marker will be)
to the Bottom of Main, Then add
CODE
004F: create_thread ££CASH_1

underneath that.

Then add this to the Bottom of the Script.

CODE
:CASH_1
0001: wait  250 ms
00D6: if  0
00ED:   actor $3 0 ()near_point_on_foot X Y radius  4.0  4.0
004D: jump_if_false ££CASH_1
0109: player $2 money +=  10000  
0001: wait 5000 ms
0002: jump ££CASH_1


Replace X and Y with your X and Y Co ordinates from the Game.

Now Let Me Explain a Little colgate.gif .

The 0001: wait * ms is How long to Wait Before (re)Performing the Action.

00ED: actor $3 0 ()near_point_on_foot X Y radius 4.0 4.0 - This Will Check to See if our Player is in the Created Marker, use the Same X and Y Co Ords as your Marker Further Up.

0109: player $2 money += 10000 - This will Give your Player $10,000, Replace 10000 with what ever amount you want your Player to Recieve.

0001: wait 5000 ms - This will make the Game Wait 5 seconds before giving another $10k. put as 0 for Infinite Loop.

I hope this Helped a Few People out. colgate.gif

evilrex
  • evilrex

    Foot Soldier

  • Members
  • Joined: 27 May 2006

#2

Posted 13 May 2007 - 09:24 PM

thanks for the tutorial, it explained a lot of my questions... though I don't understand where to put the all pieces of script....
Can I put them anywhere in the MAIN.scm file?

eg: 052C: set_player $PLAYER_CHAR drunk_visuals 100 <--- where do I put this line?

Andrew
  • Andrew

  • Andolini Mafia Family
  • Joined: 21 Jul 2003
  • None

#3

Posted 14 May 2007 - 06:23 AM

The first few parts were explaining about the lines of code. I'd place the marker code within the block of code that sets up markers.

plunk89
  • plunk89

    Cr4zy Driv3r

  • Members
  • Joined: 12 Sep 2006

#4

Posted 14 May 2007 - 09:29 AM

Thanks for the tut. Its good!
I have a question inconnection with the drunk animation: Can i make a marker that makes the player drunk for 1minute inside a bar or with a key combination pressed?

plunk89

l3mmy
  • l3mmy

    Administrator of my own world.

  • Members
  • Joined: 19 Mar 2006

#5

Posted 27 May 2007 - 07:07 PM

Sorry fora Late Reply, I'm having internet Problems atm, But anyway...

@ evilrex : 052C: set_player $PLAYER_CHAR drunk_visuals 100
I Normally put this Under Main... colgate.gif

@ plunk89 : Detect if the Player is in the Area, if he is, then Make him Drunk (add Drunk line with 100, wait 60000ms (i think), then set the Drunk visuals to 0. Should work smile.gif



matyassv12
  • matyassv12

    Player Hater

  • Members
  • Joined: 21 May 2007

#6

Posted 04 June 2007 - 02:54 AM

hello, i'm trying to install a steed mod for SA i need help with this :



004F: create_thread ££BIKETH

:BIKETH
0001: wait 0 ms
03A4: name_thread "STEED"

:BIKE1
0001: wait 127 ms
00D6: if 0
0256: player $PLAYER_CHAR defined
004D: jump_if_false ££BIKE1
00D6: if 0
03EE: player $PLAYER_CHAR controllable
004D: jump_if_false ££BIKE1
00D6: if 0
047A: $PLAYER_ACTOR;; 047A: actor $PLAYER_ACTOR driving_a_motorbike
004D: jump_if_false ££BIKE4
03C0: @0 = actor $PLAYER_ACTOR car

:BIKE2
0226: @5 = actor $PLAYER_ACTOR health
0227: @6 = car @0 health
0001: wait 10 ms
00D6: if 0
0256: player $PLAYER_CHAR defined
004D: jump_if_false ££BIKE1
00D6: if 0
82BF: NOT car @0 sunk
004D: jump_if_false ££BIKE3
00D6: if 0
80E1: NOT key_pressed 0 15
004D: jump_if_false ££BIKE3
;00D6: if 0
;8038: NOT $BIKEOFF == 1
;004D: jump_if_false ££BIKE3
00D6: if 0
80DF: NOT actor $PLAYER_ACTOR driving
004D: jump_if_false ££BIKE2
018C: play_sound 1058 at 0.0 0.0 0.0
036A: put_actor $PLAYER_ACTOR in_car @0
0223: set_actor $PLAYER_ACTOR health_to @5
0224: set_car @0 health_to @6
0002: jump ££BIKE2

:BIKE3
0001: wait 127 ms
00D6: if 0
0256: player $PLAYER_CHAR defined
004D: jump_if_false ££BIKE1
00D6: if 0
80DF: NOT actor $PLAYER_ACTOR driving
004D: jump_if_false ££BIKE3
01C3: remove_references_to_car @0;; Like turning a car into any random car
0002: jump ££BIKE1

:BIKE4
00D6: if 0
80DF: NOT actor $PLAYER_ACTOR driving
004D: jump_if_false ££BIKE1
00D6: if 1
00E1: key_pressed 0 6
00E1: key_pressed 0 8
004D: jump_if_false ££BIKE1
077E: $ACTIVE_INTERIOR = active_interior
00D6: if 0
0038: $ACTIVE_INTERIOR == 0 ;; integer values
004D: jump_if_false ££BIKE1
0172: @4 = actor $PLAYER_ACTOR z_angle
04C4: create_coordinate @1 @2 @3 from_actor $PLAYER_ACTOR offset 0.0 -1.0 -1.0
0247: request_model #NRG500
038B: load_requested_models

:BIKELAST
0001: wait 0 ms
00D6: if 0
0248: model #NRG500 available
004D: jump_if_false ££BIKELAST
00A5: @0 = create_car #NRG500 at @1 @2 @3
0175: set_car @0 z_angle_to @4
0249: release_model #NRG500
036A: put_actor $PLAYER_ACTOR in_car @0
04BA: set_car @0 speed_instantly 20.0
01C3: remove_references_to_car @0;; Like turning a car into any random car
0002: jump ££BIKE2



What do i have to do with that... do i have to just paste it at the end of main.scm or what please help

Demon86rjc
  • Demon86rjc

    Player Hater

  • Members
  • Joined: 04 Jul 2007

#7

Posted 08 July 2007 - 09:42 AM

Where Would You Put scripts In Is There A Order Or Can You Just Put Them Anywhere?

CroModder
  • CroModder

    Cro Begginer

  • Members
  • Joined: 30 Jul 2007

#8

Posted 31 July 2007 - 11:51 AM

What is doing "jump_if_false"? blush.gif

fantomcat_2k
  • fantomcat_2k

    Player Hater

  • Members
  • Joined: 31 Jan 2008

#9

Posted 31 January 2008 - 06:23 PM

I have major problems with this mod, i can get the red sphere to spwan outside the johnson house, but no cash marker, and when i stand in the marker, nothing happens.
Can you tell me where to put these lines? I have the spere amrker code just before the mission 1 data, under the police bribe codes, this works, but the rest of the code is at the bottom of the file, where the RC shop data is, and it doesnt work, ive tried to put this data next to the bribe data, (further up the file, but i just get compling errors) can any tell me exactley where to put this code? Also there are 3 bits of code, i no im asking, but can i have 3 locations??

Any help on this would be greatly appriciated!!!

l3mmy
  • l3mmy

    Administrator of my own world.

  • Members
  • Joined: 19 Mar 2006

#10

Posted 31 January 2008 - 08:41 PM

Yes You can have more than One location..If you want Send me your SCM, and i'll add it for you But i'll need the coordinates. Then i'll return it to you and you can see how it works colgate.gif

- L3mmy - [email protected]

fantomcat_2k
  • fantomcat_2k

    Player Hater

  • Members
  • Joined: 31 Jan 2008

#11

Posted 14 February 2008 - 07:47 PM

OK, ive tried again,

ive got the full code at the bottom of main, just above mission 0 and i gat nothing, ive had this code working before, but i cant remember where i put it!

come on, give me a clue?

can you give me maybe a few code boxes with the information, or a screenshot or something?


l3mmy
  • l3mmy

    Administrator of my own world.

  • Members
  • Joined: 19 Mar 2006

#12

Posted 16 February 2008 - 12:46 AM

QUOTE (fantomcat_2k @ Feb 14 2008, 19:47)
OK, ive tried again,

ive got the full code at the bottom of main, just above mission 0 and i gat nothing, ive had this code working before, but i cant remember where i put it!
come on, give me a clue?
can you give me maybe a few code boxes with the information, or a screenshot or something?

Here is an Example of a Totally Stripped SCM With the Cash Marker Function Added....

CODE
DEFINE VERSION SA 0.33

0002: jump ££Second_Segment
DEFINE MEMORY  100  ; Equals Mission Builder type global variable range $2 to $24

:Second_Segment
0002: jump ££Third_Segment
DEFINE OBJECTS  1
DEFINE OBJECT WWW.FREEWEBS.COM/L3MMY/                ; This is an unused object. You can put anything here.

:Third_Segment
0002: jump ££Fourth_Segment
DEFINE MISSIONS  0

:Fourth_Segment
0002: jump ££Fifth_Segment
DEFINE EXTERNAL_SCRIPTS  0

:Fifth_Segment
0002: jump ££Sixth_Segment
DEFINE UNKNOWN_FIFTH_SEGMENT
DEFINE UNKNOWN1  0

:Sixth_Segment
0002: jump ££MAIN_1
DEFINE UNKNOWN_SIXTH_SEGMENT
DEFINE UNKNOWN3  0

;-------------MAIN---------------


:MAIN_1
03A4: name_thread 'MAIN'
016A: fade  0 ()  0 ms
042C: set_total_missions_to  0
030D: set_total_mission_points_to  0
01F0: set_max_wanted_level_to  6
0111: set_wasted_busted_check_to  0 (disabled)
00C0: set_current_time  10  0
0005: $7 =  -2787.0 ;; floating-point values
0005: $6 =  -1113.7 ;; floating-point values
0005: $5 =  60.0 ;; floating-point values
04E4: unknown_refresh_game_renderer_at $7 $6
03CB: set_camera $7 $6 $5
062A: change_stat  165 (energy) to  999.0 ; float
062A: change_stat  23 (muscle) to  999.0 ; float
062A: change_stat  21 (fat) to  0.0 ; float
062A: change_stat  163 (health upgrade) to  999.0 ; float
062A: change_stat  160 (driving skill) to  999.0 ; float
062A: change_stat  229 (bike skill) to  999.0 ; float
062A: change_stat  223 (pilot skill) to  999.0 ; float
062A: change_stat  230 (cycling skill) to  999.0 ; float
0629: change_stat  181 (islands unlocked) to  4 ; integer see statdisp.dat
0629: change_stat  68 () to  0 ; integer see statdisp.dat
0053: $2 = create_player #NULL at $7 $6 $5
07AF: $11 = player $2 group
01F5: $3 = create_emulated_actor_from_player $2
0373: set_camera_directly_behind_player
0173: set_actor $3 z_angle_to  262.0
01B6: set_weather  1
087B: set_player $2 clothes "BBALLJACKRSTAR" "BBJACK"  0
087B: set_player $2 clothes "JEANSDENIM" "JEANS"  2
087B: set_player $2 clothes "SNEAKERBINCBLK" "SNEAKER"  3
087B: set_player $2 clothes "PLAYER_FACE" "HEAD"  1
070D: $2
04BB: select_interior  0 ;; select render area
01B4: set_player $2 frozen_state  1 (unfrozen)
01B7: release_weather
016C: restart_if_wasted at $7 $6 $5 angle  0.0 unknown  0
0247: request_model #HYDRA
02A7: $439 = create_icon_marker_and_sphere $441 at 0.0 1.0 2.0;;Replace 0.0 1.0 2.0 with your x, y, z
004F: create_thread ££CASH_1

:MAIN_39
0001: wait  0 ms
00D6: if  0
0248:   model #HYDRA available
004D: jump_if_false ££MAIN_39
00A5: $4 = create_car #HYDRA at $7 $6 $5
036A: put_actor $3 in_car $4
016A: fade  1 (back)  1000 ms
0001: wait  100 ms
03E6: remove_text_box

:MAIN_48
0001: wait  2500 ms
0002: jump ££MAIN_48

:CASH_1
0001: wait  250 ms;How Long To wait each time (To Prevent infinate loop) 1000 = 1 Second.
00D6: if  0
00ED:   actor $3 0 ()near_point_on_foot X-Coord Y-Coord radius  4.0  4.0
004D: jump_if_false ££CASH_1
0109: player $2 money +=  10000  ;The Player will Recieve $10,000
0001: wait 5000 ms
0002: jump ££CASH_1

kevindevil
  • kevindevil

    Thug Life

  • Members
  • Joined: 18 Feb 2008

#13

Posted 19 February 2008 - 08:56 PM

what progam i need for scrip editing?? blush.gif

Spider-Vice
  • Spider-Vice

    Let's Bounce

  • Zaibatsu
  • Joined: 09 Oct 2006
  • Portugal

#14

Posted 19 February 2008 - 09:32 PM

You can use Barton's Mission Builder or Sanny Builder.

kevindevil
  • kevindevil

    Thug Life

  • Members
  • Joined: 18 Feb 2008

#15

Posted 20 February 2008 - 01:12 PM

wich one is better progam??

Spider-Vice
  • Spider-Vice

    Let's Bounce

  • Zaibatsu
  • Joined: 09 Oct 2006
  • Portugal

#16

Posted 20 February 2008 - 10:10 PM

It's Barton's one. But if you don't know where to put the code, search by the Tut section.

fantomcat_2k
  • fantomcat_2k

    Player Hater

  • Members
  • Joined: 31 Jan 2008

#17

Posted 29 February 2008 - 07:50 PM

oh, cool i've got it now, thank you so much!!

Danoosh Pichgahe
  • Danoosh Pichgahe

    I Just Edit GTA SanAndreas.

  • Members
  • Joined: 29 Mar 2008

#18

Posted 29 March 2008 - 06:12 PM

[FONT=Arial][SIZE=7][COLOR=gray]Hi...

I want to make a Application
that application can stop a speed of cars or bikes or ...
for exaple you like to driving a car with 50 Km speed (in GTA san andreas) you Enable that Application and after that you can drive a car or ... in same speed.

But i don't know how can i making that Application!
1-Help Me for making that application or if you made that please tell me or upload that and after that show the Download Link.
2-if we have a Trainer and with that Trainer ; you can drive a same speed of cars please tell me..

>>>>>>>>Sorry I Can not write very good English <<<<<<<<

Flyingportugueseman
  • Flyingportugueseman

    -Playboy-

  • Members
  • Joined: 20 Jul 2008

#19

Posted 20 July 2008 - 10:46 PM

tounge2.gif Those tips are great but i'm kinda new on this stuff so...
Where do I put those codes??? confused.gif blush.gif notify.gif

Much love dog...
LOL icon14.gif
lol.gif

l3mmy
  • l3mmy

    Administrator of my own world.

  • Members
  • Joined: 19 Mar 2006

#20

Posted 21 July 2008 - 02:02 AM

Hey, Welcome to the Forums colgate.gif to use this Code you have to download SA Builder (A SCM Editor) and open the script in the san andreas folders..

Doctor Emmett L. Brown
  • Doctor Emmett L. Brown

    Gangsta

  • BUSTED!
  • Joined: 01 Apr 2008

#21

Posted 31 July 2008 - 12:55 AM

Great tutorial thanks hoping to learn more about scripting in the future!

cj360
  • cj360

  • Members
  • Joined: 19 Sep 2007

#22

Posted 04 September 2008 - 09:20 PM

could one use these for cleo scripts for do the main.scm and cleo scripts have diffences that keep you from doing so?

l3mmy
  • l3mmy

    Administrator of my own world.

  • Members
  • Joined: 19 Mar 2006

#23

Posted 04 September 2008 - 10:23 PM

I am not sure mate..I never used Cleo myself..

ThumbRehab
  • ThumbRehab

    Denied Access

  • Members
  • Joined: 28 Nov 2008
  • None

#24

Posted 03 January 2009 - 08:58 PM

A'ight, I've nvr really been good at this, the one mission bldr that's left will just about allw ths 2 hppn. I wnt to replace a line in the SAMB,
"EVENT_DRAGGED_OUT_CAR" to something alng the lines of
"EVENT_REMOVED_FROM_CAR" or something in the form of a jack mve by the OGF in San Andreas instead of just "Dragging" the guy out and beating him up, I wnt them to drag him out and take the car. sarcasm.gif cookie.gif moto_whistle.gif How would I word it?

Archie_Junior
  • Archie_Junior

    Player Hater

  • Members
  • Joined: 27 Aug 2012

#25

Posted 15 June 2014 - 01:08 AM

I want to place a save game icon inside the crack den in idlewood apartments, how do i go about doing that?




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users