Alternate Beginnings

Freeform discussion about anything related to modding Transcendence.
Post Reply
Keedo420
Militia Lieutenant
Militia Lieutenant
Posts: 165
Joined: Sun Sep 04, 2011 9:31 pm

OK, I've been trying to write a code that changes the GamSetCrawlText depending on which starting ship the player chooses. However, so far my efforts have failed. Below is the current code. I have tried several variations, including using ifs instead of switch, but so far I always get the default text even when I choose the Battlestar class ship. I have double and triple checked to make sure that the correct class id is being used. So I have two theories why it isn't working. Either I am not writing the code correctly, or gPlayerShip is not defined until the player actually spawns. This second theory seems quite likely to me since this bit of code comes after the player chooses a ship but before they actually spawn. Can anyone shed some light on this little dilemma?

Code: Select all

		<OnGameStart>
			(block (class)
				(setq class (shpGetClass gPlayerShip))
				
				(gamSetCrawlImage &rsPrologue;)
				(switch 
					(eq class &scBattlestar;)
						(block Nil
							(gamSetCrawlText (cat
								"You are the commander of a Galactica-class Battlestar. Your "
								"ship had been stripped down and was on its way to be "
								"decommisioned when the Cylons attacked. During the fight, "
								"your jump drive was damaged and unexpectedly activated. "
								"To your dismay, you discover that a Cylon virus has erased "
								"most of the data from your ship's computer, including "
								"navigational charts. Even after your jump drive is fixed, "
								"you have no way to jump back home and your cargo holds are "
								"nearly empty. In order to survive you will need to find "
								"resources and set up a base of operations before you can "
								"even think about looking for a way home. Before you do "
								"anything else, inspect your cargo. Good luck, Commander. "
							))
						)
					
					(block Nil
						(gamSetCrawlText (cat
							"This is text that should be displayed if you choose one "
							"of the vanilla ships or a ship from another mod. "
							""
						))
					)
				)
			)
		</OnGameStart>
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

you can always try and dbgLog gPlayerShip, but i think your theory about it not being set is right. gPlayerShip refers to the actual ship object, and that is not created until after the welcome screen i would think.

It is a great idea, and I suggest we come up with bug report on trac for this
Get your own Galactic Omni Device
Get it now. It's free!!
Image
shanejfilomena
Fleet Officer
Fleet Officer
Posts: 1533
Joined: Tue Mar 22, 2011 8:43 pm
Location: Alaska
Contact:

Code: Select all

startingShipCriteria="* -notInPartI"
The game is ordered to not choose so you have to choose it for the game by being specific.
you CAN edit the criteria , which might mean edits on the attributes of the ships
or you can continue with the screen descriptions with the switch for specific unids ( Type, not Class : the "class" is combat related, the identity of the ship is by Type )

and leave default text if the ship selected by the player is not listed : such as My Cruiser.

What you want is the rumor code to determine the chosen ship : this is a "suggested" code, is NOT a working code,( no copy paste)
rumor code is a "take" on the Hotel code that determines the player's next pane so between the now revealed sources within the game : rumors and Hotel : you can mix them into a working code.

Code: Select all

	(switch
	(eq (objGetType gPlayerShip) &scSapphirePlayer;)
								(gamSetCrawlText  (cat desc "\"words \""))

							(eq (objGetType gPlayerShip) &scEI100XPlayer;)
								(gamSetCrawlText (cat desc "\"words \""))

							(eq (objGetType gPlayerShip) &scWolfenPlayer;)
                                                                        (gamSetCrawlText  (cat desc "\" words \""))

               ; Otherwise drive us nuts with the next line

	(gamSetCrawlText (cat"\"  Default words \""))
Flying Irresponsibly In Eridani......

I don't like to kill pirates in cold blood ..I do it.. but I don't like it..
Keedo420
Militia Lieutenant
Militia Lieutenant
Posts: 165
Joined: Sun Sep 04, 2011 9:31 pm

That makes sense. I hadn't considered the startingShipCriteria. I will play with both suggestions when I get home and post my results tomorrow.
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

If you use shipStartingCriteria you will have to make a separate adventure for each ship though.
Get your own Galactic Omni Device
Get it now. It's free!!
Image
Keedo420
Militia Lieutenant
Militia Lieutenant
Posts: 165
Joined: Sun Sep 04, 2011 9:31 pm

alterecco wrote:If you use shipStartingCriteria you will have to make a separate adventure for each ship though.
Well, I didn't actually use shipStartingCriteria, but I put in some attributes for the starting ships and tried the objHasAttribute function, and I also tried shane's idea of using objGetType, but in both cases the results were the same as before. It keeps going to the default text. And since gPlayerShip was the obj in both cases, I am forced to conclude that it just isn't defined until the player spawns. So now I'm trying to come up with a way to have gamSetCrawlText pop-up after the player spawns. My first attempt was to put the code into the OnCreate event for the starting ship, but that resulted in nothing at all happening. Can dockscreens have crawl text I wonder?
shanejfilomena
Fleet Officer
Fleet Officer
Posts: 1533
Joined: Tue Mar 22, 2011 8:43 pm
Location: Alaska
Contact:

srry it did not work out: but it was the best I could figure out from the issue ( admit I did not test any of the idea: I am doing my stuff as Adventures but I don't do Player usable ships)
Flying Irresponsibly In Eridani......

I don't like to kill pirates in cold blood ..I do it.. but I don't like it..
Keedo420
Militia Lieutenant
Militia Lieutenant
Posts: 165
Joined: Sun Sep 04, 2011 9:31 pm

No worries. One way or another I will come up with a solution...or a compromise for this problem.
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

You could write your own crawl text function in an animated canvas screen.
Get your own Galactic Omni Device
Get it now. It's free!!
Image
Keedo420
Militia Lieutenant
Militia Lieutenant
Posts: 165
Joined: Sun Sep 04, 2011 9:31 pm

I don't know how to do that yet. :( Is there a tutorial somewhere for animated canvas screens?
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

Afraid there isn't. The best bet is to look at the Neurohack screen and go from there. Feel free to ask any specific questions you have about DS modding.
Get your own Galactic Omni Device
Get it now. It's free!!
Image
Keedo420
Militia Lieutenant
Militia Lieutenant
Posts: 165
Joined: Sun Sep 04, 2011 9:31 pm

OK, thanks. I'll look into that.
Post Reply