Full Version : Percentage based spawning
xmlspawner >>XMLSpawner Feature Request's >>Percentage based spawning


<< Prev | Next >>

Allmight- 08-16-2006
It would be nice to be able to set a percentage chance for a certain entry to spawn.

I tried to do this by setting amount to spawn as percentages. For example, say i have 4 entries, i set one to 50, one to 30, and 15 and 5 respectivly. That totals 100 spawns in the hopes it would simulate a decent percentage ratio, but it did not.

So if you could add percentage based spawning, that would really be nice.



ArteGordon- 08-16-2006
QUOTE (Allmight @ August 16, 2006 07:22 pm)
It would be nice to be able to set a percentage chance for a certain entry to spawn.

I tried to do this by setting amount to spawn as percentages. For example, say i have 4 entries, i set one to 50, one to 30, and 15 and 5 respectivly. That totals 100 spawns in the hopes it would simulate a decent percentage ratio, but it did not.

So if you could add percentage based spawning, that would really be nice.

If you set the maxcounts of the individual entries to those values, and then set the maxcount of the spawner to something like 1, then the probability of that spawn being one of the entries would be what you expect (0.5, 0.3, 0.15, 0.05)

If you set maxcount to any other value, then those expected ratios will still be maintained.

Allmight- 08-17-2006
Hmmm, odd. I tried that extensivly, and i though the "rare" spawns spawned a bit more than they should. I īgot 2-3 spawns of the "0.05" spawn in almost every spawn. I pushed respawn to respawn many times, and almost allwats the count was 2-3 spawns average.

But if you say that is how it works, i have no reason to doubt you, so it must have been a streak of luck that made them spawn that often then.

Thanks for the reply.


ArteGordon- 08-17-2006
if you post a spawner that you think is not doing what it should i can take a look at it, but that is how it should currently work.

When I tried this, I got pretty much exactly what I expected from the percentages.

QUOTE

<Spawns>
  <Points>
    <Name>PercentageSpawner</Name>
    <UniqueId>da2b2121-7ae7-454c-8ed8-4de12cd8fe68</UniqueId>
    <Map>Felucca</Map>
    <X>5418</X>
    <Y>1143</Y>
    <Width>10</Width>
    <Height>10</Height>
    <CentreX>5423</CentreX>
    <CentreY>1148</CentreY>
    <CentreZ>0</CentreZ>
    <Range>5</Range>
    <MaxCount>4</MaxCount>
    <MinDelay>5</MinDelay>
    <MaxDelay>10</MaxDelay>
    <DelayInSec>False</DelayInSec>
    <Duration>0</Duration>
    <DespawnTime>0</DespawnTime>
    <ProximityRange>-1</ProximityRange>
    <ProximityTriggerSound>500</ProximityTriggerSound>
    <TriggerProbability>1</TriggerProbability>
    <InContainer>False</InContainer>
    <MinRefractory>0</MinRefractory>
    <MaxRefractory>0</MaxRefractory>
    <TODStart>0</TODStart>
    <TODEnd>0</TODEnd>
    <TODMode>0</TODMode>
    <KillReset>1</KillReset>
    <ExternalTriggering>False</ExternalTriggering>
    <SequentialSpawning>-1</SequentialSpawning>
    <AllowGhostTriggering>False</AllowGhostTriggering>
    <AllowNPCTriggering>False</AllowNPCTriggering>
    <SpawnOnTrigger>False</SpawnOnTrigger>
    <SmartSpawning>False</SmartSpawning>
    <Team>0</Team>
    <Amount>1</Amount>
    <IsGroup>False</IsGroup>
    <IsRunning>True</IsRunning>
    <IsHomeRangeRelative>True</IsHomeRangeRelative>
    <Objects2>orc:MX=50:SB=0:RT=0:TO=0:KL=0:RK=0:CA=1:DN=-1:DX=-1:SP=1:PR=-1:OBJ=troll:MX=30:SB=0:RT=0:TO=0:KL=0:RK=0:CA=1:DN=-1:DX=-1:SP=1:PR=-1:OBJ=harpy:MX=15:SB=0:RT=0:TO=0:KL=0:RK=0:CA=1:DN=-1:DX=-1:SP=1:PR=-1:OBJ=daemon:MX=5:SB=0:RT=0:TO=0:KL=0:RK=0:CA=1:DN=-1:DX=-1:SP=1:PR=-1</Objects2>
  </Points>
</Spawns>


Note that the spawns are all in subgroup 0 (the normal default).
In your case, what may be happening is that if you are putting the spawns into subgroups, that will force them to spawn together and so it will not do the weighted spawn calculation.

Allmight- 08-17-2006
Hehe, to be honest, i have not come so far yet. Subgroups is something i dont know how to use, since i mostly have done big world spawns up until now. So to answer your thought, no they are not in any subgroups, just the main one you get when doing a normal spawn.

I will continue to test this further, and if i get a spawner that dont work right in this matter, then i will post it here, as you requested.

XavierWER- 08-17-2006
while I havent used the new #CONDITION type spawning yet
im pretty confidant that something like #{RND,0,100}<30 ; daemon
would give the daemon a 30% spawn chance.

Allmight- 08-18-2006
Hmmm, will take a look on that one. Thanks for the tip.


ArteGordon- 08-18-2006
yes, Xav is right.

#CONDITION,{RND,1,100}<30 ; daemon

would spawn the entry 30% of the time