SphereCommunity
@EnvironChange - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: @EnvironChange (/Thread-EnvironChange)



@EnvironChange - CptObvious - 04-07-2012 09:29 PM

I can't understand how this trigger works.
I want a dungeon with mobs stronger or weaker basing on the number of players. I put a tag on the region storing this number and a trigger on the mobs so on @environchange their stats are modified.

Now two questions:
1- When the @environchange fires? According to the wiki it should start when a sector variable changes, thus every ten seconds. Well my test mob isn't firing anything and I don't know if I'm missing something.
I'm asking if anyone can explain exactly how the @environchange works : )

2- I'm playing with regions but I don't know if this is a good choice in terms of performances. Are there better ways to achieve my objective?


RE: @EnvironChange - CptObvious - 04-08-2012 04:56 AM

Well I dodged the problem °L°
I have my mobs with an environchange trigger, and an object modifying lightlevel with a timer. The idea is to have just one timer acting on a lot of npcs rather than a lot of timers one for every npc.
I hope this will reduce server load.


RE: @EnvironChange - jeem - 04-08-2012 08:59 AM

You seem to have got the idea of @EnvironChange, so I'm not explaining it.

Few tips though: First, you don't need to keep a tag for the players in the area, <region.clients> will give you that. Second, your server can handle a simple looping function just fine so @EnvironChange is not a bad choice in this case but keep in mind it will trigger simultaneously on multiple mobs which is a little redundant. Because you want to modify their stats, which is a combat related thing. So if I were you, I would let the mobs out of combat just go around their business and select a trigger that only affects mobs that are fighting (say @GetHit, or something similar). A simple example:

Code:
On=@GetHit
modstr = <ostr>*<region.clients>



RE: @EnvironChange - CptObvious - 04-08-2012 06:09 PM

Woah this is definitely not a bad idea, thanks for the advice! :*

Just a question though: the wiki says region.clients gives "the total number of clients that are inside the sectors that touch the region". Shame on it, I want the number of clients just inside my (small and probably sector-crossing) region. I put enter\exit triggers on the region definition ad it seems a pretty solid solution, but if you say wiki is wrong I will totally turn to your solution.

Crap, I'm testing this thing right now :-\

[edit]
Wiki's right.
Region tag is necessary.