I'm almost done on the AI/ship side of things - I just need to modify planetinfo.plist so the frigate doesn't always appear in the same place.
Check for ships wont work in a planetinfo.plist. At this point the system is set up. There are no special ships in it yet. You can also remeve a few lines by using a else statement
pseudoFixedD100_number will ALWAYS generate the same number for a certain system. Useful for random additions of station. once selected, the system will always get the same random station. Makes a system more consistent. In your case you probably want the normal D100_number
You might be right on ATTACKED actually
In the line: UPDATE = ("rollD: 12600", decreaseAlertLevel, scanForLoot);, rollD is a priority message so the result is immediately executed. scaonForLoot is not so if it finds something, it only reacts on the found thing on the following update. ATTACKED is also priority, but will not be triggered at the update moment but when the actual shot takes place.
It's been working fine for me. But now that I've added another possible location (I plan to have four, so I doubt I can use "else"), the frigate isn't appearing. Not sure if it's a problem with pseudoFixedD100_number or my code-structuring.
pseudoFixedD100_number will ALWAYS generate the same number for a certain system. Useful for random additions of station. once selected, the system will always get the same random station. Makes a system more consistent. In your case you probably want the normal D100_number
Hmm. In that case, is there any way of using d100_number and accessing the number it generates multiple times? Ultimately, I want a 5% chance of the frigate appearing in the system, and within that, a 25% chance of it appearing in each of the four possible locations.
Hmm. I considered that, but I'm guessing it wouldn't work/be practical in planetinfo (or would it?). I suppose I don't *have* to do this in planetinfo... but to my mind the frigate is a "system" thing rather than a "mission" thing
Do I need to have <dict>, </dict> around each conditions-and-do set? And how can I have taranis_frigate_d100 return to undefined when players exit the system? (Is there a way of specifying, "if *not* this system, then do this..."?)
If I did that, though, wouldn't it just keep on resetting? Ideally I want a 5% chance of the ship appearing the moment you enter the system, and no more chances until you exit and re-enter.
I guess I could always just have it reset under the strings for all the nearby systems, but I bet there's a more elegant solution.
If I did that, though, wouldn't it just keep on resetting? Ideally I want a 5% chance of the ship appearing the moment you enter the system, and no more chances until you exit and re-enter.
reset is used to clear the variable taranis_frigate_d100, otherwise the next jump will still use the same number, and taranis_frigate_d100 won't be random any more.
I know how to do the 5% bit; it's the "if not in system 0 141" bit I don't know how to express in code. I think I'll just go for the inelegant option, and have it reset in all the surrounding systems.
I know how to do the 5% bit; it's the "if not in system 0 141" bit I don't know how to express in code. I think I'll just go for the inelegant option, and have it reset in all the surrounding systems.
This will do nothing in system [0 141] otherwise it will do the else thing. But I thought you were doing the stuff in the planetinfo.plist. This will do it thing only once when the system is entered. So resetting it at the end of the code for the system you have should be enough. Not when entering other systems.