Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 9

Tutorial to Hackel's Ally System

Tutorial to Hackel's Ally System

1. Introduction

I always wanted to have an Ally System for XAS, but after looking around and not finding one I
decided to make one myself.

Download it here!

2. How to make an Ally

You create an ally in much the same way you create a monster (see: how to create a new enemy)
- the only difference being the minus sign in front of the Enemy ID.
Basically, the enemies have the same values as your Allies (eg, Ally has an Enemy ID of -3 so he
is the 3rd entry in the Database).

3. The Move Route


You could now choose to handle it like any other enemy but then the ally would be quite stupid
and unable to adapt to his skills and weapons.

Therefore Hackel has created a new layout to use to improve the AI, simply write this into the
move route:

ki(sa,sb,sc,sd,se,ra,rb,rc,rd,re,hp,ha,freq,heal-per,skilltime,keinn)

sa to se are close combat skills:

Where sa is the most commonly used skill and se is the least used.

ra to re are long ranged skills:

Where ra is the most commonly used skill and re is the least used.

hp = a skill with which you can heal other allies.

ha = a skill with which you can cure other allies.

freq = the attack speed, the greater the number is so slow to attack, (each is attacked xte times x
= freq)

heal-per = The percentage of life that will be cured (if heal-per = 30 then heals the ally or run
away if he has to live 30%)

skilltime = the same as freq only for the skills

keinn = no melee, though it is true ally will not go into the melee (eg for the Wizards while
melee weapons but they should not use)

When any of the above does not apply (ie. you don't want to use a skill) simply put a zero in its
place.

Indeed, the AI has a lot of other skills, too: the ally


- is starting to run when he's far away from the hero
- is teleporting himself near to the hero when he's too far away
- is able to avoid little barricades
- is finding the next enemy automatically
- is following the hero automatically when there's no enemy around
- is just attacking when he's sure to hit the enemy (exept the enemy is avoiding the hit)
- cannot block the hero
- and much, much more...

The ally is also using his weapon independently but as he cannot know wether it's a range or
close combat weapon, just place the ID of the weapon skill into module XAS_SKILL
LONG_RANGE_SKILL when it's a range combat weapon and into SHORT_RANGE_SKILL
when it's a close combat weapon.

Also you should add every skill that is just causing damage to the enemy to
SKILL_ENEMY_ALLY
4. How to use

Though I changed it a bit I'm using Zeriab's


Caterpillar Script. According to this you have to name all your ALLY
EVENTS ..cat_actor[x]
(x = the actor's ID) for that there don't occur
2 actors at the same time. Doing this they will be teleported to you
automatically
and also will be teleported when the hero is teleported.

Now you could copy the events into the map but instead I integrated a system that is doing this
automatically.
Therefore you have to fill out the module XAS_ALLY

ALLY_MAPID = (e.g. 2) = the map on which your allys appear (in this map there must be only
allys)

NORMAL_ATTACK_SKILL = (e.g. 10) = the skill that is used at a normal


attack (the collisions request would only work with the player, but I
don't like it anyway)
MAX_ACTOR = 4 = the number of allys you have
(actually the number of the events on the ally map) NOT THE NUMBER OF
PLAYERS BELONGING TO THE PARTY
AUTO_TELE = true = when set "false" the allys won't be teleported automatically

one last hint: you can also add a 4. eventpage to the allys that is e.g. activated by a switch (to turn
off the actors)

5. Additional functions

For
that allys are a little better I had to write new moveroute commands
that you have to use for that your allys don't attack the hero:

move_to_enemy = move to nearest enemy


move_away_from_enemy = move away from the nearest enemy
turn_toward_enemy = turn to the nearest enemy
turn_away_from_enemy = turn away from the nearest enemy
find_to_enemy = find to the nearest enemy (can avoid little barricades)
flee_from_enemy = flee from nearest enemy (can avoid little barricades)

move_to_actor = move to nearest actor


move_away_from_actor = move away from nearest actor
turn_to_actor = turn to the nearest actor
turn_away_from_actor = turn away from the nearest actor
find_to_actor = find the nearest actor (can avoid little barricades)
flee_from_actor = flee from nearest actor (can avoid little barricades)

find_to_Player = find the player (can avoid little barricades)


flee_from_player = flee from player (can avoid little barricades)
---------------------------------------------------------------------------------------------------------------------
---------------
The enemy's AI can be found in the script.
This is an explanation:

allki(fskill,ffs,skill,fs,heal,freq,healper,skilltime,speed,se,fr) this is for close and range combat


enemys
fkeki(askill,skill1,fs1,skill2,fs2,heal,freq,healper,skilltime,speed,se,fr) this is for range combat
enemys
keki(skill1,fs1,skill2,fs2,heal,freq,healper,skilltime,speed,se,fr) this is for close combat enemys

keki(skill1,fs1,skill2,fs2,heal,freq,healper,skilltime,speed,se,fr)
skill1 = 1st skill the graphic name must be ENEMYNAME_[fs1]spe1 fs1 = number of frames
fs1 = frames of the skill1 graphic
skill2 = 2nd skill the graphic name must be ENEMYNAME_[fs1]spe2 fs2 = number of frames
fs2 = frames of the skill2 graphic
heal = a heal skill
freq = attack speed ( 20 = fast ,60 = slow)
healper = if 30 => he start to heal if he has 30% of his hp
skilltime = same as freq only for skills
speed = walk speed 5 = fast 3 = slow
se = attack se (sound)
fr = the pitch of the se

fkeki(askill,skill1,fs1,skill2,fs2,heal,freq,healper,skilltime,speed,se,fr)
askill = the attack skill
skill1 = 1st skill the graphic name must be ENEMYNAME_[fs1]spe1 fs1 = number of frames
fs1 = frames of the skill1 graphic
skill2 = 2nd skill the graphic name must be ENEMYNAME_[fs1]spe2 fs2 = number of frames
fs2 = frames of the skill2 graphic
heal = a heal skill
freq = attack speed ( 20 = fast ,60 = slow)
healper = if 30 => he start to heal if he has 30% of his hp
skilltime = same as freq only for skills
speed = walk speed 5 = fast 3 = slow
se = attack se (sound)
fr = the pitch of the se

allki(fskill,ffs,skill,fs,heal,freq,healper,skilltime,speed,se,fr)
fskill = range skill the graphic name must be ENEMYNAME_[ffs]spe2 ffs = number of frames
ffs = frames of the rage comabt skill graphic
skill = close combat skill the graphic name must be ENEMYNAME_[fs]spe1 fs = number of
frames
fs = frames of the close comabt skill graphic
heal = a heal skill
freq = attack speed ( 20 = fast ,60 = slow)
healper = if 30 => he start to heal if he has 30% of his hp
skilltime = same as freq only for skills
speed = walk speed 5 = fast 3 = slow
se = attack se (sound)
fr = the pitch of the se

If you do not have a skill or SE put a 0 in its place.

Some examples:

keki(0,0,0,0,0,30,40,0,3,0,0)
allki(77,1,0,0,0,20,10,100,3,"Mana - Duran_Hit",50)
keki(76,4,0,0,0,0,40,70,2,0,0)
fkeki(72,0,0,0,0,0,40,40,0,3,0,0)

Translated by Rainbird
(Original German version by Hackel)

閱讀更多: http://blogs.myspace.com/index.cfm?
fuseaction=blog.view&friendId=447095114&blogId=474947857#ixzz0yGQBHWbX

You might also like