Mission Coding for Dummies - Pickups

A Tutorial for Grand Theft Auto: San Andreas

Attention Gamer! We are one of the oldest mod sites on the Interwebs. Sign up and maximize your browsing experience.

  • Subscribe: Get notified of new submissions like this.
  • Say Thanks: Show your appreciation by sending Arman Ossi Loko points.
  • Post: Give Arman Ossi Loko your thoughts on this Tutorial.
  • Vote: Help Arman Ossi Loko win the Monthly Awards.
  • Rate: Give this Tutorial a rating out of 10.
  • Flag: Alert moderators and warn members of a problem with this Tutorial.
  • Watch: Get notified when this Tutorial is updated.
Mascot

Sound fun?

Sign up

Already a Bananite? Login

Pickups What does this topic really miss! Indeed, a tutorial about pickups. So that is what this tutorial is all about. General Pickups CODE > 0213: $HEALTH = create_pickup #HEALTH type 3 at 2490.5598 -1658.3495 13.3528 This is the opcode to create a pickup. First the handle, so you can give it properties (like a marker) later on. Then you have to give a model for the pickups: Health: #HEALTH Armor: #BODYARMOUR Bribe: #BRIBE Info: #INFO Keycard: #KEYCARD Save pickup: #PICKUPSAVE Rhymesbook: #RMB_RHYMESBOOK Briefcase: #BRIEFCASE Clothes: #CLOTHESP Jetpack: #JETPACK Parachute Pack: #PARA_PACK Parachute: #PARACHUTE After type, you have to say if it is never available (1), once available (3) or multiple times available (15). There are other types, but these are the most common. If you want to see a full list of the types, you can look at this page. In this case, you can only pick up the HEALTH pickup once. The final three parameters are the coordinates. Weapon Pickups CODE > 0213: $BAT= create_pickup #BAT type 3 at 2490.5598 -1658.3495 13.3528 This opcode, which is the same as the opcode above, can also be used for weapons. But you can't give it ammo, so most of the times it is only used for melee weapons. When you create other weapon pickups, like a minigun, the ammo will be a standard value standard. For a minigun it is 500, for a rocket launcher it is only 4. So you can make all weapon pickups with this opcode, but it is more common to use the following: CODE > 032B: $M4 = create_weapon_pickup #M4 group 15 ammo 150 at 2490.5598 -1658.3495 13.3528 This is almost the same as 0213, but now you have to give it some ammo. So when you are using this opcode, it will spawn a M4 multiple times, with an ammo of 150 at 2490.5598 -1658.3495 13.3528. Money Pickups It is also possible to create money pickups, with the following opcode: CODE > 02E1: $MONEY = create_cash_pickup 500 at 2490.5598 -1658.3495 13.3528 permanence_flag 1 $MONEY is, of course, the handle. 500 is the amount of money which the player gets when he picked up the money. After that there are the coordinates. When the flag is 1, the money is permanently. It won't disappear until the player gets it. When the flag is 0, it will disappear after 30 seconds. Asset Pickups There are two kind of asset pickups: available and unavailable assets. The available can be bought by the player, the unavailable not yet. CODE > 0517: $asset = create_unavailable_asset_pickup 'PROP_4' at 2490.5598 -1658.3495 13.3528 > 0518: $asset2 = create_available_asset_pickup 'PROP_3' at 2489.5598 -1658.3495 13.3528 price 1 The first is the unavailable asset. When the player is near the pickup, the text 'PROP_4" will be displayed (You cannot buy this property yet.). The second is the available asset. Behind price you have to fill in the price of the property. Collectables Pickups You can create a horseshoe, a photo opportunity or a oyster with the following opcodes. I added a weapon pickup for the camera, because otherwise you can't see the photo opportunity when you are checking it ingame. CODE > 032B: $camera = create_weapon_pickup #CAMERA 15 ammo 50 at 2488.5598 -1663.3495 13.3528 > 0959: $horse = create_horseshoe_at 2490.5598 -1658.3495 13.3528 > 0958: $photo = create_photo_at 2489.5598 -1658.3495 13.3528 > 095A: $oyster = create_oyster_at 2488.5598 -1658.3495 13.3528 Other opcodes concerning pickups CODE > 0213: $BAT = create_pickup #BAT type 3 at 2490.5598 -1658.3495 13.3528 > 03DC: 1@ = create_marker_above_pickup $BAT With this opcode you can create a marker above the pickup, just like we did in the tutorial about markers and spheres. CODE > 0214: pickup $BAT picked_up > 8214: not pickup $BAT picked_up These opcodes are conditions. You can use it to check if the player picked up the pickup. For example: CODE > 0213: $BAT = create_pickup #BAT type 3 at 2490.5598 -1658.3495 13.3528 > repeat > wait 0 > until 0214: pickup $BAT picked_up Sometimes you want to destroy the pickup. You can do it like this: CODE > 0213: $BAT = create_pickup #BAT type 3 at 2490.5598 -1658.3495 13.3528 > wait 2000 > 0215: destroy_pickup $BAT So the pickup will be created, and after 2 seconds, it will disappear. Now we will make a small script. First we will spawn three pickups: An asset for 100 dollar, a health and a minigun weapon pickup. Above the minigun weapon pickup, there has to be a marker. After the player picked up the minigun, the marker has to disappear, and there has to spawn an actor. The actor also holds a minigun, and we will set her health and accuracy. The actor will try to kill the player, and the player has to kill the actor. When the player kills the actor, he will get 100 dollar, and he can buy the asset. Then we will display a text. First we are going to spawn three pickups and a marker above the minigun: CODE > 0518: $ASSET = create_available_asset_pickup 'PROP_3' at 2487.5598 -1658.3495 13.3528 price 100 > 0213: $HEALTH = create_pickup #HEALTH type 3 at 2484.5598 -1658.3495 13.3528 > 032B: $MINIGUN = create_weapon_pickup #MINIGUN group 15 ammo 5000 at 2490.5598 -1658.3495 13.3528 > 03DC: 1@ = create_marker_above_pickup $MINIGUN Now we have to wait until the player picked up the minigun, and then we have to let the marker disappear and create the actor (with some properties): CODE > repeat > wait 0 > until 0214: pickup $MINIGUN picked_up > > 0164: disable_marker 1@ > > 0247: load_model #BFYST > 0247: load_model #MINIGUN > 038B: load_requested_models > > :MODEL_LOAD > if and > 8248: not model #BFYST available > 8248: not model #MINIGUN available > else_jump @MODEL_SPAWN > wait 0 ms > jump @MODEL_LOAD > > :MODEL_SPAWN > 10@ = Actor.Create(CIVFEMALE, #BFYST, 2488.5601, -1680.84, 13.3438 ) > 01B2: give_actor 10@ weapon 38 ammo 500 // Load the weapon model before using this > 02E2: set_actor 10@ weapon_accuracy_to 90 > 0223: set_actor 10@ health_to 1000 The actor has to attack the player. After that, the code has to wait until the player kills the actor. As a reward, the player will get 100 dollar. CODE > 05E2: AS_actor 10@ kill_actor $PLAYER_ACTOR > > repeat > wait 100 > until 0118: actor 10@ dead > > 0109: player $PLAYER_CHAR money += 100 Finally we will check if the asset is picked up, and we will display a text. CODE > repeat > wait 100 > until 0214: pickup $ASSET picked_up > > 00BC: show_text_highpriority GXT 'MCAT07E' time 3000 flag 1 [The complete code in a stripped main.scm! ](http://pastebin.com/fb9ea890 "")

Posts

None found

Share

Shareable Image:
Share banner
HTML embed code:
BB embed code:
Markdown embed code:

More embeddable images

Bookmark and Share

Credits

Original Authors
Dutchy3010

Submitter

Arman Ossi Loko avatar
Arman Ossi Loko avatar Lurkin'
Admin Joined 10y
71,925 points Ranked 56th
63 medals 9 legendary 16 rare
  • GTAV First Adopter Medal icon
  • Submitted 15 Tools Medal icon
  • Submitted 30 Tutorials Medal icon
  • 1st place - 2015 Uberstyles Contest Medal icon
  • Achieved Admin clearance Medal icon
  • 15+ Entries! GameBanana’s Christmas Giveaway 2015 Medal icon

Arman Ossi Loko avatar
Arman Ossi Loko
KOPASSUS Incorporated Flag
KOPASSUS Incorporated

Redistributor
Are you the owner? Request Ownership
Sign up to access this!
Sign up to access this!
Sign up to access this!
Sign up to access this!

Category

Details

Difficulty Level
Beginner Difficulty

Attributes

Stats

Posts
0
Views
3,750
Date Added
5y
Date Modified
4y
bcp.crwdcntrl.net tracking pixel