Author Topic: Action opcodes.  (Read 4599 times)

Akari

  • *
  • Posts: 766
    • View Profile
Action opcodes.
« on: 2010-01-05 12:29:30 »
I desided to create topic where I will post what I found in sequence of action opcodes.

Action opcodes determitate how unit and surroundings will behave itself during action. For example when MP wants to hit you with tonfa his action script do folowinf actions:
- set start direction for units. Because we want attacker and target look at each other.
- set effect of dust to it's foot
- play animation with id 6
- perform move to target. note that sometimes there are animation that moves unit forwars (for example during shoting from machinegun), but when we want to hit enemy with short range weapon we want that we hit enemy itself and not air or something behind target. This movement use target collision radius and attack radius.
- next we set dust effect again
- play animation with id 7
- next we set timer for hurt target action. When this timer is over we hear sound of attack, see number of hitpoints we damage it
- play animation with id 8
- next we instantly return our position to initial position
- and play dust effect again
- play animation with id 9
- next we return to initial direction.
- and finally return to idle action script.

So as you can see this is one of main part that determinate how attack will look like. We can display attack name here, play different effects, perform various movement and the main thing - we play animations here.

This opcodes is simple. If it's from 0x00 to 0x8d - then this is animation to play. When animation is played opcodes sequence execution is paused.

Here some of already known opcodes:

0xad - AD[joint XX][distance XXXX][start XX][end XX] Attach effect (machinegun) to joint 07 with given distance from joint which starts at frame 01 and ends at frame 0x0a. Always machingun fire. If end 0x80 byte is set then we do not add shell effect.

0xd1 - D1[distance XXXX][XXXX][steps XX] move to enemy using linear movement function by number of steps. Stop distance is distance to target collision radius.

0xe5 - E5 set initial (idle) direction for current unit acording to situation.

0xea - EA show attack name.

0xee - EE reset to idle. Script pointer to 0.

0xf0 - F0 set effect (foot_dust).

0xfa - FA instantly set default position for units.

0xfc - FC set direction for targets (delayed) and attacker acording to situation.

Aali

  • *
  • Posts: 1196
    • View Profile
Re: Action opcodes.
« Reply #1 on: 2010-01-05 13:48:35 »
Just to be clear, this is the stuff stored in the ??ab files for the PC version, right?

Akari

  • *
  • Posts: 766
    • View Profile
Re: Action opcodes.
« Reply #2 on: 2010-01-05 17:43:15 »
Just to be clear, this is the stuff stored in the ??ab files for the PC version, right?

I don't really know about PC version cause I work with PSX. In psx this is in second file in LZS pack.

First 0x68 bytes are model settings. Next are offsets to action scripts (0x4 bytes each) starting from beginning of this file. In enemy file there are always 0x20 scripts. After script offsets start script data itself.

If you can send me this file for MP then i can tell you is this it or not.
« Last Edit: 2010-01-05 17:45:03 by Akari »

Aali

  • *
  • Posts: 1196
    • View Profile
Re: Action opcodes.
« Reply #3 on: 2010-01-05 18:29:35 »
It is indeed the same data. Opcode E8 is the only thing in the game that loads magic effects (sometimes called animations), that might be interesting to know.

Akari

  • *
  • Posts: 766
    • View Profile
Re: Action opcodes.
« Reply #4 on: 2010-01-07 22:40:46 »
New discovery:
0xd8 - D8[wait XX][sound XXXX] play sound using attacker settings after waiting given number of frames.

As you may know there is no sound for attack itself in attack data in scene files. There are only sounds for impact (they played when target getting hit). Here it is. This opcode give you chance to play every sound you want.
For example MP's machinegun use this opcode to play sound of shooting.

0xb6 - B6[animation XX] pause camera scripts and then continue to play animation given animation from frame that already set. Used to smoothly finish idle animation before start of anything else. Camera paused because we want camera be sync with start of action (this is just finish animation that was already started).

0xaa - AA unpause camera scripts. As I see it usually uses right after 0xb6.

0xb9 - B9[camera_script_id XX] set camera script id to use. This is use then we want to play given camera script. this is shame, because Guard Scorpion when changing his stance has defined camera in this attack, but it's never used. Instead it uses camera defined in action script.

0xf3 - F3 repeat reading this opcode until wait time for script not reach 0. It descrease by 1 each tome this opcode called.

0xf4 - F4[wait XX] set frames to wait.

0xc5 - C5 set value from 0x800f8374 (unit fade time) as wait time for action script.

0xc6 - C6[wait XX] set value to 0x800f8374 (unit fade time) for futher use.

0xc9 - C9 do nothing just go to next opcode. Used as marker when jump up.

0xc1 - C1 jump to first meet C9 from start of script.
« Last Edit: 2010-01-11 20:48:58 by Akari »

Akari

  • *
  • Posts: 766
    • View Profile
Re: Action opcodes.
« Reply #5 on: 2010-01-11 20:53:04 »
This routine use for loading additional effect:

first we call opcode
0xe8 - E8 start load effect requested during attack (attack type id and attack id are used to determinate what effect to load).

then we create cycle where we will call some animation to hide load time

0xc9 - C9 do nothing just go to next opcode. Used as marker when jump up.
0xca - CA jump to first meet C9 at start of this script if something loading in background.

this is it =)
Just as Aali said =)

ps: 2 Aali: do you have some more opcodes that you know? I might help me a bit. =)

Aali

  • *
  • Posts: 1196
    • View Profile
Re: Action opcodes.
« Reply #6 on: 2010-01-11 20:59:37 »
Nah I haven't looked into it, that one I knew simply because I've looked over the loading mechanism. The custom driver makes it load the animation directly instead of trying to do it in the background. (Because there's no synchronization between the two threads, which probably worked for the most part on win95 but will cause all sorts of Bad Things(tm) on systems with real multithreading)

Akari

  • *
  • Posts: 766
    • View Profile
Re: Action opcodes.
« Reply #7 on: 2010-01-24 17:58:30 »
0xec - if effect not loaded we will call this opcode until it does. For magic, summon, limit, enemy skill and enemy attack we execute loaded effect. All effects are hardcoded so they can do whatever they want (play sounds, display damage, request hurt for target and so on).
0xf7 - F7[wait XX] after wait time ends execute hurt action, effect, sound. This will display damage and effect.
0xc2 - C2[wait XX] after wait time ends show damage.
0xbe - BE[wait XX] after wait time ends execute hurt action, effect, sound. This will NOT display damage and barriers effect.

0xf6 - F6 play die effect (depends on die type) if unit is dead. Used in enemy hurt actions.
« Last Edit: 2010-01-31 10:19:16 by Akari »