Quantcast

Jump to content

» «
Photo

0673 animation opcode, GTA:MA

11 replies to this topic
MW_29
  • MW_29

    i came to play

  • Members
  • Joined: 19 Jan 2008
  • None

#1

Posted 06 June 2013 - 07:33 AM

So as far as i know mod GTA: Martial Arts /GTA:MA link HERE has side feature of implementing additiona opcode related to animations. According to author:
QUOTE
Version 0.9.0.1 now makes a new opcode (0673) available that can be used to play any animation (including non-fighting ones) on an actor anytime from script. This can be considered a side-bonus of GTA:MA.


...and from description of GTA:MA's 'Demo package':

QUOTE
GTA:MA v0.9.0.1 adds an opcode to the existing opcodes of the
VC engine, therefore we'll be able to trigger it through scripting, via the
main.scm. The opcode 0673 gets used like this:

0673: play_animation on actor $PLAYER_ACTOR animgroup 64 anim 512 blendfactor 30.0

This requires a little explaining. The use of the first variable should be
obvious. The second variable (animgroup) refers to the group from which to
use it. The standard animations are all in group 0. The first custom Form
in the GTA:MA Form has id 61, the next has 62 and so on. So to trigger the
dance move, you need to use the appropriate id (ATTENTION! That does mean that
the '64' used above is not necessarily the right id for your .cfg. Do your own
calculation.) Next you will have to pass the ID of the animation itself. In our
MA_FORM section we have set 0x200 as the anim id of dance_right. That is 512 in
decimal, so that's what we'll use. The meaning of the last variable is not
entirely clear. it seems to handle the blending of the animation you want to
play with the idle animation of the actor in question. 0.0 seems to mean that
100%ly the idle animation gets used, 30.0 seems to cause the animation you want
to play to get used 100%ly. Values inbetween caused mixed (as in "blended")
results.

As a final step, add this line to the end of the opcode section of the
vicescm.ini of Barton Waterduck's GTA VC Mission Builder (so that the Mission
Builder will be able to compile the new opcode):
0673=4,play_animation on actor %1d% animgroup %2d% anim %3d% blendfactor %4f%


...in the second quoted description there is some stuff related to adding external .ifp file with SA dance movements, but i am not interested in that now.

List of in-game animations numbers that were supposed to be used with this opcode is HERE


My question is, HOW TO PROPERLY RUN this opcode on already existent in game aniations? How to run any of those "stock" anims included in game? I 've added below lines:

...to my SB's VICE_SCM.INI

CODE
0673: play_animation on actor $PLAYER_ACTOR animgroup 64 anim 512 blendfactor 30.0


...and to opcodes.txt:

CODE
0673: play_animation on actor $PLAYER_ACTOR animgroup 64 anim 512 blendfactor 30.0


So i assume having installed GTA:MA (which i have) should allow me to use this opcode in scripts.

Well, simple VC CLEO script is compilable, BUT i have every time crash when code reaches mentioned new opcode line. Whether i use this...

CODE
// This file was decompiled using vicescm.ini published by http://gtag.gtagaming.com/opcode-database on 18.5.2011

{$VERSION 2.1.1000}
{$CLEO .cs}

//-------------MAIN---------------
0000:

:NONAME_2
wait 0
if and
  Player.Defined($PLAYER_CHAR)
  not Actor.Dead($PLAYER_ACTOR)
jf @NONAME_2  
if
00E1:   key_pressed 0 13 // "V" key pressed  
jf @NONAME_2
//Player.CanMove($PLAYER_CHAR) = False  // <- tried with and without this still doesn't work
wait 100
0673: play_animation on actor $PLAYER_ACTOR animgroup 0 anim 0 blendfactor 30.0
05DC: end_custom_thread


...or this

CODE
// This file was decompiled using vicescm.ini published by http://gtag.gtagaming.com/opcode-database on 18.5.2011

{$VERSION 2.1.1000}
{$CLEO .cs}

//-------------MAIN---------------
0000:

:NONAME_2
wait 0
if and
  Player.Defined($PLAYER_CHAR)
  not Actor.Dead($PLAYER_ACTOR)
jf @NONAME_2  
if
00E1:   key_pressed 0 13 // "V" key pressed  
jf @NONAME_2
//Player.CanMove($PLAYER_CHAR) = False  // <- tried with and without this still doesn't work
jump @NONAME_3

:NONAME_3
wait 0
0673: play_animation on actor $PLAYER_ACTOR animgroup 0 anim 0 blendfactor 30.0
jump @NONAME_3  


So does anybody know how to deal with that opcode and if using it via GTA:MA is in fact possible and working in practical? Did anyone used it somewhere already? I'd be glad for any constructive responses.

DK22Pac
  • DK22Pac

    Where I Know You From

  • Feroci
  • Joined: 12 Apr 2009
  • Ukraine

#2

Posted 06 June 2013 - 09:17 AM

VC 1.0
CODE
// 0@ - ped handle
05E6: 1@ = actor 0@ struct
1@ += 0x4C
05E0: 1@ = read_memory 1@ size 4 virtual_protect 0
// CAnimManager::BlendAnimation(RpClump *, AssocGroupId, AnimationId, float)
05E1: call 0x405640 num_params 4 pop 4 _blendFactor 8.0 _animationId 165 _assocGroupId 0 _rwObject 1@

MW_29
  • MW_29

    i came to play

  • Members
  • Joined: 19 Jan 2008
  • None

#3

Posted 06 June 2013 - 01:39 PM

QUOTE (DK22Pac @ Thursday, Jun 6 2013, 09:17)
VC 1.0
CODE
// 0@ - ped handle
05E6: 1@ = actor 0@ struct
1@ += 0x4C
05E0: 1@ = read_memory 1@ size 4 virtual_protect 0
// CAnimManager::BlendAnimation(RpClump *, AssocGroupId, AnimationId, float)
05E1: call 0x405640 num_params 4 pop 4 _blendFactor 8.0 _animationId 165 _assocGroupId 0 _rwObject 1@

Thanks @DK22Pac smile.gif ...firstly it crashed, then i realised that parkour mod uses similar things so according to it's source code, i changed order of arguments for 05E6 , and then it works perfectly biggrin.gif

CODE
// This file was decompiled using vicescm.ini published by http://gtag.gtagaming.com/opcode-database on 18.5.2011

{$VERSION 2.1.1000}
{$CLEO .cs}

//-------------MAIN---------------
0000:

:NONAME_2
wait 0
if and
  Player.Defined($PLAYER_CHAR)
  not Actor.Dead($PLAYER_ACTOR)
jf @NONAME_2  
if
00E1:   key_pressed 0 13
jf @NONAME_2
05E6: $PLAYER_ACTOR = actor 1@ struct // <- just changing order of arguments here
1@ += 0x4C
05E0: 1@ = read_memory 1@ size 4 virtual_protect 0
//05DC: end_custom_thread

:NONAME_3
wait 0
05E1: call 0x405640 num_params 4 pop 4 _blendFactor 30.0 _animationId 0 _assocGroupId 0 _rwObject 1@
jump @NONAME_3


Thanks for help smile.gif

DK22Pac
  • DK22Pac

    Where I Know You From

  • Feroci
  • Joined: 12 Apr 2009
  • Ukraine

#4

Posted 06 June 2013 - 04:35 PM

MW_29, open VCSCM.ini and change
CODE
05E6=2, 1% = actor 2% struct

to
CODE
05E6=2, 2% = actor 1% struct

MW_29
  • MW_29

    i came to play

  • Members
  • Joined: 19 Jan 2008
  • None

#5

Posted 06 June 2013 - 09:28 PM

QUOTE (DK22Pac @ Thursday, Jun 6 2013, 16:35)
MW_29, open VCSCM.ini and change
CODE
05E6=2, 1% = actor 2% struct

to
CODE
05E6=2, 2% = actor 1% struct

Yeah, i can also use this way icon14.gif

By the way , do You know if is it possible to make or call some function which would create a "shot of a bullet" from one point towards another, just like SA opcode does:
CODE
06BC: create_M4_shoot_from 2193.268 -1165.441 1031.124 target $TEMPVAR_X_COORD $TEMPVAR_Y_COORD $TEMPVAR_Z_COORD energy 1
...but in Vice? Sorry for offtopic.

DK22Pac
  • DK22Pac

    Where I Know You From

  • Feroci
  • Joined: 12 Apr 2009
  • Ukraine

#6

Posted 06 June 2013 - 11:21 PM Edited by DK22Pac, 08 June 2013 - 11:17 AM.

CODE
// 1@, 2@, 3@ - start point
04C4: create_coordinate 1@ 2@ 3@ from_actor $PLAYER_ACTOR offset 0.0 1.0 0.8
05F8: 4@ = var 1@ offset
// 5@, 6@, 7@ - end point
04C4: create_coordinate 5@ 6@ 7@ from_actor $PLAYER_ACTOR offset 0.0 20.0 0.8
05F8: 8@ = var 5@ offset
05E1: call 0x5C9BB0 num_params 3 pop 3 _intensuty 15 _endPoint 8@ _startPoint 4@

MW_29
  • MW_29

    i came to play

  • Members
  • Joined: 19 Jan 2008
  • None

#7

Posted 08 June 2013 - 03:08 PM

QUOTE (DK22Pac @ Thursday, Jun 6 2013, 23:21)
CODE
// 1@, 2@, 3@ - start point
04C4: create_coordinate 1@ 2@ 3@ from_actor $PLAYER_ACTOR offset 0.0 1.0 0.8
05F8: 4@ = var 1@ offset
// 5@, 6@, 7@ - end point
04C4: create_coordinate 5@ 6@ 7@ from_actor $PLAYER_ACTOR offset 0.0 20.0 0.8
05F8: 8@ = var 5@ offset
05E1: call 0x5C9BB0 num_params 3 pop 3 _intensuty 15 _endPoint 8@ _startPoint 4@

Awesome! biggrin.gif Man where do You get all this knowledge from? I ve searched not once not twice the internet for things like that and i couldn't find anything..

The code You posted not only creates shot but the shot is a tracer round cool.gif So tell me if it is possible to change something to reach this shot effect on already present in-game guns, i mean is it possible to set default game shot to this kind of shot with tracer effect?

DK22Pac
  • DK22Pac

    Where I Know You From

  • Feroci
  • Joined: 12 Apr 2009
  • Ukraine

#8

Posted 09 June 2013 - 06:49 PM

This needs some researching, detecting all places where default bullet traces are created and replace them with that new function.

ThirteenAG
  • ThirteenAG

    Soldier

  • Feroci
  • Joined: 29 Dec 2008
  • None

#9

Posted 09 June 2013 - 09:55 PM Edited by ThirteenAG, 09 June 2013 - 10:11 PM.

QUOTE (MW_29 @ Saturday, Jun 8 2013, 19:08)
So tell me if it is possible to change something to reach this shot effect on already present in-game guns, i mean is it possible to set default game shot to this kind of shot with tracer effect?

Well, kinda proof of concept:
user posted image user posted image 2mb gif

CODE
{$CLEO}
0000:
05F8: 8@ = var 5@ offset
05F8: 4@ = var 1@ offset
05DF: write_memory 0x5734DD size 5 value 0x90 virtual_protect 1  //smoke trail
05DF: write_memory 0x5736EE size 5 value 0x90 virtual_protect 1  //smoke trail
05DF: write_memory 0x57389B size 5 value 0x90 virtual_protect 1  //smoke trail
05DF: write_memory 0x5C9C06 size 5 value 0x90 virtual_protect 1  //muzzleflash


while true
   wait 0
0054: store_player $player_char position_to 10@ 11@ 12@
if
   05EF: 13@ = random_actor_near_point 10@ 11@ 12@ in_radius 550.0 find_next 0 pass_deads 0 //IF and SET
then
   repeat
       // 1@, 2@, 3@ - start point
       05E0: 1@ = read_memory 0x7E46B8 size 4 virtual_protect 1
       05E0: 2@ = read_memory 0x7E46BC size 4 virtual_protect 1
       05E0: 3@ = read_memory 0x7E46C0 size 4 virtual_protect 1

       // 5@, 6@, 7@ - end point
       05E0: 5@ = read_memory 0x77EC78 size 4 virtual_protect 1
       05E0: 6@ = read_memory 0x77EC7C size 4 virtual_protect 1
       05E0: 7@ = read_memory 0x77EC80 size 4 virtual_protect 1    
       if
       02E0:   actor $PLAYER_ACTOR firing_weapon
       then
       04C4: create_coordinate 1@ 2@ 3@ from_actor $PLAYER_ACTOR offset 0.0 0.0 0.0
       05E1: call 0x5C9BB0 num_params 3 pop 3 _intensuty 0 _endPoint 8@ _startPoint 4@
       else
           if
           02E0:   actor 13@ firing_weapon
           then
           04C4: create_coordinate 1@ 2@ 3@ from_actor 13@ offset 0.0 0.0 0.0
           05E1: call 0x5C9BB0 num_params 3 pop 3 _intensuty 0 _endPoint 8@ _startPoint 4@
           end
       end
   until 85EF: not 13@ = random_actor_near_point 10@ 11@ 12@ in_radius 550.0 find_next 1 pass_deads 0 //IF and SET
end



end


Looks cool, but still some work needs to be done.

MW_29
  • MW_29

    i came to play

  • Members
  • Joined: 19 Jan 2008
  • None

#10

Posted 10 June 2013 - 12:36 AM Edited by MW_29, 10 June 2013 - 12:38 AM.

Good biggrin.gif Also now arming vehicles possible even without MVL tounge.gif

user posted image

The question is how to 'run' desired SFX (yeah any of weapon shot effects on example) on demand? Because opcodes 018C and 018D are let's say ... a "little" limited

By the way, i see a lot of creativity here as for an offtopic question but i hope anything what is creative will be tolerated by staff biggrin.gif

ThirteenAG
  • ThirteenAG

    Soldier

  • Feroci
  • Joined: 29 Dec 2008
  • None

#11

Posted 16 June 2013 - 03:03 PM Edited by ThirteenAG, 16 June 2013 - 03:09 PM.

My latest attempt to create bullet traces instead of smoke trails:

https://dl.dropboxus...ullet_trace.zip

It contains two scripts, for player and for peds, and the effect itself doesn't look perfect. But it's still better than smoke trail, in my opinion.

bullet_trace_pt1 src

bullet_trace_pt2 src

ThirteenAG
  • ThirteenAG

    Soldier

  • Feroci
  • Joined: 29 Dec 2008
  • None

#12

Posted 18 July 2013 - 02:35 PM



https://dl.dropboxus...ullet_trace.zip





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users