Virtual ships

Freeform discussion about anything related to modding Transcendence.
Post Reply
giantcabbage
Militia Lieutenant
Militia Lieutenant
Posts: 107
Joined: Thu Apr 07, 2011 9:05 pm

I was thinking of using virtual ships as the basis for a mission framework: http://www.neurohack.com/transcendence/ ... f=3&t=4073 as ships can be made to follow the player from system to system. Using the code below, the ship does seem to follow the player to the new system - the entered system events and 'SayHello' event are all called in the new system. But the ship is destroyed shortly afterwards. Is there any way around this, or are virtual ships only intended as base clases / AI controlers for actual ships?

Code: Select all

<ShipClass UNID="&vsQwertyTest;" virtual="true">
	<Events>
		<OnCreate>
			(block Nil
				(dbgOutput (cat "Creating vs " gSource))
				(sysAddObjRecurringTimerEvent 30 gSource "SayHello")
			)
		</OnCreate>
		<SayHello>
			(plyMessage gplayer (cat "Hello from " (sysGetName)))
		</SayHello>
		<OnPlayerLeftSystem>
			(block Nil
				(dbgOutput (cat "Player leaving " (sysGetName)))
				'followPlayer
			)
		</OnPlayerLeftSystem>
		<OnPlayerEnteredSystem>
			(dbgOutput (cat "Player entering " (sysGetName)))
		</OnPlayerEnteredSystem>
		<OnEnteredSystem>
			(dbgOutput (cat "Ship entering " (sysGetName)))
		</OnEnteredSystem>
		<OnLeftSystem>
			(dbgOutput (cat "Ship leaving " (sysGetName)))
		</OnLeftSystem>
		<OnDestroy>
			(dbgOutput (cat gSource " destroyed by " aDestroyer))
		</OnDestroy>
	</Events>
</ShipClass>
shanejfilomena
Fleet Officer
Fleet Officer
Posts: 1533
Joined: Tue Mar 22, 2011 8:43 pm
Location: Alaska
Contact:

I get it but if it has substance it can be destroyed: if it is virtual as in " Dimensional Phase " then it should not get destroyed unless it gets bored ( autons do get "bored" in the game, it is a Quasi-default for wingmen without controllers / orders.)

try pushing it to the Wingman Base attribute and see if it lives longer. The UGWingmen files are what I like to use in my wingmen/ Auton ideas, I think they are extremely reliable.
Flying Irresponsibly In Eridani......

I don't like to kill pirates in cold blood ..I do it.. but I don't like it..
giantcabbage
Militia Lieutenant
Militia Lieutenant
Posts: 107
Joined: Thu Apr 07, 2011 9:05 pm

I only want to use the virtual ships as a way to store a collection of events and associated data. I don't want them to appear as an in game ship which you can see / shoot. Maybe I should have said removed or deleted rather than destroyed. It appears that the problem is the part of the engine which moves ships from one system to another expects them to be an "actual" ship, or calls the ai update code after moving them. I can prevent the virtual ship from being removed by giving it an order - add (shpOrder gSource 'hold) to OnCreate will work. However this does have a few problems:

You can't give orders to virtual ships - an error message will be displayed on the screen, but it doesn't cause a crash.

The gate animation is triggered as each virtual object is transferred. If there are several virtual objects following the player then the gate will be animating for some time with nothing appearing.

Bug 508 can be triggered in the new system if an explosion occurs near the gate.
RPC
Fleet Admiral
Fleet Admiral
Posts: 2876
Joined: Thu Feb 03, 2011 5:21 am
Location: Hmm... I'm confused. Anybody have a starmap to the Core?

Virtual ships? That's a good one :D
Do you know what destroyed the ship, or has it "disappeared"? If that's that case, that's because ships that have completed their orders automatically gate out, so you'd have to reapply the same 'follow player shipOrder to keep them from gating out.
However, another, slightly (if not moreso) harder way to do this would be virtual stations and then storing data on the playership, with the station taking data from the playership and storing it on the playership again once the player gates out.
*EDIT- However, go to IRC if you want help/need ideas. Alterecco and Drako Slyith are great people to PM, although I haven't seen Prophet in a while....
Tutorial List on the Wiki and Installing Mods
Get on Discord for mod help and general chat
Image
Image
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.
giantcabbage
Militia Lieutenant
Militia Lieutenant
Posts: 107
Joined: Thu Apr 07, 2011 9:05 pm

looks like we were both replying at the same time.

Yes, the ship was removed by "enteredStargate". I guess the 'followPlayer from the PlayerLeftSystem event is an order which triggers the check on completed orders after the jump - in the first system the order queue doesn't matter as virtual ships can't have orders.

I've thought about transferring data via the player ship. But as you say it's a bit of work as you need to maintain a list of all the data to be transferred, or write specific code for each different mission.. well there's still plenty of work to do on the single system mission for now
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

That wont work... The 'followPlayer part of OnPlayerLeftSystem will only work for actual objects, not virtual ones (it will trigger, but there is no ship that can follow).

I have tried this same approach some time ago, and was moderately pleased with the results. Here is a paste of the code. http://paste.neurohack.com/view/YL8Hs Note that it is an unfinished event framework i was building. I have not looked at it for a long time, but i think it was working at that point. The event ship is at the end of the xml.

At this point I would not use this technique, but use one virtual station, and have that place invisible event carrying stations in every system (there is just too much that can go wrong with the event ship)
Post Reply