One interesting experiment involving <OnGlobalTopologyCreated>:
I built a 'blank' system element in an adventure extension and placed only an event in the system type:
Code: Select all
<SystemType UNID="&ssTopoMaster;">
<Events>
<OnGlobalTopologyCreated>
(block nil
(sysSetData "SE" "GlobalTest" "Event Works!")
)
</OnGlobalTopologyCreated>
</Events>
</SystemType>
The event placed the data on SE, which I looked up in-game and found to be "Event Works!" as it was set.
This shows 2 things of interest- the topology event can be triggered in a blank system (or regular one) that isn't used, and the event can perform code to set data on a system when the game starts.
I will report back with some more experiments with this event.
How to add a random link-
Code: Select all
<SystemType UNID="&ssTopoMaster;">
<Events>
<OnGlobalTopologyCreated>
(block (rand)
(setq rand (random 1 2))
(if (eq rand 1)
(sysAddStargateTopology "SE" "RandomB" "C1" "Inbound")
)
(sysSetData "SE" "GlobalTest" "Event Worked!")
)
</OnGlobalTopologyCreated>
</Events>
</SystemType>
Here's the trick of it- any topology nodeID that is 'floating' around waiting to see if it gets linked must be a rootNode. If a system is not a rootNode, it can get discarded when the topology is created.
In this example, the node that is getting linked to from Eridani looks like this:
Code: Select all
<Node ID="C1" rootNode="true">
<System>
<Table>
<System name="C1a" chance="50" UNID="&ssEarthSpaceStandard;" attributes="alphaModel, Eridanus, newBeyond" level="1"/>
<System chance="50" name="C1b" UNID="&ssEarthSpaceAsteroids;" attributes="betaModel, Eridanus, newBeyond" level="3"/>
</Table>
</System>
<StarGates>
<StarGate name="Inbound" DestID="[Prev]" DestGate="RandomB"/>
</StarGates>
</Node>