Page 1 of 1
Problems with Squad Command
Posted: Fri Jun 04, 2010 1:16 pm
by KnightsFan
I have two questions.
1. Is it possible to make an autoturret be fired in a straight line, instead of simply dropped in front of you?
2. I'm trying to execute LUA codes when autoturrets are dropped, but my if/else statements don't work.
Code: Select all
OnCharacterDispenseControllable(
function(player, controllable)
if GetEntityClassName(controllable) == ame_weap_inf_formup_ord then
ClearAIGoals(GIS)
KillObject(controllable)
AddAIGoal(GIS, "Follow", 100, 0)
elseif GetEntityClassName(controllable) == ame_weap_inf_defend_ord then
ClearAIGoals(GIS)
AddAIGoal(GIS, "Defend", 100, controllable)
end
end
)
It always executes the first code, making the AI follow me. If I switch the order, it will still always do the first and make them defend the autoturret.
Any help is appreciated.
Re: Problems with Squad Command
Posted: Fri Jun 04, 2010 2:50 pm
by Maveritchell
Your if statements aren't comparing an input and a string, they're comparing an input and a (nonexistent) variable.
E.g.
should be
"ame_weap_inf_formup_ord"
Re: Problems with Squad Command
Posted: Fri Jun 04, 2010 3:35 pm
by KnightsFan
I added quotes around them but now neither works at all. I'm not getting any errors pertaining to either besides that they aren't localized.
Re: Problems with Squad Command
Posted: Fri Jun 04, 2010 3:37 pm
by Maveritchell
KnightsFan wrote:I added quotes around them but now neither works at all. I'm not getting any errors pertaining to either besides that they aren't localized.
That probably means that there's an error with the name(s) you're referencing.
Re: Problems with Squad Command
Posted: Fri Jun 04, 2010 3:49 pm
by Fiodis
Maveritchell wrote:it just doesn't have a string output. You need to match up a GetEntityClass to a FindEntityClass, a la:
Code: Select all
GetEntityClass(etc) == FindEntityClass("ex_type_entity")
Re: Problems with Squad Command
Posted: Fri Jun 04, 2010 3:53 pm
by Maveritchell
Fiodis wrote:Maveritchell wrote:it just doesn't have a string output. You need to match up a GetEntityClass to a FindEntityClass, a la:
Code: Select all
GetEntityClass(etc) == FindEntityClass("ex_type_entity")
Not the same code. From the scripting_system.doc:
CharacterDispenseControllable: function (player, controllable)
This event occurs whenever a character drops a controllable item (such as a remote droid or a mini-turret). If you want to check exactly what kind of controllable was dropped, use GetEntityClassName(controllable).
Re: Problems with Squad Command
Posted: Fri Jun 04, 2010 4:00 pm
by KnightsFan
Thanks! They are both working like a charm now.
But I still want to know how to fire an autoturret straight out instead of drop it in front of myself, if that's possible.
Re: Problems with Squad Command
Posted: Fri Jun 04, 2010 4:26 pm
by Maveritchell
KnightsFan wrote:But I still want to know how to fire an autoturret straight out instead of drop it in front of myself, if that's possible.
Objects are always deployed in an arc. You can adjust the elevation of the toss (ShotElevate, in the dispenser .odf) and the strength/velocity of the object (Max/MinStrength; dispenser .odf, Velocity; deployable .odf).