View Single Post
Old 07.03.2006, 14:27   #14
Xellos
Архивный участник
 
Join Date: Feb 2006
Posts: 88
Default

if the quest don't work:
check your npcpos.txt
Code:
npc_begin	[antaras]	pos={185708;114298;-8221;32768}	on_delete_create(10sec,{[teleport_cube_antaras]})	total=1	respawn=10min	respawn_rand=10min	dbname=[antaras]	dbsaving={death_time;parameters;pos}	ai_parameters={[GM_ID]=[1]}	npc_end
the GM_ID is needed there


ok, and here some parts of the antaras related AIs


heart_of_warding
[php:1:a836eafe56]EventHandler TALKED:
{
ShowPage(talker, "heart_of_warding001.htm");
}

EventHandler TELEPORT_REQUESTED:
{
i0 = GetGlobalMap(1);
if (i0 <> -1) { // -1 == unregistered GlobalMap
c0 = GetCreatureFromIndex(i0);
if (c0.alive) {
if (c0.db_value == 0 || c0.db_value == 1) {
if (OwnItemCount(talker, @q_portal_stone_1) > 0) {
DeleteItem1(talker, @q_portal_stone_1, 1);
SendScriptEvent(c0, 0, 0);
i1 = 179700 + Rand(700);
i2 = 113800 + Rand(2100);
InstantTeleport(talker, i1, i2, -7709);
}
ShowPage(talker, "heart_of_warding004.htm");
} else if (c0.db_value == 2 || c0.db_value == 3) {
ShowPage(talker, "heart_of_warding003.htm");
}
} else {
ShowPage(talker, "heart_of_warding002.htm");
}
} else {
ShowPage(talker, "heart_of_warding002.htm");
}
}[/php:1:a836eafe56]

corresponding code in antaras AI:[php:1:a836eafe56]EventHandler SCRIPT_EVENT:
{
if (myself.sm.db_value == 0) {
AddTimerEx(1001, 10 * 60 * 1000);
SetDBValue(myself.sm, 1);
}
}[/php:1:a836eafe56]

the other handler of this AI are checking against (mysqlf.sm.db_value == 3) which is the state of Antaras in his Lair...

db_value (seen in boss db table):
0 = not active
1 = quest activated - 10min for players to enter the lair
2 = antaras got activated and is moving into his lair
3 = antaras is in "battle mode"

antaras CREATED:[php:1:a836eafe56]EventHandler CREATED:
{
if (reply == 0) {
SetDBValue(myself.sm, 0);
}
myself.i_ai1 = GetTick();
myself.i_ai2 = 0;
myself.i_ai3 = 0;
myself.i_ai4 = 0;
if (GM_ID <> 0) {
i0 = GetGlobalMap(GM_ID);
if (i0 == -1) {
RegisterGlobalMap(GM_ID, GetIndexFromCreature(myself.sm));
}
}
if (myself.sm.db_value == 1) {
AddTimerEx(1001, 10 * 60 * 1000);
} else if (myself.sm.db_value == 2) {
InstantTeleport(myself.sm, 185452, 114835, -8221);
AddMoveToDesire(181911, 114835, -7678, 100000);
EffectMusic(myself.sm, 10000, "antaras");
} else if (myself.sm.db_value == 3) {
AddTimerEx(1002, 1 * 60 * 1000);
myself.i_ai1 = GetTick();
AddMoveAroundDesire(5, 5);
}
}[/php:1:a836eafe56]

the only way to get a working summon for antaras is to change this handler a bit:[php:1:a836eafe56]EventHandler CREATED:
{
if (reply == 0) {
SetDBValue(myself.sm, 0);
}
myself.i_ai1 = GetTick();
myself.i_ai2 = 0;
myself.i_ai3 = 0;
myself.i_ai4 = 0;
if (GM_ID <> 0) {
i0 = GetGlobalMap(GM_ID);
if (i0 == -1) {
RegisterGlobalMap(GM_ID, GetIndexFromCreature(myself.sm));
}
} else {
// here we have the summoned antaras that is not in his lair
SetDBValue(myself.sm, 3);
// and let the rest of the script do the work
}
if (myself.sm.db_value == 1) {
AddTimerEx(1001, 10 * 60 * 1000);
} else if (myself.sm.db_value == 2) {
InstantTeleport(myself.sm, 185452, 114835, -8221);
AddMoveToDesire(181911, 114835, -7678, 100000);
EffectMusic(myself.sm, 10000, "antaras");
} else if (myself.sm.db_value == 3) {
AddTimerEx(1002, 1 * 60 * 1000);
myself.i_ai1 = GetTick();
AddMoveAroundDesire(5, 5);
}
}[/php:1:a836eafe56]

this should work

btw - I like this great AI with all the skills
but maybe it's a bad idea with the fear skill on a normal map...
your character will run a long time
Xellos is offline