Armor Ignore problems
Posted: Thu Jun 17, 2021 3:16 am
Here is my scripts
first is abilities.js
That code should then call this script to open
ArmorIgnore.js
This line is giving me a error
first is abilities.js
function onSpecialMove(pUser, abilityID)
{
if (!CheckMana(pUser, abilityID))
return true;
switch (abilityID)
{
case 0x01: // Armor Ignore
HandleArmorIgnore(pUser, abilityID);
break;
default:
break;
}
return true;
}
function CheckMana(pUser, abilityID)
{
var Mana = 30;
if (pUser.mana <= Mana)
{
pUser.TextMessage("You need " + Mana + " mana to perform that attack"); // 1060181 mana.ToString() You need ~1_MANA_REQUIREMENT~ mana to perform that attack
DeactivateSpecialMove(pUser.socket, abilityID);
return false;
}
else
pUser.mana -= Mana;
return true;
}
function HandleArmorIgnore(pUser, abilityID)
{
TriggerEvent(401, "ArmorIgnore", pUser.pAttacker, pUser.pDefender, abilityID);
//onAttack(pUser.pAttacker, pUser.pDefender, abilityID)
pUser.StartTimer(5000, abilityID, true);
}
/*function onAttack(pAttacker, pDefender, abilityID)
{
pAttacker.TextMessage("Your attack penetrates their armor!");
pDefender.health -= 9;
pDefender.TextMessage("The blow penetrated your armor!");
pDefender.SoundEffect(0x0056, true);
pDefender.StaticEffect(0x3728, 0x09, 0x06);
DeactivateSpecialMove(pAttacker.socket, abilityID);
}*/
function DeactivateSpecialMove(pSocket, abilityID)
{
var toSend = new Packet;
toSend.ReserveSize(7)
toSend.WriteByte(0, 0xbf); // Packet
toSend.WriteShort(1, 0x07); // Length
toSend.WriteShort(3, 0x21); // SubCmd
toSend.WriteByte(5, abilityID); // Ability ID
toSend.WriteByte(6, 0); // On/off
pSocket.Send(toSend);
toSend.Free();
}
function onTimer(timerObj, timerID)
{
//Toggle ability off after 2 second timer has elapsed
var toSend = new Packet;
toSend.ReserveSize(7)
toSend.WriteByte(0, 0xbf); // Packet
toSend.WriteShort(1, 0x07); // Length
toSend.WriteShort(3, 0x21); // SubCmd
toSend.WriteByte(5, timerID); // Ability ID
toSend.WriteByte(6, 0); // On/off
timerObj.socket.Send(toSend);
toSend.Free();
}
{
if (!CheckMana(pUser, abilityID))
return true;
switch (abilityID)
{
case 0x01: // Armor Ignore
HandleArmorIgnore(pUser, abilityID);
break;
default:
break;
}
return true;
}
function CheckMana(pUser, abilityID)
{
var Mana = 30;
if (pUser.mana <= Mana)
{
pUser.TextMessage("You need " + Mana + " mana to perform that attack"); // 1060181 mana.ToString() You need ~1_MANA_REQUIREMENT~ mana to perform that attack
DeactivateSpecialMove(pUser.socket, abilityID);
return false;
}
else
pUser.mana -= Mana;
return true;
}
function HandleArmorIgnore(pUser, abilityID)
{
TriggerEvent(401, "ArmorIgnore", pUser.pAttacker, pUser.pDefender, abilityID);
//onAttack(pUser.pAttacker, pUser.pDefender, abilityID)
pUser.StartTimer(5000, abilityID, true);
}
/*function onAttack(pAttacker, pDefender, abilityID)
{
pAttacker.TextMessage("Your attack penetrates their armor!");
pDefender.health -= 9;
pDefender.TextMessage("The blow penetrated your armor!");
pDefender.SoundEffect(0x0056, true);
pDefender.StaticEffect(0x3728, 0x09, 0x06);
DeactivateSpecialMove(pAttacker.socket, abilityID);
}*/
function DeactivateSpecialMove(pSocket, abilityID)
{
var toSend = new Packet;
toSend.ReserveSize(7)
toSend.WriteByte(0, 0xbf); // Packet
toSend.WriteShort(1, 0x07); // Length
toSend.WriteShort(3, 0x21); // SubCmd
toSend.WriteByte(5, abilityID); // Ability ID
toSend.WriteByte(6, 0); // On/off
pSocket.Send(toSend);
toSend.Free();
}
function onTimer(timerObj, timerID)
{
//Toggle ability off after 2 second timer has elapsed
var toSend = new Packet;
toSend.ReserveSize(7)
toSend.WriteByte(0, 0xbf); // Packet
toSend.WriteShort(1, 0x07); // Length
toSend.WriteShort(3, 0x21); // SubCmd
toSend.WriteByte(5, timerID); // Ability ID
toSend.WriteByte(6, 0); // On/off
timerObj.socket.Send(toSend);
toSend.Free();
}
ArmorIgnore.js
function onAttack(pAttacker, pDefender, abilityID)
{
pAttacker.TextMessage("Your attack penetrates their armor!");
pDefender.health -= 9;
pDefender.TextMessage("The blow penetrated your armor!");
pDefender.SoundEffect(0x0056, true);
pDefender.StaticEffect(0x3728, 0x09, 0x06);
DeactivateSpecialMove(pAttacker.socket, abilityID);
}
function DeactivateSpecialMove(pSocket, abilityID)
{
var toSend = new Packet;
toSend.ReserveSize(7)
toSend.WriteByte(0, 0xbf); // Packet
toSend.WriteShort(1, 0x07); // Length
toSend.WriteShort(3, 0x21); // SubCmd
toSend.WriteByte(5, abilityID); // Ability ID
toSend.WriteByte(6, 0); // On/off
pSocket.Send(toSend);
toSend.Free();
}
{
pAttacker.TextMessage("Your attack penetrates their armor!");
pDefender.health -= 9;
pDefender.TextMessage("The blow penetrated your armor!");
pDefender.SoundEffect(0x0056, true);
pDefender.StaticEffect(0x3728, 0x09, 0x06);
DeactivateSpecialMove(pAttacker.socket, abilityID);
}
function DeactivateSpecialMove(pSocket, abilityID)
{
var toSend = new Packet;
toSend.ReserveSize(7)
toSend.WriteByte(0, 0xbf); // Packet
toSend.WriteShort(1, 0x07); // Length
toSend.WriteShort(3, 0x21); // SubCmd
toSend.WriteByte(5, abilityID); // Ability ID
toSend.WriteByte(6, 0); // On/off
pSocket.Send(toSend);
toSend.Free();
}
This line is giving me a error
TriggerEvent(401, "ArmorIgnore", pUser.pAttacker, pUser.pDefender, abilityID);