Quantcast

Jump to content

» «
Photo

Can anyone make a mod where cars explode when a train hits it?

4 replies to this topic
gtatrainlover
  • gtatrainlover

    Square Civilian

  • Members
  • Joined: 05 Jul 2012

#1

Posted 10 October 2013 - 10:18 PM

Hello World,

This is one of my personal request:can anyone make a CLEO mod where as soon as a vehicle gets hit by a train it explodes like in GTA2 and LCS and in the mission ¨Wrong Side Of The Tracks¨.


Silent
  • Silent

    Chief Fixing Officer

  • GTA Mods Staff
  • Joined: 01 Feb 2010
  • Poland
  • Contribution Award [Mods]
    Best Script/Plugin 2014 [SilentPatch]
    Most Respected 2014
    Most Helpful [Mods] 2014
    Most Helpful [GTA] 2013
    Most Helpful [Mods] 2013
    Most Talented [Modding] 2013
    Best Map 2013 [ViceCityStories PC Edition]
    Best Vehicle 2013 [III Aircraft]
    Most Helpful [Mods] 2012
    Modder of the Year 2012

#2

Posted 13 October 2013 - 01:29 PM Edited by SilentPL, 15 October 2013 - 12:49 PM.

Alhough there is a pinned request topic, I liked the concept and decided to make it.

Warning: untested!

[fixed code below]

Compiled code:
https://dl.dropboxus...rain_explode.cs
  • gtatrainlover likes this

gtatrainlover
  • gtatrainlover

    Square Civilian

  • Members
  • Joined: 05 Jul 2012

#3

Posted 13 October 2013 - 10:23 PM

Alhough there is a pinned request topic, I liked the concept and decided to make it.

Warning: untested!
 

{$CLEO}
{
    Vehicles explode when hit by a train
    Made by Silent
}
VAR
    0@      : Int
    1@      : Int
    2@      : Int
    3@      : Int
    4@      : Int
    5@      : Int
    6@      : Int
    7@      : Int
    8@      : Int
    9@      : Int
    10@     : Int
END
// Read CPool<CVehicle,CHeli> ptr
READ_MEMORY 0xB74494 4 FALSE 0@
// Read a pointer to entries array...
READ_MEMORY 0@ 4 FALSE 1@
// ...uID array pointer...
0@ += 0x4
READ_MEMORY 0@ 4 FALSE 2@
// ...and pool size
0@ += 0x4
READ_MEMORY 0@ 4 FALSE 3@

WHILE TRUE
    WAIT 100

    // Iterate through entire pool
    4@ = 0
    5@ = 1@
    6@ = 2@
    WHILE 3@ > 4@
        READ_MEMORY 6@ 1 FALSE 7@
        IF IS_BIT_SET 7@ 7
        THEN
            // Valid vehicle, let's check if it's not a train
            0A8E: 8@ = 5@ + 0x590
            READ_MEMORY 8@ 4 FALSE 9@
            IF NOT 9@ == 6
            THEN
                // It's not a train, let's see if it was damaged by a train
                0A8E: 8@ = 5@ + 0xDC
                READ_MEMORY 8@ 4 FALSE 8@
                IF NOT 8@ == 0
                THEN
                    // Now the tricky part
                    0A8E: 10@ = 8@ + 0x36
                    9@ = 0
                    READ_MEMORY 10@ 1 FALSE 9@
                    CLEAR_BIT 9@ 3
                    CLEAR_BIT 9@ 4
                    CLEAR_BIT 9@ 5
                    CLEAR_BIT 9@ 6
                    CLEAR_BIT 9@ 7
                    IF 9@ == 2  // Is damage entity a vehicle?
                    THEN
                        0A8E: 10@ = 5@ + 0x590
                        READ_MEMORY 10@ 4 FALSE 9@
                        IF 9@ == 6  // Is a train?
                        THEN
                            // Let's get its SCM handle and explode it then
                            CALL_METHOD_RETURN 0x424160 0@ 1 0 5@ 9@
                            IF NOT IS_CAR_DEAD 9@
                            THEN
                                EXPLODE_CAR 9@
                            END
                        END
                    END
                END
            END
        END
        4@ += 1
        5@ += 0xA18
        6@ += 1
    END
END
Compiled code:
https://dl.dropboxus...rain_explode.cs

 

it didnt work. the car doesnt explode.Try fixing it please


Silent
  • Silent

    Chief Fixing Officer

  • GTA Mods Staff
  • Joined: 01 Feb 2010
  • Poland
  • Contribution Award [Mods]
    Best Script/Plugin 2014 [SilentPatch]
    Most Respected 2014
    Most Helpful [Mods] 2014
    Most Helpful [GTA] 2013
    Most Helpful [Mods] 2013
    Most Talented [Modding] 2013
    Best Map 2013 [ViceCityStories PC Edition]
    Best Vehicle 2013 [III Aircraft]
    Most Helpful [Mods] 2012
    Modder of the Year 2012

#4

Posted 15 October 2013 - 12:50 PM

OK, fixed it, now works fine:

{$CLEO}
{
    Vehicles explode when hit by a train
    Made by Silent
}
VAR
    0@      : Int
    1@      : Int
    2@      : Int
    3@      : Int
    4@      : Int
    5@      : Int
    6@      : Int
    7@      : Int
    8@      : Int
    9@      : Int
    10@     : Int
END
// Read CPool<CVehicle,CHeli> ptr
READ_MEMORY 0x4958E3 4 FALSE 0@
READ_MEMORY 0@ 4 FALSE 0@
// Read a pointer to entries array...
READ_MEMORY 0@ 4 FALSE 1@
// ...uID array pointer...
0@ += 0x4
READ_MEMORY 0@ 4 FALSE 2@
// ...and pool size
0@ += 0x4
READ_MEMORY 0@ 4 FALSE 3@
// We still need pool pointer later, so restore 0@
0@ -= 0x8

WHILE TRUE
    WAIT 100

    // Iterate through entire pool
    4@ = 0
    5@ = 1@
    6@ = 2@
    WHILE 3@ > 4@
        READ_MEMORY 6@ 1 FALSE 7@
        IF NOT IS_BIT_SET 7@ 7
        THEN
            // Valid vehicle, let's check if it's not a train
            0A8E: 8@ = 5@ + 0x590
            READ_MEMORY 8@ 4 FALSE 9@
            IF NOT 9@ == 6
            THEN
                // It's not a train, let's see if it was damaged by a train
                0A8E: 8@ = 5@ + 0xDC
                READ_MEMORY 8@ 4 FALSE 8@
                IF NOT 8@ == 0
                THEN
                    // Now the tricky part
                    0A8E: 10@ = 8@ + 0x36
                    9@ = 0
                    READ_MEMORY 10@ 1 FALSE 9@
                    CLEAR_BIT 9@ 3
                    CLEAR_BIT 9@ 4
                    CLEAR_BIT 9@ 5
                    CLEAR_BIT 9@ 6
                    CLEAR_BIT 9@ 7
                    IF 9@ == 2  // Is damage entity a vehicle?
                    THEN
                        0A8E: 10@ = 8@ + 0x590
                        READ_MEMORY 10@ 4 FALSE 9@
                        IF 9@ == 6  // Is a train?
                        THEN
                            // Let's get its SCM handle and explode it then
                            CALL_METHOD_RETURN 0x424160 0@ 1 0 5@ 9@
                            IF NOT IS_CAR_DEAD 9@
                            THEN
                                EXPLODE_CAR 9@
                            END
                        END
                    END
                END
            END
        END
        4@ += 1
        5@ += 0xA18
        6@ += 1
    END
END
Compiled:
https://dl.dropboxus...rain_explode.cs

gtatrainlover
  • gtatrainlover

    Square Civilian

  • Members
  • Joined: 05 Jul 2012

#5

Posted 15 October 2013 - 11:10 PM

Alhough there is a pinned request topic, I liked the concept and decided to make it.

Warning: untested!

[fixed code below]

Compiled code:
https://dl.dropboxus...rain_explode.cs

Thanks man you rule!!!





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users