CptBBQ
-
Content Count
93 -
Joined
-
Last visited
-
Medals
Posts posted by CptBBQ
-
-
Hi all!
I know this isn´t the right forum, but I don´t want to open a new thread.
I´ve got a bloody noob question regarding cba_functions. I can´t get cb_fnc_globalExecute to work.
Here´s what I tried:
if (isServer) then { waituntil {!isnil "bis_fnc_init"}; [-1, {sleep 5; hint _this}, "TEST"] call CBA_fnc_globalExecute; };When I host the mission locally the hint appears. But hosted on our dedi, nothing happens. I´m pretty clueless about all this, don´t even know if the bis_fnc module is necessary.
I guess there´s some basic info I´m lacking, but the forum search is useless in this regard.
Thanks & Sorry =)
bbq
-
Heh, fun and simple! I´ll try that.
Thank you.
-
Hi all!
I´ve got a (hopefully) small problem with a mission I´m planing.
Basically I want to make a scud missile detonate prematurely on launch. So the explosion would have to occur about 10m above the ground where the warhead would be located. Problem is, all noteworthy explosives I found are bombs which fall down before detonating. Too bad the missile itself doesn´t collide with other objects...
I currently use the ammo class 'ace_fuelexpbig' as a substitute which is too small for my needs. The only other way I can think of would be a nukeAirBurst, which again is a little to big ^^
Any input appreciated :)
Cheers,
bbq
-
group this setgroupid ["Alpha"];
_grp = toarray str group _killer; _grp set [0,"DEL"]; _grp set [1,"DEL"]; _grp = _grp - ["DEL"]; _grp = tostring _grp;
I'm sure there must be a more elegant way to do it, but try that. :)
Haha! Maybe it´s not elegant, but I think it´s a really smart approach :D
Exactly what I was looking for.
Thanks to both of you!
Cheers,
CptBBQ
-----------------
edit:
aaaaand, it works!

great stuff, thanks again.
-
*bumb*
pleeease... there´s got to be a way to achieve this.
-
Hi there,
first of all, thanks for looking at this. I´m running against a wall with one of my scripts, and (again) I´m desperate for help...
I´ll try to keep it as short as possible...
So, lets say I have the groups alpha and bravo and I want to store their kills in arrays named alphaKills and bravoKills. When a killedEventHandler goes of, I need to know in which array to store the kill. The script will eventually have to handle a lot more group names so I don´t want to use 'if' or 'switch' statements.
I came up with this, because I already used a similar syntax using player names.
_groupKills = str(group (_killer)) + "Kills"; //_killer is the unit passed by the EH call compile format ["%1 set [count %1, _victim]", _groupKills];
But it cannot work, because
hint format ["%1", group (_killer)];
returns e.g. "B Alpha" if _killer is in team alpha. So the array would be
called 'B AlphaKills' which is bad in many ways. I´ve got no idea where those "B"s come from, neither how to get rid of them. I´ve looked for methods to trim or edit characters in stings but haven´t found anything.
I think an answer to one of the following questions would solve my problem:
1. Can I somehow obtain the name of a group as given via 'createUnit' and 'groupName = group _unit' in form of a string? (I need the exact name without any added characters)
2. Is there a feasible method to change individual characters in strings?
3. This would be more of a last resort but could I somehow rename the initial arrays to e.g. 'B alphaKills' despite the whitespace?
4. How would you approach this problem if you wouldn´t want to 'switch' through several groupnames to access their respective arrays?
If you have any insights on this issue, please share.
Thanks in advance!
Cheers,
CptBBQ
-
EDIT**
i dont know if this would work, but what if i formatted the value of a variable into string, and then used compile afterwards? that way the function can run as many times as needed, once i compile the value that was formatted, it should return the value that was last updated when format was used?
I´d love to know if this works and how the exact syntax would look like...
-
Ok, sure. But then only one player has a team to command.
Sorry, I should have stated that this is not an option.
Isn´t there a 'good' way to do this? Or at least better than what I did?
-
Hi guys,
sorry that I couldn´t think of a more fitting thread title.. :D
I´m currently working on a 2 player coop mission and I want the players the 'share' their information on enemy positions. Basically, when one player spots an enemy, the other player should have him revealed on his map as well.
The only approach I could think of was using 'knowsAbout' and 'reveal' although I know these commands are very limited in their potential. So I had to compromise, but it actually somehow works, kind of..
There are definitely more enemies revealed on the map and the overall situational awareness is indeed enhanced. BUT.. the enemy positions don´t seem to be updated correctly, only the initial 'reveal' is spot on, after that the markers often differ for both players, or some markers don´t appear at all.
I already like this script, but I´m sure some of you would know a way to improve it. Or is there even an other completely different approach to this?
Anyway, here´s the script, any comments appreciated.
if (!isDedicated) then { while {true} do { _allUnits = + allUnits; _vehicles = + vehicles; _array = _allUnits + _vehicles; opforUnits = []; {if (side _x == east) then {opforUnits set [count opforUnits, _x];};} forEach _array; if (player == player1) then { player1Knows = []; {if (player knowsAbout _x >= 0.1) then {player1Knows set [count player1Knows, _x];};} forEach opforUnits; publicVariable "player1Knows"; waitUntil {!isNil "player2Knows"}; {if (player knowsabout _x < 1) then {player reveal _x;};} forEach player2Knows; player2Knows = nil; opforUnits = nil; }; if (player == player2) then { player2Knows = []; {if (player knowsAbout _x >= 0.1) then {player2Knows set [count player2Knows, _x];};} forEach opforUnits; publicVariable "player2Knows"; waitUntil {!isNil "player1Knows"}; {if (player knowsabout _x < 1) then {player reveal _x;};} forEach player1Knows; player1Knows = nil; opforUnits = nil; }; sleep 20; }; };Cheers,
CptBBQ
-
I´ve corrected some other issues. Not use if it works now, but it should get you much further now.
//Create the Helo_grp = createGroup WEST;
helo1 = "MH60S" createVehicle getMarkerPos "heloStart";
helo1Pilot = _grp createUnit ["USMC_Soldier_Pilot", getMarkerPos "heloStart", [], 10, "FORM"];
helo1Pilot moveInDriver helo1;
//Give the helo waypoints
_waypoint1 = _grp addWaypoint [getMarkerPos "LZ1", 0];
_waypoint1 setWaypointType "HOLD";
helo1 land "GET IN";
// Waituntil all alive units in players group are in the chopper
waitUntil { {_x in helo1 && alive _x} count units group player >= {alive _x} count units group player };
helo1 flyInHeight 30;
helo1 engineOn true;
deleteWaypoint [_grp,1];
_waypoint2 = _grp addWaypoint [getMarkerPos "wp2", 0];
_waypoint2 setWaypointType "MOVE";
_waypoint3 = _grp addWaypoint [getMarkerPos "wp3", 0];
_waypoint3 setWaypointType "MOVE";
_waypoint4 = _grp addWaypoint [getMarkerPos "wp4", 0];
_waypoint4 setWaypointType "HOLD";
helo1 land "GET OUT";
deleteWaypoint [_grp,4];
// Waituntil all alive units in players group are out of the chopper
waitUntil { {_x in helo1 && alive _x} count units group player < 1 };
_waypoint5 = _grp addwaypoint [getMarkerPos "wp5", 0];
_waypoint5 setWaypointType "MOVE";
-
guys, I think this line here can´t work...
_helo createUnit [getMarkerPos "heloStart", _grp, "this engineOn true; this flyInHeight 30; helo1 = this", 1];I´d try something like this
helo1 = "some_valid_classname" createVehicle getMarkerPos "heloStart";helo1 engineOn true;
helo1 flyInHeight 30;
@Bashkire: exactly, helo1 isn´t defined, because it wasn´t created. You´ll need a whole other syntax. Try my example, but first get the classname of an adequate helicopter you want to use. I´d try armaholic.com for example.
-
yes, provided that your helo1.sqf is in the main mission folder..
-
Hi!
No "all knowing eye" here but I´m pretty sure you´ll have to use 'getMarkerPos' instead of 'position'. The latter only works with objects.
EDIT: Andy455 beat me to it. And put much more effort in it :D
-
Well, you don´t. That´s what this helper script is about ;)
Btw, while pimping my debug mode with the new syntax I made this little script..
coordMode = player addAction [("<t color="#1F67CC"">" + ("Coordinates") + "</t>"),"gen_action.sqf","player removeAction coordMode;
titleText ['Click on map to copy target coordinates to clipboard', 'PLAIN DOWN];
onMapSingleClick 'copyToClipboard (str (_pos)); hintSilent format [''%1'',_pos]';
",10,false,true,"",""];
It copies map positions to clipboard, nothing spectacular but it saved me some time already so I thought I´ll put it out there.
Cheers,
CptBBQ
-
You´re welcome =)
-
isServer returns true on a dedi and for the host on lan
isDedicated returns true for the dedi
isPlayer returns true for every human player (including a lan host)
And I think your assumptions are fully correct. Although some commands, like 'setPos', are broadcasted in multiplayer even though executed locally.
At least I think so...
-
Heh, finally =L2D=Curry gets some credit for his work^^
And as I see it, Big Dawg already used it in combination with compiled functions.
So, is there any reason, to use 'addAction' the way it was intended? ;)
-
Sorry for gravedigging but I just stumbled upon this little script and I´m really loving it :)
I got a quick question though. As you mentioned, it is not recommended to execute complex code and apparently one cannot use code that contains single quotation marks (').
I was thinking coulnd´t one just compile any kind of code and call it within the added Action? Would this method still be limited to 'simple' and short code?
Cheers,
bbq
-
Ok, but how will this behave when the randomized location is occupied by another unit, vehicle, building, etc...?
-
Hehe! Actually, you gave me the idea, nuxil :D
Last time the vehicle was AI controlled, so the part about the action key wasn´t really needed - but also not overlooked ;)
But while we´re at it, let me hijack my own thread...
I just tried to teleport the player near the position of another unit. The player shouldn´t be placed on that units toes so just using setPos wouldn´t do it. I guess adding some offset would help, but could be problematic in crowded urban environment (at least I think so).
Scanning the biki I found the setVehiclePosition command which looked perfect for that purpose. So I tried
player setVehiclePosition [getpos targetUnit, [], 20];which placed the player within a 20m radius of the target unit. But then it gets weird: The player model becomes invisible depending on the direction I look. Yes, you read that right^^. I don´t see my own player model neither in 1st nor in 3rd person view when I look in one or more certain directions. In tactical view the model remains invisible the whole time. I can tell it´s still there, because I´m able to interact, collide and leave footprints on the ground.
Frankly I suspect my Arma installation to be somehow bugged because this is by far the strangest behaviour I´ve observed in the game so far.
But maybe someone has made similar experiences or there´s even some known issue with setVehiclePosition...?
-
*facepalms*
I guess I wasn´t using the exact same syntax in another script then :o
It now works just as it should, Celery. Thank you for your advice.
-
Hey everyone!
Sorry to bother you again but I don´t think I´ll solve this one without help.
Lately I was playing around with display EHs and I decided I had to make my own 'turbo' button for some vehicles.. :D
functionName_keyDown = {private["_handled", "_ctrl", "_dikCode", "_shift", "_ctrlKey", "_alt"];
_ctrl = _this select 0;
_dikCode = _this select 1;
_shift = _this select 2;
_ctrlKey = _this select 3;
_alt = _this select 4;
_handled = false;
_atv = ["ATV_US_EP1"];
if (!_shift && !_ctrlKey && !_alt) then {
_veh = vehicle player;
if ((_dikCode == 79) AND (_veh in _atv)) then {
hintSilent format ["%1",_veh];
_vel = velocity _veh;
_dir = direction _veh;
_speed = 15;
_veh setVelocity [(_vel select 0)+(sin _dir*_speed),(_vel select 1)+(cos _dir*_speed),(_vel select 2)];
_handled = true;
};
};
_handled;
};
waitUntil { !(isNull (findDisplay 46)) };
(findDisplay 46) displayAddEventHandler ["keyDown", "_this call functionName_keyDown"];
Atm the whole thing is called from init.sqf. It worked just fine until I added the check for the vehicle type (see the red parts in the above code).
(_veh in _atv) returns 'false' because (vehicle player) always returns "B 1-1-A:1 (CptBBQ)" (where CptBBQ is my profile name, obviously), no matter whether I´m on foot on in any kind of vehicle.
I´ve used the exact type of syntax to check for vehicle types in other scripts without a problem. I also tried slight variations of the same syntax but to no avail.
Any suggestions are much appreciated.
Thanks in advance!
Cheers,
CptBBQ
-
Thanks nuxil!
The "sleep 0.01" did the trick. I´ll just have to adjust _speed depending on the vehicle. But that´ll be just a little trial and error.
:bounce3:
Cheers,
Bbq
-
Thanks guys!
Your answers explain why the motorcycle takes off like a rocket while the heavier car won´t move much at all. So, I´ll experiment with a loop and see what happens.
Maybe there´s a better way to achieve what I intended. So I´ll explain a little..
The vehicles will be driven by civilian AI´s which, at some point in a mission, will head towards the closest blufor troops and blow them self up when they are close enough.
For the movement I used the 'doMove' command. This worked fine for pedestrians, but AI in a vehicle will not come closer than 20-30m to it´s target. So at that point I let kick in the acceleration, which was enough to nudge the motorcycle towards it´s target.
As I´ve just learned, a much heavier vehicle will take a whole different kinetic impulse to reach it´s target. But of course, I want to control both (and maybe even more) vehicles with the same script.
So, maybe the doMove command is more of a problem than the relative acceleration code.
I´m still learning and always thankful for a insight on how others would solve the same problems.
Cheers,
CptBBQ
EDIT: Executing the code within a loop results in a very choppy, "laggy" movement. Looks like the car goes right back to its original velocity after every loop.
I think I need to take a different approach...
CBA: Community Base Addons for A2, OA and CO
in ARMA 2 & OA - ADDONS & MODS: COMPLETE
Posted
Thank you, Sickboy! :)