Alternative ship texture for different ship roles

Discussion and information relevant to creating special missions, new ships, skins etc.

Moderators: winston, another_commander

User avatar
Captain Beatnik
Deadly
Deadly
Posts: 154
Joined: Sun Feb 27, 2011 10:15 pm
Location: Eastern Bavaria (Average Agricultural Confederacy)

Re: Alternative ship texture for different ship roles

Post by Captain Beatnik »

Rorschachhamster wrote:
short related question: Is there a way to make a ship take on a random texture, or would I have to randomize wich ship is used after having all possible textures defined via shipdata.plist?
The second approach you mention is the approach I use to bring a little bit more variety to the spacelanes. The core game also uses this approach, eg there are two different types of the cobra MK 3. But I think it is also possible to change the texture via script.

You should ask Smivs, I think he has a script in his Battle Damage OXP that changes the texture when the ship is damaged. With some tweaks it should be possible to generate random textures with this script.
I love deadlines. I like the whooshing sound they make as they fly by. (Douglas Adams, 1952 - 2001)
You have to try the impossible to achieve the possible. (Emil Sinclair, 1877 - 1962)
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: Alternative ship texture for different ship roles

Post by Smivs »

Re switching textures, yes it can be done by script - in fact several of my OXPs use this most notably my Smivs'Shipset which includes both variations of textures for some of the ships, and switching textures for the battle damage effects.
set_materials is your friend here, although I've never tried using it to apply a random texture, and off the top of my head I don't really know how you would approach that. It is an interesting idea though.
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
Shipbuilder
---- E L I T E ----
---- E L I T E ----
Posts: 877
Joined: Thu May 10, 2012 9:41 pm
Location: Derby

Re: Alternative ship texture for different ship roles

Post by Shipbuilder »

Ok I've put together a shipdata.plist which includes a player version of my new ship which uses a texture file called GalTech_Escort_Fighter_auv.png.

The shipdata.plist also includes a NPC escort version which should use a texture called GalTech_Escort_Fighter_auv_escort.png.

I have run some tests by spawning an escort version of this ship using the debug console however the escort version is using the stardard player texture i.e. GalTech_Escort_Fighter_auv.png.

I have included both texture files in the Textures folder in the test oxp.

I'm sure it is a simple issue but I must be missing something as I can't see why this is occurring (Perhaps it is just too late :? ).

Can anyone see the error I am making in the code below ?

EDIT - I've also just noticed that the emission map is not working on the NPC escort ship.

Code: Select all

{
// ++++++           GALTECH ESCORT FIGHTER                ++++++

"GalTech_Escort_Fighter-player" = 
	{
		name = "GalTech Escort Fighter";	
		roles = "player";
		model = "galtech_escort_fighter.dat"; 
		smooth = no;

		forward_weapon_type = "WEAPON_BEAM_LASER";
		aft_weapon_type = "WEAPON_BEAM_LASER";
		laser_color = "redColor";
		weapon_position_aft = "0.0 -3.1 -19.4";
		weapon_position_forward = "0.0 -0.1 20.4";
		missiles = 2;	
		max_missiles = 2;
		missile_launch_position = "0.0 -0.1 21.0";
		missile_load_time = 2.0;

		max_energy = 300;
		energy_recharge_rate = 3.3;

		max_cargo = 2;
		extra_cargo = 0;
		aft_eject_position = "0.0 -0.3 -19.0";
		scoop_position = "0.0 -4.6 -4.4";

		max_flight_pitch = 1.8;
		max_flight_roll = 1.7;
		max_flight_speed = 355;
		thrust = 40;
		hyperspace_motor_spin_time = 15;
		exhaust = ("0.0 0.3 -14.0 3.0 3.0 6.0");
		density = 1.5;

		cloak_passive = yes;

		view_position_aft = "0.0 7.0 -19.0";
		view_position_forward = "-0.0 1.0 25.0";
		view_position_port = "3.0 0.4 13.0";
		view_position_starboard = "-3.1 0.4 13.0";

		custom_views =
		(
    			{
        			view_description = "Rear View";
        			view_orientation = "1.0 0.0 0.0 0.0";
        			view_position = "0.0 10.0 -100.0";
        			weapon_facing = "FORWARD";
    			},
    			{
        			view_description = "Rear Right View";
        			view_orientation = "0.9239 0.0 0.3827 0.0";
        			view_position = "75 10.0 -75.0";
        			weapon_facing = "FORWARD";
    			},
    			{
        			view_description = "Right View";
        			view_orientation = "0.7071 0.0 0.7071 0.0";
        			view_position = "100 10.0 0.0";
        			weapon_facing = "FORWARD";
    			},
    			{
        			view_description = "Front Right View";
        			view_orientation = "0.3827 0.0 0.9239 0.0";
        			view_position = "75 10.0 75.0";
        			weapon_facing = "FORWARD";
    			},
    			{
        			view_description = "Front View";
        			view_orientation = "0.0 0.0 1.0 0.0";
       			 	view_position = "0.0 10.0 100.0";
        			weapon_facing = "FORWARD";
    			},
    			{
      		  		view_description = "Front Left View";
      		 	 	view_orientation = "0.3827 0.0 -0.9239 0.0";
      			  	view_position = "-75 10.0 75.0";
     	  			weapon_facing = "FORWARD";
    			},
    			{
      			  	view_description = "Left View";
      			  	view_orientation = "0.7071 0.0 -0.7071 0.0";
       			 	view_position = "-100 10.0 0.0";
       			 	weapon_facing = "FORWARD";
    			},
    			{
     			   	view_description = "Rear Left View";
    			    	view_orientation = "0.9239 0.0 -0.3827 0.0";
     			   	view_position = "-75 10.0 -75.0";
      			  	weapon_facing = "FORWARD";
    			},
    			{
   			     	view_description = "Top View";
    			    	view_orientation = "-0.7071 0.7071 0.0 0.0";
        			view_position = "0.0 100.0 0.0";
        			weapon_facing = "FORWARD";
    			},
    			{
        			view_description = "Bottom View";
        			view_orientation = "0.0 0.0 0.7071 0.7071";
        			view_position = "0.0 -100.0 0.0";
        			weapon_facing = "FORWARD";
    			},
  			{
				view_description = "Cinematic View";
				view_orientation = "0.0 0.35 1.0 0.05";
				view_position = "-10.0 25.0 200.0";
				weapon_facing = "FORWARD";
			}
		);

	materials = 
		{ 
			"GalTech_Escort_Fighter_auv.png" = 
			{ 
			emission_map = "GalTech_Escort_Fighter_auv.glow.png";
			shininess = 10;
			}; 
		};

	};





	"GalTech_Escort_Fighter-escort" =
	{
	   	like_ship = "GalTech_Escort_Fighter-player";
		name = "GalTech Escort Fighter";	
		roles = "escort";
		smooth = no;
		auto_ai = yes;

		missile_load_time = 8.0;

		likely_cargo = 1;
		cargo_type = "CARGO_NOT_CARGO";

		fuel = 70;
		has_ecm = 0.9;
		has_scoop = yes;

	materials = 
		{ 
			"GalTech_Escort_Fighter_auv_escort.png" = 
			{ 
			emission_map = "GalTech_Escort_Fighter_auv.glow.png";
			shininess = 10;
			}; 
		};
	};
}
The GalTech Industries Corporation - Building ships to populate the galaxies.

Increase the variety of ships within your Ooniverse by downloading my OXPs

Flying the [wiki]Serpent_Class_Cruiser[/wiki] "Thargoid's Bane"
User avatar
Thargoid
Thargoid
Thargoid
Posts: 5528
Joined: Thu Jun 12, 2008 6:55 pm

Re: Alternative ship texture for different ship roles

Post by Thargoid »

Have a look at my Butterflies OXP. The script in there randomises the texture colour via setMaterialsand diffuse:, but you can do the same with diffuseMap: to change the texture map itself.

For more details see [EliteWiki] here
User avatar
Smivs
Retired Assassin
Retired Assassin
Posts: 8408
Joined: Tue Feb 09, 2010 11:31 am
Location: Lost in space
Contact:

Re: Alternative ship texture for different ship roles

Post by Smivs »

Shipbuilder, for the escort you need to refer to the base texture in the materials section. So say the .dat specifies the player texture which we'll call GalTechPlayer_diffuse.png, the materials section for the player should look like this

Code: Select all

   materials = 
      { 
         "GalTechPlayer_diffuse.png" = 
         { 
         emission_map = "whatever_emission_map_it_should_have.png";
         shininess = 10;
         specular_color = ( 0.3, 0.3, 0.3, 0.5 ); 
         }; 
      };
and the escort must refer to this and then over-ride the diffuse_map with its own which we'll call 'GalTechEscort_diffuse.png', thus

Code: Select all

   materials = 
      { 
         "GalTechPlayer_diffuse.png" = 
         { 
         diffuse_map = "GalTechEscort_diffuse.png";
         emission_map = "whatever_emission_map_it_should_have.png";
         shininess = 10;
         specular_color = ( 0.3, 0.3, 0.3, 0.5 ); 
         }; 
      };
Also, you must include the model in the escort section of shipdata.
You might be wise to keep the plist alphabetical. I helps to read it and diagnose any problems. For a good working example of all of these aspects, take a look at my Contractor OXP which has a player, bounty hunter and pirate version - the player and bounty hunter share a texture, the pirate has a separate one.
Last edited by Smivs on Sun Nov 18, 2012 10:01 am, edited 1 time in total.
Commander Smivs, the friendliest Gourd this side of Riedquat.
User avatar
Shipbuilder
---- E L I T E ----
---- E L I T E ----
Posts: 877
Joined: Thu May 10, 2012 9:41 pm
Location: Derby

Re: Alternative ship texture for different ship roles

Post by Shipbuilder »

Thanks Smivs I’ve corrected the code based on your notes and all is working fine now. :D

For anyone using this thread in the future to achieve a similar result for completeness the relavent part of the code is provided below.

For the original ship using the standard texture i.e. the texture defined in the .dat file

Code: Select all

	materials = 
		{ 
			"GalTech_Escort_Fighter_auv.png" = 
			{ 
			emission_map = "GalTech_Escort_Fighter_auv.glow.png";
			shininess = 10;
			}; 
		};
Then for an alternative ship, in this case those with a role of escort, the code becomes: -

Code: Select all

	materials = 
		{ 
			"GalTech_Escort_Fighter_auv.png" = 
			{ 
			diffuse_map = "GalTech_Escort_Fighter_auv_escort.png";
			emission_map = "GalTech_Escort_Fighter_auv.glow.png";
			shininess = 10;
			}; 
		};
The GalTech Industries Corporation - Building ships to populate the galaxies.

Increase the variety of ships within your Ooniverse by downloading my OXPs

Flying the [wiki]Serpent_Class_Cruiser[/wiki] "Thargoid's Bane"
Post Reply