Go Back   EQEmulator Home > EQEmulator Forums > Quests > Quests::Q&A

Quests::Q&A This is the quest support section

Reply
 
Thread Tools Display Modes
  #1  
Old 12-25-2008, 04:30 AM
Richardo
Banned
 
Join Date: Oct 2003
Location: Mattmecks Basement
Posts: 546
Default Random Race

I need something but I cannot accomplish it! Basically, I need an npc to spawn. Once he spawns, he/she changes to a random race/gender (Race range is from 1 - 12) (Gender Range 0 - 1). This is what I've got so far.
Code:
sub EVENT_SPAWN {
my $randomrace = quest::ChooseRandom(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
my $randomgender = quest::ChooseRandom(0, 1);
quest::npcgender($randomgender);
quest::npcrace($randomrace);

if($randomrace == 4){
quest::npcsize(5);
}
if($randomrace == 3){
quest::npcsize(7);
}
if($randomrace == 7){
quest::npcsize(5);
}
if($randomrace == 6){
quest::npcsize(5);
}
if($randomrace == 11){
quest::npcsize(4);
}
if($randomrace == 8){
quest::npcsize(4);
}
if($randomrace == 12){
quest::npcsize(4);
}
if($randomrace == 10){
quest::npcsize(8);
}
if($randomrace == 9){
quest::npcsize(8);
}
if($randomrace == 2){
quest::npcsize(8);
}
}
Unfortunately for me, this won't work in EVENT_SPAWN. I have to make it a signal revolver. Basically I have an NPC that acts as a signal receiver. Once an npc spawns, it signals the NPC. Upon being signaled, it signals back. As seen below.

Code:
sub EVENT_SPAWN {
quest::signal(999371, 0);
}

sub EVENT_SIGNAL {
my $randomrace = quest::ChooseRandom(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
my $randomgender = quest::ChooseRandom(0, 1);
quest::npcgender($randomgender);
quest::npcrace($randomrace);

if($randomrace == 4){
quest::npcsize(5);
}
if($randomrace == 3){
quest::npcsize(7);
}
if($randomrace == 7){
quest::npcsize(5);
}
if($randomrace == 6){
quest::npcsize(5);
}
if($randomrace == 11){
quest::npcsize(4);
}
if($randomrace == 8){
quest::npcsize(4);
}
if($randomrace == 12){
quest::npcsize(4);
}
if($randomrace == 10){
quest::npcsize(8);
}
if($randomrace == 9){
quest::npcsize(8);
}
if($randomrace == 2){
quest::npcsize(8);
}
}
Any ideas? :(
Reply With Quote
  #2  
Old 12-25-2008, 05:39 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Ya, it can't work while spawning, because it doesn't have the ID and stuff fully done at that point. But, you can always make a timer and have it run 1 second after it spawns and it will let you do just about anything you want from that point. Lemme know if you need any help with setting up the timer.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #3  
Old 12-25-2008, 08:43 PM
Richardo
Banned
 
Join Date: Oct 2003
Location: Mattmecks Basement
Posts: 546
Default

I have tested the timer idea in the past. It does not work for me. :( Not even this works..

Code:
sub EVENT_SPAWN {
   quest::settimer("RandRG", 5)
}

sub EVENT_TIMER {
my $randomrace = quest::ChooseRandom(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
my $randomgender = quest::ChooseRandom(0, 1);

   if ($timer eq "RandRG") {

quest::npcgender($randomgender);
quest::npcrace($randomrace);
quest::stoptimer("RandRG");
}
}
Also, assuming I could get this to work. I still need to add the code that changes the npc to the correct size. How would I add if + elsif statements in this timer to check the $randomrace variable?

Last edited by Richardo; 12-26-2008 at 04:46 AM..
Reply With Quote
  #4  
Old 12-25-2008, 09:35 PM
Loccochris
Fire Beetle
 
Join Date: Aug 2008
Location: nj, usa
Posts: 24
Default

Did you try going into zone, killing an npc and waiting for it to spawn and see what it does?

I personally know currently there is an issue with size where when I multi box unless all my toons are in the zone if one zones in after will have default size viewed for players who were shrunk/big. Strange bug but if this was the case of illusions as well (havn't tested this) code might work but require a respawn while you are actually physically in the zone/near mob. Kind of like that question "If a tree falls in the woods and no one hears it does it make a sound?". Well in EQ shrink/grow spells don't make a sound if no one is in zone to witness it.

Other then this code looks fine to me from programming stand point. Only other thing I can suggest is instead of phsically trying to change its race/size, you could have it immediatly cast an illusion and custom grow/shrink spell on itself.

But like I said, spell wise out of zone players who zone in will not see the size difference.
Reply With Quote
  #5  
Old 12-25-2008, 09:48 PM
Richardo
Banned
 
Join Date: Oct 2003
Location: Mattmecks Basement
Posts: 546
Default

Ahh.. Illusion is a good idea but I dislike the idea about 'casting'. There has to be a different way to go about things. Size is kept when players zone in. They see the correct size + changed race. Trevius, do you have any ideas mate?

Last edited by Richardo; 12-26-2008 at 02:24 PM..
Reply With Quote
  #6  
Old 12-26-2008, 11:16 AM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Here is an example of a quest that I currently use and know that it works:

Code:
#Explosive Storm

my $entity_id;

sub EVENT_SPAWN {

  quest::settimer("change_storm1",5);

}

sub EVENT_TIMER {

  if ($timer eq "change_storm1") {
    quest::stoptimer("change_storm1");
    quest::npctexture(2);
    quest::emote("gains more energy and becomes less stable.");
    quest::settimer("change_storm2",5); }

  if ($timer eq "change_storm2") {
    quest::stoptimer("change_storm2");
    quest::npctexture(1);
    quest::emote("gains even more energy and looks extremely dangerous.");
    quest::settimer("change_storm3",5); }
    
  if ($timer eq "change_storm3") {
    quest::stoptimer("change_storm3");
$npc->CastSpell(7758, $userid);
    quest::emote("explodes and disperses.");
    quest::depop(); }

}
I am not sure you can change multiple size/gender/race all at the same time without issues, but I imagine something like this might work:

Code:
my $randomrace = quest::ChooseRandom(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
my $randomgender = quest::ChooseRandom(0, 1);

sub EVENT_SPAWN {
   quest::settimer("RandRace", 1)
}

sub EVENT_TIMER {

my $raceset = $randomrace;

   if ($timer eq "RandRace") {
    quest::stoptimer("RandRace");
    quest::npcrace($raceset);
    quest::settimer("RandGender", 1)
  }

   if ($timer eq "RandGender") {
    quest::stoptimer("RandGender");
    quest::npcgender($randomgender);
    quest::settimer("SetRaceSize", 1)
  }

   if ($timer eq "SetRaceSize") {
    quest::stoptimer("SetRaceSize");
    if($raceset == 4){
      quest::npcsize(5);
    }
    if($raceset == 3){
      quest::npcsize(7);
    }
    if($raceset == 7){
      quest::npcsize(5);
    }
    if($raceset == 6){
      quest::npcsize(5);
    }
    if($raceset == 11){
      quest::npcsize(4);
    }
    if($raceset == 8){
      quest::npcsize(4);
    }
    if($raceset == 12){
      quest::npcsize(4);
    }
    if($raceset == 10){
      quest::npcsize(8);
    }
    if($raceset == 9){
      quest::npcsize(8);
    }
    if($raceset == 2){
      quest::npcsize(8);
    }

  }

}
I don't know if that will work or not, but maybe something like that.

Here is another example I use with random Race changing:

Code:
sub EVENT_ITEM {

  if($platinum == 100) {
    quest::say("H-h-h-happy Trick or T-t-treating!");
    quest::playerrace(quest::ChooseRandom(14,46,60,82,85)); }

  if($platinum == 500) {
    quest::say("Yar! H-h-h-happy Trick or T-t-treating!");
my $hgender = $client->GetBaseGender();
    quest::playerrace(quest::ChooseRandom(338,339,340,341,342));
    quest::playergender($hgender); }

}
You can also look at the Illusionist quest I have posted in the Custom section, but those are all for changing player race and genders.
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
Reply


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 11:38 AM.


 

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 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3