Getting code to run when the game starts
I need to run a block of code as soon as the game starts (I think it'll just insert an item into the player's inventory). How do I do it?
[schilcote] It doesn't have to be good, it just has to not be "wow is that the only thing you could think of" bad
-
- Fleet Admiral
- Posts: 2876
- Joined: Thu Feb 03, 2011 5:21 am
- Location: Hmm... I'm confused. Anybody have a starmap to the Core?
Check out Utility Items:
http://xelerus.de/index.php?s=mod&id=1017
Basically I used <OnGlobalSystemCreated>. Be careful since it runs *every* time a system is generated, so make sure to save data so that you know you've already added items.
http://xelerus.de/index.php?s=mod&id=1017
Basically I used <OnGlobalSystemCreated>. Be careful since it runs *every* time a system is generated, so make sure to save data so that you know you've already added items.
Tutorial List on the Wiki and Installing Mods
Get on Discord for mod help and general chat


Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.
Get on Discord for mod help and general chat


Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.
-
- Fleet Admiral
- Posts: 2876
- Joined: Thu Feb 03, 2011 5:21 am
- Location: Hmm... I'm confused. Anybody have a starmap to the Core?
Nah, just the one with the time to code, and even that's diminishing 

Tutorial List on the Wiki and Installing Mods
Get on Discord for mod help and general chat


Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.
Get on Discord for mod help and general chat


Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.
Eh, I've got too much time these days. I get depressed when I'm not working on something.
Another question:
Is it possible to have a ship fly up to the player and force him into a dockscreen? I'm thinking for a quest mod I'd have some guy in St. K's go up to you and tell you about this mysterious artifact he just so happens to know the location of...
Another question:
Is it possible to have a ship fly up to the player and force him into a dockscreen? I'm thinking for a quest mod I'd have some guy in St. K's go up to you and tell you about this mysterious artifact he just so happens to know the location of...
[schilcote] It doesn't have to be good, it just has to not be "wow is that the only thing you could think of" bad
-
- Fleet Admiral
- Posts: 2876
- Joined: Thu Feb 03, 2011 5:21 am
- Location: Hmm... I'm confused. Anybody have a starmap to the Core?
I think that you can just spring the dockscreen by running either
(scrShowPane ...)
(scrShowScreen screenGlobal screen [pane] [data])
in some event.
As for getting a ship to go to the player, you can do that with the ShpOrder funcs. Try 'goto and sysVectorPolarOffset from the playership so the other ship doesn't go on top of the playership (unless you want that, then don't use sysVectorPolarOffset).
(scrShowPane ...)
(scrShowScreen screenGlobal screen [pane] [data])
in some event.
As for getting a ship to go to the player, you can do that with the ShpOrder funcs. Try 'goto and sysVectorPolarOffset from the playership so the other ship doesn't go on top of the playership (unless you want that, then don't use sysVectorPolarOffset).
Tutorial List on the Wiki and Installing Mods
Get on Discord for mod help and general chat


Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.
Get on Discord for mod help and general chat


Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.
Hmm. I looked at the code you linked to, and it seems to work in its native environment, but not when I try to use it.
Any obvious problems there?
Code: Select all
<StationType UNID="&vtCFWInitSpawner;"
virtual= "True"
>
<Events>
<OnGlobalSystemCreated>
(block Nil
(sysCreateStation &vtCFWStation; nil)
(cfwInit)
)
</OnGlobalSystemCreated>
</Events>
</StationType>
<StationType UNID="&vtCFWStation;"
virtual= "True"
>
<Events>
<OnPlayerEnteredSystem>
(block Nil
(if (not (objGetData gPlayerShip "CFWInitialized")) ;If CFW isn't initialized...
(block Nil
(objRegisterForEvents gSource gPlayerShip) ;Register the virtual station to recieve events related to the playership.
(objSetData gPlayerShip "CFWInitialized" 1) ;Then leave a sticky-note on the player that says we've already initialized CFW.
)
(block Nil
;Nothing happens if CFW is already initialized- I might remove this if I don't figure out a use for it.
)
)
)
</OnPlayerEnteredSystem>
</Events>
</Stationtype>
[schilcote] It doesn't have to be good, it just has to not be "wow is that the only thing you could think of" bad
If you only need to run code once, when you start a new game, <OnGlobalUniverseCreated> would be useful.
Download and Play in 1.9 beta 1...
Drake Technologies (Alpha): More hardware for combat in parts 1 and 2!
Star Castle Arcade: Play a classic arcade game adventure, with or without more features (like powerups)!
Playership Drones: Buy or restore exotic ships to command!
Other playable mods from 1.8 and 1.7, waiting to be updated...
Godmode v3 (WIP): Dev/cheat tool compatible with D&O parts 1 or 2.
Drake Technologies (Alpha): More hardware for combat in parts 1 and 2!
Star Castle Arcade: Play a classic arcade game adventure, with or without more features (like powerups)!
Playership Drones: Buy or restore exotic ships to command!
Other playable mods from 1.8 and 1.7, waiting to be updated...
Godmode v3 (WIP): Dev/cheat tool compatible with D&O parts 1 or 2.
Actually, I'm pretty sure my code as it is needs there to be a station in every system. Doesn't make all that much difference though.PM wrote:If you only need to run code once, when you start a new game, <OnGlobalUniverseCreated> would be useful.
The ultimate problem seems to be that I can't figure out a way to make the station show up when the game starts.
[schilcote] It doesn't have to be good, it just has to not be "wow is that the only thing you could think of" bad
-
- Fleet Admiral
- Posts: 2876
- Joined: Thu Feb 03, 2011 5:21 am
- Location: Hmm... I'm confused. Anybody have a starmap to the Core?
Can you post the whole xml? It doesn't seem to look wrong...
Tutorial List on the Wiki and Installing Mods
Get on Discord for mod help and general chat


Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.
Get on Discord for mod help and general chat


Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.
[schilcote] It doesn't have to be good, it just has to not be "wow is that the only thing you could think of" bad
-
- Fleet Officer
- Posts: 1533
- Joined: Tue Mar 22, 2011 8:43 pm
- Location: Alaska
- Contact:
Ok : I am on the run from my own bad ideas but I am not exactly unrusty: in my opinion and how I would write the station:
what I first see in your code is "the declarations": easiest way to point this out for a station Extra Data: is with a mission station : above the station, like a Hurin Fortress, mining colony, etc. the states are declared.
AND you need to edit the playership extra data to include your states or achievements/ status : such as a " sister's intro" , hasID, etc ( whatever your placing on the ship itself ) many instances do not require actually editing the playership extra data but it short cuts any potential problem fixing.
other then that : I admire your work , but I like to keep it simple : less typing and less problems.
oh: BTW: Try this : " What works in 1.1 SHOULD work on later version" - George said that
I do not play the latest versions ( 1.08 is still trying to kill me ) so I do not know this "OnGlobalUniveCreated"
what I first see in your code is "the declarations": easiest way to point this out for a station Extra Data: is with a mission station : above the station, like a Hurin Fortress, mining colony, etc. the states are declared.
AND you need to edit the playership extra data to include your states or achievements/ status : such as a " sister's intro" , hasID, etc ( whatever your placing on the ship itself ) many instances do not require actually editing the playership extra data but it short cuts any potential problem fixing.
other then that : I admire your work , but I like to keep it simple : less typing and less problems.
oh: BTW: Try this : " What works in 1.1 SHOULD work on later version" - George said that
I do not play the latest versions ( 1.08 is still trying to kill me ) so I do not know this "OnGlobalUniveCreated"
Code: Select all
<Events>
<OnGlobalSystemCreated>
(sysCreateStation &st( whatever); nil)
</OnGlobalSystemCreated>
<OnCreate>
Blah blah blah
</OnCreate>
Flying Irresponsibly In Eridani......
I don't like to kill pirates in cold blood ..I do it.. but I don't like it..
I don't like to kill pirates in cold blood ..I do it.. but I don't like it..
-
- Fleet Admiral
- Posts: 2876
- Joined: Thu Feb 03, 2011 5:21 am
- Location: Hmm... I'm confused. Anybody have a starmap to the Core?
Couple things:
1. you need to match the <OnGlobalSystemCreated>
2. dbglog doesn't work anymore. It got superseded by PrintTo 'log
http://wiki.neurohack.com/transcendence ... icket/1139
I have a ticket for it here:
http://wiki.neurohack.com/transcendence ... icket/1193
Also, I have given both stations an image so that you can see it at the center of the sun
http://paste.neurohack.com/view/Y8Nm7/
1. you need to match the <OnGlobalSystemCreated>
2. dbglog doesn't work anymore. It got superseded by PrintTo 'log
http://wiki.neurohack.com/transcendence ... icket/1139
I have a ticket for it here:
http://wiki.neurohack.com/transcendence ... icket/1193
Also, I have given both stations an image so that you can see it at the center of the sun

http://paste.neurohack.com/view/Y8Nm7/
Tutorial List on the Wiki and Installing Mods
Get on Discord for mod help and general chat


Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.
Get on Discord for mod help and general chat


Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.
-
- Fleet Officer
- Posts: 1533
- Joined: Tue Mar 22, 2011 8:43 pm
- Location: Alaska
- Contact:
Obviously, RPC is still nothing short of AWESOME 
That pretty much does everything I think. I would have still did extra data on the playership, but I always was the Noob

That pretty much does everything I think. I would have still did extra data on the playership, but I always was the Noob

Flying Irresponsibly In Eridani......
I don't like to kill pirates in cold blood ..I do it.. but I don't like it..
I don't like to kill pirates in cold blood ..I do it.. but I don't like it..