Quote:
Originally posted by Kaimetsu
Question, though: What do these fish do? If you're worried about timeouts then how are you going to make them do anything other than float on the water's surface and do nothing?
|
There are two types of fish on The Adv.:
- the normal fish which are just represented by the variable "level.fishrate". This variable controls how fast you can get a normal fish using your fishing rod.
- the Fighting Fish which are actually NPCs which are moving around and fight against each other. They are very rare and sometimes apearing the water.
Quote:
Originally posted by Falcor
I'm sure there are other ways, maybe even more efficient ways of doing what you want.
|
Ok, I think I've found the optimal way now:
I'll save how much time has past since the last time the level was refilled. This time will be used for calculating the current increase/chance. Something like this: (the used numbers are just examples. I have to calculate better values)
NPC Code:
if (actionserverside)
{
if (level.lastrefill == 0) level.lastrefill = timevar;
passedtime = timevar - level.lastrefill;
if (level.fishrate < level.maxfishrate)
{
if (level.fishrate <= 0) level.fishrate = 0.05;
level.fishrate = level.fishrate * (1.1^passedtime);
if (level.fishrate > level.maxfishrate) level.fishrate = level.maxfishrate;
}
chance = 1-(0.99^passedtime);
if (chance > random(0,1))
{
// put fighting fish
}
level.lastrefill = timevar;
}
//#CLIENTSIDE
if (playerenters)
{
triggeraction 0,0,serverside,-FishRefill;
}