Page 1 of 1
Turret Troubles
Posted: Thu Sep 16, 2010 10:02 pm
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

Re: Turret Troubles
Posted: Thu Sep 30, 2010 5:44 pm
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.
Re: Turret Troubles
Posted: Fri Oct 01, 2010 4:08 pm
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.