Quantcast

Jump to content

» «
Photo

Mission Coding for Dummies and Pro's!

64 replies to this topic
gtasearcher
  • gtasearcher

    No sh*t.

  • Members
  • Joined: 26 Aug 2008

#31

Posted 02 July 2009 - 05:20 PM

Use the opcodes! Search for them in opcode search mad.gif There's no class for killing yet. For driving, use
CODE
Car.DriveTo($car, $x, $y, $z)

hetment
  • hetment

    GTA 4 and gta san andreas. the best gta games ever!

  • Members
  • Joined: 03 May 2009

#32

Posted 03 July 2009 - 06:49 AM

OK but dude he opcode search don't shows exactly what opcodes we want....... anyways 'I will also try to understand more about scm coding ... Its kinda hard

PatrickW
  • PatrickW

    GTA Juggernaut

  • Moderator
  • Joined: 07 Jan 2004
  • Netherlands

#33

Posted 03 July 2009 - 08:51 AM

Please keep general opcode discussions in the "mission Coding Discussion forum", not in tutorial topics.

Deji
  • Deji

    Coding like a Rockstar!

  • Feroci Racing
  • Joined: 24 Dec 2007
  • None

#34

Posted 24 July 2009 - 01:13 AM Edited by Deji, 24 July 2009 - 01:30 AM.

I'm "nitpicking" here...

CODE
repeat
wait †0 ms
if 00E1: † player 0 pressed_key 15
then
† † † † † † † 08DA: remove_panel $MENU
03E6: remove text box
jump @END
end
until 00E1: † player 0 pressed_key 16


Even though I barely know what that means (I find most of the high-level constructs hard to get my mind around), I assume it's basically this...

CODE
:BLKMRKT_DEAL2
wait 0
if
80E1: † not player 0 pressed_key 15
else_jump @BLKMRKT_REMOVEPANELSANDPRECHECK
if
80E1: † not player 0 pressed_key 16
else_jump @BLKMRKT_DEAL2
08D7: 5@ = panel 0@ active_row
jump @BLKMRKT_DEALDRUGS


To save threads, complication and time... I like to use (and teach people to use) this instead:

CODE
:BLKMRKT_DEAL2
wait 0
// If player pressed key (Enter)
if
80E1: † not player 0 pressed_key 15
// Then jump to the remove panel thread.
else_jump @BLKMRKT_REMOVEPANELSANDPRECHECK
// Store the row that is currently selected.
08D8: 5@ = panel 0@ selected_row
// If selected the first row.
if
8039: † not †5@ == 0
// Jump to the deal drugs thread.
else_jump @BLKMRKT_DEALDRUGS
// If selected the second row.
if
8039: † not †5@ == 1
// Jump to the deal weapons thread.
else_jump @BLKMRKT_DEALWEAPONS
// Loop.
jump @BLKMRKT_DEAL2

(I even commented my code, just for you! tounge2.gif )

The selected_row opcode only activates once a player selects a row. Thus saving the "if player pressed NUM0 or w/e you're control is" loop (teehee, I used the word "thus"!).

This difference is slight, but it highlights the difference between the two opcodes. One of them can be used to test if a player has pressed the row... And one can be used to see if the player highlighted the row. This is incredibly useful to me during the Black Market mod (it was actually the cause of me discovering these differences... saved my life)... I created a table in which you could press the left and right keys while highlighting an option to change the values of that option. Which was a lifesaver! Before, I had to create double the amount of fxt entries and have the player press a row (which was then highlighted ~y~) before they could change the values.

Anyway... The point is, there is a difference between the 2 opcodes that I think people are missing out on... Big time! And I want people to know it. Instead of ending up like me when I was wondering why my table wasn't working the way I wanted smile.gif


Note to all of you that you have just had your first exclusive preview of the Black Market mod... And to get you excited, everyone who happens to be reading this (only a few of you) I can say this to... IT'S GONNA BE f*ckING GREAT!! tounge2.gif

Dutchy3010
  • Dutchy3010

    Female SCM coder!

  • Moderator
  • Joined: 30 Jul 2006
  • Netherlands

#35

Posted 24 July 2009 - 01:48 AM

Deji, you have to keep in mind that this is a tutorial for beginners. If there is a difference between two opcodes and can be used both, doesn't mean that I have to explain that. The method I'm using is a good method, I've used it for every menu I made so far, including all the DYOM menu's. I'm just saying how you CAN do it, of course it doesn't mean that it's the only way.

If they are more advanced, they don't need my tutorial, and they can do it themselves. Then they can go and try things, without using the tutorial. Just like you did.
I keep it simple, only the basics and only one way to do it (most of the time). Just to keep it clear, so nobody will get confused. It's difficult enough without explaining every single opcode that can be used for something.

About your way of commenting it, I just don't think that will make it more organized. wink.gif And about the repeat-wait-until, that is in my opinion the best way to make it, so that's what I explain it in the tutorial.

Deji
  • Deji

    Coding like a Rockstar!

  • Feroci Racing
  • Joined: 24 Dec 2007
  • None

#36

Posted 24 July 2009 - 01:56 AM

What's wrong with the comments?

And the point was that this is more simple than the other method as you don't have to script more wait's...

I'm not saying you have to go into detail about the differences... I just think it's more simple to have that in the code than having to write extra stuff. But I guess if you reckon the other way is easier, that's fine too smile.gif I just think this has to be mentioned somewhere as it lead me to nearly cancel a few of my mods xO

Dutchy3010
  • Dutchy3010

    Female SCM coder!

  • Moderator
  • Joined: 30 Jul 2006
  • Netherlands

#37

Posted 24 July 2009 - 01:59 AM

QUOTE (Deji @ Jul 24 2009, 03:56)
What's wrong with the comments?

There is nothing wrong with it, I just don't think it is more organized. tounge.gif

Deji
  • Deji

    Coding like a Rockstar!

  • Feroci Racing
  • Joined: 24 Dec 2007
  • None

#38

Posted 24 July 2009 - 02:02 AM

QUOTE (Dutchy3010 @ Jul 24 2009, 01:59)
QUOTE (Deji @ Jul 24 2009, 03:56)
What's wrong with the comments?

There is nothing wrong with it, I just don't think it is more organized. tounge.gif

Than what?

I'd like to know how my comments could be improved.

What's an example of a good comment? Something more like this?

CODE
0000: NOP

// Really pointless opcode.

0000: NOP

// In fact, it doesn't exist.

0000:NOP

Dutchy3010
  • Dutchy3010

    Female SCM coder!

  • Moderator
  • Joined: 30 Jul 2006
  • Netherlands

#39

Posted 24 July 2009 - 02:10 AM

Oh, lol, didn't read your post well. I thought you said that you wanted me to make my tutorials with that comments instead of a text. tounge.gif Didn't think that you actually commented a code for me. lol.gif Aaah well, let's go back ontopic, lol.

d0mm2k8
  • d0mm2k8

    ad infinitum

  • Leone Family Mafia
  • Joined: 06 Jan 2009

#40

Posted 24 July 2009 - 09:59 PM

Totally awesome tutorial biggrin.gif Helps loads icon14.gif

Sniputer
  • Sniputer

    IM NOT COMING HERE ANYMORE

  • BUSTED!
  • Joined: 01 May 2007

#41

Posted 26 July 2009 - 03:14 PM Edited by Sniputer, 26 July 2009 - 03:20 PM.

Good tutorial, took me 1 hour to read / learn "Actors". biggrin.gif But Sanny hit me up with an error when I wanted to compile the stripped code with a spawned actor...

EDIT: problem solved smile.gif

d0mm2k8
  • d0mm2k8

    ad infinitum

  • Leone Family Mafia
  • Joined: 06 Jan 2009

#42

Posted 27 July 2009 - 10:05 PM Edited by d0mm2k8, 01 August 2009 - 06:30 PM.

Hey, I've been coding for quite a while (thanks to the Dummies tut)
and I have a request for a tutorial biggrin.gif

You know when you have a special actor go on mission with you
(like Sweet) they follow you and get in your car and have the ability
to swim ect.

I just wondered if you could make a tut on how to code that into
a mission please smile.gif

I used the opcode search, searched this forum, googled it and I couldn't
find anything whatsthat.gif

EDIT: After messing around with random code, I found out how to do it tounge.gif

hetment
  • hetment

    GTA 4 and gta san andreas. the best gta games ever!

  • Members
  • Joined: 03 May 2009

#43

Posted 04 August 2009 - 04:08 PM

HElp guys please!! See in MPACK discussion i founded create folder..,. I can understand we can create and rename the scr.scm but th other text.gxt file! How we create it !? Please help .. Tell me where to get all file for MPACK

violentAZoom
  • violentAZoom

    Gangsta

  • BUSTED!
  • Joined: 04 Aug 2009

#44

Posted 04 August 2009 - 05:23 PM

First of all, you can copy the american.gxt to it, then remove all entries and add your own for your MPACK, the .scm is just by compiling a main.scm, create a text document, then when you save it, it it as .dat and you should be set.

goodmakers
  • goodmakers

    TI FAN

  • BUSTED!
  • Joined: 21 Aug 2009

#45

Posted 23 August 2009 - 12:53 PM

You are the best for making this tuttorial great have some cookie

12jango
  • 12jango

    "This is not revenge! This is entertainment!"

  • Members
  • Joined: 08 Mar 2008

#46

Posted 26 August 2009 - 02:11 AM

Hey, still confused with cutscenes:

- Camera.setposition (X, Y, Z, float, float, float)
I thought those floats are the rotation aren't they? If so, how to use them?

- Camera.pointat (X, Y, Z, mode)
I saw you use opcode to make a camera point, then there was a mode 2, what's it mean? And there are some modes other than mode 2?

- If you don't mind, would you please explain once more about making a simple cutscene (without any spawning actors and anims)?

Thank you!:^:

Skaf_
  • Skaf_

    Bullets N Harmony

  • Members
  • Joined: 23 Sep 2009

#47

Posted 24 September 2009 - 01:15 PM

okay check this i'm hella nubbycake at scripting but i'm gettin the basics down.
and i got a question, i read through almost the whole thing of Dutchy's coding for dummies. .
Went to coding for pros and i noticed the tut script there had a cleo directive in it.
and i'm not to good in modding, but does that mean once you would finish the work, you could put it the cleo folder and have it work in the game after starting a new game?
and have that file to select like the mpack.dat does, but be able to save to???
or would you have to place all your files from the mpackx folder somewhere in the san andreas folder for it to work... could it work ?. . sorry if my question is newb status lol.

oh quick question, can anyone tell me how the hell i can make a text box of players talking to players not just M_PASS crap.
like in a cutscene or somethin have a dude pull up in a car, have my character walk over to him, and have a conversation lmao. does anyone know how i can do this?

JohnPro
  • JohnPro

    GTAHalo.com

  • Members
  • Joined: 12 Apr 2007

#48

Posted 05 November 2009 - 10:39 AM

Why hasn't anyone said thank you. THANK YOU for your mega long mega complex tut.

MG 097
  • MG 097

    Player Hater

  • Members
  • Joined: 03 Aug 2009

#49

Posted 05 November 2009 - 08:35 PM

Thank you... icon14.gif icon14.gif happy.gif colgate.gif biggrin.gif

ananthuma
  • ananthuma

    Player Hater

  • Members
  • Joined: 20 Mar 2010

#50

Posted 26 March 2010 - 09:53 AM

thanks a lot

ananthuma
  • ananthuma

    Player Hater

  • Members
  • Joined: 20 Mar 2010

#51

Posted 26 March 2010 - 10:09 AM

the script is not working in my sa it says "unable to load"
pls help me dutchy3010

Dutchy3010
  • Dutchy3010

    Female SCM coder!

  • Moderator
  • Joined: 30 Jul 2006
  • Netherlands

#52

Posted 26 March 2010 - 08:42 PM

I'm sorry, which script do you mean?

gta_sa_player123
  • gta_sa_player123

    King of San Andreas

  • Members
  • Joined: 17 Mar 2010

#53

Posted 27 May 2010 - 02:47 PM Edited by gta_sa_player123, 29 May 2010 - 10:22 PM.

you can teleport using sanny builder's coords manager by changing the coords and pressing the set button

Dingleman
  • Dingleman

    SA:LC Mod Leader

  • Members
  • Joined: 18 Dec 2005

#54

Posted 01 August 2010 - 12:24 AM

Permit me to correct a mistake made by the GTAForums staff..

user posted image

Awesome tutorial..

$COOKIE = cookie.gif
2@ = 99999999
$COOKIE *= 2@
$ Dutchy3010 += $COOKIE

Man I'm sad... tounge.gif

coin-god
  • coin-god

    High Roller

  • $outh $ide Hoodz
  • Joined: 18 Mar 2007

#55

Posted 01 August 2010 - 03:00 AM

Man, your code is wrong! You have to load the cookie first.

lol

Dingleman
  • Dingleman

    SA:LC Mod Leader

  • Members
  • Joined: 18 Dec 2005

#56

Posted 01 August 2010 - 04:40 AM

haha.. smartass tounge.gif

Ashwin.Star
  • Ashwin.Star

    I'm a Business Boy Now !

  • Members
  • Joined: 14 Nov 2010
  • India

#57

Posted 21 January 2011 - 03:35 PM

The tutorial that you have given
is the best tutorial that i have seen ever
thanks for that tutorial,

mercie_blink.gif mercie_blink.gif but, mercie_blink.gif
it was for gta san andreas
and i want to learn about gta vice city colgate.gif colgate.gif

if the opcode of both game are same & work same
confused.gif confused.gif then please convert your
small basic mission script (of san andreas )
to
gta vice city

cryani.gif cryani.gif cryani.gif if opcode are different
then,
can you cryani.gif please cryani.gif make a new tutorial for gta vice city

""if you can't then pls reply me so i will not wait for it"
"& if you can then pls tell me where i will find it"

I AM AN INDIAN ,AND NOT SO GOOD IN ENGLISH
IF FEEL ANYWARE THAT
I AM suicidal.gif suicidal.gif ORDERING suicidal.gif suicidal.gif YOU TO MAKE THAT TUTORIAL
PLEASE lol.gif lol.gif FORGIVE lol.gif ME
BECAUSE
I AM JUST REQUESTING ONLY

T # @ /\/ K & 4 R {- @ !) ! /\/ G

coin-god
  • coin-god

    High Roller

  • $outh $ide Hoodz
  • Joined: 18 Mar 2007

#58

Posted 21 January 2011 - 03:47 PM

Its the same for VC, just that VC ahs a few diferent opcodes. But the structure is the same. But if you dont know english, you wont learn coding.

Ashwin.Star
  • Ashwin.Star

    I'm a Business Boy Now !

  • Members
  • Joined: 14 Nov 2010
  • India

#59

Posted 22 January 2011 - 06:31 AM

QUOTE (goin-god @ Jan 21 2011, 15:47)
But if you dont know english, you wont learn coding.

i know english but i'am not perfect in it.

what about converting of small mission script ?

kmlwin.1996
  • kmlwin.1996

    Hold upô

  • BUSTED!
  • Joined: 11 May 2010

#60

Posted 23 January 2011 - 03:56 AM

QUOTE (jemahuk1 @ Jun 27 2009, 12:32)
023C: load_special_actor 'CAT' as 1 // models 290-299

models 290-299 > What does it mean?

It means you can load special actors to 9 actors.

All peds can be loaded by loading ide files.

Example

CODE
model.load(#MALE01)


But special actors like OGLOC, Ceaser , Truth etc... must load with this.

CODE
023C: load_special_actor 'OGLOC' as 1 // models 290-299


Special actor loading has limit. You can only load 9 actors.
==============
KMWLWIN@2011




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users