CLEO Help Why doesn't it work?

CLEO related
Status
Not open for further replies.

ThermaL

Expert
Joined
Oct 23, 2013
Messages
1,593
Reaction score
3
I tried to make a CLEO which auto-switchs tru weapons when my current weapon has less than 2 bullets.
But I get crashed...  :table_flip:  :red_eyes:  :yuno: WORK?

Code:
{$CLEO}

thread 'Auto-Switch'

while true
wait 0
0470: get_current_char_weapon $PLAYER_ACTOR store_to 0@                    
041A: get_ammo_in_char_weapon $PLAYER_CHAR weapon 0@ store_to 1@
end

:AUTOSWITCH_1
wait 0
if
1@ <= 2
else_jump @AUTOSWITCH_1
jump @AUTOSWITCH_2

:AUTOSWITCH_2
wait 0
01B9: set_current_char_weapon $PLAYER_CHAR to 0
wait 50
01B9: set_current_char_weapon $PLAYER_CHAR to 0@
jump @AUTOSWITCH_1
 

Opcode.eXe

Expert
Joined
Feb 18, 2013
Messages
1,493
Reaction score
236
Location
( ͡° ͜ʖ ͡°)
Code:
{$CLEO .cs}
0000:

WHILE TRUE
    WAIT 0
    0470: get_current_char_weapon $PLAYER_ACTOR store_to 0@   
    041A: get_ammo_in_char_weapon $PLAYER_CHAR weapon 0@ store_to 1@
    if
    1@ < 2
    then
        for 2@ = 0 to 46
            if
            0491:   actor $PLAYER_ACTOR has_weapon 2@
            then
                if
                803B:   2@ == 1@  // (int)
                then
                    01B9: set_actor $PLAYER_ACTOR armed_weapon_to 2@
                end
            end
        end
    end
END
 

ThermaL

Expert
Joined
Oct 23, 2013
Messages
1,593
Reaction score
3
xzytro link said:
Are you sure that 041A opcode defines the ammo in the clip and not the ammo of weapon?
IY7AgSU.png

You are right, that was the problem.
BTW do you know any opcodes to get the ammo of the clip?
 

xghostsamp

Active member
Joined
Aug 31, 2013
Messages
44
Reaction score
0
ThermaL link said:
[quote author=xghostsamp link=topic=6083.msg34562#msg34562 date=1394988173]
Awww you're making it for me :3
^^ yes
xzytro link said:
[quote author=ThermaL link=topic=6083.msg34559#msg34559 date=1394987727]
do you know any opcodes to get the ammo of the clip?
http://ugbase.eu/snippets/ammo-in-clip/
[/quote]Thank you! :D
[/quote]

Lol thanks to the both of you, now you just need to compile it :3
 

ThermaL

Expert
Joined
Oct 23, 2013
Messages
1,593
Reaction score
3
WTF it still doesn't work

{$CLEO}

thread 'Auto-Switch'

:AUTOSWITCH
wait 0
if
Player.Defined($PLAYER_ACTOR)
jf @AUTOSWITCH                   
0A96: 0@ = actor $PLAYER_ACTOR struct
0@ += 0x718 // Current Weapon Slot
0A8D: 1@ = read_memory 0@ size 1 virtual_protect 0
0A96: 0@ = actor $PLAYER_ACTOR struct
0@ += 0x5A0 // Start of weapon data (28 bytes)
1@ *= 28
005A: 0@ += 1@ // Get weapon structure
0@ += 8 // Pointer to "Ammo in clip"
0A8D: 3@ = read_memory 0@ size 1 virtual_protect 0 // Ammo in clip
jump @AUTOSWITCH_1

:AUTOSWITCH_1
wait 0
if
3@ <= 2
else_jump @AUTOSWITCH_1
jump @AUTOSWITCH_2

:AUTOSWITCH_2
wait 0
01B9: set_current_char_weapon $PLAYER_CHAR to 0
wait 50
01B9: set_current_char_weapon $PLAYER_CHAR to 0@
jump @AUTOSWITCH
 
Joined
Feb 18, 2005
Messages
2,965
Reaction score
273
01B9: set_current_char_weapon $PLAYER_CHAR to 0
01B9: set_current_char_weapon $PLAYER_CHAR to 0@

change to $PLAYER_ACTOR and use 01B9
 

xzytro

God
Joined
Apr 1, 2013
Messages
2,294
Reaction score
7
Took long enough  :computer_guy:

Code:
{$CLEO .cs}
THREAD "ROFL"
0662: NOP "MADE BY TH3RM4L" 
0662: NOP "UGBASE.EU"

:AUTOSWITCH
wait 0
if and
0256:   player $PLAYER_CHAR defined
056D:   actor $PLAYER_ACTOR defined
044B:   actor $PLAYER_ACTOR on_foot
else_jump @AUTOSWITCH

:LEL
wait 0
if and
82D8:   not actor $PLAYER_ACTOR current_weapon == 0
82D8:   not actor $PLAYER_ACTOR current_weapon == 1
82D8:   not actor $PLAYER_ACTOR current_weapon == 25  //Shotgun has 1 ammo in clip
82D8:   not actor $PLAYER_ACTOR current_weapon == 34  //Sniper has 1 ammo in clip
else_jump @LEL
0470: $oldweap = actor $PLAYER_ACTOR current_weapon
GOSUB @GET_AMMO_IN_CLIP
wait 0
if
0029:   3@ >= 2
then
jump @LEL
else
01B9: set_actor $PLAYER_ACTOR armed_weapon_to 0
wait 150
01B9: set_actor $PLAYER_ACTOR armed_weapon_to $oldweap
0ACD: show_text_highpriority "LEL!" time 1500
jump @AUTOSWITCH
end

:GET_AMMO_IN_CLIP
wait 0
0A96: 0@ = actor $PLAYER_ACTOR struct 
0@ += 0x718 // Current Weapon Slot
0A8D: 1@ = read_memory 0@ size 1 virtual_protect 0 
0A96: 0@ = actor $PLAYER_ACTOR struct 
0@ += 0x5A0 // Start of weapon data (28 bytes)
1@ *= 28 
005A: 0@ += 1@ // Get weapon structure
0@ += 8 // Pointer to "Ammo in clip"
0A8D: 3@ = read_memory 0@ size 1 virtual_protect 0 // Ammo in clip
return
Rest is up to you :dont_care: Add more weapons, remove Lel! message, do anything.
 

ThermaL

Expert
Joined
Oct 23, 2013
Messages
1,593
Reaction score
3
xzytro link said:
Took long enough  :computer_guy:

Code:
{$CLEO .cs}
THREAD "ROFL"
0662: NOP "MADE BY TH3RM4L" 
0662: NOP "UGBASE.EU"

:AUTOSWITCH
wait 0
if and
0256:   player $PLAYER_CHAR defined
056D:   actor $PLAYER_ACTOR defined
044B:   actor $PLAYER_ACTOR on_foot
else_jump @AUTOSWITCH

:LEL
wait 0
if and
82D8:   not actor $PLAYER_ACTOR current_weapon == 0
82D8:   not actor $PLAYER_ACTOR current_weapon == 1
82D8:   not actor $PLAYER_ACTOR current_weapon == 25  //Shotgun has 1 ammo in clip
82D8:   not actor $PLAYER_ACTOR current_weapon == 34  //Sniper has 1 ammo in clip
else_jump @LEL
0470: $oldweap = actor $PLAYER_ACTOR current_weapon
GOSUB @GET_AMMO_IN_CLIP
wait 0
if
0029:   3@ >= 2
then
jump @LEL
else
01B9: set_actor $PLAYER_ACTOR armed_weapon_to 0
wait 150
01B9: set_actor $PLAYER_ACTOR armed_weapon_to $oldweap
0ACD: show_text_highpriority "LEL!" time 1500
jump @AUTOSWITCH
end

:GET_AMMO_IN_CLIP
wait 0
0A96: 0@ = actor $PLAYER_ACTOR struct 
0@ += 0x718 // Current Weapon Slot
0A8D: 1@ = read_memory 0@ size 1 virtual_protect 0 
0A96: 0@ = actor $PLAYER_ACTOR struct 
0@ += 0x5A0 // Start of weapon data (28 bytes)
1@ *= 28 
005A: 0@ += 1@ // Get weapon structure
0@ += 8 // Pointer to "Ammo in clip"
0A8D: 3@ = read_memory 0@ size 1 virtual_protect 0 // Ammo in clip
return
Rest is up to you :dont_care: Add more weapons, remove Lel! message, do anything.
Thank you :dont_care:
 
Status
Not open for further replies.
Top