Blitzen 10 Posted April 10, 2011 Im in the process of making a mission where the player must cross a river in an AI controlled boat. After reaching the other side, the player will then join and lead another npc group (who road across the river on a seperate boat). The problem is that after the player gets out of the boat, his waypoints are displayed ontop of the boat he just got out of. However, the waypoints remain where they are placed in the editor. For instance if the player tells one of his squad mates to "move to the next waypoint" the soldier moves to where the waypoint is actually placed. The problem is that the waypoints are displayed above the boat instead of where they actually are. I assume that this issue occurs because the player is still somehow linked to the boat? :confused: **PS** For my random question... This "code" will make a unit follow a group leader when it is placed in the condition line of a waypoint: if(this distance leader grptest>50)then{[this,1] setWPpos getpos leader grptest}; false Is this the correct way edit this so a group leader will follow another group leader: if(leader group this distance leader grptest>50)then{[leader group this,1] setWPpos getpos leader grptest}; false Share this post Link to post Share on other sites
Sepe 1 Posted April 12, 2011 Yes, the problem with the boat is that the player is still assigned to the boat. You can either use a "GET OUT" waypoint for when you want the player to disembark, and/or the command "unassignVehicle player" in your waypoint/script/trigger. If the player is a member of a group (and not the leader) he will also be commanded out. As for your second question, I think the easiest way to get a leader of a group to follow another leader would be using a script, for instance: #loop ~10 ?(leader group1 distance leader group2)<50:goto "loop" group1 move getPos leader group2 goto "loop" That way you don't have to add specific waypoints to group1 (the group following), though if all units in group2 (the group being followed) get killed, group1 will just stand around at the leader's corpse. This can be avoided by checking if there are any units left in group2 and telling group1 to move (using the "move" command and targets such as game logics or markers). Share this post Link to post Share on other sites
Blitzen 10 Posted April 12, 2011 Yes, the problem with the boat is that the player is still assigned to the boat. You can either use a "GET OUT" waypoint for when you want the player to disembark, and/or the command "unassignVehicle player" in your waypoint/script/trigger. If the player is a member of a group (and not the leader) he will also be commanded out. I did have a "get out" waypoint sync'd with a "transport unload" waypoint but that didnt solve the problem. I also tried the "unassignvehicle" command but that too didn't fix the problem. I fixed it by changing the "join and lead" waypoint to a move waypoint and had the other squad join the player's squad by using the "join" command in the waypoints activation field. Apparently, the "join and lead" waypoint was causing the issue..:confused: As for your second question, I think the easiest way to get a leader of a group to follow another leader would be using a script, for instance: #loop ~10 ?(leader group1 distance leader group2)<50:goto "loop" group1 move getPos leader group2 goto "loop" That way you don't have to add specific waypoints to group1 (the group following), though if all units in group2 (the group being followed) get killed, group1 will just stand around at the leader's corpse. This can be avoided by checking if there are any units left in group2 and telling group1 to move (using the "move" command and targets such as game logics or markers). Yes, a script would be nice but to use this for multiple squads would require multiple scripts. I generally use this "code" so that an enemy squad will always find an opposing squad. This is also a good way to have an armoured unit stay near an infantry squad (for support) with out having it be a part of that squad. I wanted to fix the code so that, for example, if an enemy squad was to move to a player's position and the enemy squad leader was killed, this squad would continue to follow the player. However, I'm thinking that it might work as it is....:confused: Share this post Link to post Share on other sites
nikiller 18 Posted April 13, 2011 (edited) hi, Here's a solution to have only one script for all your group. check_dis.sqs ;************************************************************ ;Group follows another group Script by Nikiller v0.9b ;Note: place a game logic named server on the map ;contact: nikillerofp@hotmail.fr ;[followedGroupName,followerGroupName] exec "scriptName.sqs" ;************************************************************ if (local server) then {} else {goto "ende"} _followed = _this select 0 _follower = _this select 1 _lfd=leader _followed _lfr=leader _follower _pos=getPos _lfd _ufr = Units _followed _ufd = Units _follower _d=20 _dis=50 #loop ~_d if (_lfr distance _lfd>_dis) then {_follower move _pos} if (({alive _x} count _ufr==0) || ({alive _x} count _ufd==0)) then {goto "ende"} else {goto "loop"} #ende exit Not tested but it should be SP/MP compatible. cya. Nikiller. Edited April 14, 2011 by Nikiller Share this post Link to post Share on other sites