Mod Showroom

 Reply to this postStart new topic

[CLEO3/4] CLEO Nitro Control

LINK/2012
post Sep 20 2011, 03:18 AM
Post #1


I will kill you

Posts: 126
Joined: 13-May 11





With this mod u can control the nitro boosts from your car.
Download

Source:

SANNY

{$CLEO}
0000: NITRO!!!!
while true
    wait 100
    if and
    00DF:   actor $PLAYER_ACTOR driving
    00E1:   player 0 pressed_key 17     // Fire/Nitro
    jf continue
    03C0: 1@ = actor $PLAYER_ACTOR car
    096D: get_car 1@ component_on_slot 8 model_to 2@
    if and
    2@ <> #NTO_B_S
    2@ <> #NTO_B_L
    2@ <> #NTO_B_TW    
    then
        wait 0
        01C3: remove_references_to_car 1@
        jump -2
    end    
    0A97: 0@ = car 1@ struct
    0A8E: 2@ = 0@ + 0x8A4
    0A8E: 3@ = 0@ + 0x48A
    0A8D: 4@ = read_memory 2@ size 4 virtual_protect 0
    0A8D: 5@ = read_memory 3@ size 1 virtual_protect 0
    if 5@ == 0
    then
        4@ <> 1.0
        jf continue  
    end
    while true
        wait 100
        while 00E1:   player 0 pressed_key 17   // Fire/Nitro
            wait 0
            if 856E:   not car 1@ defined
            then
                01C3: remove_references_to_car 1@
                jump -2
            else
                80DB:   not actor $PLAYER_ACTOR in_car 1@
                jf continue
                01C3: remove_references_to_car 1@
                jump -2  
            end
        end
        0A8D: 5@ = read_memory 3@ size 1 virtual_protect 0      
        5@ += 1
        0A8C: write_memory 2@ size 4 value 1.0 virtual_protect 0
        0A8C: write_memory 3@ size 1 value 5@ virtual_protect 0
        while 80E1:   not player 0 pressed_key 17   // Fire/Nitro
            wait 0
            if 856E:   not car 1@ defined
            then
                01C3: remove_references_to_car 1@
                jump -2
            else
                80DB:   not actor $PLAYER_ACTOR in_car 1@
                jf continue
                01C3: remove_references_to_car 1@
                jump -2  
            end
        end
    end    
end
hex
    "LINK/2012"
end

Go to the top of the page
 
+Quote Post
uokka
post Sep 20 2011, 09:54 AM
Post #2


Actually living entity

Posts: 143
From: Earth
Joined: 15-January 11



Yay, no more nitro.dll which prevents other ASIs and DLLs to load/work correctly!
I've just decided yesterday that I wont use nitro.dll anymore
as it makes UltraThing being unable to show car reflections and other stuff..
Your script comes just in time

Great, thanks..

But, is it necessary to leave Standard Nitro usable? I would like to still be able to use the Primary Fire Button for something else.
Could I be able to edit it for myself so that only Controllable Nitro Boost is used (i may not ask if i would know these memory addresses), or is the 'Two Nitros' a workaround?


--------------------
My english is just perfekt. I am only not sure, whether I it rightly utilize..
. . .
Go to the top of the page
 
+Quote Post
Deji
post Sep 20 2011, 07:58 PM
Post #3


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



Allow me to suggest a more R*-ish, optimised and possibly safer code. Although your code is pretty good anyway. It's mainly the two while loops which could have a small flaw.
SANNY
{$CLEO}
0000: NITRO!!!!
while true
    wait 100
    if and
    00DF:   actor $PLAYER_ACTOR driving
    00E1:   player 0 pressed_key 17     // Fire/Nitro
    jf continue
    03C0: 1@ = actor $PLAYER_ACTOR car
    096D: get_car 1@ component_on_slot 8 model_to 2@
    if and
    2@ <> #NTO_B_S
    2@ <> #NTO_B_L
    2@ <> #NTO_B_TW    
    then
        wait 0
        jump @Cleanup
    end    
    0A97: 0@ = car 1@ struct
    0A8E: 2@ = 0@ + 0x8A4
    0A8E: 3@ = 0@ + 0x48A
    0A8D: 4@ = read_memory 2@ size 4 virtual_protect 0
    0A8D: 5@ = read_memory 3@ size 1 virtual_protect 0
    if 5@ == 0
    then
        4@ <> 1.0
        jf continue  
    end
    while true
        wait 100
        while 00E1:   player 0 pressed_key 17   // Fire/Nitro
            wait 0
            8119:   not car 1@ wrecked   // doubles as an 'if exists' check
            jf @Cleanup
            00DB:   actor $PLAYER_ACTOR in_car 1@
            jf @Cleanup
        end
        0A8D: 5@ = read_memory 3@ size 1 virtual_protect 0      
        5@ += 1
        0A8C: write_memory 2@ size 4 value 1.0 virtual_protect 0
        0A8C: write_memory 3@ size 1 value 5@ virtual_protect 0
        while 80E1:   not player 0 pressed_key 17   // Fire/Nitro
            wait 0
            8119:   not car 1@ wrecked   // doubles as an 'if exists' check
            jf @Cleanup
            00DB:   actor $PLAYER_ACTOR in_car 1@
            jf @Cleanup
        end
    end    
end

:Cleanup  // save a few bytes here and there
01C3: remove_references_to_car 1@   // can always run safely
jump -2

hex
    "LINK/2012"
end


Tired of labels? tongue.gif


--------------------
Go to the top of the page
 
+Quote Post
LINK/2012
post Sep 20 2011, 10:22 PM
Post #4


I will kill you

Posts: 126
Joined: 13-May 11



QUOTE (uokka @ Sep 20 2011, 06:54 AM) *
But, is it necessary to leave Standard Nitro usable? I would like to still be able to use the Primary Fire Button for something else.
Could I be able to edit it for myself so that only Controllable Nitro Boost is used (i may not ask if i would know these memory addresses), or is the 'Two Nitros' a workaround?

Yes, If you mean that the player should enable the nitro to the mod works, Yes, it's necessary.
Keys you can modifie, The key should be Primary or Secondary Fire.


QUOTE (Deji @ Sep 20 2011, 04:58 PM) *
Allow me to suggest a more R*-ish, optimised and possibly safer code. Although your code is pretty good anyway. It's mainly the two while loops which could have a small flaw.

Thanks, Corrections are very good, without it I can't move wink.gif

...So
QUOTE
0119: car 0@ wrecked

Checks if the car is defined too?
Go to the top of the page
 
+Quote Post
Deji
post Sep 21 2011, 02:06 PM
Post #5


Coding like a Rockstar!

Group Icon

Posts: 1,468
From: ???
Joined: 28-May 09



Yeah, but it's better to think of "defined" as "exists". Small anomalies like that are what makes SCM coding hard to understand at times.


--------------------
Go to the top of the page
 
+Quote Post
Wesser
post Sep 21 2011, 02:40 PM
Post #6


The Assistant

Posts: 84
From: Matera, IT
Joined: 16-June 11



I already thought to make a script to control nitro manually. I started with basic SCM scripting, but it wasn't necessary to modify the nitro system completely. So, I came up with this code.

Maybe I have to release it, but I'm not so convinced about the filosophy I followed to write the script. If someone want help me, I'll be glad to get your idea.

This post has been edited by Wesser: Sep 21 2011, 02:41 PM
Go to the top of the page
 
+Quote Post
uokka
post Sep 21 2011, 06:03 PM
Post #7


Actually living entity

Posts: 143
From: Earth
Joined: 15-January 11



@Wesser
Tryed to compile it with sanny.
If I understand the last comment in your code correctly
SANNY
// Compilation won't work for file missing error
then you didnt expect anybody to be able to use it without missing .INC files, right?

I cannot help with coding but maybe by testing it(?).

As well @LINK2012
And by requesting functionality.. smile.gif


--------------------
My english is just perfekt. I am only not sure, whether I it rightly utilize..
. . .
Go to the top of the page
 
+Quote Post
Wesser
post Sep 24 2011, 08:54 PM
Post #8


The Assistant

Posts: 84
From: Matera, IT
Joined: 16-June 11



Sorry for the late answer. I had to prevent the source from stealing. I just posted my work so that someone would be interested on helping me with some advice.

Nitros time rises regarding to the multiplier (x2 = about 4800, x5 = about 5800, x10 = about 8800) but since there's too much difference between x2-x5 and x5-x10, I was asking if I should leave it as it is.
Go to the top of the page
 
+Quote Post
charyriordanU
post Feb 24 2013, 09:06 AM
Post #9


The New Guy!

Posts: 2
Joined: 22-February 13



I always love a good supply of nitro. No one can leave you last on the road with it.


--------------------
Go to the top of the page
 
+Quote Post
Reply to this postStart new topic

2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members: