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 05-14-2009, 03:03 PM
BWStripes
Sarnak
 
Join Date: Jun 2007
Location: Finland
Posts: 65
Default Spawning multiple mobs in random locs

This might be dangerous to do, but I thought I would give it a go. Are there any reasons why we can't/shouldn't use while loops in the quest system?

It does work by the way ^_^

Code:
        $count = 0;
        while ($count <= 24) {
            $randX = int(rand(60));
            $randY = int(rand(90));
            $randZ = int(rand(45));
            $randH = int(rand(260));
            $randPNX = int(rand(2));
            $randPNY = int(rand(2));
            $randPNZ = int(rand(2));
                ##quest::say("Randomness1: $randX, $randY, $randZ, $randH, $randPNX, $randPNY, $randPNZ");
            if($randPNX == 1) {
                $randX = -$randX;
            }
            if($randPNY == 1) {
                $randY = -$randY;
            }
            if($randPNZ == 1) {
                $randZ = -$randZ;
            }
                ##quest::say("Randomness2: $randX, $randY, $randZ, $randH");
        		quest::spawn2(216071,0,0,$randX,$randY,$randZ,$randH); # Triloun Vaporfiend
            $count ++;
		}
Reply With Quote
  #2  
Old 05-14-2009, 03:11 PM
So_1337
Dragon
 
Join Date: May 2006
Location: Cincinnati, OH
Posts: 689
Default

Let me guess, for encounters like... Coirnav? =)

Very nice.
Reply With Quote
  #3  
Old 05-14-2009, 03:16 PM
BWStripes
Sarnak
 
Join Date: Jun 2007
Location: Finland
Posts: 65
Default

Yeah, Nork is working hard *cough*itsme* on it.
Reply With Quote
  #4  
Old 05-14-2009, 03:33 PM
cavedude's Avatar
cavedude
The PEQ Dude
 
Join Date: Apr 2003
Location: -
Posts: 1,988
Default

Loops are fine, so long as you terminate them properly. An endless loop in the EQEmu code not long ago increased load noticeably. I'd hate to see what Perl could do!
Reply With Quote
  #5  
Old 05-14-2009, 10:32 PM
trevius's Avatar
trevius
Developer
 
Join Date: Aug 2006
Location: USA
Posts: 5,946
Default

Yeah, this should be fine as long as it isn't running it extremely often. The only time I have seen quests cause major impact on Storm Haven is when I first got the client search quest script working for part of my custom Thanksgiving event. Initially, I had it doing a FOR loop every second from 0 to 2000 for all entities with IDs in that range and then doing distance calculations and other stuff lol. It wasn't actually too bad on the server until I kept spawning more turkeys for testing and finally it got pretty noticeable lol. Not to mention that I had something in the script that was incorrect a bit and generating a ton of quest log entries every second. After leaving it running for a while before I fixed all issues, I had a few GBs of log files!
__________________
Trevazar/Trevius Owner of: Storm Haven
Everquest Emulator FAQ (Frequently Asked Questions) - Read It!
Reply With Quote
  #6  
Old 05-15-2009, 06:38 AM
BWStripes
Sarnak
 
Join Date: Jun 2007
Location: Finland
Posts: 65
Default

Poor Turkeys
Thanks, I hadn't seen while loops used in any scripts so I'd assumed there was a reason, rather than lack of support.

Interestingly, that raises the question of handling turn-ins in a loop, since live clearly does it for tasks that require >4 turn-ins.

I suppose using variables, you could then also support a fledgling Multi-Quest system, assuming that the zone wasn't dynamic and the server was going to stay up a while. Personally I hated MQ'd tasks on live, but that is in the past. Grr.
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:22 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