Spearhead 1944 Code Snippets: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (category)
(added code to have revive system for AI joining the player group)
Line 13: Line 13:
   ((getModelInfo _x) # 0) in ["spe_crater_decal_large.p3d","spe_crater_decal_small.p3d"]
   ((getModelInfo _x) # 0) in ["spe_crater_decal_large.p3d","spe_crater_decal_small.p3d"]
};
};
</sqf>
= Enable revive system on AI joining the player group =
Certain scripts/missions/mods allow the player to recruit AI to his group or add reinforcements to the player group.
Important: The enhanced revive module needs to be put into the mission (or the scripted setup used).
<sqf>
//initPlayerLocal.sqf/init.sqf with if (hasInterface) then  {...};
(group player) addEventHandler ["UnitJoined",
{
    params ["_group", "_newUnit"];
    [_newUnit] call SPE_MissionUtilityFunctions_fnc_ReviveToksaInit;
    [_newUnit] call SPE_MissionUtilityFunctions_fnc_ReviveToksaActionsInit;
}];
</sqf>
</sqf>


[[Category: Spearhead 1944]]
[[Category: Spearhead 1944]]

Revision as of 13:03, 5 August 2023

Determine positions of craters on terrain

The craters that are part of the terrain, are not objects.

Normandy-Crater.jpg

They usually have crater decals in them but the once present on the terrain do not link to the config versions which makes detecting them is harder.

In order to detect craters within 10 meters around the player, use the following code:

(nearestObjects [player, [], 10]) select { ((getModelInfo _x) # 0) in ["spe_crater_decal_large.p3d","spe_crater_decal_small.p3d"] };

Enable revive system on AI joining the player group

Certain scripts/missions/mods allow the player to recruit AI to his group or add reinforcements to the player group.

Important: The enhanced revive module needs to be put into the mission (or the scripted setup used).

//initPlayerLocal.sqf/init.sqf with if (hasInterface) then {...}; (group player) addEventHandler ["UnitJoined", { params ["_group", "_newUnit"]; [_newUnit] call SPE_MissionUtilityFunctions_fnc_ReviveToksaInit; [_newUnit] call SPE_MissionUtilityFunctions_fnc_ReviveToksaActionsInit; }];