Linked kill object = texture change?

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

Post Reply
fasty
1st Lieutenant
1st Lieutenant
Posts: 438
Joined: Thu Apr 15, 2010 4:17 am
Projects :: Server modding
Games I'm Playing :: SWBF2
Contact:

Linked kill object = texture change?

Post by fasty »

Is it possible to rig it so on the destruction of an object, another objects texture changes?
I'd assume it would go something like this:
Hidden/Spoiler:
[code]killobjc = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "ObjectIKill" then
<InsertCodeThatChangesTextureHere>
end
end
)[/code]
User avatar
Firefang
Major
Major
Posts: 518
Joined: Mon Nov 15, 2010 8:55 pm
Location: California

Re: Linked kill object = texture change?

Post by Firefang »

You have to spawn a new object with the changed texture.
User avatar
DarthD.U.C.K.
Master of the Force
Master of the Force
Posts: 6027
Joined: Wed Sep 27, 2006 11:05 am
Location: Duckburg, Germany

Re: Linked kill object = texture change?

Post by DarthD.U.C.K. »

no, you dont have to, you can do it by loading a new texture with the same name into memory
how to switch textures through lua:
1. make a side "textures" and the according folder in _BUILD\Sides\ with the munge.bat and clean.bat in it.
2. make an "msh"-folder in the data_XXX\Sides\Texture folder and put in all textures.
3.1 change the texture(s) once:
make a "textures.req" file with this in it:

Code: Select all

ucft
{
	REQN
	{
	
		"texture"
		"texturename1"
		"texturename2" etc.
	}
}
in your lua, put that in your triggerfunction:

Code: Select all

ReadDataFile("DC:SIDE\\textures.lvl")
3.2 change textures and change them back or change different textures on different events:
make a "textures.req" with this in it

Code: Select all

ucft
{
	REQN
	{
	
		"lvl"
		"texturepack1"
		"texturepack2" etc.
	}
}
make a "req" folder in your sides folder and for each pack listed in the "textures.req"
make a new reqfile called "texturepack1.req" and so on, in each put:

Code: Select all

ucft
{
	REQN
	{
	
		"texture"
		"texturename1"
		"texturename2" etc.
	}
}
in your lua you can now trigger the change by putting this in your function:

Code: Select all

					ReadDataFile("DC:SIDE\\textures.lvl",
								"texturepack1")
and so on.
Last edited by DarthD.U.C.K. on Wed Feb 23, 2011 11:50 am, edited 1 time in total.
fasty
1st Lieutenant
1st Lieutenant
Posts: 438
Joined: Thu Apr 15, 2010 4:17 am
Projects :: Server modding
Games I'm Playing :: SWBF2
Contact:

Re: Linked kill object = texture change?

Post by fasty »

Thanks I knew there was SOME way to do it. :wink: That's very clever.
User avatar
DarthD.U.C.K.
Master of the Force
Master of the Force
Posts: 6027
Joined: Wed Sep 27, 2006 11:05 am
Location: Duckburg, Germany

Re: Linked kill object = texture change?

Post by DarthD.U.C.K. »

thanks :D
i think you can change mshs and odfs through this too, but im not sure. i tried it with an odf once and it atleast gave some kind of respose (geometry not found :P)
User avatar
AceMastermind
Gametoast Staff
Gametoast Staff
Posts: 3285
Joined: Mon Aug 21, 2006 6:23 am
Contact:

Re: Linked kill object = texture change?

Post by AceMastermind »

fasty wrote:...

Code: Select all

killobjc = OnObjectKill(
   function(object, killer)
      if GetEntityName(object) == "ObjectIKill" then
      <InsertCodeThatChangesTextureHere>
      end
   end
)
What kind of code do you plan to use that actually changes the object's texture? I don't see any properties that can do this for any object. I'm no programmer but I think Firefang may be right. The instructions provided by DarthD.U.C.K. is basically what Syth describes HERE as a "skin side". This thread can't be solved until you have something that works like it should.
fasty
1st Lieutenant
1st Lieutenant
Posts: 438
Joined: Thu Apr 15, 2010 4:17 am
Projects :: Server modding
Games I'm Playing :: SWBF2
Contact:

Re: Linked kill object = texture change?

Post by fasty »

So far I've gotten my unit to change weapons on object destruction, but I'm still working on a texture change. I don't really know what to put in place of WeaponName1 that will change the texture. Everything I've tried either doesn't work or crashes. :? Changing the geometry causes a crash just like Duck said it would.
Hidden/Spoiler:
[code]killobjc = OnObjectKill(
function(object, killer)
if GetEntityName(object) == "dea1_prop_panel" then
SetClassProperty("rep_inf_ep3_rifleman", "WeaponName1", "rep_weap_inf_emp_launcher")
end
end
)[/code]
User avatar
Firefang
Major
Major
Posts: 518
Joined: Mon Nov 15, 2010 8:55 pm
Location: California

Re: Linked kill object = texture change?

Post by Firefang »

You would have to change the unit's msh to change texture. I was working on this a while ago, which proves that a msh can be swapped ingame.
User avatar
DarthD.U.C.K.
Master of the Force
Master of the Force
Posts: 6027
Joined: Wed Sep 27, 2006 11:05 am
Location: Duckburg, Germany

Re: Linked kill object = texture change?

Post by DarthD.U.C.K. »

i tried overriding a msh via sideloading and it complained about model being loaded already.
loading an odf didnt give me an error but i think you have to respawn a prop to get it to use the new odf (if that works)

anyway, like firefang said, you can change the texture by changing the units model with setproperty.
there is however a difference between changing the "odf" of the unit and the texture itself.
if you change the odf with setproperty, it will apply to all units that are spawned after the change was made
if you change it by overriding a texture in the memory, it will apply to all units.
to change the texture in memory, put "ReadDataFile("DC:SIDE\\textures.lvl")" instead of the setpropertyline in the function.
Post Reply