Jump to content

Mine drop mod


GamerShotgun

Recommended Posts

GamerShotgun

Hi! I've tried out PatrickW's stinger drop mod, and got an idea about a mine drop mod...

BUT, im not a good coder at all, so i need help with the script to get it working...

 

Here's the code what i've done:

 

 

:Mine_Drop_Mod0001: wait 20 ms         00D6: if 00443: player $PLAYER_CHAR in_a_car004D: jump_if_false ££Mine_Drop_mod 00DA: $83C = player $PLAYER_CHAR car0407: create coordinate $coord_x $coord_y $coord_z from car $83C offset  0.0 -3.0  0.0 0247: request model #MINE0002: jump ££Mine_Drop_Mod_2:Mine_Drop_Mod_20001: wait 150 ms00D6: if 00248: model #MINE available004D: jump_if_false ££Mine_Drop_Mod038B: load requested models  0002: jump ££Mine_Drop_Mod_3:Mine_Drop_Mod_30001: wait 400 ms00D6: if 100DC:   player $PLAYER_CHAR driving  $83C00E1: key_pressed  0  17004D: jump_if_false ££Mine_Drop_mod_30107: $MINE = create object #MINE at $coord_x $coord_y $coord_z  01BB: store object $MINE position to $objcoord_x $objcoord_y $objcoord_z0002: jump ££Mine_Drop_Mod_4:Mine_Drop_Mod_40001: wait 300 ms00D6: if 004DA:   has object $MINE collided004D: jump_if_false ££Mine_Drop_Mod_4020C: create explosion with radius  1 at $objcoord_x $objcoord_y $objcoord_z0108: destroy object $MINE0002: jump ££Mine_Drop_Mod

 

 

When i start a new game, and enter in a car, my game crashes dontgetit.gif

 

I would appreciate some help!

Link to comment
Share on other sites

 

Hi! I've tried out PatrickW's stinger drop mod, and got an idea about a mine drop mod...

BUT, im not a good coder at all, so i need help with the script to get it working...

 

Here's the code what i've done:

 

 

When i start a new game, and enter in a car, my game crashes  dontgetit.gif

 

I would appreciate some help!

Try this, not tested..

 

 

 

:Mine_Drop_Mod0247: request model #MINE038B: load requested models  :Mine_Drop_Mod_L0001: wait 20 ms         00D6: if 00443: player $PLAYER_CHAR in_a_car004D: jump_if_false ££Mine_Drop_mod 00DA: $83C = player $PLAYER_CHAR car0407: create coordinate $coord_x $coord_y $coord_z from car $83C offset  0.0 -3.0  0.0 :Mine_Drop_Mod_20001: wait 150 ms00D6: if 00248: model #MINE available004D: jump_if_false ££Mine_Drop_Mod2:Mine_Drop_Mod_30001: wait 400 ms00D6: if 100DC:   player $PLAYER_CHAR driving  $83C00E1: key_pressed  0  17004D: jump_if_false ££Mine_Drop_mod_30107: $MINE = create object #MINE at $coord_x $coord_y $coord_z  0249: release model #MINE01BB: store object $MINE position to $objcoord_x $objcoord_y $objcoord_z0002: jump ££Mine_Drop_Mod_40001: wait 300 ms00D6: if 004DA:   has object $MINE collided004D: jump_if_false ££Mine_Drop_Mod_4020C: create explosion with radius  1 at $objcoord_x $objcoord_y $objcoord_z0108: destroy object $MINE0002: jump ££Mine_Drop_Mod_L

 

 

I have removed some unnessesary jumps, now, as an excercise. Try to figure out what I've done more.

Link to comment
Share on other sites

@MasterK: Before using commands that refer to the player, you need to use an if player defined check. Code runs linearly, so you will never need a command to jump to the very next line. Is loaded checks should loop to themselves. Also, they should have a wait 0. You shouldn't be capturing the car until the trigger is satisfied. grovespaz's idea of keeping the mine model loaded might be a good idea; Still, you should make the triggering check an is driving AND button pressed check. Furthermore, once you're done grabbing the offsets from the car, you should remove_references to the car. Otherwise, the game will crash in time. You should be using local vars instead of global to save overall space. Finally, the code is written so that only one mine can be dropped at a time, but that's something to expand on later if you choose to.

 

@grovespaz: Teaching a new person to keep a model loaded always probably isn't the best idea. Also, I've been told that load requested models was NOP'ed in SA, so you can skip it altogether.

Link to comment
Share on other sites

 

Also, I've been told that load requested models was NOP'ed in SA, so you can skip it altogether.

'Fraid I'm gonna have to disagree with you sir. All the ini's I've seen still have it listed. My own testing shows a faster and more consistent rate of loading models by using this opcode vs not using it. Is it a HUGE difference? It is to me, but loading and unloading models is my bread and butter. Average users probably won't see a difference, but I just wanted to point out that it does work as intended, and there is a (slight) performance increase.

 

Just sayin' is all. smile.gif

 

EDIT: The original SA main.scm uses this all over the place, so I doubt it'd be NOP'd.

Edited by ceedj
Link to comment
Share on other sites

Original code has jumps after returns and the setting of variables immediately before checking if that var is ANOTHER value. So that's no proof. Just the same, I made sure to let the person know that I had only heard. Thought it was a respectable source. Thank you for the correction.
Link to comment
Share on other sites

038B: load_requested_models is not a NOP opcode.

 

I think its meaning is not only to load requested models but also to see how the game perfomance changes during this process. R* probably used this opcode as a kind of optimization measure for models: if some ones cause the perfomance to be reduced, they made it lighter to get optimal variant.

 

They also counts the perfomance frequency in opcode 0417 (start_mission where the mission data are copied from main.scm to the mission block), while loading GXTs, reading cutscenes data and so forth.

 

 

 

ontopic: I made such mode for VC while agooo. This is it, but some opcodes need to be changed (03C1 -> 03C0).

 

 

:Mines03A4: name thread "MINES"0004: $mines =  0;; integer values0213: $pickup_mine = create pickup #mine type 14 at 38.43125 -1089.187 9.8:Mines10001: wait 250 ms00D6: if  00256:   player $PLAYER_CHAR defined004D: jump_if_false ££Mines100D6: if  00214:   pickup $pickup_mine picked up004D: jump_if_false ££Mines203C1: 1@ = player $PLAYER_CHAR car01C3: remove references to car 1@0008: $mines +=  5;; integer values008B: 0@ = $mines;; integer values and handles004F: create thread ££CreateMine:Mines20001: wait  0 ms00D6: if  00442:   player $PLAYER_CHAR in_car 1@004D: jump_if_false ££Mines3008A: $mines =  0@;; integer values and handles00D6: if  00018:   $mines > 0;; integer values004D: jump_if_false ££Mines404F7: status text $mines 0 line 1 "MINES";; MINES:00D6: if  000E1:   key pressed  0  17004D: jump_if_false ££Mines10407: create_coordinate  3@ 4@ 5@ from_car 1@ offset  0.0 -2.5  -.50213: 2@ = create pickup #mine type 11 at 3@ 4@ 5@000C: $mines -=  1;; integer values008B: 0@ = $mines;; integer values and handles0001: wait 1000 ms0002: jump ££Mines1:Mines30004: $mines = 0;; integer values:Mines40151: remove status text $mines0002: jump ££Mines1:CreateMine0001: wait 25000 ms0213: $pickup_mine = create pickup #mine type 14 at 38.43125 -1089.187 9.8004E: end thread

 

 

 

MasterK;

 

You're using 00DA which is unsupported in SA. Please, specify for what game you're writing this mod.

Edited by Seemann
Link to comment
Share on other sites

GamerShotgun

Uhm, sorry i didn't mentioned that.. I wanted to make this mod for vice city...

 

Thanks for the response, will post here in 30 minutes. If the code'll work, then u'r almighty...

 

 

Link to comment
Share on other sites

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
  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

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