Turret Troubles

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
User avatar
AgentSmith_#27
Rebel Warrant Officer
Rebel Warrant Officer
Posts: 302
Joined: Thu Feb 11, 2010 3:10 pm
Projects :: No Projects I am ready to unveil
Games I'm Playing :: SWBF2-MW2-Madden 08
xbox live or psn: No gamertag set
Location: Zeroeditor
Contact:

Turret Troubles

Post by AgentSmith_#27 »

Okay, I am very near to completing Cerea Final, and would really like to get it uploaded this weekend, but first I am going to need you guys' help with my two turret troubles.

1: This one is a must-fix, I need to know how to localize the turret (NOTE: I know how to localize the entity and all that) like you would localize a new side E.G. Savage 678 killed AgentSmith_#27. The turret side is a custom one, and I'd hate to have to release it with a flaw like that.

2: When I die while manning a custom turret, instead of being sent to the unit selection screen, the camera just stays in that transitional period, when I press escape to respawn, it says I killed myself but still it stays in the fixed camera thing.


I would be eternally grateful to anyone that can offer me help, because this is the first time I've had more than a few minutes to work on modding.

Edit: Nice to see all the eager offers of aid so I could seize the one chance I have to actually finish my map :(
stardestroyer001
Sergeant Major
Sergeant Major
Posts: 239
Joined: Fri Apr 16, 2010 7:02 pm
Projects :: Space Coruscant [before it corrupted]
Games I'm Playing :: World of Warships
xbox live or psn: StarDestroyer75
Location: Canada
Contact:

Re: Turret Troubles

Post by stardestroyer001 »

1) You need to know the name of the turret. Then, determine what it is (object, vehicle, weapon, etc). Finally, using the localizing tool, find the location of where other objects/vehicles/weapons/etcs are, and add a new entry. If it's a completely new side, add a new scope with your new side's name, and add the key in that.

Ex. the magnaguard: cis_inf_magnaguard_ptc
It would go in entity/cis/, create a new key, label it inf_magnaguard_ptc, and add whatever name you want to appear in-game in the text box.

2) Sorry, I don't know the answer to that one. Double-check your LUAs and ODFs. If this happens with the custom turret no matter what type of trooper you are, then double-check your turret's ODF files, and your game's LUA and, if applicable, your BAK files too.
User avatar
jangoisbaddest
Lieutenant General
Lieutenant General
Posts: 661
Joined: Mon Feb 27, 2006 12:10 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: All Along The Watchtower

Re: Turret Troubles

Post by jangoisbaddest »

AgentSmith_#27 wrote:2: When I die while manning a custom turret, instead of being sent to the unit selection screen, the camera just stays in that transitional period, when I press escape to respawn, it says I killed myself but still it stays in the fixed camera thing.
I ran into that same problem a while back. Here is what I used to work around:

Code: Select all

turretKill = OnObjectKillClass(
	function(object, killer)
		print("Turret destroyed callback called.")
		local humanChar = 0
		if humanChar then
			print("Player sucessfully found.")
			if GetCharacterVehicle(humanChar) then
				if GetEntityName(GetCharacterVehicle(humanChar)) == "turret_console_1" and       GetEntityName(object) == "turret_ext1" then
					print("Driver registered as in turret 1. Killing driver.")
					KillObject(GetCharacterUnit(humanChar))
				elseif GetEntityName(GetCharacterVehicle(humanChar)) == "turret_console_2" and GetEntityName(object) == "turret_ext2" then
					print("Driver registered as in turret 2. Killing driver.")
					KillObject(GetCharacterUnit(humanChar))
				--elseif GetEntityName(GetCharacterVehicle(humanChar)) == "turret_console_3" and GetEntityName(object) == "turret_ext3" then
					--print("Driver registered as in turret 3. Killing driver.")
					--KillObject(GetCharacterUnit(humanChar))
				--elseif GetEntityName(GetCharacterVehicle(humanChar)) == "turret_console_4" and GetEntityName(object) == "turret_ext4" then
					--print("Driver registered as in turret 4. Killing driver.")
					--KillObject(GetCharacterUnit(humanChar))
				else
					print("Character not registered as in vehicle.")
				end
			end
		end
	end,
"tan4_bldg_turret_external"
)
Of course, some of this code is geared toward single player use, but can be easily adapted to multiplayer if that's the type of map you are creating (hint: 0 is always the characterIndex of the player in single player maps. Hopefully that will clarify some of the code). Let me know if you have any questions, as I know LUA can be confusing when you are first learning it.

Edit: Well, okay, not THAT easily. You would have to either find a function that returns the character/unit using the vehicle (turrets are vehicles) or cycle through each player on the opposite team and check to see if the GetCharacterVehicle returns the correct value. But hopefully this has given you a good starting point.
Post Reply