Jump to content

[GTASA][ANIMATIONS][CODING] Looping animations that are not looped by default


Gat4

Recommended Posts

Hello everyone. I'm trying to do [title] and I can't figure it out.

Some animations are nicely structured with a START, LOOP and END, but not these ones in particular.

My best guess is that I would have to manually loop the animation back and forth using OPCODE 0614 by altering the animation progress from 0.0 to 1.0 and back to 0.0, but I don't know if that would even play the animation correctly.

Is there any other way that is not so convoluted? If not, how could this be done? Thanks everyone.

EDIT1!: Before anyone replies this: No, I am not trying to loop going from A to B and then jumping to A (such as with 0605 loop 1), I'm trying to go from A to B to A and so on.

Edited by Gat4
Link to comment
Share on other sites

Use opcode 0612: and 0614:

 

{$CLEO .cs}
thread 'ANIMPRO'

while true
    wait 0
    if
        0256:   player $PLAYER_CHAR defined
    then
        if
            0AB0:    key_pressed 8// 	press Backspace
        then
                
            0@ = 0               
            
            while 0256:   player $PLAYER_CHAR defined
                wait 0
                03F0: enable_text_draw 1
                045A: text_draw_1number  20.0  200.0 'NUMBER' 0@
                if
                    0@ == 0
                then
                    0812: AS_actor $PLAYER_ACTOR perform_animation "KO_SKID_BACK" IFP "PED" framedelta 4.0 loopA 0 lockX 1 lockY 1 lockF 0 time -1 // versionB 
                    0@ = 1
                end
                
                if  and
                    0@ == 1
                    0611:   actor $PLAYER_ACTOR performing_animation "KO_SKID_BACK"
                then
                    0613: 1@ = actor $PLAYER_ACTOR animation "KO_SKID_BACK" time
                    if
                        1@ >= 0.9
                    then
                        0@ = 2
                    end
                    
                end
                
                if
                    0@ == 2                    
                then
                    if
                        1@ > 0.0
                    then
                        1@ -= 0.01
                        0612: set_actor $PLAYER_ACTOR animation "KO_SKID_BACK" paused 0
                        0614: set_actor $PLAYER_ACTOR animation "KO_SKID_BACK" progress_to 1@ // 0.0 to 1.0                                             
                    else    
                        0792: disembark_instantly_actor $PLAYER_ACTOR
                        0@ = 0
                    end
                end
                                
                if
                    0AB0:    key_pressed 9// ----------------------	press TAB to exit anim mode
                then
                    0792: disembark_instantly_actor $PLAYER_ACTOR
                    break
                end
                
            end
            
            wait 500
            
        end
    end
end

 

 

Link to comment
Share on other sites

jet ranger
On 5/23/2023 at 7:27 PM, ZAZ said:

Use opcode 0612: and 0614:

 

{$CLEO .cs}
thread 'ANIMPRO'

while true
    wait 0
    if
        0256:   player $PLAYER_CHAR defined
    then
        if
            0AB0:    key_pressed 8// 	press Backspace
        then
                
            0@ = 0               
            
            while 0256:   player $PLAYER_CHAR defined
                wait 0
                03F0: enable_text_draw 1
                045A: text_draw_1number  20.0  200.0 'NUMBER' 0@
                if
                    0@ == 0
                then
                    0812: AS_actor $PLAYER_ACTOR perform_animation "KO_SKID_BACK" IFP "PED" framedelta 4.0 loopA 0 lockX 1 lockY 1 lockF 0 time -1 // versionB 
                    0@ = 1
                end
                
                if  and
                    0@ == 1
                    0611:   actor $PLAYER_ACTOR performing_animation "KO_SKID_BACK"
                then
                    0613: 1@ = actor $PLAYER_ACTOR animation "KO_SKID_BACK" time
                    if
                        1@ >= 0.9
                    then
                        0@ = 2
                    end
                    
                end
                
                if
                    0@ == 2                    
                then
                    if
                        1@ > 0.0
                    then
                        1@ -= 0.01
                        0612: set_actor $PLAYER_ACTOR animation "KO_SKID_BACK" paused 0
                        0614: set_actor $PLAYER_ACTOR animation "KO_SKID_BACK" progress_to 1@ // 0.0 to 1.0                                             
                    else    
                        0792: disembark_instantly_actor $PLAYER_ACTOR
                        0@ = 0
                    end
                end
                                
                if
                    0AB0:    key_pressed 9// ----------------------	press TAB to exit anim mode
                then
                    0792: disembark_instantly_actor $PLAYER_ACTOR
                    break
                end
                
            end
            
            wait 500
            
        end
    end
end

 

 

Can i use it to aim ( to loop aim animation ) ?

Link to comment
Share on other sites

13 hours ago, jet ranger said:

Can i use it to aim ( to loop aim animation ) ?

It can loop the aim animation, yes

But the aim/shoot function won't work

Link to comment
Share on other sites

1 hour ago, MiranDMC said:

Have you tried to set negative framedelta argument?

No, you can try that by yourself

valid values are from 0.0 to 1.0

You can test it with my last script

{$CLEO .cs}
thread 'ANIMPRO'
0@ = 0
1@ = 0.0

while true
    wait 0
    if
        0256:   player $PLAYER_CHAR defined
    then
        if
            //00E1:   player 0 pressed_key 6 // AIM
            0AB0:    key_pressed 8// 	press Backspace
        then
            03F0: enable_text_draw 1
            045A: text_draw_1number  20.0  200.0 'NUMBER' 0@
            045A: text_draw_1number  20.0  220.0 'NUMBER' 3@                
            if
                0@ == 0
            then
                0812: AS_actor $PLAYER_ACTOR perform_animation "FightA_3" IFP "PED" framedelta 4.0 loopA 0 lockX 0 lockY 0 lockF 0 time -1 // versionB 
                0@ = 1
            end
            
            if
                0@ == 1                    
            then
                if
                    0.35 > 1@
                then
                    1@ += 0.01
                                        
                else    
                    0@ = 2
                end
            end

            if
                0@ == 2                    
            then
                if
                    1@ > 0.2
                then
                    1@ -= 0.01                                           
                else    
                    0@ = 1
                end
            end
            if or
                0@ == 1
                0@ == 2
            then
                0612: set_actor $PLAYER_ACTOR animation "FightA_3" paused 0
                0614: set_actor $PLAYER_ACTOR animation "FightA_3" progress_to 1@ // 0.0 to 1.0 
            end
                                   
            0087: 3@ = 1@ // (float)
            0013: 3@ *= 100.0
            0092: 3@ = float 3@ to_integer
        end
        if
            0AB0:    key_pressed 9// ----------------------	press TAB to exit anim mode
        then
            0792: disembark_instantly_actor $PLAYER_ACTOR
            0@ = 0
            wait 500
        end        
    end
end

 

Link to comment
Share on other sites

Bit convoluted, but thank you for solving. I'm also going to try to edit the animations with 3DSMAX to avoid all this coding. Wish me luck.

Edit 1: Its actually easier to edit the anims once you learn to use 3DSMAX.

Edited by Gat4
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.