d3nn16 3 Posted January 9, 2009 I'm editing a map and I want to synchronize several "script created" triggers. I use a "script created" gamelogic for which I add an "AND" type waypoint which is synchronized with the triggers. So when all triggers return true the statement in the waypoint is executed. The problem is that I can't create a group for the game logic (created with "logic" createVehicleLocal [0, 0]) which I need for the setWaypointType command. Here's the code : <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _glogic = "logic" createVehicleLocal [0,0]; _waypoint = group _glogic addWaypoint [[0, 0], 0];player globalchat str [group _glogic]; _waypoint setWaypointType "and"; _waypoint setWaypointStatements ["true", "player setDamage 1"]; {_x synchronizeWaypoint [_waypoint]} forEach CTF_GAME_AREAS; _waypoint = group _glogic addWaypoint [[0, 0], 0]; _waypoint setWaypointType "cycle"; Is there a way of creating a valid group of side logic ? Share this post Link to post Share on other sites
dr_eyeball 16 Posted January 10, 2009 Perhaps try treating the game logic as an ungrouped (no side) unit and use traditional unit group techniques. - create your game logic object _gLogic - create a group for the side LOGIC _grpLogic  _group = createGroup LOGIC; - join the group  [_gLogic] join _grpLogic; then try the waypoint code using _grpLogic Share this post Link to post Share on other sites
d3nn16 3 Posted January 10, 2009 tried to use createUnit with "logic" type but didnt return an object, and also tried the join command as u said but didnt work either Share this post Link to post Share on other sites
d3nn16 3 Posted January 10, 2009 When I tested the createGroup command : <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _grp = createGroup west; player globalChat str [_grp]; _grp2 = createGroup logic; player globalChat str [_grp2]; gives [WEST 1-1-B] [0x2000] GGL is a game logic placed in mission.sqm <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> player globalChat str [group GGL]; _gl = "logic" createUnit [[0, 0], group GGL]; player globalChat str [group _gl]; gives [LOGIC 1-1-A] [0x2000] Share this post Link to post Share on other sites
UNN 0 Posted January 11, 2009 You need to use the alternative version of createunit. Somthing like this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">//See if there is a game logic placed on the map _Group=CreateGroup Logic; //If there are no groups of side logic If (IsNull _Group) Then     {     //Create a valid Center for side logic     CreateCenter Logic;     //Now create the new group     _Group=CreateGroup Logic;     }; //Create a unit for the new group _unit=_Group createUnit ["Logic",[0,0,0], [], 0, "NONE"]; Share this post Link to post Share on other sites
d3nn16 3 Posted January 11, 2009 Doesn't work : player globalChat str [_Group] would print [0x2000] in your example instead of something similar to [LOGIC 1-1-A]. createUnit or createVehicle commands do create a game logic but it seems the problem is creating a game logic group with the createGroup command. I tried this : <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _grp = createGroup logic; if (isNull _grp) then { createCenter logic; _grp = createGroup logic; }; player globalChat str [_grp]; _unit = _grp createUnit ["logic", [0, 0], [], 0, "none"]; _waypoint = _grp addWaypoint [[0, 0], 0];player globalChat str [_waypoint]; _waypoint setWaypointType "and"; _waypoint setWaypointStatements ["true", "player setDamage 1"]; {_x synchronizeWaypoint [_waypoint]} forEach CTF_GAME_AREAS; _waypoint = _grp addWaypoint [[0, 0], 0]; _waypoint setWaypointType "cycle"; player globalChat str [_grp]; prints [0x2000] (a valid group returns [LOGIC 1-1-A]) player globalChat str [_waypoint]; prints [ARRAY] (a valid waypoint returns [LOGIC 1-1-A, 1]) Note: anyway I found a workaround by spawning a thread that checks if player is in one of the trigger areas and kills him if not. Creating a game logic group with waypoints is a faster way (maybe more efficient ?) of synchronizing triggers. This is the thread : <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> if ((count CTF_GAME_AREAS > 0) && !DEDICOMP) then { [] spawn { sleep 1; while {true} do { waitUntil {alive player}; sleep 0.5; _outside = true; { scopeName "loop"; if ((vehicle player) in (list _x)) then { _outside = false; breakOut "loop"; }; } forEach CTF_GAME_AREAS; if (_outside) then {player setDamage 1}; }; }; }; Share this post Link to post Share on other sites
UNN 0 Posted January 11, 2009 Quote[/b] ]Doesn't work : player globalChat str [_Group] would print [0x2000] in your example instead of something similar to [LOGIC 1-1-A]. Yeah, side Logic is not recognized as valid. You can place a Game Logic onto the map and call it, say GL01. Then the following works: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">//Assign the group _Group=Group GL01; //Create a unit for the group _unit=_Group createUnit ["Logic",[0,0,0], [], 0, "NONE"]; Share this post Link to post Share on other sites
killswitch 19 Posted January 12, 2009 createUnit or createVehicle commands do create a game logic but it seems the problem is creating a game logic group with the createGroup command.The correct "side type" value for a game logic is sideLogic, not "logic".Thus, <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_grp = createGroup sideLogic; if (isNull _grp) then { Â Â createCenter sideLogic; Â Â _grp = createGroup sideLogic; }; player globalChat str [_grp]; ... ...Good luck! Share this post Link to post Share on other sites
dr_eyeball 16 Posted January 12, 2009 Biki side topic updated to reflect this (non-existant 'logic' keyword). Share this post Link to post Share on other sites
d3nn16 3 Posted January 12, 2009 Finally! So sideLogic was the keyword. There should be some cleaning done in the script command list in the Biki. The code I used : <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _grp = createGroup sideLogic;player globalChat str [_grp]; _unit = _grp createUnit ["logic", [0, 0], [], 0, "none"];player globalChat str [_unit]; _waypoint = _grp addWaypoint [[0, 0], 0];player globalChat str [_waypoint]; _waypoint setWaypointType "and"; _waypoint setWaypointStatements ["true", "player setDamage 1"]; {_x synchronizeWaypoint [_waypoint]} forEach CTF_GAME_AREAS; _waypoint = _grp addWaypoint [[0, 0], 0]; _waypoint setWaypointType "cycle"; this prints [LOGIC 1-1-A] [LOGIC 1-1-A:1] [[LOGIC 1-1-A,1]] It seems that a logic center is not needed. @ UNN This works too now (maybe because of the new command createUnit used) - GGL a game logic in mission.sqm : <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE"> _grp = group GGL;player globalChat str [_grp];//createGroup sideLogic; _unit = _grp createUnit ["logic", [0, 0], [], 0, "none"];player globalChat str [_unit]; _waypoint = _grp addWaypoint [[0, 0], 0];player globalChat str [_waypoint]; _waypoint setWaypointType "and"; _waypoint setWaypointStatements ["true", "player setDamage 1"]; {_x synchronizeWaypoint [_waypoint]} forEach CTF_GAME_AREAS; _waypoint = _grp addWaypoint [[0, 0], 0]; _waypoint setWaypointType "cycle"; Since a game logic present in mission.sqm is local only to server, the above command (_unit = group GGL createUnit ["logic", [0, 0], [], 0, "none"]) would not work on clients right ? Share this post Link to post Share on other sites