Log in

View Full Version : Question about quest code


Bdiddy
12-15-2010, 09:57 PM
Below is the code for Terris Thule in nightmareb, can someone explain to me what is going on on the death event and the timer event? I read the wiki but woudn't figure these two out exactly.

Also on a side note, is there a way to keep an npc from running at low health and how exactly do i make them kos. I tried Georges tool to make an npc kos faction but i still con indiff with or w/o the gm flag on. thx



sub EVENT_SPAWN {

quest::setnexthpevent(75);

quest::settimer(1,1);

}



sub EVENT_HP {

if($hpevent == 75)

{

quest::spawn2(221006,0,0,-1858,-25,134,5);

quest::spawn2(221006,0,0,-1780,-59,134,193);

quest::spawn2(221006,0,0,-1833,102,134,165);

quest::spawn2(221006,0,0,-1852,48,134,157);

quest::spawn2(221006,0,0,-1876,-63,134,228);



quest::spawn2(221006,0,0,-1933,49,134,156);

quest::spawn2(221006,0,0,-1984,-61,134,148);



quest::spawn2(221006,0,0,-1896,-108,134,230);

quest::spawn2(221006,0,0,-1899,-65,134,243);

quest::spawn2(221006,0,0,-1732,3,134,190);

quest::spawn2(221006,0,0,-1773,-39,134,187);

quest::spawn2(221006,0,0,-2005,85,134,99);

quest::spawn2(221006,0,0,-2031,-3,134,142);



quest::spawn2(221006,0,0,-1954,-29,134,71);

quest::spawn2(221006,0,0,-1887,33,124,113);

quest::setnexthpevent(50);

}



if($hpevent == 50) {

$npc->CastSpell(3150,221008);

quest::setnexthpevent(35);

}

if($hpevent == 35) {

quest::spawn2(221007,0,0,-1808,-120,134,239);

quest::spawn2(221007,0,0,-1774,-7,134,191);

quest::spawn2(221007,0,0,-1837,91,134,159);

}

}



sub EVENT_DEATH {

quest::spawn2(202368,0,0,$x,$y,$z,$h);

}



sub EVENT_TIMER {

if($timer == 1) {

quest::stoptimer(1);

quest::settimer(1,1);

}



if(($timer == 1 && $x <= -2100) || ($y >= 230) || ($y <= -265) || ($x >= -1600)) {

quest::depop();

quest::shout("Never shall I be removed from nightmares!");

}

}

Jaekob
12-15-2010, 11:28 PM
Upon death another NPC will spawn at the location of NPC that was killed.

Timer is just a leash to keep the NPC in a certain spot, but looks like the NPC will despawn if outside of the specificed x, y coordinates.

Faction and whether a npc will flee are simple fixes in the db. PEQ db editor can do this fairly simply.