Difference between revisions of "Attack Scripting Portal"
DracoHouston (talk | contribs) |
|||
| Line 21: | Line 21: | ||
RegisterAttack is a global function that hooks into an engine function, the first of many such interfaces you will encounter. It sets up a move, giving it an ID number, name and description, then a script file to read for the rest. Let's look at attack #1, Pound | RegisterAttack is a global function that hooks into an engine function, the first of many such interfaces you will encounter. It sets up a move, giving it an ID number, name and description, then a script file to read for the rest. Let's look at attack #1, Pound | ||
< | <syntaxhighlight lang="lua"> | ||
SetAttackBaseDamage(1,40) | SetAttackBaseDamage(1,40) | ||
SetAttackMaxPP(1,35) | SetAttackMaxPP(1,35) | ||
| Line 29: | Line 29: | ||
SetAttackPriority(1,0) | SetAttackPriority(1,0) | ||
SetAttackAccuracy(1,255) | SetAttackAccuracy(1,255) | ||
</ | </syntaxhighlight> | ||
This is the most basic of attacks, it merely sets the stats up and it is done. Each of these functions take the attack ID number then the value. There are more settings. For example, this is Ember, a fully animated attack with a special effect | This is the most basic of attacks, it merely sets the stats up and it is done. Each of these functions take the attack ID number then the value. There are more settings. For example, this is Ember, a fully animated attack with a special effect | ||
< | <syntaxhighlight lang="lua"> | ||
SetAttackBaseDamage(52,40) | SetAttackBaseDamage(52,40) | ||
SetAttackMaxPP(52,25) | SetAttackMaxPP(52,25) | ||
| Line 67: | Line 67: | ||
AnimationSequenceEnd() | AnimationSequenceEnd() | ||
end | end | ||
</ | </syntaxhighlight> | ||
Latest revision as of 13:52, 3 March 2013
Attack Scripting involves using LUA scripts to create attacks for pokemon.
Tools
- Decoda A free, open source LUA IDE with debugger
- Notepad++ Free text editor with LUA syntax highlighting
Documentation
Introduction
Internally, an attack is an Attack object, which contains its stats and what it does. To set these attacks up we use LUA scripts. On launch, the engine will run a script called Attacks.lua contained in /Scripts/. Inside that is the move index, for example:
RegisterAttack(1,"Pound","The target is physically pounded with a long tail or a foreleg, etc.","Attacks\\Normal\\Pound")
RegisterAttack(2,"Karate Chop","The target is attacked with a sharp chop. Critical hits land more easily.","Attacks\\Fighting\\KarateChop")
RegisterAttack(3,"DoubleSlap","The target is slapped repeatedly and forth, two to five times in a row.","Attacks\\Normal\\DoubleSlap")
RegisterAttack(4,"Comet Punch","The target is hit with a flurry of punches that strike two to five times in a row.","Attacks\\Normal\\CometPunch")
RegisterAttack(5,"Mega Punch","The target is slugged by a punch thrown with muscle-packed power.","Attacks\\Normal\\MegaPunch")
RegisterAttack is a global function that hooks into an engine function, the first of many such interfaces you will encounter. It sets up a move, giving it an ID number, name and description, then a script file to read for the rest. Let's look at attack #1, Pound
SetAttackBaseDamage(1,40)
SetAttackMaxPP(1,35)
SetAttackCategory(1,0)
SetAttackContestCategory(1,0)
SetAttackType(1,0)
SetAttackPriority(1,0)
SetAttackAccuracy(1,255)
This is the most basic of attacks, it merely sets the stats up and it is done. Each of these functions take the attack ID number then the value. There are more settings. For example, this is Ember, a fully animated attack with a special effect
SetAttackBaseDamage(52,40)
SetAttackMaxPP(52,25)
SetAttackCategory(52,1)
SetAttackContestCategory(52,2)
SetAttackType(52,9)
SetAttackPriority(52,0)
SetAttackAccuracy(52,255)
SetAttackAttackingAnimationDelegate(52, "ATTACKS_FIRE_EMBER_ATTACKING_ANIMATION")
SetAttackHitAnimationDelegate(52, "ATTACKS_FIRE_EMBER_HIT_ANIMATION")
SetAttackSpecialAttackDelegate(52, "ATTACKS_FIRE_EMBER_SPECIAL")
function ATTACKS_FIRE_EMBER_SPECIAL()
Attacks_TryToBurn(30, "target")
end
function ATTACKS_FIRE_EMBER_ATTACKING_ANIMATION()
AnimationSequenceBegin()
AttacksSpawnMovingAnimation(0.0,0.0,0.0,"Textures\\Battle\\Fire\\EmberBall", 0.2, 0.2, 0.2, 4.0, 0.0, 0.0, 0.036, false, true, 0.0, 0.0)
for i = 0, 12, 1 do
AttacksSpawnOpacityAnimation(i * 0.2, 0.0, 0.0, "Textures\\Battle\\Fire\\Fire", 0.2, 0.2, 0.2, 0.01, false, 0.0, i * 0.6, 0.0)
end
AnimationSequenceEnd()
end
function ATTACKS_FIRE_EMBER_HIT_ANIMATION()
AnimationSequenceBegin()
AttacksSpawnMovingAnimation(2.4,0.0,0.0,"Textures\\Battle\\Fire\\EmberBall", 0.2, 0.2, 0.2, 0.0, 0.0, 0.0, 0.036, false, true, 0.0, 0.0)
for i = 0, 12, 1 do
AttacksSpawnOpacityAnimation(i * 0.2, 0.0, 0.0, "Textures\\Battle\\Fire\\Fire", 0.2, 0.2, 0.2, 0.01, false, 0.0, 7.2 - (i * 0.6), 0.0)
end
AttacksSpawnOpacityAnimation(0.1, 0.0, 0.0, "Textures\\Battle\\Fire\\Fire", 1.0, 1.0, 1.0, 0.01, false, 0.0, 7.2, 1.0)
AnimationSequenceEnd()
end