Всем привет и с наступившим новым годом!
Прошу помощи. На сервере есть мобы - маги, которые нон стоп кастуют скиллы, и не бегут после каста бить с руки. Хочется все таки сделать так, чтобы после каста скилла, моб пошёл ковырять игрока с руки. Эксперименты не удались. Решил обратиться к знатокам для помощи. Прикладываю ветку классов визарда. Буду признателен любой помощи! Спасибо!
Прошу помощи. На сервере есть мобы - маги, которые нон стоп кастуют скиллы, и не бегут после каста бить с руки. Хочется все таки сделать так, чтобы после каста скилла, моб пошёл ковырять игрока с руки. Эксперименты не удались. Решил обратиться к знатокам для помощи. Прикладываю ветку классов визарда. Буду признателен любой помощи! Спасибо!
C++:
class wizard : wizard_parameter
{
parameter:
float Attack_DecayRatio = 6.600000;
float UseSkill_DecayRatio = 66000.000000;
float Attack_BoostValue = 300.000000;
float UseSkill_BoostValue = 100000.000000;
handler:
EventHandler NO_DESIRE( )
{
myself.AddMoveAroundDesire( 5, 5 );
}
EventHandler CREATED( )
{
if ( ShoutMsg1 > 0 ) {
myself.Shout( MakeFString( ShoutMsg1, _blank, _blank, _blank, _blank, _blank ) );
}
if ( ( ( ( MoveAroundSocial > 0 ) || ( ShoutMsg2 > 0 ) ) ) || ( ShoutMsg3 > 0 ) ) {
myself.AddTimerEx( 1001, 10000 );
}
myself.AddTimerEx( 1002, 10000 );
myself.i_ai0 = 0;
super;
}
EventHandler TIMER_FIRED_EX( timer_id, h0, i0 )
{
if ( timer_id == 1001 ) {
if ( ( ( ( myself.p_state == 1 ) || ( myself.p_state == 2 ) ) ) || ( myself.p_state == 9 ) ) {
if ( ( ( ( MoveAroundSocial > 0 ) || ( MoveAroundSocial1 > 0 ) ) ) || ( MoveAroundSocial2 > 0 ) ) {
if ( MoveAroundSocial2 > 0 && Rand( 100 ) < 20 ) {
myself.AddEffectActionDesire( myself.sm, 3, ( ( MoveAroundSocial2 * 1000 ) / 30 ), 50 );
} else {
if ( MoveAroundSocial1 > 0 && Rand( 100 ) < 20 ) {
myself.AddEffectActionDesire( myself.sm, 2, ( ( MoveAroundSocial1 * 1000 ) / 30 ), 50 );
} else {
if ( MoveAroundSocial > 0 && Rand( 100 ) < 20 ) {
myself.AddEffectActionDesire( myself.sm, 1, ( ( MoveAroundSocial * 1000 ) / 30 ), 50 );
}
}
}
}
if ( ShoutMsg2 > 0 && Rand( 1000 ) < 17 ) {
myself.Shout( MakeFString( ShoutMsg2, _blank, _blank, _blank, _blank, _blank ) );
}
} else {
if ( myself.p_state == 3 ) {
if ( ShoutMsg3 > 0 && Rand( 100 ) < 10 ) {
myself.Shout( MakeFString( ShoutMsg3, _blank, _blank, _blank, _blank, _blank ) );
}
}
}
myself.AddTimerEx( 1001, 10000 );
} else {
if ( timer_id == 1002 ) {
myself.AddTimerEx( 1002, 10000 );
myself.RemoveAllHateInfoIF( 1, 0 );
myself.RemoveAllHateInfoIF( 3, 1000 );
} else {
if ( timer_id == 1003 ) {
if ( ( GetAbnormalLevel( myself.sm, myself.Skill_GetAbnormalType( 69730305 ) ) > 0 ) || ( GetAbnormalLevel( myself.sm, myself.Skill_GetAbnormalType( 87556097 ) ) > 0 ) ) {
myself.AddTimerEx( 1003, 10000 );
} else {
myself.RemoveAllAttackDesire( );
myself.i_ai0 = 0;
h0 = myself.GetMaxHateInfo( 0 );
i0 = 0;
if ( myself.IsNullHateInfo( h0 ) == 0 ) {
if ( myself.IsNullCreature( h0.creature ) == 0 ) {
i0 = 1;
}
}
if ( i0 == 1 ) {
myself.MakeAttackEvent( h0.creature, 100, 0 );
}
}
}
}
}
super;
}
EventHandler ATTACKED( attacker, damage, skill_name_id, f0 )
{
if ( ( attacker.is_pc != 0 ) || ( myself.IsInCategory( 12, attacker.npc_class_id ) ) ) {
if ( myself.GetHateInfoCount( ) == 0 ) {
f0 = 0;
if ( SetHateGroup >= 0 ) {
if ( myself.IsInCategory( SetHateGroup, attacker.occupation ) ) {
f0 = ( f0 + SetHateGroupRatio );
}
}
if ( attacker.occupation == SetHateOccupation ) {
f0 = ( f0 + SetHateOccupationRatio );
}
if ( SetHateRace == attacker.race ) {
f0 = ( f0 + SetHateRaceRatio );
}
f0 = ( ( ( 1.000000 * damage ) / ( myself.sm.level + 7 ) ) + ( ( f0 / 100 ) * ( ( 1.000000 * damage ) / ( myself.sm.level + 7 ) ) ) );
myself.AddHateInfo( attacker, FloatToInt( ( ( f0 * 100 ) + 300 ) ), 0, 1, 1 );
} else {
f0 = 0;
if ( SetHateGroup >= 0 ) {
if ( myself.IsInCategory( SetHateGroup, attacker.occupation ) ) {
f0 = ( f0 + SetHateGroupRatio );
}
}
if ( attacker.occupation == SetHateOccupation ) {
f0 = ( f0 + SetHateOccupationRatio );
}
if ( SetHateRace == attacker.race ) {
f0 = ( f0 + SetHateRaceRatio );
}
f0 = ( ( ( 1.000000 * damage ) / ( myself.sm.level + 7 ) ) + ( ( f0 / 100 ) * ( ( 1.000000 * damage ) / ( myself.sm.level + 7 ) ) ) );
myself.AddHateInfo( attacker, FloatToInt( ( f0 * 100 ) ), 0, 1, 1 );
}
}
if ( ( ( ( ( skill_name_id / 65536 ) == ( 69730305 / 65536 ) ) || ( ( skill_name_id / 65536 ) == ( 81657857 / 65536 ) ) ) ) || ( ( skill_name_id / 65536 ) == ( 87556097 / 65536 ) ) ) {
myself.i_ai0 = 1;
myself.AddTimerEx( 1003, 10000 );
}
super;
}
EventHandler CLAN_ATTACKED( attacker, damage, f0 )
{
if ( myself.GetLifeTime( ) > 7 ) {
if ( ( attacker.is_pc != 0 ) || ( myself.IsInCategory( 12, attacker.npc_class_id ) ) ) {
if ( myself.GetHateInfoCount( ) == 0 ) {
f0 = 0;
if ( SetHateGroup >= 0 ) {
if ( myself.IsInCategory( SetHateGroup, attacker.occupation ) ) {
f0 = ( f0 + SetHateGroupRatio );
}
}
if ( attacker.occupation == SetHateOccupation ) {
f0 = ( f0 + SetHateOccupationRatio );
}
if ( SetHateRace == attacker.race ) {
f0 = ( f0 + SetHateRaceRatio );
}
f0 = ( ( ( 1.000000 * damage ) / ( myself.sm.level + 7 ) ) + ( ( f0 / 100 ) * ( ( 1.000000 * damage ) / ( myself.sm.level + 7 ) ) ) );
myself.AddHateInfo( attacker, FloatToInt( ( ( f0 * 30 ) + 300 ) ), 0, 1, 1 );
} else {
f0 = 0;
if ( SetHateGroup >= 0 ) {
if ( myself.IsInCategory( SetHateGroup, attacker.occupation ) ) {
f0 = ( f0 + SetHateGroupRatio );
}
}
if ( attacker.occupation == SetHateOccupation ) {
f0 = ( f0 + SetHateOccupationRatio );
}
if ( SetHateRace == attacker.race ) {
f0 = ( f0 + SetHateRaceRatio );
}
f0 = ( ( ( 1.000000 * damage ) / ( myself.sm.level + 7 ) ) + ( ( f0 / 100 ) * ( ( 1.000000 * damage ) / ( myself.sm.level + 7 ) ) ) );
myself.AddHateInfo( attacker, FloatToInt( ( f0 * 30 ) ), 0, 1, 1 );
}
}
}
}
EventHandler SEE_SPELL( speller, skill_name_id, target, f0, i0 )
{
if ( myself.Skill_GetEffectPoint( skill_name_id ) > 0 ) {
if ( myself.p_state == 3 && myself.top_desire_target == speller ) {
i0 = myself.Skill_GetEffectPoint( skill_name_id );
f0 = 0;
if ( SetHateGroup >= 0 ) {
if ( myself.IsInCategory( SetHateGroup, speller.occupation ) ) {
f0 = ( f0 + SetHateGroupRatio );
}
}
if ( speller.occupation == SetHateOccupation ) {
f0 = ( f0 + SetHateOccupationRatio );
}
if ( SetHateRace == speller.race ) {
f0 = ( f0 + SetHateRaceRatio );
}
f0 = ( ( ( 1.000000 * i0 ) / ( myself.sm.level + 7 ) ) + ( ( f0 / 100 ) * ( ( 1.000000 * i0 ) / ( myself.sm.level + 7 ) ) ) );
myself.AddHateInfo( speller, FloatToInt( ( f0 * 150 ) ), 0, 1, 1 );
} else {
i0 = myself.Skill_GetEffectPoint( skill_name_id );
f0 = 0;
if ( SetHateGroup >= 0 ) {
if ( myself.IsInCategory( SetHateGroup, speller.occupation ) ) {
f0 = ( f0 + SetHateGroupRatio );
}
}
if ( speller.occupation == SetHateOccupation ) {
f0 = ( f0 + SetHateOccupationRatio );
}
if ( SetHateRace == speller.race ) {
f0 = ( f0 + SetHateRaceRatio );
}
f0 = ( ( ( 1.000000 * i0 ) / ( myself.sm.level + 7 ) ) + ( ( f0 / 100 ) * ( ( 1.000000 * i0 ) / ( myself.sm.level + 7 ) ) ) );
myself.AddHateInfo( speller, FloatToInt( ( f0 * 75 ) ), 0, 1, 1 );
}
}
}
EventHandler DESIRE_MANIPULATION( speller, desire )
{
if ( myself.IsBoss( ) == 0 ) {
myself.AddHateInfo( speller, desire, 0, 1, 1 );
}
super;
}
EventHandler MY_DYING( target, i0, i1, last_attacker, i2, i3, i4, i9, lparty, random1_list, code_info )
{
if ( ShoutMsg4 > 0 && Rand( 100 ) < 30 ) {
myself.Shout( MakeFString( ShoutMsg4, _blank, _blank, _blank, _blank, _blank ) );
}
}
}
class wizard_ddmagic2 : wizard
{
parameter:
int W_ShortRangeDDMagic = 272629761;
int W_LongRangeDDMagic = 272039937;
int DDMagic1 = 262209537;
int DDMagic2 = 262209537;
handler:
EventHandler ATTACKED( attacker, damage, h0, i0, i1, f0 )
{
super;
h0 = myself.GetMaxHateInfo( 0 );
if ( ( attacker.is_pc != 0 ) || ( myself.IsInCategory( 12, attacker.npc_class_id ) ) ) {
if ( myself.i_ai0 == 0 ) {
i0 = 0;
if ( myself.IsNullHateInfo( h0 ) == 0 ) {
if ( myself.IsNullCreature( h0.creature ) == 0 ) {
i0 = 1;
}
}
if ( i0 == 1 ) {
if ( h0.creature == attacker ) {
i0 = 1;
}
}
if ( myself.DistFromMe( attacker ) > 100 && Rand( 100 ) < 80 ) {
if ( i0 == 1 ) {
if ( myself.Skill_GetConsumeMP( W_LongRangeDDMagic ) < myself.sm.mp && myself.Skill_GetConsumeHP( W_LongRangeDDMagic ) < myself.sm.hp ) {
if ( myself.Skill_InReuseDelay( W_LongRangeDDMagic ) == 0 ) {
myself.AddUseSkillDesire( attacker, W_LongRangeDDMagic, 0, 1, 1000000 );
} else {
myself.AddUseSkillDesire( attacker, W_LongRangeDDMagic, 0, 1, 1000000 );
}
} else {
myself.i_ai0 = 1;
myself.AddAttackDesire( attacker, 1, 1000 );
}
} else {
if ( Rand( 100 ) < 2 ) {
if ( myself.Skill_GetConsumeMP( W_LongRangeDDMagic ) < myself.sm.mp && myself.Skill_GetConsumeHP( W_LongRangeDDMagic ) < myself.sm.hp ) {
if ( myself.Skill_InReuseDelay( W_LongRangeDDMagic ) == 0 ) {
myself.AddUseSkillDesire( attacker, W_LongRangeDDMagic, 0, 1, 1000000 );
} else {
myself.AddUseSkillDesire( attacker, W_LongRangeDDMagic, 0, 1, 1000000 );
}
} else {
myself.i_ai0 = 1;
myself.AddAttackDesire( attacker, 1, 1000 );
}
}
}
} else {
if ( i0 == 1 ) {
if ( myself.Skill_GetConsumeMP( W_ShortRangeDDMagic ) < myself.sm.mp && myself.Skill_GetConsumeHP( W_ShortRangeDDMagic ) < myself.sm.hp ) {
if ( myself.Skill_InReuseDelay( W_ShortRangeDDMagic ) == 0 ) {
myself.AddUseSkillDesire( attacker, W_ShortRangeDDMagic, 0, 1, 1000000 );
} else {
myself.AddUseSkillDesire( attacker, W_ShortRangeDDMagic, 0, 1, 1000000 );
}
} else {
myself.i_ai0 = 1;
myself.AddAttackDesire( attacker, 1, 1000 );
}
} else {
if ( Rand( 100 ) < 2 ) {
if ( myself.Skill_GetConsumeMP( W_ShortRangeDDMagic ) < myself.sm.mp && myself.Skill_GetConsumeHP( W_ShortRangeDDMagic ) < myself.sm.hp ) {
if ( myself.Skill_InReuseDelay( W_ShortRangeDDMagic ) == 0 ) {
myself.AddUseSkillDesire( attacker, W_ShortRangeDDMagic, 0, 1, 1000000 );
} else {
myself.AddUseSkillDesire( attacker, W_ShortRangeDDMagic, 0, 1, 1000000 );
}
} else {
myself.i_ai0 = 1;
myself.AddAttackDesire( attacker, 1, 1000 );
}
}
}
}
} else {
if ( ( attacker.is_pc != 0 ) || ( myself.IsInCategory( 12, attacker.npc_class_id ) ) ) {
f0 = 0;
if ( SetHateGroup >= 0 ) {
if ( myself.IsInCategory( SetHateGroup, attacker.occupation ) ) {
f0 = ( f0 + SetHateGroupRatio );
}
}
if ( attacker.occupation == SetHateOccupation ) {
f0 = ( f0 + SetHateOccupationRatio );
}
if ( SetHateRace == attacker.race ) {
f0 = ( f0 + SetHateRaceRatio );
}
f0 = ( ( ( 1.000000 * damage ) / ( myself.sm.level + 7 ) ) + ( ( f0 / 100 ) * ( ( 1.000000 * damage ) / ( myself.sm.level + 7 ) ) ) );
myself.AddAttackDesire( attacker, 1, ( f0 * 100 ) );
}
}
}
}
EventHandler CLAN_ATTACKED( attacker, damage, i6, h0 )
{
myself.RemoveAllHateInfoIF( 1, 0 );
if ( ( myself.GetLifeTime( ) > 7 && ( ( attacker.is_pc != 0 ) || ( myself.IsInCategory( 12, attacker.npc_class_id ) ) ) ) && myself.GetHateInfoCount( ) == 0 ) {
if ( myself.DistFromMe( attacker ) > 100 ) {
if ( myself.Skill_GetConsumeMP( W_LongRangeDDMagic ) < myself.sm.mp && myself.Skill_GetConsumeHP( W_LongRangeDDMagic ) < myself.sm.hp ) {
if ( myself.Skill_InReuseDelay( W_LongRangeDDMagic ) == 0 ) {
myself.AddUseSkillDesire( attacker, W_LongRangeDDMagic, 0, 1, 1000000 );
} else {
myself.AddUseSkillDesire( attacker, W_LongRangeDDMagic, 0, 1, 1000000 );
}
} else {
myself.i_ai0 = 1;
myself.AddAttackDesire( attacker, 1, 1000 );
}
} else {
if ( myself.Skill_GetConsumeMP( W_ShortRangeDDMagic ) < myself.sm.mp && myself.Skill_GetConsumeHP( W_ShortRangeDDMagic ) < myself.sm.hp ) {
if ( myself.Skill_InReuseDelay( W_ShortRangeDDMagic ) == 0 ) {
myself.AddUseSkillDesire( attacker, W_ShortRangeDDMagic, 0, 1, 1000000 );
} else {
myself.AddUseSkillDesire( attacker, W_ShortRangeDDMagic, 0, 1, 1000000 );
}
} else {
myself.i_ai0 = 1;
myself.AddAttackDesire( attacker, 1, 1000 );
}
}
}
super;
}
EventHandler USE_SKILL_FINISHED( h0, i0 )
{
h0 = myself.GetMaxHateInfo( 0 );
i0 = 0;
if ( myself.IsNullHateInfo( h0 ) == 0 ) {
if ( myself.IsNullCreature( h0.creature ) == 0 ) {
i0 = 1;
}
}
if ( i0 == 1 ) {
if ( myself.i_ai0 != 1 ) {
if ( myself.DistFromMe( h0.creature ) > 100 ) {
if ( myself.Skill_GetConsumeMP( W_LongRangeDDMagic ) < myself.sm.mp && myself.Skill_GetConsumeHP( W_LongRangeDDMagic ) < myself.sm.hp ) {
if ( myself.Skill_InReuseDelay( W_LongRangeDDMagic ) == 0 ) {
myself.AddUseSkillDesire( h0.creature, W_LongRangeDDMagic, 0, 1, 1000000 );
} else {
myself.AddUseSkillDesire( h0.creature, W_LongRangeDDMagic, 0, 1, 1000000 );
}
} else {
myself.i_ai0 = 1;
myself.AddAttackDesire( h0.creature, 1, 1000 );
}
} else {
if ( myself.Skill_GetConsumeMP( W_ShortRangeDDMagic ) < myself.sm.mp && myself.Skill_GetConsumeHP( W_ShortRangeDDMagic ) < myself.sm.hp ) {
if ( myself.Skill_InReuseDelay( W_ShortRangeDDMagic ) == 0 ) {
myself.AddUseSkillDesire( h0.creature, W_ShortRangeDDMagic, 0, 1, 1000000 );
} else {
myself.AddUseSkillDesire( h0.creature, W_ShortRangeDDMagic, 0, 1, 1000000 );
}
} else {
myself.i_ai0 = 1;
myself.AddAttackDesire( h0.creature, 1, 1000 );
}
}
}
}
}
}
class wizard_ddmagic2_curse : wizard_ddmagic2
{
parameter:
int W_ShortRangeDDMagic = 272629761;
int W_LongRangeDDMagic = 272039937;
int DeBuff = 264568833;
handler:
EventHandler ATTACKED( attacker, damage, i6, h0, i0 )
{
super;
h0 = myself.GetMaxHateInfo( 0 );
if ( ( ( attacker.is_pc != 0 ) || ( myself.IsInCategory( 12, attacker.npc_class_id ) ) ) && myself.i_ai0 == 0 ) {
i0 = 0;
if ( myself.IsNullHateInfo( h0 ) == 0 ) {
if ( myself.IsNullCreature( h0.creature ) == 0 ) {
i0 = 1;
}
}
if ( Rand( 100 ) < 33 && GetAbnormalLevel( attacker, myself.Skill_GetAbnormalType( DeBuff ) ) <= 0 && i0 == 1 ) {
if ( myself.Skill_GetConsumeMP( DeBuff ) < myself.sm.mp && myself.Skill_GetConsumeHP( DeBuff ) < myself.sm.hp ) {
if ( myself.Skill_InReuseDelay( DeBuff ) == 0 ) {
myself.AddUseSkillDesire( attacker, DeBuff, 0, 1, 1000000 );
} else {
myself.AddUseSkillDesire( attacker, DeBuff, 0, 1, 1000000 );
}
} else {
myself.i_ai0 = 1;
myself.AddAttackDesire( attacker, 1, 1000 );
}
}
}
super;
}
EventHandler CLAN_ATTACKED( attacker, damage, i6 )
{
if ( ( myself.GetLifeTime( ) > 7 && ( ( attacker.is_pc != 0 ) || ( myself.IsInCategory( 12, attacker.npc_class_id ) ) ) ) && myself.GetHateInfoCount( ) == 0 ) {
if ( Rand( 100 ) < 33 && GetAbnormalLevel( attacker, myself.Skill_GetAbnormalType( DeBuff ) ) <= 0 ) {
if ( myself.Skill_GetConsumeMP( DeBuff ) < myself.sm.mp && myself.Skill_GetConsumeHP( DeBuff ) < myself.sm.hp ) {
if ( myself.Skill_InReuseDelay( DeBuff ) == 0 ) {
myself.AddUseSkillDesire( attacker, DeBuff, 0, 1, 1000000 );
} else {
myself.AddUseSkillDesire( attacker, DeBuff, 0, 1, 1000000 );
}
} else {
myself.i_ai0 = 1;
myself.AddAttackDesire( attacker, 1, 1000 );
}
}
}
super;
}
}