Jump to content
    1. Welcome to GTAForums!

    1. GTANet.com

    1. GTA Online

      1. Los Santos Drug Wars
      2. Updates
      3. Find Lobbies & Players
      4. Guides & Strategies
      5. Vehicles
      6. Content Creator
      7. Help & Support
    2. Red Dead Online

      1. Blood Money
      2. Frontier Pursuits
      3. Find Lobbies & Outlaws
      4. Help & Support
    3. Crews

    1. Grand Theft Auto Series

      1. Bugs*
      2. St. Andrews Cathedral
    2. GTA VI

    3. GTA V

      1. Guides & Strategies
      2. Help & Support
    4. GTA IV

      1. The Lost and Damned
      2. The Ballad of Gay Tony
      3. Guides & Strategies
      4. Help & Support
    5. GTA San Andreas

      1. Classic GTA SA
      2. Guides & Strategies
      3. Help & Support
    6. GTA Vice City

      1. Classic GTA VC
      2. Guides & Strategies
      3. Help & Support
    7. GTA III

      1. Classic GTA III
      2. Guides & Strategies
      3. Help & Support
    8. Portable Games

      1. GTA Chinatown Wars
      2. GTA Vice City Stories
      3. GTA Liberty City Stories
    9. Top-Down Games

      1. GTA Advance
      2. GTA 2
      3. GTA
    1. Red Dead Redemption 2

      1. PC
      2. Help & Support
    2. Red Dead Redemption

    1. GTA Mods

      1. GTA V
      2. GTA IV
      3. GTA III, VC & SA
      4. Tutorials
    2. Red Dead Mods

      1. Documentation
    3. Mod Showroom

      1. Scripts & Plugins
      2. Maps
      3. Total Conversions
      4. Vehicles
      5. Textures
      6. Characters
      7. Tools
      8. Other
      9. Workshop
    4. Featured Mods

      1. Design Your Own Mission
      2. OpenIV
      3. GTA: Underground
      4. GTA: Liberty City
      5. GTA: State of Liberty
    1. Rockstar Games

    2. Rockstar Collectors

    1. Off-Topic

      1. General Chat
      2. Gaming
      3. Technology
      4. Movies & TV
      5. Music
      6. Sports
      7. Vehicles
    2. Expression

      1. Graphics / Visual Arts
      2. GFX Requests & Tutorials
      3. Writers' Discussion
      4. Debates & Discussion
    1. Announcements

    2. Forum Support

    3. Suggestions

Object explode on impact


Another GTA Fan
 Share

Recommended Posts

Another GTA Fan

I've created a script that creates an object that can be thrown; Works pretty much like the grenades in the game, though the thing I can't seem to do is make them explode on impact like the Molotov Cocktail.

 

To put it simple: How do I make it so they explode on impact like the Molotovs? At least what coding am I missing to make this so?

Link to comment
Share on other sites

IF HAS_OBJECT_COLLIDED_WITH_ANYTHING (obj)    GET_OBJECT_COORDINATES (obj) (x,y,z)    ADD_EXPLOSION (x, y, z, 0)    DELETE_OBJECT (obj)ENDIF

I guess this could work,haven't tested though.

Link to comment
Share on other sites

Another GTA Fan
IF HAS_OBJECT_COLLIDED_WITH_ANYTHING (obj)    GET_OBJECT_COORDINATES (obj) (x,y,z)    ADD_EXPLOSION (x, y, z, 0)    DELETE_OBJECT (obj)ENDIF

I guess this could work,haven't tested though.

 

I honestly couldn't find them in the op code search feature in SannyBuilder, unless I'm using them wrong.

 

if

04DA: has_object [email protected] collided

then

Object.StorePos([email protected], [email protected] [email protected] [email protected]

020C: create_explosion_with_radius 0 at [email protected] [email protected] [email protected]

object.Destroy([email protected])

end

That's how I originally coded the script, but 04DA doesn't seem to work for me. I've tried that code loads of times and it just doesn't want to work for me.

As of now, I'm using 05A3 to check if the object has stopped, and that works, but 04DA doesn't. Is there any reason why? Because checking to see if the object has stopped takes too long which is why I'd love to get 04DA to work instead so it's an impact thing.

Link to comment
Share on other sites

it has to be in a loop

see this script

:startwaai 0if 00E1:   player 0 pressed_key 7 // Ejf @SPH_15A7 04ED: load_animation "GRENADE" Model.Load(1598)jump @SPH_14AB :SPH_14AB04C4: store_coords_to [email protected] [email protected] [email protected] from_actor $PLAYER_ACTOR with_offset 0.0 2.0 0.5 0812: AS_actor $PLAYER_ACTOR perform_animation "WEAPON_THROW" IFP "GRENADE" framedelta 4.0 loopA 0 lockX 0 lockY 0 lockF 0 time -1 // versionB wait 70 [email protected] = Object.Init(1598, [email protected], [email protected], [email protected])Object.ToggleInMovingList([email protected]) = True08D2: object [email protected] scale_model 0.1 04D9: object [email protected] set_scripted_collision_check 1 Object.CollisionDetection([email protected]) = TrueObject.Indestructibility([email protected]) = True0906: set_object [email protected] mass_to 10000.0 // float [email protected] = Actor.Angle($PLAYER_ACTOR)0819: [email protected] = actor $PLAYER_ACTOR distance_from_ground [email protected] = 140.1 02F6: [email protected] = sine [email protected] // (float) 02F7: [email protected] = cosine [email protected] // (float) 006B: [email protected] *= [email protected] // (float) 006B: [email protected] *= [email protected] // (float) [email protected] *= -1.0 [email protected] += 3.0 Object.Throw([email protected], [email protected], [email protected], [email protected])Object.RemoveReferences([email protected])[email protected] = 1 jump @SPH_15A7 :SPH_15A7if   [email protected] == 1 jf @SPH_16DE if 03CA:   object [email protected] exists jf @SPH_16DE 0400: store_coords_to [email protected] [email protected] [email protected] from_object [email protected] with_offset 0.0 0.0 0.0 04D5: create_corona_at [email protected] [email protected] [email protected] radius 6.5 type 1 flare 1 RGB 200 0 0 095C: create_smoke_at [email protected] [email protected] [email protected] velocity 0.0 0.0 0.0 RGBA 0.0 0.0 1.0 1.0 size 0.1 last_factor 0.1 09E5: create_flash_light_at [email protected] [email protected] [email protected] RGB_mask 200 0 0 radius 200.0 jump @SPH_1657 :SPH_1657if 03CA:   object [email protected] exists jf @SPH_16DE if or04E7:   object [email protected] in_water 04DA:   has_object [email protected] collided jf @SPH_16DE 0400: store_coords_to [email protected] [email protected] [email protected] from_object [email protected] with_offset 0.0 0.0 0.0 0948: create_explosion_at [email protected] [email protected] [email protected] type 10 camera_shake 0.2 if 03CA:   object [email protected] exists jf @SPH_16D0 Object.Destroy([email protected])Model.Destroy(1598):[email protected] = 0wait 0:SPH_16DEjump @start
Edited by Sanmodder
Link to comment
Share on other sites

That's how I originally coded the script, but 04DA doesn't seem to work for me. I've tried that code loads of times and it just doesn't want to work for me.

not all objects detect collision to everything, peds, cars, mapobjects

use one of these objects:

1598, beachball

3065, BBALL_col

2891, kmb_packet

3054, DYN_WREKING_BALL

1305, dyn_quarryrock01

1582, pizzabox, prop_pizzabox

Link to comment
Share on other sites

Another GTA Fan

It works! Thank you @Sanmodder and @ZAZ

 

I changed it to the beachball and looped it as you both said, and it's working perfectly :^:

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
 Share

  • 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.