View Full Version : AI function GetAbnormalLevel problem
Hi.
Any ai gurus here?
Please, explain why this handler code always return i0 = -1 :confused:
EventHandler SEE_CREATURE(creature,i0)
{
i0 = myself::GetAbnormalLevel( creature, myself::Skill_GetAbnormalType( 1046529 ) );
myself::ShoutEx( "1046529 Level: " + myself::IntToStr( i0 ) ,1200);
if( myself::GetAbnormalLevel( creature, myself::Skill_GetAbnormalType( 1046529 ) ) <= 0 )
{
myself::AddUseSkillDesire( creature, 1046529, @ST_ATTACK, @AMT_MOVE_TO_TARGET, 1000000 );
}
super;
}
Skill cast works perfect, but function GetAbnormalLevel do not return any abnormal level of it.
(C4 server without any extenders)
tnx.
Версия форума 2009–2010. Восстановлено из публичного снимка Wayback Machine. Тема могла сохраниться частично. Время показано по часам снимка; часовой пояс не установлен. Дата в снимке: 06-24-2009, 06:12 PM. Открыть источник (https://web.archive.org/web/20100324120537id_/http://www.postpacific.com:80/archive/index.php/t-609.html).
Assume you're actually affected by a bleed skill when you test this...?
Версия форума 2009–2010. Восстановлено из публичного снимка Wayback Machine. Тема могла сохраниться частично. Время показано по часам снимка; часовой пояс не установлен. Дата в снимке: 06-24-2009, 06:23 PM. Открыть источник (https://web.archive.org/web/20100324120537id_/http://www.postpacific.com:80/archive/index.php/t-609.html).
Assume you're actually affected by a bleed skill when you test this...?
Yep, surely! NPC casts skill on me, but GetAbnormalLevel always return -1 when NPC see me again.
This handler is just for demonstration, in my other tests GetAbnormalLevel do not work at all also.
Can anybody test it and give a feedback here?
Версия форума 2009–2010. Восстановлено из публичного снимка Wayback Machine. Тема могла сохраниться частично. Время показано по часам снимка; часовой пояс не установлен. Дата в снимке: 06-24-2009, 06:43 PM. Открыть источник (https://web.archive.org/web/20100324120537id_/http://www.postpacific.com:80/archive/index.php/t-609.html).
So the skill casting works fine and NPC does not cast 2nd time, after you are already affected?
I mean seeing if issue with the abnormal functions or I dunno...something weird. Maybe skill_pch2 with the actual abnormal of that skill. Compare to..
EventHandler SEE_CREATURE(creature,i0)
{
i0 = myself::GetAbnormalLevel( creature, myself::Skill_GetAbnormalType( 1046529 ) );
myself::ShoutEx( "1046529 Level: " + myself::IntToStr( i0 ) ,1200);
if( i0 == -1 )
{
myself::AddUseSkillDesire( creature, 1046529, @ST_ATTACK, @AMT_MOVE_TO_TARGET, 1000000 );
}
super;
}
I don't feel like reloading my AI :<
Версия форума 2009–2010. Восстановлено из публичного снимка Wayback Machine. Тема могла сохраниться частично. Время показано по часам снимка; часовой пояс не установлен. Дата в снимке: 06-24-2009, 06:52 PM. Открыть источник (https://web.archive.org/web/20100324120537id_/http://www.postpacific.com:80/archive/index.php/t-609.html).
So the skill casting works fine and NPC does not cast 2nd time, after you are already affected?
I mean seeing if issue with the abnormal functions or I dunno...something weird. Maybe skill_pch2 with the actual abnormal of that skill. Compare to..
EventHandler SEE_CREATURE(creature,i0)
{
i0 = myself::GetAbnormalLevel( creature, myself::Skill_GetAbnormalType( 1046529 ) );
myself::ShoutEx( "1046529 Level: " + myself::IntToStr( i0 ) ,1200);
if( i0 == -1 )
{
myself::AddUseSkillDesire( creature, 1046529, @ST_ATTACK, @AMT_MOVE_TO_TARGET, 1000000 );
}
super;
}
I don't feel like reloading my AI :<
NPC casts skill 2nd and 3rd time and so on, always when he see me again, cause function GetAbnormalLevel always returns -1 :) just like I said.
I don't ask you to reload your AI :rolleyes:, but make sure that this function realy works on your server ;)
Версия форума 2009–2010. Восстановлено из публичного снимка Wayback Machine. Тема могла сохраниться частично. Время показано по часам снимка; часовой пояс не установлен. Дата в снимке: 06-24-2009, 07:08 PM. Открыть источник (https://web.archive.org/web/20100324120537id_/http://www.postpacific.com:80/archive/index.php/t-609.html).
Just clarifying, thought you meant it Shouted '-1' all the time but it casted correctly only when it should.
As I said, check the skill itself, make sure its abnormal_type / skill_pch2 are set right.
And yeah making sure it works = reload AI on my serber = lazy :(.
Версия форума 2009–2010. Восстановлено из публичного снимка Wayback Machine. Тема могла сохраниться частично. Время показано по часам снимка; часовой пояс не установлен. Дата в снимке: 06-24-2009, 07:11 PM. Открыть источник (https://web.archive.org/web/20100324120537id_/http://www.postpacific.com:80/archive/index.php/t-609.html).
Just clarifying, thought you meant it Shouted '-1' all the time but it casted correctly only when it should.
As I said, check the skill itself, make sure its abnormal_type / skill_pch2 are set right.
And yeah making sure it works = reload AI on my serber = lazy :(.
Shout function used just to ease the tests.
skilldata:
skill_begin skill_name = [s_npc_bleed1] /* [출혈] */ skill_id = 4088 level = 1 operate_type = A2 magic_level = 10 effect = {{t_hp;-9;5}} is_magic = 1 mp_consume2 = 14 cast_range = 40 effective_range = 200 skill_hit_time = 1 skill_cool_time = 0.8 skill_hit_cancel_time = 0.5 reuse_delay = 6 activate_rate = 100 lv_bonus_rate = 2 basic_property = con abnormal_time = 20 abnormal_lv = 2 abnormal_type = bleeding attribute = attr_bleed effect_point = -100 target_type = enemy_only affect_scope = single affect_limit = {0;0} next_action = none abnormal_visual_effect = ave_dot_bleeding debuff = 1 ride_state = {@ride_none;@ride_wind;@ride_star;@ride_twilight} skill_end
skill_pch:
[s_npc_bleed1] = 1046529
skill_pch2:
1046529 40 0 14 4 -100 16 30 2 2 4 1 -12345
see any mistakes here?
btw, GetAbnormalLevel don't work not only for [s_npc_bleed1] skill, but for other skills also.
Версия форума 2009–2010. Восстановлено из публичного снимка Wayback Machine. Тема могла сохраниться частично. Время показано по часам снимка; часовой пояс не установлен. Дата в снимке: 06-24-2009, 07:22 PM. Открыть источник (https://web.archive.org/web/20100324120537id_/http://www.postpacific.com:80/archive/index.php/t-609.html).
Oh
I'm outa ideas, usage of that function seems fine compared to old Ai examples :<
Версия форума 2009–2010. Восстановлено из публичного снимка Wayback Machine. Тема могла сохраниться частично. Время показано по часам снимка; часовой пояс не установлен. Дата в снимке: 06-24-2009, 07:29 PM. Открыть источник (https://web.archive.org/web/20100324120537id_/http://www.postpacific.com:80/archive/index.php/t-609.html).
Oh
I'm outa ideas, usage of that function seems fine compared to old Ai examples :<
:)
Thanks for your help, then if you find any time for a real test, please give a feedback.
Версия форума 2009–2010. Восстановлено из публичного снимка Wayback Machine. Тема могла сохраниться частично. Время показано по часам снимка; часовой пояс не установлен. Дата в снимке: 06-24-2009, 07:35 PM. Открыть источник (https://web.archive.org/web/20100324120537id_/http://www.postpacific.com:80/archive/index.php/t-609.html).
if you test it with GM lvl 80, the probabity of this skill passing falls down to 0.
make sure, that your character were affected by this skill.
Версия форума 2009–2010. Восстановлено из публичного снимка Wayback Machine. Тема могла сохраниться частично. Время показано по часам снимка; часовой пояс не установлен. Дата в снимке: 06-24-2009, 11:14 PM. Открыть источник (https://web.archive.org/web/20100324120537id_/http://www.postpacific.com:80/archive/index.php/t-609.html).
OpalSnow
25.06.2009, 03:58
if (myself::GetAbnormalLevel(creature, 112) > 9) {
}
Версия форума 2009–2010. Восстановлено из публичного снимка Wayback Machine. Тема могла сохраниться частично. Время показано по часам снимка; часовой пояс не установлен. Дата в снимке: 06-25-2009, 03:58 AM. Открыть источник (https://web.archive.org/web/20100324120537id_/http://www.postpacific.com:80/archive/index.php/t-609.html).
What you are looking for is the following:
if (myself::GetAbnormalLevel(creature, 112) > 9) {
}
Checks if creature is affected by abnormal_type '112' higher than level 9.
Hmm, but what is 112 ? and why creature must be affected by it?
Anybody who really tested function GetAbnormalLevel, give a feedback please :)
Версия форума 2009–2010. Восстановлено из публичного снимка Wayback Machine. Тема могла сохраниться частично. Время показано по часам снимка; часовой пояс не установлен. Дата в снимке: 06-25-2009, 07:36 AM. Открыть источник (https://web.archive.org/web/20100324120537id_/http://www.postpacific.com:80/archive/index.php/t-609.html).
NPC casts skill 2nd and 3rd time and so on, always when he see me again, cause function GetAbnormalLevel always returns -1 :) just like I said.
I don't ask you to reload your AI :rolleyes:, but make sure that this function realy works on your server ;)
when npc cast the skill, you still have the previous bleed effect on you?
Версия форума 2009–2010. Восстановлено из публичного снимка Wayback Machine. Тема могла сохраниться частично. Время показано по часам снимка; часовой пояс не установлен. Дата в снимке: 06-25-2009, 08:50 AM. Открыть источник (https://web.archive.org/web/20100324120537id_/http://www.postpacific.com:80/archive/index.php/t-609.html).
'bleeding' is abnormal type 30 : p
Defined in manual_pch.
Версия форума 2009–2010. Восстановлено из публичного снимка Wayback Machine. Тема могла сохраниться частично. Время показано по часам снимка; часовой пояс не установлен. Дата в снимке: 06-25-2009, 11:53 AM. Открыть источник (https://web.archive.org/web/20100324120537id_/http://www.postpacific.com:80/archive/index.php/t-609.html).
Anybody who really tested function GetAbnormalLevel, give a feedback please :)
1. the function GetAbnormalLevel is a means to Get Level of Abnormal from creature.
2. if you want to get level of abnormal from creature, this creature must have abnormal, which you are checking.
3. if NPC casts some skill to creature, it not means that this skill passing to creature.
Версия форума 2009–2010. Восстановлено из публичного снимка Wayback Machine. Тема могла сохраниться частично. Время показано по часам снимка; часовой пояс не установлен. Дата в снимке: 06-25-2009, 12:35 PM. Открыть источник (https://web.archive.org/web/20100324120537id_/http://www.postpacific.com:80/archive/index.php/t-609.html).
1. the function GetAbnormalLevel is a means to Get Level of Abnormal from creature.
2. if you want to get level of abnormal from creature, this creature must have abnormal, which you are checking.
3. if NPC casts some skill to creature, it not means that this skill passing to creature.
2+2=4
you have tested GetAbnormalLevel or what ) ?
please, just add the code in my first post to any npc, compile, insert in ai, reload ai, login with a 40 level char, summon creature, walk around it several times to make creature see you, npc will cast bleeding on you one or more times, then please notice what npc says in chat when it see your char again.
tnx/
Версия форума 2009–2010. Восстановлено из публичного снимка Wayback Machine. Тема могла сохраниться частично. Время показано по часам снимка; часовой пояс не установлен. Дата в снимке: 06-25-2009, 12:43 PM. Открыть источник (https://web.archive.org/web/20100324120537id_/http://www.postpacific.com:80/archive/index.php/t-609.html).
when npc cast the skill, you still have the previous bleed effect on you?
it works as folows: i summon creature, it sees me and cast skill on me, char starts bleeding ), then i walk around the npc, when it see me again it casts skill again, npc cant recognize the skill on me. surely in chat i see my test message "1046529 Level: -1" showing the return of function.
Версия форума 2009–2010. Восстановлено из публичного снимка Wayback Machine. Тема могла сохраниться частично. Время показано по часам снимка; часовой пояс не установлен. Дата в снимке: 06-25-2009, 12:51 PM. Открыть источник (https://web.archive.org/web/20100324120537id_/http://www.postpacific.com:80/archive/index.php/t-609.html).
OpalSnow
25.06.2009, 16:12
What you are looking for is the following:
if (myself::GetAbnormalLevel(creature, 112) > 9) {
}
Checks if creature is affected by abnormal_type '112' higher than level 9.
'bleeding' is abnormal type 30 : p
Defined in manual_pch.
Thats all you need. Change the 112 to 30 for bleed.
Версия форума 2009–2010. Восстановлено из публичного снимка Wayback Machine. Тема могла сохраниться частично. Время показано по часам снимка; часовой пояс не установлен. Дата в снимке: 06-25-2009, 04:12 PM. Открыть источник (https://web.archive.org/web/20100324120537id_/http://www.postpacific.com:80/archive/index.php/t-609.html).
l2online
25.06.2009, 17:32
You probably meant this:
i0 = myself::GetAbnormalLevel(creature, myself::Skill_GetAbnormalType(1046529));
Which is pretty pointless as said above since abnormal type is always 30.
Версия форума 2009–2010. Восстановлено из публичного снимка Wayback Machine. Тема могла сохраниться частично. Время показано по часам снимка; часовой пояс не установлен. Дата в снимке: 06-25-2009, 05:32 PM. Открыть источник (https://web.archive.org/web/20100324120537id_/http://www.postpacific.com:80/archive/index.php/t-609.html).
You probably meant this:
i0 = myself::GetAbnormalLevel(creature, myself::Skill_GetAbnormalType(1046529));
Which is pretty pointless as said above since abnormal type is always 30.
I dont understand what do you wanted to say.
You mean myself::GetAbnormalLevel(creature, myself::Skill_GetAbnormalType(1046529)) == myself::GetAbnormalLevel(creature, 30) ?
Yeah, thats right. But the result = -1 :D thats strange for me.
Версия форума 2009–2010. Восстановлено из публичного снимка Wayback Machine. Тема могла сохраниться частично. Время показано по часам снимка; часовой пояс не установлен. Дата в снимке: 06-25-2009, 05:35 PM. Открыть источник (https://web.archive.org/web/20100324120537id_/http://www.postpacific.com:80/archive/index.php/t-609.html).
Oh
I'm outa ideas, usage of that function seems fine compared to old Ai examples :<
Before starting this thread I checked Suron's decompiled C4 AI and find out that 90% uses of GetAbnormalLevel function looks like this:
i1 = myself::GetAbnormalLevel( speller, myself::Skill_GetAbnormalType( DeBuff1 ) );
if( i1 == -1 )
{
// some code
}
else if( i1 == 10 )
{
}
or like this:
if( myself::GetAbnormalLevel( myself.sm, myself::Skill_GetAbnormalType( SpecialSkill ) ) <= 0 )
{
// some code
}
It checks the negative value of function, and.. if the function always returns -1 then 90% of code works fine. :)
Soo.. I'm outa ideas too now :D
Версия форума 2009–2010. Восстановлено из публичного снимка Wayback Machine. Тема могла сохраниться частично. Время показано по часам снимка; часовой пояс не установлен. Дата в снимке: 06-25-2009, 06:24 PM. Открыть источник (https://web.archive.org/web/20100324120537id_/http://www.postpacific.com:80/archive/index.php/t-609.html).
OpalSnow
26.06.2009, 07:42
I gave you the solution 2 times now. Start reading.
Версия форума 2009–2010. Восстановлено из публичного снимка Wayback Machine. Тема могла сохраниться частично. Время показано по часам снимка; часовой пояс не установлен. Дата в снимке: 06-26-2009, 07:42 AM. Открыть источник (https://web.archive.org/web/20100324120537id_/http://www.postpacific.com:80/archive/index.php/t-609.html).
it works as folows: i summon creature, it sees me and cast skill on me, char starts bleeding ), then i walk around the npc, when it see me again it casts skill again, npc cant recognize the skill on me. surely in chat i see my test message "1046529 Level: -1" showing the return of function.
if the creature see you when you don't have the effect of the bleed, then it's ok to return -1, also display the abnormal id.
instead of using see_creature, try with attacked handler for easier testing.
i0 = myself::Skill_GetAbnormalType(1046529);
i1 = myself::GetAbnormalLevel(attacker, myself::Skill_GetAbnormalType(1046529));
myself::Say( "Abnormal: " + i0 + " Level: " + i1 );
Версия форума 2009–2010. Восстановлено из публичного снимка Wayback Machine. Тема могла сохраниться частично. Время показано по часам снимка; часовой пояс не установлен. Дата в снимке: 06-26-2009, 09:27 AM. Открыть источник (https://web.archive.org/web/20100324120537id_/http://www.postpacific.com:80/archive/index.php/t-609.html).