Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Custom

Quests::Custom Custom Quests here

Reply
 
Thread Tools Display Modes
  #1  
Old 04-12-2009, 08:09 PM
RichardoX
Hill Giant
 
Join Date: Dec 2004
Location: in your closet....
Posts: 169
Default

Very cool stuff.
__________________
a hill giant slashes YOU for 25 points of damage!
You have been slain!
LOADING, PLEASE WAIT...
Reply With Quote
  #2  
Old 04-14-2009, 03:37 PM
Dibalamin
Hill Giant
 
Join Date: Dec 2007
Posts: 182
Default

Thanks for the step by step explaination, that rocked!

One question though:

How would you mod this code to select a single random target(s) from the zone & then cast on them?

It's there, I'm just not good enough yet to see it.
Reply With Quote
  #3  
Old 04-14-2009, 07:02 PM
Kayen
Developer
 
Join Date: Mar 2009
Location: -
Posts: 228
Default Choosing a random player and casting on them.

It is actual not that simple.

Here is away to use this code to choose semi-random targets. It isn't truly random b/c the list always cycles in the same order so the players at top have a better chance of getting hit, however they will really never notice. It's not perfect but its functional.

The code basically searches the clients, and then for each client does a random 1-20(This can be changed to whatever you want, I'd recommend however many players are at the event). If the number is 18 the effect essentially goes off on that player and the cycle ends, if 20 is saves the players ID, then starts a 3 sec timer, then from that timer it casts a spell on that player. If you don't roll a 29, nothing happens. Here is the commented code.


Quote:
if ($timer eq "getclients") {
my $Stop = 0; #This decides if the script is on or off

my $list_check = 0;

for ($list_check = 0; $list_check < 2000; $list_check++) {

$client_search = $entity_list->GetClientByID($list_check);

if ($client_search) {
my $distanceCHK = $client_search->CalculateDistance($x, $y, $z);
if ($distanceCHK <= 300) { #Checks all players w/in 300 range
my $ChooseClient = quest::ChooseRandom(1,2,3,4,5,6,7,8,9,10,11,12,13, 14,15,16,17,18,19,20);
if (($ChooseClient == 20) && ($Stop == 0) ) { #So 1/20 chance to get spell cast on them, the $Stop == 0, turns this off once a player is choosen
$RandomSpellID = $client_search->GetID(); #Saves the Player's ID who was choose so the spell can target them
quest::stoptimer("getclients"); #Stops the loop, otherwise it cycles again till a client is selected
#$client_search->Message(13, "You were choosen at random $RandomSpellID" ); #Sends message to client they were selected
quest::settimer("CastRandomWither", 3); #Sets timer for spell cast
my $Stop = 1;
}
if ($ChooseClient <= 17) {
#$client_search->Message(13, "You were NOT choosen at random $ChooseClient" ); #Client is not choose (You don't need even really need this)
}
}

}
}
}

if ($timer eq "CastRandomWither") {
quest::stoptimer("CastRandomWither");
$npc->CastSpell(5120, $RandomSpellID); #Cast spell 5120, on client who was choose.
}

}


Code:
sub EVENT_TIMER {


#####################################
##########Random Cast##################
#####################################
if ($timer eq "getclients") {
my $Stop = 0;

my $list_check = 0;

for ($list_check = 0; $list_check < 2000; $list_check++) {

$client_search = $entity_list->GetClientByID($list_check);

if ($client_search) {
my $distanceCHK = $client_search->CalculateDistance($x, $y, $z);
if ($distanceCHK <= 300) {
my $ChooseClient = quest::ChooseRandom(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18);
if (($ChooseClient == 18) && ($Stop == 0) ) {
$RandomSpellID = $client_search->GetID(); 
quest::stoptimer("getclients");
#$client_search->Message(13, "You were choosen at random $RandomSpellID" );
quest::settimer("CastRandomWither", 3);
my $Stop = 1;
}
if ($ChooseClient <= 17) {
#$client_search->Message(13, "You were NOT choosen at random $ChooseClient" );
}
}

}
}
}

if ($timer eq "CastRandomWither") {
quest::stoptimer("CastRandomWither");
$npc->CastSpell(5120, $RandomSpellID);
}

}

Last edited by trevius; 05-01-2009 at 03:29 PM..
Reply With Quote
  #4  
Old 04-14-2009, 09:11 PM
Dibalamin
Hill Giant
 
Join Date: Dec 2007
Posts: 182
Default

Perfect, thanks for the code man & for taking the time to respond!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 08:59 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3