Jump to content

[SA] How to get a random front bumper of a random car as weapon?


Recommended Posts

MrGTAmodsgerman

Hey,
I wanna make a mod that can use the front bumper of any traffic car as weapon.
I find many opcodes but now Sanny Builder dont let me compile my script.

{$VERSION 3.1.0027}{$CLEO .cs}//-------------MAIN---------------:NONAME_2wait 0ifPlayer.Defined($PLAYER_CHAR)jf @NONAME_20006: 5@ = -1if053E: 5@ = get_random_car_with_model -1 in_rectangle_cornerA 1@ 2@ cornerB 11@ 12@004D: jump_if_false @NONAME_201C3: remove_references_to_car 5@ // Like turning a car into any random carif and0AB0: key_pressed 1090006: 15@ = 1300D6: if8491:   not actor $PLAYER_ACTOR has_weapon 15@004D: jump_if_false @NONAME_201B2: give_actor $PLAYER_ACTOR weapon 15@ ammo 1 // Load the weapon model before using thisjf @NONAME_20006: 10@ = remove_componentA (5)0689: set_car 5@ 10@ visible_effect_flag 1070A: AS_actor $PLAYER_ACTOR attach_to_object 15@ offset 0.0 0.0 0.0 on_bone 6 16 perform_animation "NULL" IFP_file "NULL" time -10001: wait 10 ms01B9: set_actor $PLAYER_ACTOR armed_weapon_to 15@029B: 5@ = init_object #BRASSKNUCKLE at 0.0 0.0 0.00249: release_model #BRASSKNUCKLE0400: store_coords_to 2@ 3@ 4@ from_object 5@ with_offset 0.08 0.03 0.140400: store_coords_to 5@ 6@ 7@ from_object 5@ with_offset 1.58 0.03 2.14jump @NONAME_50:NONAME_50wait 0if0AB0: key_pressed 107jf @NONAME_50068A: set_car 5@ repair_componentA (5)wait 0jump @NONAME_2

Sanny Builder tell me, i need 2 more parameters at line 25.

But how? what is the problem?

 

 

I hope i can get help.


PS: Where i can find all Cleo opcodes and that other stuff?

Here is a modpreview, that is what i mean

fm544w.png

Your script have some stock failures, you're bloody newbie, but you have a crazy plan.
Forget ideas with random cars and learn first scripting by writing simple scripts

model load for weapon model is missing

else jump is missing:

if and0AB0: key_pressed 109


Line 21 didn't compile

0006: 10@ = remove_componentA (5)

because wrong opcode

 

---------------------------------------------------------------------------

Find codes:
Basicly we have the opcodes "listed" in the Sanny Builder install dir\data\sa\sascm.ini
it's a text file and contains the code translations for the compiler
but the code translations' format is unsuitable for using in scripts

Find opcodes by using opcode search tool: Choose TOOLS on menue, then IDE Tools >> Opcode Search
Sanny Builder searchs then in Sanny istall dir\data\sa\opcodes.txt
Codes of Rockstar as well these for cleo3 and cleo4 are listed in a usefull format

You can make your own opcodes.txt by decompiling the original main.scm into sannybuilder and have it open in the editors window, then choose TOOLS on sanny menue, then: make opcodes.txt but then the cleo opcodes are missing
Btw., it makes sense to study and work with main.scm, looking how rockstar used codes.


Also find cleo opcodes in Sannybuilder Help: CLEO 3 : Code Library > CLEO 3: opcodes

Cleo4 opcodes aren't documented very well

Find opcode descriptions at http://gtag.gtagaming.com/opcode-database/

---------------------------------------------------------------------------
---------------------------------------------------------------------------

In addition, there is a second kind of syntax: writing classes instead opcodes
with opcode:

029B: 5@ = init_object #BRASSKNUCKLE at 0.0 0.0 0.0

as classes:

5@ = Object.Init(#BRASSKNUCKLE, 0.0, 0.0, 0.0)

Remember to make the setting in TOOLS > Options > GENERAL: "writing opcodes"
(in german: Programme > Optionen > Allgemein: "opcodes schreiben")
...to choose between two kinds of syntax when you decompile scripts

Atvantage of "writing opcodes": the opcode itself (4 digits e.g. 029B:) is a helpfull identifier
Disatvantage of "writing opcodes": much text and numbers makes the script unclear, especially this: 004D: jump_if_false @

Atvantage of "writing without opcodes": the script is more clear
especially the "if" and "jump_if_false"
a script snippet as example

without opcodesifPlayer.Defined($PLAYER_CHAR)jf @NONAME_2
with opcodes00D6: if 0256:   player $PLAYER_CHAR defined 004D: jump_if_false @OTTACH_11


Disatvantage of "writing without opcodes": the need of comma separation

5@ = Object.Init(#BRASSKNUCKLE, 0.0, 0.0, 0.0)

---------------------------------------------------------------------------

 

Sannybuilder allows to merge lines of both syntax

 

---------------------------------------------------------------------------
---------------------------------------------------------------------------

the opcodes.txt doesn't contain Classes unless you make your own opcodes.txt as descripted above by decompiling main.scm "without opcode"
or you add this to sannys opcode.txt

Actor.DestroyInstantly(18@)Actor.DestroyWithFade(2@)Actor.LockInCurrentPosition($PLAYER_ACTOR) = TrueActor.PutAt($PLAYER_ACTOR, 345.5621, 306.2212, 998.4484)Actor.RemoveFromMissionCleanupList(1@)Actor.RemoveReferences(2@)Actor.SetCarWeapon($PLAYER_ACTOR, 38, 200000)Actor.SetImmunities(2@, 0, 0, 1, 1, 0)Actor.StoreDeadActorPos(72@(43@,4i), $TEMPVAR_FLOAT_1, $TEMPVAR_FLOAT_2, $TEMPVAR_FLOAT_3)Actor.StorePos($PLAYER_ACTOR, $TEMPVAR_FLOAT_1, $TEMPVAR_FLOAT_2, $TEMPVAR_FLOAT_3)Camera.OnPed(215@, 15, 2)Camera.OnVehicle(34@, 18, 2)Camera.PointAt(665.8948, -479.5685, 16.4175, 2)Camera.RestoreCamera.Restore_WithJumpCutCamera.SetAtPos(2488.562, -1666.865, 13.3757)Camera.SetBehindPlayerCamera.SetPosition(664.9277, -479.6112, 16.1668, 0.0, 0.0, 0.0)Camera.Shake(40)Car.Destroy(22@)Car.DoorStatus(0@) = 4Car.DriveTo(99@, 252@, 253@, 254@)Car.ImmuneToNonPlayer(69@) = TrueCar.LockInCurrentPosition(22@) = TrueCar.PutAt(22@, -1577.942, 52.6333, 40.0)Car.RemoveReferences($IMPORT_CAR)Car.SetAnimation(77@, 3, 6000)Car.SetDriverBehaviour(62@, 5)Car.SetImmunities(0@, 1, 1, 1, 1, 1)Car.SetMaxSpeed(36@, 10.0)Car.SetSpeedInstantly(34@, 0.0)Car.SetToNormalDriver(54@)Car.SetToPsychoDriver(44@)Car.StorePos(0@, 3@, 4@, 5@)Car.ToggleHydraulics(69@) = TrueCar.ToggleTaxiLight(87@) = False Garage.Activate('VECMOD')Garage.ChangeType('MICHDR', 5)Garage.Close('MICHDR')Garage.Deactivate('BEACSV')Garage.Open('BURG_LK')Garage.SetToAcceptCar('HBGDSFS', $1867) Marker.Disable($MARKER_CATALINA)Marker.SetColor(42@, 1)Marker.SetIconSize(45@, 2)Marker.TieToCar(341@, 340@, 0, 1)Model.Destroy($IMPORT_CARS_MODEL($IMPORT_PANEL_ROW,6i))Model.Load($IMPORT_CARS_MODEL($IMPORT_PANEL_ROW,6i))Object.CollisionDetection(0@) = TrueObject.Destroy($WANTED_LIST_OBJECT)Object.Indestructibility($GIRLDOORS[0]) = FalseObject.KeepInMemory(0@) = TrueObject.PutAt(0@, $TEMPVAR_FLOAT_1, $TEMPVAR_FLOAT_2, $TEMPVAR_FLOAT_3)Object.RemoveFromMissionCleanupList(27@)Object.RemoveReferences(82@(39@,16i))Object.SetImmunities($GIRLDOORS[0], 1, 1, 1, 1, 1)Object.StorePos(0@, $TEMPVAR_FLOAT_1, $TEMPVAR_FLOAT_2, $TEMPVAR_FLOAT_3)Object.Throw(0@, 23@, 24@, 25@)Object.ToggleInMovingList(0@) = TruePickup.Destroy($BUY_ASSET_PICKUPS[0])Player.Build($PLAYER_CHAR)Player.CanMove($PLAYER_CHAR) = TruePlayer.ClearWantedLevel($PLAYER_CHAR)Player.InfiniteRun($PLAYER_CHAR) = FalsePlayer.MakeSafe($PLAYER_CHAR)Player.SetClothes($PLAYER_CHAR, "VEST", "VEST", Torso)Player.SetDrunkVisuals($PLAYER_CHAR, 100)Player.SetHandlingResponsiveness($PLAYER_CHAR, 145@)Player.SetMinWantedLevel($PLAYER_CHAR, 2)Player.SprintMode($PLAYER_CHAR) = False

as well one important code which is allways missing because it's from xbox game version

to change the player model:

09C7: change_player $PLAYER_CHAR model_to #FAM1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 0 User Currently Viewing
    0 members, 0 Anonymous, 0 Guests

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.