tacplay 2 Posted July 18, 2017 Hi. I want to write a small function, spawning a soldier at a marker (just an understanding thing, I know it's way more easy to do this in a different way). params [ ["_class","",[""]], ["_wp","",[""]] ]; _posStart = getMarkerPos _wp; _grp01 = createGroup east; _unit01 = _grp01 createUnit [_class, _posStart, [], 0, "CAN COLLIDE"]; It's working, when called with _spawnUnit = ["O_G_Soldier_F","marker1"] call TACP_fnc_Test_spawnSoldier; Given class is spawning at the marker. But I always got the failure message "'call{_spawnUnit |#|= ["O_G_Soldier_F","marker1"] call TACP_fnc..." Error Generic error in expression." What am I doing wrong? *confused* Share this post Link to post Share on other sites
killzone_kid 1331 Posted July 18, 2017 add _unit01 as last line Share this post Link to post Share on other sites
sarogahtyp 1108 Posted July 18, 2017 The reason for this is that u r assigning a value to a variable but the function call returns no value. This is fixed with kks solution by adding a return value to Ur function.Another solution would be to use spawn instead of call then the return value would be a script handle but not the created object.sent from mobile using Tapatalk Share this post Link to post Share on other sites
tacplay 2 Posted July 18, 2017 Argh. Thank you guys! Functions have to return a value. Sometimes it's all too obvious ... but my brain was script-fried. Share this post Link to post Share on other sites
R3vo 2654 Posted July 19, 2017 21 hours ago, tacplay said: Argh. Thank you guys! Functions have to return a value. Sometimes it's all too obvious ... but my brain was script-fried. I believe it's a good habit to always return some sort of value, for example a bool. Share this post Link to post Share on other sites