Quantcast

Jump to content

» «
Photo

Mission Coding for Dummies and Pro's!

64 replies to this topic
ZAZ
  • ZAZ

    Kernlochbohrer

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

#1

Posted 22 March 2009 - 12:17 AM Edited by Dutchy3010, 03 May 2009 - 06:57 PM.

If you want to show your appreciation for Dutchy & PatrickW's Mission Coding for Dummies! and/or Mission Coding for Pro's threads, then post in here rather than in those topic, so Dutchy and Patrick can add tutorials if needed. Also questions and suggestions belong here.

Cheers wink.gif - Ottae



Wuah.. mercie_blink.gif a really complete mission coding tutorial
my friend you won the award a again
cookie.gif cookie.gif cookie.gif cookie.gif cookie.gif
  • cyrilaeshell likes this

coin-god
  • coin-god

    High Roller

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

#2

Posted 22 March 2009 - 12:21 AM

Damn. This is the best tutorial i have ever seen.

Your tutorial is awesome, good work Dutchy!

_Rob_
  • _Rob_

    Game Dev, Graphics Artist

  • Members
  • Joined: 24 Sep 2006
  • None

#3

Posted 22 March 2009 - 09:52 AM

wow Dutchy, everytime i see a new topic with your name on it i always wonder what can she do next, its amazing nice work, i might even try and learn mission coding now tounge.gif

Seemann
  • Seemann

    Ruhe

  • Members
  • Joined: 03 Sep 2004
  • Russia

#4

Posted 22 March 2009 - 10:15 AM

Please, dont give direct links to the Sanny Builder installer (your very first post contains it). Link to the download page instead. The reason is that direct links become broken eventually (as that your link to SB 3.03) thus useless.

And as I already said you - great tutorials, I like them. icon14.gif

Dutchy3010
  • Dutchy3010

    Female SCM coder!

  • Moderator
  • Joined: 30 Jul 2006
  • Netherlands

#5

Posted 22 March 2009 - 11:22 AM

Fixed, it links to the download page now.

Thanks for all the compliments. ^^ If someone wants to have a tutorial about anything that is useful for making missions, just give me a pm and I will see what I can do. wink.gif

Seemann
  • Seemann

    Ruhe

  • Members
  • Joined: 03 Sep 2004
  • Russia

#6

Posted 25 March 2009 - 09:43 AM

I would make the table of content as reference links (linking to the same page, with # sign before), so you dont need to reload the page to read a specific tutorial. Like this:

Before you begin
Basics of coding (coding structures)

etc wink.gif

NTAuthority
  • NTAuthority

    member_title

  • The Yardies
  • Joined: 09 Sep 2008
  • European-Union

#7

Posted 27 March 2009 - 08:22 AM

Hmm, it seems like I have read almost the exact same guide somewhere before... don't remember where, may be that the same person posted it there too. Even if I did know it, the updates done to a lot of parts make it an even better guide smile.gif

coin-god
  • coin-god

    High Roller

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

#8

Posted 27 March 2009 - 07:16 PM

QUOTE (NTAuthority @ Mar 27 2009, 05:22)
Hmm, it seems like I have read almost the exact same guide somewhere before... don't remember where, may be that the same person posted it there too. Even if I did know it, the updates done to a lot of parts make it an even better guide smile.gif

She originally wrote it in dutch i think.

ThaGTAGamer
  • ThaGTAGamer

    Player Hater

  • Members
  • Joined: 30 Mar 2009

#9

Posted 04 April 2009 - 11:44 AM

Yeah... COOL tutorial, but it is for SA. Does it same with VC or GTA III??? confused.gif

coin-god
  • coin-god

    High Roller

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

#10

Posted 04 April 2009 - 11:29 PM

QUOTE (ThaGTAGamer @ Apr 4 2009, 08:44)
Yeah... COOL tutorial, but it is for SA. Does it same with VC or GTA III??? confused.gif

Well, Dutchy used Advanced coding, which i dont know if its supported in Vice. But the basics are almsot the same thing.

Sicologikal
  • Sicologikal

    Shark

  • Members
  • Joined: 18 Dec 2006

#11

Posted 29 April 2009 - 12:51 AM Edited by Sicologikal, 29 April 2009 - 01:06 AM.

Excellent work this will come in handy for my mod!

Thanks a million!

cookie.gif

Dutchy3010
  • Dutchy3010

    Female SCM coder!

  • Moderator
  • Joined: 30 Jul 2006
  • Netherlands

#12

Posted 03 May 2009 - 06:47 PM

Mission Coding for Pro's!

From now on, this is a reaction topic for Mission Coding for Dummies and Mission Coding for Pro's. It is a project of PatrickW and myself. Good luck with all the tutorials. wink.gif

coin-god
  • coin-god

    High Roller

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

#13

Posted 03 May 2009 - 08:31 PM Edited by goin-god, 03 May 2009 - 08:33 PM.

I lol'd

Awesome work guys icon14.gif

Aschratt
  • Aschratt

    Three Headed Monkey

  • Members
  • Joined: 12 Apr 2006

#14

Posted 22 May 2009 - 02:00 PM Edited by Aschratt, 22 May 2009 - 02:08 PM.

QUOTE (Dutchy3010 @ May 3 2009, 19:47)
Mission Coding for Pro's!

From now on, this is a reaction topic for Mission Coding for Dummies and Mission Coding for Pro's. It is a project of PatrickW and myself. Good luck with all the tutorials. wink.gif

Great work! icon14.gif

I'd enjoyed reading the tutorials (espacially the last one). To write coding style guidelines it requires alot of knowledge and practical experience. While reading both tutorials you realy feel that both of the authors got it.

Anyway I'd got something to add. However those guidelines are great (Although I personally prefer the opcode-param notation... it is just a personal oppinion of myself since the "High-Level" representations are only synonyms for the opcodes in most cases), but you will get lost in huge code-files anyway. So I am talking about using SannyBuilder's directives, especially {$INCLUDE } which is a pretty usefull tool if you are working on complex scripts (Like a storyline or something in this way). $INCLUDE does nothing else than adding a predefined file to the position the directive is located. The content of this file of course needs to be SannyBuilder compatible plain text source code. As simple as this directive seems it has much power in readability of huge source. By splitting your script into multiple files and giving the files strong names descriping the content of the file in one or two words it drasticly reduces the time spent into searching for some special code.

For example I am using $INCLUDE for each thread I am creating in my script file. So what I did (remember - we are talking about big sources!) was creating a file corresponding to some kind of interface. It does nothing else than including all threads. So everything I had to do was including this file right below the main-routine in my main source file. The only thing you have to be aware is that you have opened the main tab in SB before compiling the script. Otherwise you could cause errors because of missing variable declarations or something in this way. As I said the directive is rudimentary and SB only knows sequential code, so it is not able to search for references of this file. Another weak point of course is that there is no way to prevent a multiple includes of one and the same file, but this would lead to errors during compile progress because of label redeclarations usualy. At least if you have created a label there... if not you should because of the reason descriped above... The behaviour can be compared to "#pragma once" from C/C++ then.

Another thing which could be improved is the part handling constant declares. For people switched over to SCM from C, Pascal or Java constants may be interprated as kinds of objects. For example have a look at this pseudo C-Code:
CODE
const int myVar = 0;

if(myVar == 0)
{
   printf("%d", myVar);
}
(Yes I know it does not make many sense at all - it is just an example - but in an similar way this could be used to create some kind of compile-time polymorphism which means that I can define code sequences which are only executed if an constant has an certain value. If it hasn't - the code can be seen as "waste" tounge.gif )
Now let's try to translate this code to SCM using const..end notation:
CODE
const
myVar = 0
end

:MY_PSEUDO_CODE
00D6: if
0038:   myVar == 0                     // ERROR!
004D: jump_if_false @SOMEWHERE_ELSE
045A: draw_text_1number 2.0 2.0 GXT 'NUMBER' number myVar
0002: jump @SOMEWHERE_ELSE
So the line marked as error does compile, but crash as soon as the game reaches this code segment, while the text-draw line (045A) does not crash. The reason is simple. Constants are no objects! They are just aliases. During compilation they are searched and replaced by their values. This can be strings, numbers or other constants (as the documentation of SB sais), where the other constants would cause some kind of recursion. Anyway now the compiler would get
CODE
0038:   0 == 0
which is valid since we have specified that the first value must be an global variable. But global variables are nothing else than numbers (something like addresses... for more info see an SCM documentation). So now the game reaches there and crashes, because 0 is no valid variable. I don't know what happens if you initialize "myVar" with something else than 0, but I guess it would crash or at least end in undefined behaviour - so do not do this!

That's all. As told above those are just points where I think they are worth to be mentioned. Especially the $INCLUDE directive is a great tool for readable code.

So far... greetings and thank's for the nice tutorial!
Keep it up,
- Aschratt.

billy7877
  • billy7877

    CRAZY Because Design Your Own Mission

  • Members
  • Joined: 30 Jan 2009

#15

Posted 22 May 2009 - 04:05 PM

Thank you very much for the tutorial!!

KornEL[HUN]
  • KornEL[HUN]

    a good txd editor

  • Members
  • Joined: 21 Jun 2009

#16

Posted 21 June 2009 - 06:06 PM

the custom save pickup doesnt work or i have f*cked up anything

i want to make a new save pickup at theese coordinates:

X 2335.42
Y -1141.08
Z 1053.80

can u help me?

(the new game starts but the save is not on its place)

there is the code what i ve used:

thread "SAVE"
$SAVE_X = 2335.42
$SAVE_Y = -1141.08
$SAVE_Z = 1053.8

:SAVE_38
0395: clear_area 1 at $SAVE_X $SAVE_Y $SAVE_Z radius 1.0
$SAVE_PICKUP = Pickup.Create(#PICKUPSAVE, 3, $SAVE_X, $SAVE_Y, $SAVE_Z)

:SAVE_74
wait 100
Pickup.Picked_up($SAVE_PICKUP)
else_jump @SAVE_74
$ONMISSION = 1
Player.CanMove($PLAYER_CHAR) = False
03D8: show_save_screen

:SAVE_106
wait 100
03D9: save_done
else_jump @SAVE_106
Pickup.Destroy($SAVE_PICKUP)

:SAVE_124
wait 100
Player.Defined($PLAYER_CHAR)
else_jump @SAVE_124
Camera.Restore_WithJumpCut
Camera.SetBehindPlayer
Player.CanMove($PLAYER_CHAR) = True
$ONMISSION = 0

:SAVE_158
wait 0
80EC: not actor $PLAYER_ACTOR 0 near_point 2310.32 -1141.08 radius 1053.8 2.0
else_jump @SAVE_158
jump @SAVE_38
end_thread

sorry for my bad english rampage_ani.gif !

Dutchy3010
  • Dutchy3010

    Female SCM coder!

  • Moderator
  • Joined: 30 Jul 2006
  • Netherlands

#17

Posted 21 June 2009 - 07:22 PM

I hope you are trying to create a pickup in an interior? Else the z-value is way too big.

You have to give some more information. Does the game crash? Can't you see the pickup? Where did you put that code?

trickstar34
  • trickstar34

    ATM, Money

  • BUSTED!
  • Joined: 14 Dec 2008

#18

Posted 21 June 2009 - 08:32 PM

How come you only mentioned mission start text style and don't show how to use it? I tried researching the main but the only thing I found was this and it didn't work. When I use it nothing happens.

CODE
054C: use_GXT_table 'CASIN10'

Dutchy3010
  • Dutchy3010

    Female SCM coder!

  • Moderator
  • Joined: 30 Jul 2006
  • Netherlands

#19

Posted 21 June 2009 - 08:48 PM

CODE
00BA: show_text_styled GXT 'BEEFY' time 3000 style 1

When you use 2 instead of 1 after style, you have the begin mission text. I explained that in the tutorial...

KornEL[HUN]
  • KornEL[HUN]

    a good txd editor

  • Members
  • Joined: 21 Jun 2009

#20

Posted 22 June 2009 - 06:45 AM

1yes its in an interior
2do not crash
3where need i put it???(MAIN.scm)

thx for the answer

KornEL[HUN]
  • KornEL[HUN]

    a good txd editor

  • Members
  • Joined: 21 Jun 2009

#21

Posted 23 June 2009 - 05:02 PM

can u write me the correct code?

plz do it for me!

jemahuk1
  • jemahuk1

    Player Hater

  • Members
  • Joined: 22 Jun 2009

#22

Posted 27 June 2009 - 12:32 PM

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

models 290-299 > What does it mean?

Dutchy3010
  • Dutchy3010

    Female SCM coder!

  • Moderator
  • Joined: 30 Jul 2006
  • Netherlands

#23

Posted 27 June 2009 - 01:32 PM

Everything behind // is a comment, that means that it won't be read. It's just for the scripter.

Every ped has it's own "slot". Every slot has a number. The special actor slots are 290-299.

PS: please don't reply in the other topic.

KornEL[HUN]
  • KornEL[HUN]

    a good txd editor

  • Members
  • Joined: 21 Jun 2009

#24

Posted 28 June 2009 - 12:12 PM

dutchy can u make a save pickup at X 2335.42 Y -1141.08 Z 1053.75?

P.S. it needs to a mod plz help me and srry for my bad english=] turn.gif

Dutchy3010
  • Dutchy3010

    Female SCM coder!

  • Moderator
  • Joined: 30 Jul 2006
  • Netherlands

#25

Posted 28 June 2009 - 01:49 PM

In what interior is it supposed to be?

KornEL[HUN]
  • KornEL[HUN]

    a good txd editor

  • Members
  • Joined: 21 Jun 2009

#26

Posted 28 June 2009 - 07:40 PM

i have completed it 5 minutes ago and i'll upload it now. thank you for the help and srry for my bad english=]

(and its the unused safehouse interior=D) tounge.gif

KornEL[HUN]
  • KornEL[HUN]

    a good txd editor

  • Members
  • Joined: 21 Jun 2009

#27

Posted 28 June 2009 - 07:46 PM

here is a download link!

http://www.thegtapla...ile.php?id=4169

hetment
  • hetment

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

  • Members
  • Joined: 03 May 2009

#28

Posted 02 July 2009 - 04:04 PM

Hey dutchy nice tutorial can you give me codes to make actor drive cars or heli??? because i can't find in tut... Please give smile.gif

gtasearcher
  • gtasearcher

    No sh*t.

  • Members
  • Joined: 26 Aug 2008

#29

Posted 02 July 2009 - 04:48 PM

QUOTE (hetment @ Jul 2 2009, 19:04)
Hey dutchy nice tutorial can you give me codes to make actor drive cars or heli??? because i can't find in tut... Please give smile.gif

Use opcode search.

Get into Sanny Builder, and press CTRL+ALT+2.

hetment
  • hetment

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

  • Members
  • Joined: 03 May 2009

#30

Posted 02 July 2009 - 05:15 PM

i mean like how to write it.... like kill_ actor....

I want how to type like this and get done




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users