The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
region NPC's
Author Message
Rattlehead
Master
**

Posts: 290
Likes Given: 3
Likes Received: 8 in 6 posts
Joined: Jun 2012
Reputation: 8



Post: #1
region NPC's
what is the best/easiest way to remove all NPC's in a region?

i have came up with a couple ways, but they are really complicated, hoping someone may have a better way.

[Image: matts_siggy.gif]
07-23-2013 05:45 PM
Find all posts by this user Like Post Quote this message in a reply
Alaric
Journeyman
*

Posts: 227
Likes Given: 7
Likes Received: 9 in 4 posts
Joined: Oct 2012
Reputation: 7



Post: #2
RE: region NPC's
I would loop through every npc in the world and check whether its in region with uid XYZ.

But if you are going to do it often, this may cause lag.
(This post was last modified: 07-23-2013 07:11 PM by Alaric.)
07-23-2013 07:07 PM
Find all posts by this user Like Post Quote this message in a reply
Mordaunt
Super Moderator
****

Posts: 1,237
Likes Given: 26
Likes Received: 55 in 43 posts
Joined: Mar 2012
Reputation: 35



Post: #3
RE: region NPC's
This is one of the reasons I have suggested a FOR REGION type function before... c'mon jump on the bandwagon Tongue

[Image: 2nis46r.jpg]
07-24-2013 01:00 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Rattlehead
Master
**

Posts: 290
Likes Given: 3
Likes Received: 8 in 6 posts
Joined: Jun 2012
Reputation: 8



Post: #4
RE: region NPC's
yeah, definitely dont wanna loop thru every NPC in the world lol, thats even crazier than what ive come up with Tongue

a FORREGION??

OH BEN Big Grin

who do we have to pimp Mordaunt out to, to get a FORREGIONS function, i like that idea ALOT!!

[Image: matts_siggy.gif]
07-24-2013 01:31 AM
Find all posts by this user Like Post Quote this message in a reply
Shaklaban
Master
**

Posts: 378
Likes Given: 0
Likes Received: 1 in 1 posts
Joined: Mar 2012
Reputation: 8

DOT

Post: #5
RE: region NPC's
(07-23-2013 05:45 PM)Rattlehead Wrote:  what is the best/easiest way to remove all NPC's in a region?

i have came up with a couple ways, but they are really complicated, hoping someone may have a better way.

http://wiki.sphere.torfo.org/index.php/Sectors

PHP Code:
region.allchars actest

[function actest]
if !<
isplayer>
    ...
endif 
07-24-2013 01:37 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Alaric
Journeyman
*

Posts: 227
Likes Given: 7
Likes Received: 9 in 4 posts
Joined: Oct 2012
Reputation: 7



Post: #6
RE: region NPC's
Well, I'm quite confused with the terms now.... region, area, room, sector. This loops through what? The sector or the region(=area or room)? Or couple of sectors... Because the function allchars is on the page - Sectors.

Rattle: If you don't have too much complicated area, which I guess you have, then calculate the middle of the area, and the distance from the furthest corner. But if shaklabans code work then there is nothing left to solve or discuss. But I personaly don't understand the code... How can it work. Smile
(This post was last modified: 07-24-2013 02:01 AM by Alaric.)
07-24-2013 01:51 AM
Find all posts by this user Like Post Quote this message in a reply
Ben
Sphere Developer
*****

Posts: 612
Likes Given: 2
Likes Received: 123 in 70 posts
Joined: Mar 2010
Reputation: 18

SphereCommunity

Post: #7
RE: region NPC's
As far as I can tell, anything that can be done to Sectors, can be done to regions.
When applied to regions, it sends the command to all sectors that is part of the region.

Yay for one more thing that is not documented!!!

AxisII's current version: 2.0.4j
AxisII SourceCode on Github
AxisII up to date changelog
07-24-2013 02:12 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Rattlehead
Master
**

Posts: 290
Likes Given: 3
Likes Received: 8 in 6 posts
Joined: Jun 2012
Reputation: 8



Post: #8
RE: region NPC's
its actually a multi region, im creating an instant dungeon type script, where i use a multi i created that gets put into the world to act as the dungeon, i have scripted components that act as one time spawners and everything works great, except if there are left over monster when they reach the end of the dungeon i need those removed with the multi, which is removed when they exit

and yes i agree, i was not aware that allchar was a region type fucntion, not sure if sectors apply inside a multi region

[Image: matts_siggy.gif]
07-24-2013 02:37 AM
Find all posts by this user Like Post Quote this message in a reply
amonvangrell
Banned

Posts: 337
Likes Given: 17
Likes Received: 32 in 20 posts
Joined: Aug 2012

britannia shard

Post: #9
RE: region NPC's
Rattlehead i would love to have this script of yours once its done... ;]
you think u could share it?
thx!
07-24-2013 08:22 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Rattlehead
Master
**

Posts: 290
Likes Given: 3
Likes Received: 8 in 6 posts
Joined: Jun 2012
Reputation: 8



Post: #10
RE: region NPC's
i would share it, but its part of a huge complex system that pretty much ties into most of all the other things on the server so id have to post most of my server lol

but once i have it all done and working right, i can make a tutorial on how i did it, what you need, and basic functions to make it work properly Wink

[Image: matts_siggy.gif]
07-24-2013 03:21 PM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)