Raddik 10 Posted September 13, 2009 Can someone tell me what is wrong with the below addAction code? I have placed it in my init.sqf file. The intended purpose is to run the said script when a player is inside a plane. takeoff2= _target addaction ["Go","go.sqf",nil,1,false,true,"","(_target isKindof "plane")"]; Any expert insight here would be much appreciated. Raddik Share this post Link to post Share on other sites
kylania 568 Posted September 13, 2009 Use "" or ' around plane since you're using quotes inside of " " Share this post Link to post Share on other sites
Raddik 10 Posted September 13, 2009 Like this? takeoff2= _target addaction ["Go","go.sqf",nil,1,false,true,"","_target isKindof ""plane""]; Share this post Link to post Share on other sites
kylania 568 Posted September 13, 2009 Missed one. :) takeoff2= _target addaction ["Go","go.sqf",nil,1,false,true,"","_target isKindof ""plane"""]; Share this post Link to post Share on other sites
Raddik 10 Posted September 13, 2009 (edited) Hmmm... Still not working. It works with a simpler condition and when i use a specific vehicle's name in place of the first _target...can I use that object name there? I know I can in the condition field but I'm unsure about there. ---------- Post added at 01:24 AM ---------- Previous post was at 01:03 AM ---------- Just confirmed it is in fact the first _target at the beginning of the code that breaks it. If I change it to a specific vehicle name and I'm in the said vehicle it works. How can I make this work with any plane I get into? Edited September 13, 2009 by Raddik Share this post Link to post Share on other sites
shuko 59 Posted September 13, 2009 (vehicle player) isKindof? Share this post Link to post Share on other sites
Raddik 10 Posted September 13, 2009 shk, isKindof returns a Boolean correct? How would I use that here: takeoff2= _target addaction Thanks for the help, Raddik Share this post Link to post Share on other sites
shuko 59 Posted September 13, 2009 (edited) Question, could you show your init.sqf or tell me how you have defined _target in: takeoff2= _target addaction Not that I've used addactions that much, but as I've understood them, you can't use the _target that is passed to the action script outside of it (obviously). Or, are you just using a var with same name. EDIT: init.sqf { _x addaction ["Go","go.sqf",nil,1,false,true,"","(vehicle player) == _target"]; } foreach [plane1,plane2]; Edited September 13, 2009 by Shuko Share this post Link to post Share on other sites
Deadfast 43 Posted September 13, 2009 The reason why the initial code and the the one above my post won't work is that _target is undefined in the condition scope. You need to compose the condition string using format: takeoff2= _target addaction ["Go","go.sqf",nil,1,false,true,"", format ['%1 isKindof "plane", _target]'] Share this post Link to post Share on other sites
shuko 59 Posted September 13, 2009 You need to compose the condition string using format: No he doesnt. _target works just fine in the condition parameter. It will refer to the object the action was attached to. Share this post Link to post Share on other sites
Raddik 10 Posted September 13, 2009 shk, your code has worked perfectly...thank you greatly for clarifying things for me! Regards, Raddik Share this post Link to post Share on other sites