I dispensed two different autoturrets with beam weapons and used LUA to set them to teams 3 and 4, as well as setting 3 and 4 against each other and friendly with everyone else:
Hidden/Spoiler:
[code] beamswitch_a = OnCharacterDispenseControllable(
function(character, controllable)
if GetEntityClass(controllable) == FindEntityClass("rep_bldg_inf_trapstart_a") then
SetObjectTeam(controllable, 3)
SetTeamAsFriend(ATT,3)
SetTeamAsFriend(3,ATT)
SetTeamAsFriend(DEF,3)
SetTeamAsFriend(3,DEF)
SetTeamAsEnemy(3,4)
end
end
)
beamswitch_b = OnCharacterDispenseControllable(
function(character, controllable)
if GetEntityClass(controllable) == FindEntityClass("rep_bldg_inf_trapstart_b") then
SetObjectTeam(controllable, 4)
SetTeamAsFriend(ATT,4)
SetTeamAsFriend(4,ATT)
SetTeamAsFriend(DEF,4)
SetTeamAsFriend(4,DEF)
SetTeamAsEnemy(4,3)
end
end
)
sidetest = OnCharacterDispenseControllable(
function(character, controllable)
if GetEntityClass(controllable) == FindEntityClass("rep_bldg_inf_sidetest") then
SetObjectTeam(GetCharacterUnit(character), 3)
end
end
)[/code][/size]
That's all in ScriptPostLoad. I've also tried putting the SetTeamAsEnemy and SetTeamAsFriend code where the local side tutorial says to put it, in ScriptInit.
The problem is that the turrets ignore everything around them, including each other. I want them to shoot each other up, but instead they just try to stare each other down. When I used the sidetest weapon to switch myself to team 3, just to check if the team switching was working, the team 4 turret became my enemy, like it should. It had a red health bar and everything, but I paraded in front of it in all manner of ways without it batting an eyelash, much less slicing me with an energy beam.
Here's also the beam weapon odf. Both turrets use the same weapon.
It does look like I got the targeting parameters right, but maybe there's something I missed. Any ideas? If you need any other files, just let me know.
Re: Placed turrets ignoring enemies
Posted: Sun Jul 17, 2011 11:08 pm
by Dakota
i made an auto turret with a beam weapon once and it wouldn't fire.
are you sure that the weapon itself works? try making the turret pilotable to check.
(maybe its just that its a beam and ai hate beams.)
Re: Placed turrets ignoring enemies
Posted: Mon Jul 18, 2011 4:03 am
by AQT
Dakota wrote:(maybe its just that its a beam and ai hate beams.)
The AI use beam weapons all the time in the shipped game. The AI auto turrets in Sky's Dark Space/Last Days mod use their beam weapons without a problem.
Re: Placed turrets ignoring enemies
Posted: Mon Jul 18, 2011 12:56 pm
by Dakota
AQT wrote:
Dakota wrote:(maybe its just that its a beam and ai hate beams.)
The AI use beam weapons all the time in the shipped game. The AI auto turrets in Sky's Dark Space/Last Days mod use their beam weapons without a problem.
well the thing about beams sometimes i think is just that in the stock game they don't use them well sometimes.
the spider walker has that problem. and i had the problem with a turret like that. anyway checking if the turret gun works by piloting the turret would help see if the weapon is the problem or not anyway.
Re: Placed turrets ignoring enemies
Posted: Mon Jul 18, 2011 9:21 pm
by Fiodis
Dakota wrote:well the thing about beams sometimes i think is just that in the stock game they don't use them well sometimes.
the spider walker has that problem. and i had the problem with a turret like that. anyway checking if the turret gun works by piloting the turret would help see if the weapon is the problem or not anyway.
Eh. What's "using it well"? At the end of EP2 you see beam weapons not being held steady, but being swept over the battlefield - exactly like BF2's Spider Walkers do.
Anyway, any kind of aiming problem should probably be able to be fixed to some degree via odf. My problem isn't so much that the turrets don't fire well; they don't fire at all. Their barrels don't even track me when I switch myself to an enemy team. It's like they don't notice me. And they certainly don't notice each other, despite being on opposing teams. Maybe I need to do something with AI goals? At the moment I give each turret's team a Deathmatch AI goal with a weighting of 100. Ought I use something else?
Re: Placed turrets ignoring enemies
Posted: Mon Jul 18, 2011 9:46 pm
by Dakota
ok its just in the first message you said they just try to stare each other down. but did you test the weapon itself to see if you can fire it. sometimes the turrets just won't use a weapon if it crashes or doesn't work.
Re: Placed turrets ignoring enemies
Posted: Mon Jul 18, 2011 11:32 pm
by FragMe!
Just checking, your turret odf does have the following line yes?
Pilottype = "self"
Re: Placed turrets ignoring enemies
Posted: Mon Jul 18, 2011 11:41 pm
by [RDH]Zerted
You forgot to change the PerceivedTeam value. Use SetProperty()
Also, put the team setup code back where it normally goes. There's no reason to re-set the teams alliances every time a turret is spawned. I know what you were thinking.
Re: Placed turrets ignoring enemies
Posted: Tue Jul 19, 2011 8:10 pm
by Fiodis
[RDH]Zerted wrote:You forgot to change the PerceivedTeam value. Use SetProperty()
Also, put the team setup code back where it normally goes. There's no reason to re-set the teams alliances every time a turret is spawned. I know what you were thinking.