Spriterfight 10 Posted April 20, 2020 So i want a dead body(t4) to be spawned after the vehicle(t1) is destroyed.My code is this: _pos = getPos [t1,0]; _unit = [t4,0]; _unit setPos [_pos,0]; _unit setDamage 1; its says getpos:string expected object,location Share this post Link to post Share on other sites
Harzach 2518 Posted April 20, 2020 https://community.bistudio.com/wiki/getPos Not sure where you got the idea to use those arrays. _pos = getPos t1; _unit = t4; _unit setPos _pos; _unit setDamage 1; And as @Chewz points out, you don't need to redefine your object variables to local variables, at least within the scope of what you have shared here. 1 1 Share this post Link to post Share on other sites
Chewz 23 Posted April 20, 2020 Your code doesn't make any sense. In order to get a position you simply need to do getPos <OBJECT>, not the array you did. When assigning the _unit variable, you've defined the unit as an array, which won't work for both the setPos and setDamage commands. This code below will work provided both t1 and t4 are assigned objects. _Pos = getPosATL t1; // Gets the position of object 't1' at the terrain level. t4 setPos _Pos; // Sets object 't4' to the position of 't1'; t4 setDamage 1; // Kills object 't4' (for some reason you want to do this) // Ideally you then should delete t1 // deleteVehicle t1; 1 1 Share this post Link to post Share on other sites
Spriterfight 10 Posted April 20, 2020 Thank you guys!I solved it with this _pos = position t1; _unit = t4; _unit setDamage 1; _unit setPos _pos; it works Share this post Link to post Share on other sites