Spearhead 1944 Code Snippets: Difference between revisions
Jump to navigation
Jump to search
m (corrected snippet) |
|||
Line 39: | Line 39: | ||
collect3DENHistory | collect3DENHistory | ||
{ | { | ||
private _layerID = -1 add3DENLayer "River Objects"; | |||
private _riverObjects = nearestTerrainObjects [[0.5 * worldSize, 0.5 * worldSize, 0], ["HIDE"], sqrt 2 / 2 * worldSize]; | private _riverObjects = nearestTerrainObjects [[0.5 * worldSize, 0.5 * worldSize, 0], ["HIDE"], sqrt 2 / 2 * worldSize]; | ||
_riverObjects apply | _riverObjects apply | ||
{ | { | ||
Line 47: | Line 48: | ||
private _entity = create3DENEntity ["Comment", "", getPosATL _x]; | private _entity = create3DENEntity ["Comment", "", getPosATL _x]; | ||
_entity set3DENAttribute ["Description", typeOf _x]; | _entity set3DENAttribute ["Description", typeOf _x]; | ||
_entity set3DENLayer _layerID; | |||
}; | |||
}; | |||
}; | |||
}; | |||
</sqf> | |||
= Highlight Bridges in [[Eden Editor]] = | |||
<sqf> | |||
if is3DEN then | |||
{ | |||
collect3DENHistory | |||
{ | |||
private _layerID = -1 add3DENLayer "Bridge Objects"; | |||
private _riverObjects = nearestTerrainObjects [[0.5 * worldSize, 0.5 * worldSize, 0], ["HIDE"], sqrt 2 / 2 * worldSize]; | |||
_riverObjects apply | |||
{ | |||
if ("bridge" in toLower (str _x)) then | |||
{ | |||
private _entity = create3DENEntity ["Comment", "", getPosATL _x]; | |||
_entity set3DENAttribute ["Description", str _x]; | |||
_entity set3DENLayer _layerID; | |||
}; | }; | ||
}; | }; |
Revision as of 10:19, 30 March 2024
Determine positions of craters on terrain
The craters that are part of the terrain, are not objects.
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.
Highlight Rivers in Eden Editor
if is3DEN then
{
collect3DENHistory
{
private _layerID = -1 add3DENLayer "River Objects";
private _riverObjects = nearestTerrainObjects [[0.5 * worldSize, 0.5 * worldSize, 0], ["HIDE"], sqrt 2 / 2 * worldSize];
_riverObjects apply
{
if ("river" in toLower (typeOf _x)) then
{
private _entity = create3DENEntity ["Comment", "", getPosATL _x];
_entity set3DENAttribute ["Description", typeOf _x];
_entity set3DENLayer _layerID;
};
};
};
};
Highlight Bridges in Eden Editor
if is3DEN then
{
collect3DENHistory
{
private _layerID = -1 add3DENLayer "Bridge Objects";
private _riverObjects = nearestTerrainObjects [[0.5 * worldSize, 0.5 * worldSize, 0], ["HIDE"], sqrt 2 / 2 * worldSize];
_riverObjects apply
{
if ("bridge" in toLower (str _x)) then
{
private _entity = create3DENEntity ["Comment", "", getPosATL _x];
_entity set3DENAttribute ["Description", str _x];
_entity set3DENLayer _layerID;
};
};
};
};