Game Start Process Questions-

Freeform discussion about anything related to modding Transcendence.
Post Reply
User avatar
Periculi
Fleet Officer
Fleet Officer
Posts: 1282
Joined: Sat Oct 13, 2007 7:48 pm
Location: Necroposting in a forum near you

When a new game is started is the topology checked in it's entirety to validate it, or at least to load it? Is there a way that I can check for the existence of a system according to it's name or node ID? How would I do that?

Is there a way to make sure that a script gets fired every time I enter a system? I am not sure I have seen an <OnEnter> or <OnExit> event for systems, does something like that exist?

Is there a way to attach a timer to the playership or other object so that it gets carried from system to system? Would a recurring timer on an item in the cargo hold continue running whatever system the ship was in? How much of an impact on game performance do the timers have? How many is too many?

Let's say I want to have a plant grow, slowly over time. It's a little daisy for my cockpit dash. It takes a 14 days to flower or so, how would I know when it was done if I am busy flying around several systems?

Does each station get a little unique data of it's own that persists? It must for the inventory of items- so how is the station uniquely named? I have seen up to 5 'weapons dealers' or 'Arms Dealers' in the same system- (why????!!!) if they have the same name and the same UNID source, how are they identified uniquely? Is there a way to find the unique reference and use it in a sysFindObject from a script that is attached to something else like the playership? I want to pinpoint an exact station, not a station in the same class.
george moromisato
Developer
Developer
Posts: 2998
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

1. There aren't too many functions or events that involve the system topology--I will need to add more over time.

For now, if you want to check if a particular node got created you can use the (sysSetData) function. Normally, that function is used to set data for a particular topology node; but as a side effect, it will tell you if a topology node exists or not.

For example, the topology node "C3A" doesn't always appear. You can check for its existence as follows"

(if (sysSetData "C3A" "Dummy" Nil)
; system exists
)

As you said, the topology is generated when the game starts, so this should work at any time.

2. There is currently no script that fires every time you enter a system. But I will add some eventually. What is the target of the event? The system? The player ship?

3. I've never tried it, but you may be able to attach a time to a player ship (with sysAddObjRecurringTimerEvent).

4. To keep track of time you can use the (unvGetTick) function. This returns the number of ticks that have elapsed since you started the game. Everytime the player checks on the little flower, you can call unvGetTick to determine its growth state. [If you wanted an event when that happened, that would be harder...and probably not worth it in this version.]

5. Today there is the function (objGetID) which returns a numeric ID for any object that is unique and that persists across games. Unfortunately, today there is no way to get back from an objID to an actual object pointer. In the next version there will be a function called (objGetObjByID) which will return the object pointer from an objID. In that version you should be able to do what you want.

For now, I recommend the following:

a. Let's say that gSource is a station object pointer (e.g., some random armor dealer in the system).

b. First we store the objID of that station in the player ship:

(objSetData gPlayerShip "TheStation" (objGetID gSource))

c. Next we need the armor dealer station to remember its own objID (in future versions this will not be necessary):

(objSetData gSource (cat "ID" (objGetID gSource)) True)

d. When you want to get the station pointer back, you can use:

(sysFindObject gPlayerShip (cat "TD:" (objGetData gPlayerShip "TheStation") ";"))

This will either return Nil (in which case, the station is not in the current system) or it will return a list with the object pointer.

Hope this helps, but if not, feel free to ask clarifying questions.
User avatar
Periculi
Fleet Officer
Fleet Officer
Posts: 1282
Joined: Sat Oct 13, 2007 7:48 pm
Location: Necroposting in a forum near you

Does that mean that sysSetData can be used to target an unvisited system and supply some create data?! Say for instance, from Eridani an event happens that will come to a conclusion in St. K's. Could sysSetData be used to tell SK what the trigger was before the player visits, and then use that data in the <OnCreate>?

Or, better example: A mission is started that requires the player to hunt down an unknown villian. The mission goal is generated at the start of the mission and given a random unvisited node to conclude in. When the target system is finally found and visited, an <OnCreate> for that system checks the data for a trigger (the mission conclusion at the villian's hideout) and places an appropriate station in the system to conclude the mission.
george moromisato
Developer
Developer
Posts: 2998
Joined: Thu Jul 24, 2003 9:53 pm
Contact:

Periculi wrote:Does that mean that sysSetData can be used to target an unvisited system and supply some create data?!
Yes, that should work! Let me know if it does.
User avatar
Periculi
Fleet Officer
Fleet Officer
Posts: 1282
Joined: Sat Oct 13, 2007 7:48 pm
Location: Necroposting in a forum near you

You betcha! :)
User avatar
Periculi
Fleet Officer
Fleet Officer
Posts: 1282
Joined: Sat Oct 13, 2007 7:48 pm
Location: Necroposting in a forum near you

3. I've never tried it, but you may be able to attach a time to a player ship (with sysAddObjRecurringTimerEvent).
I wasn't able to get this to work. Using an OnCreate in the Playership failed, and so I then tried to make this line work in an OnCreate for Eridani- (sysAddObjRecurringTimerEvent 30 gPlayerShip "OnCheckTimer") where OnCheckTimer just sent me a message counting seconds. The timer didn't seem to be activated, because I didn't get the message. Changing the gPlayerShip to gSource and placing the timer in the Star worked, but then it is only for Eridani and doesn't travel around with me.

Is there another method to attach a timer to the playership, and will it persist between systems?

It also seems like timers can't be added to an item or object alone- they are only a system level event, perhaps?


Edit- I figured out what I did wrong with the OnCreate, but the timer dies out when you cross to a new system- so it is impossible to make a persistent timer by attaching it to the playership.
Post Reply