Spriterfight 10 Posted March 20, 2020 I want a unit to move in a vehicle after respawn but it shows that error code: 17:52:36 Error in expression <_wp = _unit addWaypoint [_pos1, 0];> 17:52:36 Error position: <_unit addWaypoint [_pos1, 0];> 17:52:36 Error Undefined variable in expression: _unit 17:52:36 Error in expression <_unit setWaypointType "MOVE";> 17:52:36 Error position: <_unit setWaypointType "MOVE";> 17:52:36 Error Undefined variable in expression: _unit 17:52:36 Error in expression <_unit setWaypointSpeed "Full";> 17:52:36 Error position: <_unit setWaypointSpeed "Full";> 17:52:36 Error Undefined variable in expression: _unit 17:52:36 Error in expression <_unit setWaypointBehaviour "Combat";> 17:52:36 Error position: <_unit setWaypointBehaviour "Combat";> 17:52:36 Error Undefined variable in expression: _unit 17:52:36 Error in expression <_unit setWaypointType "GETIN NEAREST";> 17:52:36 Error position: <_unit setWaypointType "GETIN NEAREST";> 17:52:36 Error Undefined variable in expression: _unit the script is activated with this in the unit's init:this addMPEventHandler ["MPRespawn", {[_unit] exec "respawnvehiclescript.sqf"}]; the script: _unit = _this select 0; _pos1 = getMarkerPos "Marker1"; _wp = _unit addWaypoint _pos1 _unit setWaypointType "MOVE"; _unit setWaypointSpeed "Full"; _unit setWaypointBehaviour "Combat"; _unit setWaypointType "GETIN NEAREST"; hint "%1 respawned!!!" Share this post Link to post Share on other sites
Larrow 2822 Posted March 20, 2020 this addMPEventHandler[ "MPRespawn", { params[ "_unit", "_corpse" ]; [ _unit ] execVM "respawnvehiclescript.sqf" }]; 1 Share this post Link to post Share on other sites
Spriterfight 10 Posted March 20, 2020 its a lan server and playable ais respawning Share this post Link to post Share on other sites
Spriterfight 10 Posted March 20, 2020 10 minutes ago, Larrow said: this addMPEventHandler[ "MPRespawn", { params[ "_unit", "_corpse" ]; [ _unit ] execVM "respawnvehiclescript.sqf" }]; it seems to be working but now i get this error: 18:31:37 Error in expression <Marker1"; _wp = _unit addWaypoint _pos1 _wp setWaypointType "MOVE"; _wp setWayp> 18:31:37 Error position: <_wp setWaypointType "MOVE"; _wp setWayp> 18:31:37 Error Missing ; script:private ["_unit"]; _unit = _this select 0; IF(!local _unit) exitwith {}; _pos1 = getMarkerPos "Marker1"; _wp = _unit addWaypoint _pos1 _wp setWaypointType "MOVE"; _wp setWaypointSpeed "Full"; _wp setWaypointBehaviour "Combat"; _wp setWaypointType "GETIN NEAREST"; hint "%1 respawned!!!" Share this post Link to post Share on other sites
Spriterfight 10 Posted March 20, 2020 Just now, Spriterfight said: it seems to be working but now i get this error: 18:31:37 Error in expression <Marker1"; _wp = _unit addWaypoint _pos1 _wp setWaypointType "MOVE"; _wp setWayp> 18:31:37 Error position: <_wp setWaypointType "MOVE"; _wp setWayp> 18:31:37 Error Missing ; script:private ["_unit"]; _unit = _this select 0; IF(!local _unit) exitwith {}; _pos1 = getMarkerPos "Marker1"; _wp = _unit addWaypoint _pos1 _wp setWaypointType "MOVE"; _wp setWaypointSpeed "Full"; _wp setWaypointBehaviour "Combat"; _wp setWaypointType "GETIN NEAREST"; hint "%1 respawned!!!" nevermind i got it Share this post Link to post Share on other sites
Larrow 2822 Posted March 20, 2020 5 minutes ago, Spriterfight said: _wp = _unit addWaypoint _pos1 No ending ; 1 Share this post Link to post Share on other sites
Spriterfight 10 Posted March 20, 2020 1 minute ago, Larrow said: No ending ; now shows this 18:38:05 Error in expression <1 = getMarkerPos "Marker1"; _wp = _unit addWaypoint _pos1; _wp setWaypointType > 18:38:05 Error position: <addWaypoint _pos1; _wp setWaypointType > 18:38:05 Error addwaypoint: Type Object, expected Group script: _pos1 = getMarkerPos "Marker1"; _wp = _unit addWaypoint _pos1; _wp setWaypointType "MOVE"; _wp setWaypointSpeed "Full"; _wp setWaypointBehaviour "Combat"; _wp setWaypointType "MOV"; hint "%1 respawned!!!" Share this post Link to post Share on other sites
Harzach 2518 Posted March 20, 2020 You are adding your waypoint to a unit, not a group. _wp = (group _unit) addWaypoint _pos1; or similar, the parentheses may not be necessary. 1 1 Share this post Link to post Share on other sites
beno_83au 1369 Posted March 20, 2020 You should bookmark this page - https://community.bistudio.com/wiki/Category:Scripting_Commands_Arma_3 - and have a look at the commands you are using. Use of them is explained pretty well, and in this case it's addWaypoint that is wrong next (you need to give it a group, not a unit), but there's a few other mistakes in there that you'll find the answers to in the script wiki 3 1 Share this post Link to post Share on other sites
Harzach 2518 Posted March 20, 2020 Oh, addWaypoint takes at least two arguments (center and radius) _unit = unit1; _pos1 = getMarkerPos "Marker1"; _wp = (group _unit) addWaypoint [_pos1, 0]; _wp setWaypointType "MOVE"; _wp setWaypointSpeed "Full"; _wp setWaypointBehaviour "Combat"; 1 Share this post Link to post Share on other sites
Harzach 2518 Posted March 20, 2020 9 minutes ago, beno_83au said: you'll find the answers Sorry @beno_83au, just saw you were leading him to water 🙂 Or teaching him to fish? I dunno. I'm tired. 1 2 Share this post Link to post Share on other sites
Spriterfight 10 Posted March 20, 2020 now it says 18:31:51 File C:\Users\tibcs_000\Documents\Arma 3\missions\ww2mp.Tanoa\respawnvehiclescript.sqf, line 7 18:31:51 Error in expression <Marker1"; _wp = _unit addWaypoint _pos1 _wp setWaypointType "MOVE"; _wp setWayp> 18:31:51 Error position: <_wp setWaypointType "MOVE"; _wp setWayp> 18:31:51 Error Missing ; script: private ["_unit"]; _unit = _this select 0; IF(!local _unit) exitwith {}; _unit = unit1; _pos1 = getMarkerPos "Marker1"; _wp = (group _unit) addWaypoint [_pos1,0]; _wp setWaypointType "MOVE"; _wp setWaypointSpeed "Full"; _wp setWaypointBehaviour "Combat"; hint "%1 respawned!!!" do respawned ai units change variable name? Share this post Link to post Share on other sites
Spriterfight 10 Posted March 20, 2020 wow its working 😄 i just had to name the unit .Thank you guys! Share this post Link to post Share on other sites
Harzach 2518 Posted March 20, 2020 No, I pasted my test code, I forgot to remove that declaration. Just delete the line _unit = unit1; Told you I was tired. 1 Share this post Link to post Share on other sites
Spriterfight 10 Posted March 20, 2020 what to do if the ai dosent follow waypoints and runs everywhere on the server but if i switch to sp they follow the waypoints properly Share this post Link to post Share on other sites
Harzach 2518 Posted March 20, 2020 You are doing a locality check, so if the AI aren't local to your machine, they won't receive the waypoint. Share this post Link to post Share on other sites
Spriterfight 10 Posted March 20, 2020 So i tested some things the ai wont move on the mp map even if i switch to singleplayer but if i make a new scenario the ai moves Share this post Link to post Share on other sites