Page 1 of 1

Retrying when condition is false?

Posted: 27 May 2023, 11:05
by Pederont
Is it possible to trigger the random fun again till the condition is true?
I made a random spawn plugin that only spawns on empty land, but now it's spawnrate depends on the amount of empty land.

Code: Select all    Reset

"random fun":[{ "condition":{"type":"and", "inner":[{"type":"tree", "invert":true}, {"type":"building","invert":true},{"type":"zone", "invert":true}]}, "actions":[{"type":"build", "id":"$mokokoseed_pederont"}], "p":0.01
JSON checker
Check

Re: Retrying when condition is false?

Posted: 28 May 2023, 05:50
by CommanderABab
Try a value of p closer to 1.

Re: Retrying when condition is false?

Posted: 28 May 2023, 09:19
by Pederont
CommanderABab wrote: 28 May 2023, 05:50 Try a value of p closer to 1.
Doesn't that increases the entire spawnrate? I just want to keep spawnrate low but want it always spawn on empty tile when random fun triggers..

Re: Retrying when condition is false?

Posted: 28 May 2023, 09:44
by JustAnyone
If I recall correctly, "p" is the probability for the random fun object to get called, not the action.

Re: Retrying when condition is false?

Posted: 30 May 2023, 09:49
by alfredparker360
Doesn't that raise the spawnrate overall? When random fun triggers, I only want to keep the spawn rate low and have it always spawn on an empty tile.

Re: Retrying when condition is false?

Posted: 04 Jun 2023, 10:48
by JustAnyone
And if that condition is true, then the action gets trig.gered, correct.