odyseus 19 Posted July 20, 2012 Hello guys i have a little problem. I post on the map a game logic, which is a training base and on it's int i post this: _newComp = [(getPos this), (getDir this), "SmallBase_EP1"] call (compile (preprocessFileLineNumbers "ca\modules\dyno\data\scripts\objectMapper.sqf")); I also put 2 markers and grouped it to the game logic to randomize it's location. here is the issue 1. I have 4 groups which i wanted to be part of the base. Therefore every time the base move location the 4 groups would move location as well. I tried to group them, but it seems that every time i do that the groups dismember and also lose their way-points. Any ideas? Problem number 2. I would like to place AI on gun possition with in this game logic "SmallBase_EP1" Problem number 3. How can i have some evidence that would indicate the location of the map. I was thinking of a map. that when payer finds will show the current location of the base on the map with a marker. Any ideas. Please help! Thank you :D Share this post Link to post Share on other sites
Muzzleflash 108 Posted July 20, 2012 Here are some general ideas and code snippets that might help. This is not the entire code or even valid code all of it: 1. Place something, eg. another logic or marker, let's call this BeforeBasePos. The logic which has the real pos of the base let's call that AfterBasePos. Place all the squads and units in relation to BeforeBasePos. E.g. if Squad A should start 200m left of the base then place it 200m left of BeforeBasePos. Now what you want to do is teleport all units up to the new base. Example pseudo-code: _fromPos = getPos BeforeBasePos; _toPos = getPos AfterBasePos; { _squad = _x; { //Single unit is _x - also don't use _x for coordinate in here //Find relative pos to before base, eg. if unit was 50m N and 100m W of BeforeBase then would be [50, -100]. _newPos = [getPos _x select 0 - _fromPos select 0, getPos _x select 1- _fromPos select 1, 0]; //Now add this to the after base pos: _newPos = [_newPos select 0 + _toPos select 0, _newPos select 1 + _toPos select 1, 0]; //Now move the unit _x setPos _newPos; } forEach _squad; } forEach [squadA, SquadB, SquadC, SquadD]; The trick is that if the unit has waypoints you would need to do the same to them. I recommend moving them first then the unit. Also if the squads in question patrols the base and you used the fact that the squads original position is a hidden waypoint in your patrol then you might want to create an explicit waypoint on their own position. 2. In your snippet _newComp contains all the objects created in the composition. So you can go through all objects to check if it can have a gunner: _mannableGuns = []; { _className = typeOf _x; //Has gunner then add it if (getNumber (configFile >> "CfgVehicles" >> _className "hasGunner") == 1) then { _mannableGuns set [count _mannableGuns, _x]; }; } forEach _newComp; if (count _mannableGuns > 0) then { //There were some guns. Create units to man and assign them to guns. _baseDefenseSquad = createGroup east; { _defender = _baseDefenseSquad createUnit [.......]; _defender assignAsGunner _x; _defender moveInGunner _x; } forEach _mannableGuns; }; 3. Here's the quick and dirty, but MP friendly version. Add the evidence to the map. Add an action to it (addAction) e.g. in it's init. However, make sure the condition of the addAction is "isNil 'MAP_FOUND'". When the action is triggered you should: MAP_FOUND = true; publicVariable "MAP_FOUND"; You should also create a trigger with CONDITION: isServer && MAP_FOUND ON ACT: createMarker ....... However, not sure this is JIP safe - depends on whether you use beta or not I would guess. Share this post Link to post Share on other sites
Hendo 1 Posted July 20, 2012 heya, You also have a space between the .sqf and the " in the composition call, should be this _newComp = [(getPos this), (getDir this), "SmallBase_EP1"] call (compile (preprocessFileLineNumbers "ca\modules\dyno\data\scripts\objectMapper.sqf")); not _newComp = [(getPos this), (getDir this), "SmallBase_EP1"] call (compile (preprocessFileLineNumbers "ca\modules\dyno\data\scripts\objectMapper.sqf ")); cya Share this post Link to post Share on other sites
odyseus 19 Posted July 21, 2012 Hey thank you. Now could you walk me through # 2. I m having some problems. Here is what i did. I copy your php code to notepad, then i save it .sqf , then i went to the game logic of the base and past on its int: _nil = [] execVM "xxx.sqf" is that right??? Share this post Link to post Share on other sites
odyseus 19 Posted July 23, 2012 I cant make number 2 work. what m I doing wrong? Share this post Link to post Share on other sites
Muzzleflash 108 Posted July 23, 2012 I cant make number 2 work. what m I doing wrong? As I wrote it is pseudo code and will need some adjustments to work - isn't copy-paste-ready. This line: if (getNumber (configFile >> "CfgVehicles" >> _className "hasGunner") == 1) then { is missing a >> and even then i'm not 100% sure it is right. This line also has to be fixed: _defender = _baseDefenseSquad createUnit [.......]; Also the script posted under point 2 has to know what _newComp is. Two possible solutions are to put this script in below the first one which creates the composition. Another is to pass it into the script, eg.: _newComp = _this select 0; And instead of starting it from a logic you start it at the bottom of the other script: //Part of script #1... //..... [] execVM "xxx.sqf"; Share this post Link to post Share on other sites
odyseus 19 Posted July 24, 2012 thank you so much muzzleflash. sorry i did not now what a pseudo code was. anyways. Now i do! I will try to do something with it. I think will be very hard since my level of scripting is beginner of the beginner. :D LOL Share this post Link to post Share on other sites