If you want a new mission to be *offered* from a ship, with the option to accept or reject, that ship must be a përs. If you want to use a mission to trigger the appearance of a përs (by setting a bit OnStart and clearing it OnSuccess/OnFail/OnAbort) then you can set a specific probability of the përs appearing in specific systems. For example, you could make the përs appear 100% of the time in one specific system. To make this "random", you'll need to make several different përs resources, affiliated with different systems, and with different appearance bits, and have the mission randomly set exactly one of the appearance bits. If you want the përs to have several different behaviors and offer several different missions, randomly, you can take advantage of the fact that multiple përs resources with the same name will make only one appear at a time (is it the one with the highest or lowest ID that appears in case both are trying to? eg. if you give 2 përses 100% chance to appear and they have the same name, which one, if either, appears consistently?).

So, if we want the ship to be randomly in one of four possible systems:

Mission 0: (The mission before the one we're dealing with) randomly toggles state of bits b1 and b2.

Mission 1a: Offered if !b1 & !b2. Special ship with no specific goal in system Alpha. Sets b3 OnStart.

Mission 1b: Offered if b1 & !b2. Special ship with no specific goal in system Beta. Sets b3 OnStart.

Mission 1c: Offered if !b1 & b2. Special ship with no specific goal in system Gamma. Sets b3 OnStart.

Mission 1c: Offered if b1 & b2. Special ship with no specific goal in system Delta. Sets b3 OnStart.

Mission 2i: Offered from përs P1a, P1b, P1c, or P1d. Escort to sell cargo. OnAccept and OnReject, fail Mission 1a. (Reject can start another mission.)

Mission 2ii: Offered from përs P2a, P2b, P2c, or P2d. Fight (maybe doesn't need to be a mission at all.) OnAccept and OnReject, fail Mission 1a. (Reject can start another mission.)

Mission 2iii: Offered from përs P3a, P3b, P3c, or P3d. Flee (maybe doesn't need to be a mission at all.) OnAccept and OnReject, fail Mission 1a. (Reject can start another mission.)

Mission 2iv: Offered from përs P4a, P4b, P4c, or P4d. Beg for mercy. OnAccept and OnReject, fail Mission 1a. (Reject can start another mission.)

përs P1a: Appears 100% of the time in system Alpha if b3 & (!b1 & !b2). LinkMission 2i.

përs P2a: Appears 50% of the time in system Alpha if b3 & (b1 & !b2). LinkMission 2ii.

përs P3a: Appears 33% of the time in system Alpha if b3 & (!b1 & b2). LinkMission 2iii.

përs P4a: Appears 25% of the time in system Alpha if b3 & (b1 & b2). LinkMission 2iv.

përs P1b: Appears 100% of the time in system Beta if b3 & (!b1 & !b2). LinkMission 2i.

përs P2b: Appears 50% of the time in system Beta if b3 & (b1 & !b2). LinkMission 2ii.

përs P3b: Appears 33% of the time in system Beta if b3 & (!b1 & b2). LinkMission 2iii.

përs P4b: Appears 25% of the time in system Beta if b3 & (b1 & b2). LinkMission 2iv.

përs P1c: Appears 100% of the time in system Gamma if b3 & (!b1 & !b2). LinkMission 2i.

përs P2c: Appears 50% of the time in system Gamma if b3 & (b1 & !b2). LinkMission 2ii.

përs P3c: Appears 33% of the time in system Gamma if b3 & (!b1 & b2). LinkMission 2iii.

përs P4c: Appears 25% of the time in system Gamma if b3 & (b1 & b2). LinkMission 2iv.

përs P1d: Appears 100% of the time in system Delta if b3 & (!b1 & !b2). LinkMission 2i.

përs P2d: Appears 50% of the time in system Delta if b3 & (b1 & !b2). LinkMission 2ii.

përs P3d: Appears 33% of the time in system Delta if b3 & (!b1 & b2). LinkMission 2iii.

përs P4d: Appears 25% of the time in system Delta if b3 & (b1 & b2). LinkMission 2iv.

Note that the 100/50/33/25 percent chances to appear mean there's 25% of each being the one to appear (provided the 25 has precedence over the 33 has precedence over the 50 has precedence over the 100.) If you wanted, you could make a crön do the random bit-swapping instead of relying on the previous mission. Then you can use the random bits for whatever you want anytime you need something random.

That should be enough to get you running. Clear b3 when any of the mission 1's fail or abort. Obviously need some other storyline bit to prevent things from happening twice.

A clever way to pull off multiple destinations with only one copy of Mission 1 and only 4 përses would be to have all the përses appear (with 25/33/50/100 odds) in each of the possible ShipSystems. Then Mission 1 randomly picks its ShipSystem and puts a destination arrow there (by way of a dummy special ship, just like what I described above). So technically it doesn't matter which of the systems the player goes to and hails the përs in, but the arrow on the map will be random, so it's likely the player will believe and follow that arrow. Of course there will be a përs there, so most people will never suspect the same përs was elsewhere. And honestly, does it really matter if they do?

This post has been edited by **Qaanol** : 17 December 2009 - 09:41 PM