I suggest using keyscripts + follow animations for this feature. This is because, unlike freespecials, there's no event that may trigger follow animations accidentally, unless you force them with scripts or via "followanim/followcond".For example, I want to use the same command, but have it trigger anim freespecial2 with about a 90% chance and anim freespecial3 with a 10% chance.
I would appreciate it if you could tell me how to implement this.
keyscript data/scripts/critical.c
void main()
{
void self = getlocalvar("self");
int pIndex =...
I suggest using keyscripts + follow animations for this feature. This is because, unlike freespecials, there's no event that may trigger follow animations accidentally, unless you force them with scripts or via "followanim/followcond".For example, I want to use the same command, but have it trigger anim freespecial2 with about a 90% chance and anim freespecial3 with a 10% chance.
I would appreciate it if you could tell me how to implement this.
keyscript data/scripts/critical.c
void main()
{
void self = getlocalvar("self");
int pIndex = getlocalvar("player");
int attack2 = playerkeys(pIndex, 1, "attack2");
if(attack2)
{
int iR = rand()%50+50; //RANDOM CHANCE
if(iR >= 0 && iR < 90)
{
performattack(self, openborconstant("ANI_FOLLOW1"), 0); //90% CHANCE
}
else
{
performattack(self, openborconstant("ANI_FOLLOW2"), 0); //10% CHANCE
}
}
}
Thank you for the reply. I researched a different method and managed to solve it.I suggest using keyscripts + follow animations for this feature. This is because, unlike freespecials, there's no event that may trigger follow animations accidentally, unless you force them with scripts or via "followanim/followcond".
That said, just create any .c file in your scripts folder and call it in your character header, like this:
After that, put a script like the example below:
Code:void main() { void self = getlocalvar("self"); int pIndex = getlocalvar("player"); int attack2 = playerkeys(pIndex, 1, "attack2"); if(attack2) { int iR = rand()%50+50; //RANDOM CHANCE if(iR >= 0 && iR < 90) { performattack(self, openborconstant("ANI_FOLLOW1"), 0); //90% CHANCE } else { performattack(self, openborconstant("ANI_FOLLOW2"), 0); //10% CHANCE } } }
In this example, if you press the attack2 button, it will randomly perform follow1 or follow2 animations based on the defined chance.
Just rename both freespecial2/freespecial3 to follow1/follow2 and it will work fine. In case you need a "mp" cost (like energycost), you will need some additional lines, but I suggest trying this example first.