Jump to content
blockade

Create marker at altitude

Recommended Posts

How do I create a marker to create at a height so I can use a trigger to use BIS_fnc_spawnGroup to spawn a sniper on a building. Been stuck on this one task for a few hours now. I will not provide what syntax I have tried or it will be a bible long description,, I'll just stick to what is needed..


Trigger act:.

Nul = execVM "scripts\sniper_spawn.sqf";

sniper_spawn.sqf

_snp1m = createMarker ["snp1m",[12253.9,16406.5]];
    _snp1m setMarkerDir 85;
    _snp1m setMarkerShape "ICON";
    _snp1m setMarkerType "Empty";
sleep 1;
_snp1 = [getmarkerpos "snp1m", EAST, ["TBan_Sniper"],[],[],[],[],[],85] call BIS_fnc_spawnGroup;

Cheers!
And a big thank you!
 

Share this post


Link to post
Share on other sites

You spawn sniper on marker position, but you set height in which unit will spawn, e.g. height of building

_height = 20; //your height of building

_pos = getMarkerPos "snp1m";
_snp1 = [ [_pos select 0, _pos select 1, _height] , EAST, ["TBan_Sniper"],[],[],[],[],[],85] call BIS_fnc_spawnGroup;

Better solution should be spawn sniper on one of roof positions of building. (more here buildingPos )

 

 

 

 

Edit: Here is script for garrison units in buildings. Zenophon have there also option to garrison only roof of building. I think it may be useful to you.

 

https://forums.bistudio.com/topic/170936-release-infantry-occupy-house-script/

  • Like 1

Share this post


Link to post
Share on other sites

You spawn sniper on marker position, but you set height in which unit will spawn, e.g. height of building

_height = 20; //your height of building

_pos = getMarkerPos "snp1m";
_snp1 = [ [_pos select 0, _pos select 1, _height] , EAST, ["TBan_Sniper"],[],[],[],[],[],85] call BIS_fnc_spawnGroup;

Better solution should be spawn sniper on one of roof positions of building. (more here buildingPos )

 

 

 

 

Edit: Here is script for garrison units in buildings. Zenophon have there also option to garrison only roof of building. I think it may be useful to you.

 

https://forums.bistudio.com/topic/170936-release-infantry-occupy-house-script/

Alright, I'll toy with this in a bit, just playing with trigger scripting right now,, thank you!

Share this post


Link to post
Share on other sites

JEBUS supports placing a unit in the Editor and let them spawn with a trigger. So you could place your sniper in the Editor and let him spawn in with trigger activation with JEBUS. Maybe this helps?

 

http://forums.bistudio.com/topic/174661-jebus-just-editor-based-unit-spawning/

 

EDIT: I did some testing and sadly I was unable to spawn in units on buildings. Ground worked fine. Sorry :( Well, maybe it will be of good use to spawn in ground units..

Share this post


Link to post
Share on other sites

JEBUS supports placing a unit in the Editor and let them spawn with a trigger. So you could place your sniper in the Editor and let him spawn in with trigger activation with JEBUS. Maybe this helps?

 

http://forums.bistudio.com/topic/174661-jebus-just-editor-based-unit-spawning/

 

EDIT: I did some testing and sadly I was unable to spawn in units on buildings. Ground worked fine. Sorry :( Well, maybe it will be of good use to spawn in ground units..

I don't want to place units in the editor 'cause I want to make massive missions, so I do not want the entity to exist till it is time so as not to overtax the server with the use of too much resources bogging it down, nor do I want to bog down the client by having to disable simulation on their machines, I'm trying to keep the traffic communication down on the network as much as possible.

Share this post


Link to post
Share on other sites

You spawn sniper on marker position, but you set height in which unit will spawn, e.g. height of building

_height = 20; //your height of building

_pos = getMarkerPos "snp1m";
_snp1 = [ [_pos select 0, _pos select 1, _height] , EAST, ["TBan_Sniper"],[],[],[],[],[],85] call BIS_fnc_spawnGroup;

Better solution should be spawn sniper on one of roof positions of building. (more here buildingPos )

 

 

 

 

Edit: Here is script for garrison units in buildings. Zenophon have there also option to garrison only roof of building. I think it may be useful to you.

 

https://forums.bistudio.com/topic/170936-release-infantry-occupy-house-script/

I can confirm this works M1ke, thank you.

Could you comment a tad on the syntax so I know what is happening please ?

My gift is that I can usually understand what I read, but I have issues writing the syntax, getting much better tho thanks to folks like yourself who help me and my understanding along, once again,, thank you!

I understand when select 0 is used in an array, but in this case my mind is at a lose.

Share this post


Link to post
Share on other sites

Okay now I have another problem, how do I pass unit commands to the unit like setUnitPos "UP" so they don't prone out ?

Share this post


Link to post
Share on other sites

I understand when select 0 is used in an array, but in this case my mind is at a lose.

_snp1 = [ [_pos select 0, _pos select 1, _height] , EAST, ["TBan_Sniper"],[],[],[],[],[],85] call BIS_fnc_spawnGroup;

First argument in BIS_fnc_spawnGroup is _position (array). This array have syntax [ _x, _y, _z] (coordinates) where you set your elevation ( _z ) as hight from the ground. So in code above you select coordinates from marker position (_x and _y) and set custom _z.

  • Like 1

Share this post


Link to post
Share on other sites

Okay now I have another problem, how do I pass unit commands to the unit like setUnitPos "UP" so they don't prone out ?

 

BIS_fnc_spawnGroup have return value group. So you have your group in _snp1 variable. In your case your group have only 1 unit. So you want to set position for every (just one) unit in this group.

{ _x setUnitPos "UP"; } forEach (units _snp1);

You can use command units witch return all units from group in array format [_unit1, _unit2, ...]. Then you can iterate through each unit with forEach and set position for each unit in group. This _x in this case is magic variable used in forEach command to select current item in array (unit in array of units).

 

Hope I make any sence to you :) 

 

  • Like 1

Share this post


Link to post
Share on other sites

Okay, thank you so much M1ke, I'm not new to editing,,, but there is somethings that still catch my ignorance.
I'm starting to do things outside of my comfort level.. I just starting to actually read every line of the syntax to better understand it..

Cheers!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×