#arma3_scripting
1 messages · Page 439 of 1
@Dedmen
´´´
_waypoints = [[3611,13113,0],[3251,5236,0]];
_trp = createVehicle ["B_Heli_Light_01_F", [3611,13113,0], [], 0, "CAN_COLLIDE"];
_trp setDir 185;
_pos = getPosATL _trp apply {call BIS_fnc_cutDecimals};
if (_pos in _waypoints) } then { hint "true!" } else { hint "false"
};
´´´
damn forgot the marks for higlitght
If you drop weapon player wants to play animation. And after animation is done the weapon is dropped. That might explain the slight delay
Use the toFixed command instead of BIS_fnc_cutDecimals, its faster. Nothing major, but worth a change.
@sacred fox I said remove the parseNumber not remove all arguments to BIS_fnc_cutDecimals
@warm gorge toFixed turns into string
Sorry, in combination with parseNumber
possibly yea
I don't think that converting to string, truncating and converting back is more expensive than just doing modulo 1 or something like that
actually. _x - _x % 1 might be a nice solution
So, how exactly would I makeshift a entity created event, is there anything in CBA for that yet?
Meaning -> No entity creation handler exists yet -> How would I get a script to catch new units?
_waypoints = [[3611,13113,0],[3251,5236,0]];
_trp = createVehicle ["B_Heli_Light_01_F", [3611,13113,0], [], 0, "CAN_COLLIDE"];
_trp setDir 185;
_pos = getPosATL _trp apply {_x - _x % 1};
if (_pos in _waypoints) } then { hint "true!" } else { hint "false"
};
``` @sacred fox
Alright, I'll check that out.
https://i.imgur.com/fDg760k.gifv @still forum new bug 😄 but thats a nonissue imo
no way to dupe that
lol
@warm gorge Do you have Arma open? Can you check
parseNumber (3.56346 toFixed 0);
[3.56346,0] call BIS_fnc_cutDecimal;
3.56346 - (3.56346 % 1)
?
parseNumber (3.56346 toFixed 0); // 0.0016
[3.56346,0] call BIS_fnc_cutDecimal; // 0.0011
3.56346 - (3.56346 % 1) // 0.0007
Interesting
https://i.imgur.com/fP3XNZK.png what I got
cutDecimal is suddenly faster than toFixed+parseNumber?
Probably handles 0 decimal places specially
I copied that speed result from someones comment on the wiki
oh you wanted speed 😅
That wiki entry was probably before cutDecimal was optimized
I edited my above example to him with your method, the fastest
And yeah most likely, ill update it
@Dedmen is it possible to remove one number infront of the decimal, so when it comes to getPosATL it will only count every 10m. so for example instead of [9193,12114,0] it will be [919,1211,0]
😂
easy way _pos vectorMultiply [0.1,0.1,0.1]
right now i have this, and it is working, but its too precise for me :P
_approxPos = _vehiclePos apply { [_x,0] call BIS_fnc_cutDecimals};
so you mean i should make like
_roughPos = _approxPos vectorMultiply [0.1,0.1,0.1]; ?
yeah
But that will be a completly different position
9193 -> 919 is 8274m away from the original position
15:29:59 Error in expression <nc_cutDecimals};_roughPos = _approxPos vectorMultiply [0.1,0.1,0.1]; if (_rough>
15:29:59 Error position: <vectorMultiply [0.1,0.1,0.1];if (_rough>
15:29:59 Error vectormultiply: Type Array, expected Number
cutting away the decimals work, but vectorMultiply on that doesnt for some reason.
do i have to make a forEach statement of apply or something?
like
_roughPos = _approxPos apply {vectorMultiply [0.1,0.1,0.1] };
so
'''
_roughPos = _approxPos apply { vectorMultiply 0.1; };
'''
btw what was the trick to get syntax higlightning in discord? 😛
oh ok
```sqf
```
so this is right then?
_roughPos = _approxPos vectorMultiply 0.1;
yeah
do you guys know a way to lock ammo boxes?
Just close the inventory right after someone opened it
tehn hint "This box is locked"
I think Lifers do the same
what about the take action from the weapon holders?
replace your crate with simple object
Disable the action via a mod is only way to remove the hand
Well, i remove it by set the damage to 1
the weapon was supouse to be a dummy anyway.
But any way, since the update that did this, i dont know how to put magazines in the weapon that are either placed in the editor or in script, anywone know that?
for exemple
_holder = createvehicle [ "weaponholdersimulated",[getPos player select 0, getpos player select 1,0],[], 0, "can_Collide"];
_holder addWeaponCargoGlobal [primaryWeapon player,1];
_holder addMagazineCargoGlobal [currentMagazine player, 1];
The magazine is not on the gun, there is only a tiny box on its side
you cannot create magazines with attachments (that includes magazines) via script
besides giving them to an AI and ordering it to drop it
I have a script command ready for that. Still waiting on BI to copy-paste it into the engine :U
quick question , is it possible to create a local unit ? I need it just to check if player has space for a bunch of items before merging them onto the player
so, what is the work around for what i what?
Why don't you just check... If the player has space? Without a local unit? ^^ I think you can createVehicleLocal a unit.
@astral tendon As I said. besides giving them to an AI and ordering it to drop it
its for my market system @still forum i want to make sure they have space for all the items, before they are added 😃
well, i cant order a dead AI to drop it.
so it doesnt get halfway through and say no fuck you
aka get their uniform classname. Check in config how much total space it has
then use script to check how much of it is full
Check how much space the items you wanna add need
i was going to use canAddItem to backpack etc
Can do all that without a sacrificial unit
yeah
I know
uniform/vest/backpack all the same
load ?
Don't even need config
Miiight need config to get the mass of the items you are trying to add.
Dunno if there is a handy command for it
There is
@peak plover what is it ?
can add doesnt give mass.
Im trying to find out if the player can hold all the items, before adding any of them.
nah, I was going to create a duplicated unit, with the same gear, and add it to him, then if he can hold all of them, copy the gear over.
Market.
so basically need to know if it can hold all of the items, before even adding one.
^ the penis licker item is expensive
So u stop buying completely ?
I buy, but I complain
when the buyer clicks buy.. its going to check if they have space for all the items, if they do, send the function to the server to set the item as bought , then return, and give the player all the items.
total weight wont work
because it might have the right weight between 2 containers.
{
private _itemClassname = _x select 0;
private _itemType = _x select 1; //only needed for virtual items.
if (_itemType != "virtual items") then {
_itemWeight = //This is what I need.
if (_spaceLeftinBackpack < _itemWeight) then {
if (_spaceLeftinVest < _itemWeight) then {
if (_spaceLeftinUniform < _itemWeight) exitWith {
//No containers left.
_notEnoughSpace = true;
} else {
_spaceLeftinUniform = _spaceLeftinUniform - _itemWeight;
}
} else {
_spaceLeftinVest = _spaceLeftinVest - _itemWeight;
}
} else {
_spaceLeftinBackpack = _spaceLeftinBackpack - _itemWeight;
}l
};
}forEach _arr;
``` something like that.
I need the ``_itemWeight`
Use.config viewer ingame
i did, cant find anyintg xD
only thing even close is weight which on all the items I have seen is 0
private _itemClassname = _x select 0;
private _itemConfig = ([_itemClassname] call Life_fnc_fetchCfgDetails) select 6;
private _mass = switch (_itemConfig) do {
case ("CfgWeapons") : {getNumber(configFile >> "CfgWeapons" >> _itemClassname >> "mass")};
case ("CfgVehicles") : {getNumber(configFile >> "CfgVehicles" >> _itemClassname >> "mass")};
case ("CfgMagazines") : {getNumber(configFile >> "CfgMagazines" >> _itemClassname >> "mass")};
};
``` have to work on it a bit, but thanks @restive cedar
Is there some built in function that display some structured text in a dialog?
?
ctrlSetStructuredText
but you have to have a control in your dialog , that is compatible with structuredText
Yup. But I am asking if there is such a generic function already. Basically, want to avoid defining my own Dialog.
Probably BIS or CBA maybe already has something.
Basically just need to display some structured text and a close button.
rscStructuredText
Then manually set position and size.
I know how to do it. I am asking if there already is functionality already done.
hintC
Yup. That gets close. But no close button, and ideally would like something scrollable
ahh. let me try
if you want it scrollable, you will need rscControlsGroup
Hmm hint works, but hintC does nothing
at this point predefining a display is probably cleaner xD
and quicker
a control sorry,
if !(Side _this == civilian) then{
_this addMPEventHandler ["mpkilled", {
_Target = (_this select 0);
_Unit = (_this select 0);
_killer = (_this select 1);
_Unit remoteExec [ "RemoveAllActions", 0, true ];
if (Side _killer == west AND (currentWeapon _Unit isEqualTo "")) then {hint "ROE violated"};
if (true) then {
_wh = "WeaponHolderSimulated_Scripted" createVehicle getpos _Target;
_wh addWeaponCargo [currentMuzzle _Target,1];
_wh addMagazinecargo [currentMagazine _Target, 1];
_wh setPosASL [(eyePos _Target select 0) + 0,(eyePos _Target select 1) - 0,(eyePos _Target select 2) - 0];
_Target action ["DropWeapon", _wh, currentWeapon _Target];
_wh addAction ["Secure Evidence", {
_wh = _this select 0;
Player playAction "TakeFlag";
deleteVehicle _wh;
},nil,1.5,true,true,"","true",2,false,""
];
removeAllWeapons _Target;
_wh spawn {
sleep 1;
_this setDamage 1;
};
};
}];
};
My only problem with this is the fact that the weapon holder does not have a magazine on the weapon but out side of it, any fix for that?
create a controls group, with the controls you need, then create a function that you can call to make it 😃
@errant jasper https://community.bistudio.com/wiki/BIS_fnc_guiMessage
unit addWeaponItem [weaponName, itemName]
@astral tendon Why do you ask the same question again that I answered you before?
Like i said, i cant order a dead unit to drop the weapon
There is no other way
@astral tendon : unit addWeaponItem [weaponName, itemName]
You have to spawn a living AI. Give it the weapon. let it reload. Let it drop the weapon. And despawn it again
@wary vine No. Completly useless
oh wiat[.
he wants to add a magazine to the holder
he has a weapon holder
@naive estuary Thanks, that pretty much exactly what I was looking for.
No scrolling though, so have to make my own
He wants to add a magazine to a weapon in the weapon holder.
So, how does the game does that by default?
@astral tendon you can not see a weapon as a "container" in a wh
Which is what I've been saying an hour ago ^^
only way
Even easier fix. https://gist.github.com/dedmen/68cf103cbcaebc2980aa1776046c8eac
There you have a script command to add a weapon with attachments to a container
get BI to implement it. They only have to copy-paste
+1 to that would be nice.
Dwarden told me I should ask again after Arma 2 EOL
Arma 2 patches stopped a month ago. But they aren't done yet
I have it so you can preview the item with attachments, but there is a few second gap when it reloads the weapon
But. My command doesn't have magazine yet 😄 ¯_(ツ)_/¯
if you can modify the attachments in the wh, it would be beautiful
fak
I think magazine was too hard to implement. But I might take a look at it again later
So, is there a way i can get the droped weaponholder init?
"init" ?
"init"
Well. Just type "init" in the debug console and you'll get "init"
I would like to get the weapon holder a variable at the moment the unit dies and put comands on it
I dont know man.
If you don't know what you want how should anyone help you with that?
Never mind, better i just live with that.
how can I check when modded "face" is used but addon not loaded ?
_faces apply { if ( ([_x] call BIS_fnc_itemType) select 1 isEqualTo "" ) then { diag_log format ["_class: %1 | face not found", _x]; _faces = _faces - [_x]; }; };
this apply only for items, but not faces
got faces in predefined array _faces
I want to filter faces that are used but their addon is not loaded
and subtract them from _faces array
anyone knows a foolproof way of deleting a vehicle and spawning a similar one in the exact same spot? deleteVehicle _vic; private _newVic = "B_G_Offroad_01_F" createVehicle [23783,23007,0.55]; _newVic setPosATL [23783,23007,0.55]; _newVic setDir 282; this leads to an explosion 1 in 5 times
i tried a little sleep between del and create but to no avail
vehicle is inside a garage btw
bugging into roof or ground or just randomly exploding?
hard to tell, it seems to spawn in the correct spot
i copied pos directly from editor
best way of checking what type of weapon I am on (prim/secondary/handgun)
currentWeapon == primaryWeapon and so on
hmm
I think that's best/only
not quite like that
if (//istypeofprimaryweapon) then {
if ((primaryWeapon _unit) isEqualTo "") then {
_unit addWeapon _itemClassname;
_itemHandled = true;
};
};
cant I use type = in the configs ?
what's the deal with people avoiding == for string comparison, is it a habit from java/c or does it actually make a difference in arma?
isEqualTo is quicker i beleive.
isEqualTo is quicker and case sensitive
private _weaponType = getNumber(configFile >> "cfgWeapons" >> _itemClassname >> "type");
//primaryWeapons
if (_weaponType isEqualTo 1) then {
if ((primaryWeapon _unit) isEqualTo "") then {
_unit addWeapon _itemClassname;
_itemHandled = true;
};
};
//Handguns
if (_weaponType isEqualTo 2) then {
if ((handgun _unit) isEqualTo "") then {
_unit addWeapon _itemClassname;
_itemHandled = true;
};
};
//Launchers
if (_weaponType isEqualTo 4) then {
if ((secondaryWeapon _unit) isEqualTo "") then {
_unit addWeapon _itemClassname;
_itemHandled = true;
};
};
``` something like that would work right ?
not in script
where would that be modified ?
likely #arma3_terrain dunno
ok
with ace 3 running how can you detect when a vehicle gets destroyed ? From what I understand ace does something with killed EH that I dont understand
wat im trying to do is
hint when a vehicle die, like say "vic has died"
_myVehicle addEvhentHandler ["Killed", { hint "I am dead"; }] doesn't work?
you could go with waitUntil { not alive _myVehicle; } , if all else fails
mission eh EntityKilled also
Anybody can help me understand why my AI just seems to die when they paradrop, the flyinheight is 450 which feels like enough but they faceplant when they land, only on a couple of occasions have 1-2 survived.
_heli flyInHeight 450;
_heli forceSpeed 50;
they are also using B_Parachute
B_Parachute < that is backpack
Release parachute is a vehicle
which mod is that ?
just iron front
the script im using was left over in one of bohemias escapes but only decided to try it out today
so anyway, they only visually have a parachute or something?
Release parachute is a vehicle
lol..
@subtle ore care to elaborate?
anyway, fixed it myself, bparachute was the issue
in this game parachutes work like vehicles, but you automatically get in/out
probably collisions with chutes, makes troubles there
also sometimes units will take damage when they ejected
oh nvm... they are not ejected in your script
disable collisions/damage for them maybe
when you use _myVehicle addEvhentHandler ["Killed", { hint "I am dead"; }] with ace it doesnt work,so for example if u try to hint back the killer, it returns error no unit or something to thatline
So i was wondering if there was a way around that killed Eh to detect when a vic dies
amarite in saying you cant do returns with spawns ?
@wary vine the variable attached to the spawn is only going to return <spawn>
yup feck
from https://community.bistudio.com/wiki/spawn
Return Value: Script Handle
what would you want to do?
@winter rose https://community.bistudio.com/wiki/scriptDone
@subtle ore yes?
That's an example of what you would use a script handle for
well, yes I know 😄 I asked @wary vine what he wanted the spawn to return, and maybe help him with his code
yeah, no I needed an actual variable returned xD
its ok, was just trying to make things too complicated. xD
just set it
Do you guys know how to change the name or even the skin of vanila weapons in the game with out need of mods and can be done only inside the mission file?
Like those servers that have custom textures for clothes.
@astral tendon I don't, but I've seen quite a few guides/youtube videos on the subject. Have you tried looking at any of those already?
most of they arent reallt what i want
Looking for some advice on extdb3 before I make this system. I want to just do a bunch of mysql queries all the time as it would be easier to code, but I'm concerned about a performance cost vs doing one load when the player enters the server, modification of data while in the server and one save when the player exists the server back onto the database. Is there a problem with the first method? I ask because I pretty much see people using the second method exclusively
As far as I know, there is no way to modify values set in a cfg via mission file or a script.
you cannot modify addon configs from mission
As long as you aren't doing a shitload of queries every second. It won't be an issue.
That would be true for nearly anything though. I'm nervous about scalability
What are you going to be saving to the database.
if I were to do it the second way a 2d array with around 80 elements, each element being an array of around 5 elements. The first way I would just store each as an entry into a table
It's a custom inventory script
We could say that the server would need to pull all the data of the players inventory and send it to them everytime they open their inventory, which my gut says is a problem, but I'm not entirely sure if it is
Have a loop that stores the players last inventory, and their current, if their current is not equal to the last, then update the database.
That way you minimize amount of queries.
You could even do something to make sure their inventory hasn't changed for x seconds before updating.
If I wanted to do something like that I might as well have only two queries for when they leave and enter the server
Yeah
I guess I'll just do that, and not risk problems by keeping the data only in the database
Keep in mind, if the server ever crashes mid-game, inventory changes since the last time a player connected wont be saved.
Is there a way to know what target is the AI targeting?
assignedTarget only return the target that is assigned, not what is targeting
targets returns all targets in a range.
targetsQuery seens to do it but o dont know if the aray it return come in order with that he is actually aiming at
im trying this
_unit = player;
_targets = (_unit targets [true, 300]);
_TagetThatUnitCanSee = [];
{if ([objNull, "VIEW"] checkVisibility [eyePos _x, eyePos _unit] > 0) then {[_x] + _TagetThatUnitCanSee}} forEach _targets;
_TagetThatUnitCanSee;
_targets do return the arays but it seens like that if is not happening at all and _TagetThatUnitCanSee is returning the empty aray i set before
[x] + _TagetThatUnitCanSee doesn’t do anythingn
I figured
_unit = player;
_targets = (_unit targets [true, 300]);
_TagetThatUnitCanSee = [];
{
if ([objNull, "VIEW"] checkVisibility [eyePos _x, eyePos _unit] > 0) then {_TagetThatUnitCanSee append [_x]}
} forEach _targets;
_TagetThatUnitCanSee;
this one now works
Try _TagetThatUnitCanSee pushback _x
Don’t use append if you don’t have to
Well, don’t wrap something in an array if you don’t have to
And your naming convention probably is going to give anyone else you show this to a seizure
Perhaps _visibleTargets?
If i dont put _x in a array it gives a error
Not if you use pushback
well, i not in a naming convention anyway, plus, i am not that creative with names
What’s this script for? Yourself?
Just for test and see what i could do with it
though, what is the reverse of pushBack?
well, i finished testing
_unit = _this;
while {(alive _unit AND !captive _unit)} do{
_targets = (_unit targets [true, 300]);
_TargetThatUnitCanSee = [];
{if ([objNull, "VIEW"] checkVisibility [eyePos _x, eyePos _unit] > 0) then {_TargetThatUnitCanSee pushBack _x}} forEach _targets;
{_unit forgetTarget _x} forEach allunits - _TargetThatUnitCanSee;
sleep 1;
};
{_X execVM "AiTargeting.sqf"} forEach ((allUnits) select {side group _x isEqualTo east});
what this does is stop the AI from targeting units it does not see, tough i dont really like to put i on a while loop, any other option better than while for a loop?
im afraind that it may turn urgly if there is many units on the mission
So I have put Paratroopers in my mission but when they land they kind of just stand there as the AI does. I found this thread https://forums.bohemia.net/forums/topic/185613-making-ai-units-actively-chase-the-player/ However I only want those sqfs to work only with the Paratroopers.
https://pastebin.com/pAfqwg1L Here is the Paratrooper script
although saying that, having all the AI actively come after you is quite intense..
So i have a pbo file in my mod that contains music
i can call the song name for example soldier1 say3D "song Name"; say3D is not for music i know but i put the music in the config.cpp as a sound not music.
that works but only i can hear it
my other team mates can't hear the sound playing
any input?
@obsidian chasm well that is only using doMove and also uses getpos
@ornate pawn try playSound3D, that should do the trick. https://community.bistudio.com/wiki/playSound3D
i was using [CAMP_Base_Speaker_1, "BEW_Song_01"] call CBA_fnc_globalSay3d;
it works on everything else
and i can hear the music playing on the spearker but my friends can't but they can hear other sounds using the same line of code
only that those sounds are in the mission and not in the mod.
weird
@peak plover huh turns out im an idiot anyway, those scripts arent even working lol, just getting script not found
If it's still bugging u in a few days I'll be back at PC and can help
ye seems its just a problem with chaser, maybe i can get it fixed before that
although im thinking ive just set it up wrong, so no worries
@ornate pawn ok how about the thing i suggested??
I will give it a try yes. but now something else has caught my attention and its fucking ace mod not letting me disable view distance..
thansk
@ornate pawn I suggest you delete the question that you copied in here, seeming cross-posting isn't allowed
seeming you could get in trouble
@ornate pawn You could read a whole ACE documentations and explore ACE git data for that time you've asking that a hundred time again.
@modern sand Questions realted to scripting are no trouble here.
But view distance and ACE aren't related to scripting, more so mod use
its okay i already deleted the question here but Are you really gonna make me read the whole documentation just to get an answer on why i can't disable view distance when i already just disable it and it seems not to make any difference ? why even add that feature ? its annoying you know? just let people tweak their own view distance.
Jesus..
He suggested to read the documentation included with the mod, no need to come across as rude.
private["_trigger"];
_obstacleCount = count W_Obstacles;
_obstacleName = _x;
if (_obstacleCount != 0) then {
{
_obsPos = _x;
_trigger = CreateTrigger ["Detector", _obsPos, true];
_trigger setTriggerArea [10,10,3, true];
_trigger setTriggerActivation ["GUER", "PRESENT", true];
_trigger setTriggerStatements ["this",
_vel = velocity _trp3;
_dir = direction _trp3;
_speed = 20;
_trp3 setVelocity [
(_vel select 0) + (sin _dir * _speed),
(_vel select 1) + (cos _dir * _speed),
(_vel select 2)];
uiSleep 4;
_obsMarker = createMarker ["Obstacle", _obsPos];
_obsMarker setMarkerShape "RECTANGLE";
_obsMarker setMarkerSize [100,100];
uiSleep 0.5;
_obstacleCount = _obstacleCount + 1;
} forEach _obstacles;
};
why is this throwing me
13:55:47 Error in expression <ger setTriggerStatements ["this",
_vel = velocity _trp3;
_dir = direction _trp3>
13:55:47 Error position: <= velocity _trp3;
_dir = direction _trp3>
13:55:47 Error Missing ]
At the statement line. AFAIK there is no ] missing 😐
that's not the point dude the point is that if you have a button called Turn off / Turn On it should work and nothing more.
@sacred fox because your array isn't closed.
if that button doesn't work return the item. end of story. that's my point.
Not talking about that ^ talking about your response to him suggesting you read the documentation
@modern sand where are you from? are you from U.S ?
@sacred fox This SQF _trigger setTriggerStatements ["this", Needs to be this SQF _trigger setTriggerStatements ["this"];
No, AU
if that's being rude to you..
server.armaprofile
viewDistance=3000;
preferredObjectViewDistance=3000;
terrainGrid=12.5;
Don't know why you have to be smart buddy, you seem to always be like this when people try to help you.
damn i have stared myself blind on that. thanks nicholas, sometimes you just need other peoples eyes 😛
All good buddy. glad you asked 😃
No. you said i was being rude when i wasn't
those arguments are below
Doesn't change the line being broken and erroring out.
well yer, don't know about the syntax use for setTriggerStatements, just knew that an array needed to be closed :L
anyways @little eagle that will set mi view distance to 3000 and not letting me go lower what if my players need lower their view distance cause they have toasters?
do i really need a trigger off statement aswell?
The clients can only use a view distance up to the servers view distance. If your server is on toaster settings, even the ACE slider cannot change it above that.
do i really need a trigger off statement aswell?
Yes, the command needs 3 args rhs. Not more, not less.
yeah that's why i disable that feature on mods or addons configuration and it is still enable.. i don't have a module in the mission so why in the world isn't off?
You need to change the view distance in the server config. ffs read the doc.
hm, ok, what the hell should i put in the OFF statement then. :P
yeah im using the biki all the time. but now i just got lost, i only want it to fire when a particular AI enters the trigger, right now its firing on anything, which is what i want when testing. but why should the trigger have to do anything when nothing has fired it?
I disable it too.. jesus
You cannot disable the view distance in the server config. That makes no sense. You'd knew that if you read the doc.
k
lol
@sacred fox is your question still related to setTriggerStatements? (I'm a tad confused xD)
im trying to simplify down to the basics before making it more complicated. one question though, if i want to append a number at the end of a variable value, its for creating unique names in a forEach statement, so for example Obstacle1, Obstacle2 etc.
my guess is that
obstacleName = "Obstacle"+_obstacleCount;
doesnt work?
this is the full statement
private["_trigger"];
_obstacleCount = count _Obstacles;
if (_obstacleCount != 0) then {
{
_obsPos = _x;
_trigger = CreateTrigger ["EmptyDetector", _obsPos, true];
_trigger setTriggerArea [20,20,3, false];
_trigger setTriggerActivation ["ANY", "PRESENT", true];
_trigger setTriggerStatements ["this", "hint 'Obstacle near'", "hint 'Obstacle cleared'"]; uiSleep 4;
_obstacleName = "Obstacle"+_obstacleCount
_obsMarker = createMarker [_obstacleCount, _obsPos];
_obsMarker setMarkerShape "CIRCLE";
_obsMarker setMarkerSize [20,20];
uiSleep 0.5;
_obstacleCount = _obstacleCount + 1;
} forEach _Obstacles;
No you cannot append a number to a string
🤦
number and string are completly different things
oh ok, so if i want to create unique marker names for each run in the forEach loop then? yh but a number can still be typed as a string, i mean it could be a letter aswell. i just want to append something to make the markername unique each run
Also why is that private for _trigger up there?
And why do you want to name your Obstaces from Obstace20 to Obstacle40 instead of 0 to 20 ?
You can use str or format
as for the private, i thought it was needed, to be able to call the variable from this particular script, isnt private for the innermost scope, which mean the variable cant be touched fomr the outside of the script?
no
It means that you cannot touch variables from scripts that called yours
not the other way around
also you can use private _trigger = instead.
ah ok
So yeah, tried to put this in my mission but it just says 'scripts not found' however i put them in the scripts folder as I usually do.
https://forums.bohemia.net/forums/topic/185613-making-ai-units-actively-chase-the-player/
Here is the script, not sure what I'm doing wrong
so as for the count i can just use like
obastacleName = str(_obsPos); // should name the marker with the coordinates.?
@obsidian chasm Uh.. Yeah. Scripts folder is wrong. That page expects them directly next to init.sqf
@sacred fox I guess you could yeah
So just put all that in the init.sqf?
hm well I did that and it gave me errors
@still forum No you cannot append a number to a string 🤦
Weeeeeell in PHP and Javascr.... hemmm nevermind 😄
Well yeah.. Undefined variable.. Meaning your script was found and is running
chaser is the variable of the unit that should chase the player
you ofcause gotta have to set that
@still forum I don't understand sorry
here is the script btw, the other works perfectly fine it seems
well they spawn from triggers
so would i be bale to just remove chaser and it'd do it for all ai?
i did that just now and got zero errors
do i need to call BIS_fnc_MP to make sure triggers get created on the server?, i have a script now, which is firing in the editor, but it wont fire on the server.
if (_obstacleCount != 0) then {
{
_obsPos = _x;
_trigger = CreateTrigger ["EmptyDetector", _obsPos, true];
_trigger setTriggerArea [20,20,3, false];
_trigger setTriggerActivation ["ANY", "PRESENT", true];
_trigger setTriggerStatements ["this", "_trp setFuel 1;
_trp setVehicleAmmo 1;
_trpDriver disableAI 'MOVE';
_vel = velocity _trp;
_dir = direction _trp;
_speed = 20;
_trp setVelocity [
(_vel select 0) + (sin _dir * _speed),
(_vel select 1) + (cos _dir * _speed),
(_vel select 2)];", "hint 'Obstacle cleared'"];
_obstacleName = str(_obsPos);
_obsMarker = createMarker [_obstacleName, _obsPos];
_obsMarker setMarkerShape "ELLIPSE";
_obsMarker setMarkerSize [20,20];
uiSleep 0.5;
_obstacleCount = _obstacleCount + 1;
} forEach _obstacles;
and i have make sure to make it fire on ANYTHING. to rule out the conditions. so right now it seem to be some kind of server/multiplayer solution im missing. btw im running exile, maybe there is some kind of Exile function which need to be called when creating triggers?
Hey guys, not too sure where to put this, but is it possible to put a progress bar behind an image? If so, how would i go about doing it?
@sacred fox No BIS_fnc_MP anymore. remoteExec command is what it is now.
if you run that code on server then it will run on server.
@sacred fox I'd suggest reading this: https://community.bistudio.com/wiki/Code_Optimisation
I've personally fallen for trying to optimize the shit out of something that just works.
Is there an event for the AI when they go from normal to alerted? i.e. when AI are idle and player approaches the AI so they start fire, I'd like to hook up to that event of changing the state.
if you mean "event handler" afaik there are none, but we have commands knowsAbout and targetKnowledge
Oh man, that's it. I think I could get away with using knowsAbout
Thank you @meager heart
Hey,
Im trying to create a helicopter that starts of flying straight away however after spawning it with this script:
_activeHeli = createVehicle ["B_Heli_Transport_03_F", getPos player, [], 0, "FLY"];
It instantly goes into a nose dive and crashes into the floor (The Engines are on but it just nose dives) any ideas?
Sorry if im being a massive noob lol
@drowsy axle i will do that, but for now, any clue on why the trigger isnt being created/firing on the server, it gets loaded, the log no longer throws any errors and my markers get generated on the map. but the trigger is driving me crazy as it does work when i run the code in the debugconsole in the editor. then it gets created and also firing when i enter it.
err I haventt manually added one no, is their a way to force an AI into the pilot seat?
nvm I found it thanks
@sacred fox Did you read @still forum's post? No BIS_fnc_MP anymore. remoteExec command is what it is now.
Why do you even create a trigger. They're annoying and pointless.
Probably because he’s new
@drowsy axle in Eden you can right-click on objects and "show in config viewer" there you can copy the classname. Maybe there is a faster way too that I can't think of
there is an option to copy the item class to clipboard on the right click menu too
@still forum @robust hollow http://steamcommunity.com/sharedfiles/filedetails/?id=1341112604
@robust hollow I cannot see that option. Could you explain it?
Log > Log Classes to Clipboard
https://i.imgur.com/HmgHKwm.png
Ahh okay. That's in default ArmA3.
Does anyone know how to replicated the rotating head in the avatar editor menu on the main screen of Arma?
@tough abyss im guesing you could look through the configs, and see how its done ?
Can you make an #include ''; inside an array?sqf bon_recruit_recruitableunits = [ #include 'script.sqf'; ];script.sqfsqf "B_solder_F", "B_solder_AT_F"
what message?
Oh, it probably hit char limit
Ah
Okay, so what are you trying to do with that information?
I inputted all the classnames
Which all good. but I want to be able to make the classnames into separate files so that it ain't one long list.
you could do something along the lines of : (I do this a lot in my stuff):
in your description.ext:
#include "config\CfgSelectables.hpp" from there you'd make a folder named config in your root and make a header file called "CfgSelectables.hpp"
Then, in your CfgSelectables.hpp:
class CfgSelectables
{
class nato
{
selectable[]={"Unit_1","Unit_2","Blah1"};
};
}:
And then use : https://community.bistudio.com/wiki/missionConfigFile , for referencing the entries and getting returns
getText , getNumber , getArray , etc
Right. Here's where the array is #included : sqf if (bon_dynamic_list) then { _scripthandler =[] execVM "bon_recruit_units\recruitable_units.sqf"; //executes dynamic arrray builder to find units of player's subfaction waitUntil{ ScriptDone _scripthandler }; //MUST wait for script to finish } else { #include "recruitable_units_static.sqf" };
Well that message ^ took it's time displaying... :/
Well, it doesn't make a whole lot of sense since your #include contains "B_solder_F","B_solder_AT_F" correct?
No no no. that the original script for the array. not my file separation
because all #include does it copies the code from one file from another
So can I do:c class CfgSelectables { class nato { selectable[]={"Unit_1","Unit_2","Blah1"}; }; class natoPacific { selectable[]={"Unit_1","Unit_2","Blah1"}; }; }:
Yeah, besides the awful formatting lol.
private _pacific = getArray(missionConfigFile >> "CfgSelectables" >> "nato-pacific" >> "selectable");
Oh yeah
Oh, I guess something like this exists too: https://community.bistudio.com/wiki/getMissionConfigValue
natoPacific
perfect
how do I exec something like "hint [speed player]"?
hintSilent format["SPEED: %1",speed player];
Thanks!
if (bon_dynamic_list) then {
_scripthandler =[] execVM "bon_recruit_units\recruitable_units.sqf"; //executes dynamic arrray builder to find units of player's subfaction
waitUntil{ ScriptDone _scripthandler }; //MUST wait for script to finish
} else {
_aiList = getArray (missionConfigFile >> "CfgSelectables" >> "nato" >> "selectable");
};```Would this work?
No problem Tim,
Capwell, yeah that should work.
didn't work, but I think I know what's wrong
player is local
From:sqf { _displname = getText (configFile >> "CfgVehicles" >> _x >> "displayName"); _picture = getText (configFile >> "CfgVehicles" >> _x >> "portrait"); _weaponstring = format["%1",_displname,_picture]; _unitlist lbAdd _weaponstring; } foreach bon_recruit_recruitableunits;To:sqf { _displname = getText (configFile >> "CfgVehicles" >> _x >> "displayName"); _picture = getText (configFile >> "CfgVehicles" >> _x >> "portrait"); _weaponstring = format["%1",_displname,_picture]; _unitlist lbAdd _weaponstring; } foreach _aiLIst;Seems right?
@marble flare sqf hintSilent format["SPEED: %1",speed vehicle player];
hintSilent format["Player speed : %1, Ship Speed: %2",speed player,speed (vehicle player)];
So many tim's 😛
yeah that should work.
Do you need the (vehicle player)?
I can't really double check right now though, so you will need to test for yourself
Well, to return the speed of the ship yeah
no, I just changed player to "sloop" (name of my ship) and it returned 7.8
That will also work 😛
Alright, yeah. Where are you executing this? Player may not work because of locality issue
when I hit escape, in the exec box
local exec?
i guess
you...guess?
i dunno. this scripting stuff makes as much sense to me as women
Lol, you have three boxes in your debug console: global exec, server exec, and local exec.
oh, local exec
ok, how would I write it to automatically convert kph to knots given 1.852 kph = 1 knot?
figured it out, i'm sailing with a starboard tack SE at 4.5 knots
👏
if !(_itemHandled) then {
if (_forceDrop) then {
_holder = createVehicle ["WeaponHolderSimulated", (getpos _unit), [], 0, "CAN_COLLIDE"];
if (_holder canAdd _itemClassname) then {
_holder addItemCargoGlobal [_itemClassname,1];
_itemHandled = true;
};
};
};
``` any idea why im getting bad vehicle type here, but its all working
yo
I just got arma 3, and I have notepad ++ with the sqf highlighting, later today It would be nice if some1 can go over the basics wit me
@stone yarrow hi! I invite you to bookmark this page https://community.bistudio.com/wiki/Category:Scripting_Topics , that is full of good advices here and there.
If we can be of help, you are welcome
east setFriend [resistance, 1]; should be in initServer.sqf or init.sqf ?
@real tartan marked as Server Execution on the wiki, so Server run 🙂
https://community.bistudio.com/wiki/setFriend
@wary vine Don't use WeaponHolderSimulated
Or do you specifically need a physx holder?
If so use WeaponHolderSimulated_Scripted
And you don't need the canAdd check
SO I want an array like this [[Name,"Classname"],[Name02,"Classname02"],[etc]]
but with every single item available in the arsenal
Is there a way to script this and not have to manually do it?
@still forum ill take a look now.
@radiant needle Yes. But not thaaat easy
will variables in a script be availble for a script that is included in the script, for example you have script1.sqf which includes script2.sqf, will local variables in script 1 be availble to script2?
you have to pass it in array
What is "included"?
then get them back params / _this select x
@lusty canyon wrong for called and included scripts
spawn or call same difference
["var1","var2"] call whatever.sqf; ["var1","var2"] spawn whatever.sqf;
same difference
@Dedmen its a separate script which spawns the triggers at different locations, but i want it to be able to recognize the _trp from script 1 in the statements, right now, it doesnt recognize the vairable, as for now i have only included script2 from script1
I prefer to wait till he tells me what he means. rather than speculating
What does "include" mean
You didn't answer that
#include
yes. Carries over
ok 😃
@still forum Does it involve adding every item to a crate and then checking the cargo, and parsing the output? Because that's the only way I can think of.
no
Arsenal stores it's classnames after it loaded
Check the contents of the bis_fnc_arsenal_data variable. After opening the arsenal atleast once
Would the code be copyToClipboard str bis_fnc_arsenal_data?
@still forum So I did hint format["%1",bis_fnc_arsenal_data]; and it returns "Any"
After opening the arsenal atleast once
Whoops my bad was opening Ace arsenal
Lol it maxes out copyToClipboard
Yeah im looking in n++ and it cuts off right at 8192 characters
error line 112
Only problem with this data is it appears to be classname only
not display name
GEIE
To get displayName configFile >> "CfgWeapons" >> _x >> "displayName"
for weapons. And CfgMagazines and CfgVehicles for magazines and backpacks
I can always split it, luckily the array is already catagorized by tabs
heh cool it works
A little excel magic and baby you got a table cooking
[
[ [], [], [] ], // Weapons 0
[ [], [], [] ], // WeaponAccessories 1
[ ], // Magazines 2
[ ], // Headgear 3
[ ], // Uniform 4
[ ], // Vest 5
[ ], // Backpacks 6
[ ], // Goggles 7
[ ], // NVGs 8
[ ], // Binoculars 9
[ ], // Map 10
[ ], // Compass 11
[ ], // Radio slot 12
[ ], // Watch slot 13
[ ], // Comms slot 14
[ ], // WeaponThrow 15
[ ], // WeaponPut 16
[ ], // InventoryItems 17
[ ], // Unique misc 18*
[ ], //Unique mags 19*
[ ], //Unique throw 20*
[ ], //Unique put 21*
[ [], [], [], [] ] // Unique accs 22*
[ ], //misc CfgVehicles 23*
[ ], // misc CfgGlasses 24*
];
*(exist only between onArsenalOpen and onArsenalClose)
What would it be for magazines cause I noticed arsenal_data select 2 gave me handguns
no idea for BI Virtual Arsenal
Oh is this for ace?
I wish Arma was more like excel
Or that it could output CSV files
Itd be a poor mans database
haha no 😄
Incase anybody wants a huge ass list of guns + classnames
I feel like a stereotypical woman with shoes
I have 601 weapons in my mod collection but yet every mission I want something different
why is triggers so painful?, is there any way to see triggers created? right now, im not even sure the trigger gets created, the markers however is getting created. also when i try out the triggers in the editor they work as intended. so either they arent getting created for some reason or they arent fire for another reason, i've set them to fire on anything aswell. so its kinda weird.
btw its a server side script, and the log output shows no errors.
Why do you even use triggers
i want to generate triggers for every bridge (at specific coordinates) in the AI waypoint path. so that the AI gets disabled right before the bridge and then velocity gets added. and that works fine in the editor. but for some strange reason it doesnt work when on the server.
if only the bridges had classname and werent terrain object i could use nearObject function. but as they arent i cant. and the only solution i come up with is using triggers
hm.. shouldnt be too hard to make custom classnames for the bridge p3ds right?
however this IS working in the editor.
_trigger = CreateTrigger ["EmptyDetector", _obsPos, true];
_trigger setTriggerArea [30,30,3, false];
_trigger setTriggerActivation ["ANY", "PRESENT", true];
_trigger setTriggerStatements ["this", "_trp setFuel 1;
_trp setVehicleAmmo 1;
_trpD disableAI 'MOVE';
_vel = velocity _trp;
_dir = direction _trp;
_speed = 20;
_trp setVelocity [
(_vel select 0) + (sin _dir * _speed),
(_vel select 1) + (cos _dir * _speed),
(_vel select 2)];", "_trpD enableAI 'MOVE'"];
but even the most simplified TriggerStatement with hints wont fire. so its not the statements. it must be that it isnt being created somehow or maybe wrong pos.
Is there an easy way to break the windows of every building that has breakable windows?
https://community.bistudio.com/wiki/setHitPointDamage could be perhaps be used
just need to figure out what if theres glass hitpoints to break
Any magical thing i need to do to get setParticleParams working?
params ["_class", ["_interval", 0.1]];
if !(isNil QGVAR(cloudDbg)) then {
deleteVehicle GVAR(cloudDbg);
};
private _pos01 = player modelToWorld [0, 10, 1];
_source01 = "#particlesource" createVehicleLocal _pos01;
_source01 setParticleClass _class;
_source01 attachTo [player, [0, 10, 1]];
GVAR(cloudDbg) = _source01;
private _data = [_class] call FUNC(cloudletExport);
(_data select 0) set [0, "uwotm8"];
_data set [11, [500]]; // Size
_data set [13, [0.5]]; // Speed
_data set [6, [0, 200, 0]]; // Velocity
_data set [4, 10];
_source01 setParticleParams _data;
_source01 setDropInterval _interval;
_data
Put some values on bullshit stuff just to see if it worked... nope
There are on vehicles
how would go about having a addAction only only show up for only the zeus using the condition parameter?
assignedCurator
ah k thx
to be honest, assignEDcurator is not listed in https://community.bistudio.com/wiki/Category:Scripting_Commands_Arma_3
all I get are
getAssignedCuratorLogic
getAssignedCuratorUnit
assignED curator page doesn't exist
https://community.bistudio.com/wiki/assignCurator does
throws 🍪
weee
i just used getAssignedCuratorUnit 😛
Yeah. It's getAssignedCurator. Instead of assignedCurator. All hail BI's consistency
fun times,why cant there be a isCurator I just want to have a action menu be only usable by zues 😦
zeus*
Because why add a useless command
you already have a command you can use to do the same
@edgy dune if (player in allCurators) then {} ?
That's a weird way of saying if false then {}
allCurators is the logics, not the units assigned to it
player in (allCurators apply { getAssignedCuratorUnit _x })
that is a note on the wiki page. Should probably be in description
Man.. You guys have so many bad ideas 😄
!isNull getAssignedCuratorLogic player
/care about zeus, don't even know the commands 😦
Oh look. It does exist
no bulli mr furry
it's a BIS fnc
the page is... clean?
lol
You literally just have to CTRL+F for assignedCurator The first one is the solution
I don't get why people just ignore the first and directly jump to the second. Which does something completly different
private ["_curator","_logic","_curators"];
_curator = _this param [0,objnull,[objnull]];
_logic = missionnamespace getvariable ["bis_functions_mainscope",objnull];
_curators = _logic getvariable ["bis_fnc_curatorInterface_curators",[]];
_curator in _curators
heh, no more info
and the code is different in both
/*
Author: Karel Moricky
Description:
Return if given object is curator logic
Parameter(s):
0: OBJECT
Returns:
BOOL
*/
private ["_curator"];
_curator = _this param [0,objnull,[objnull]];
gettext (configfile >> "cfgvehicles" >> typeof _curator >> "simulation") == "curator"
hahahahaha, where is this one
^ this one is defined in functions_f_curator\curator
the other in functions_f\curator
@edgy dune : player in BIS_fnc_listCuratorPlayers should definitely do it 😉
@lone glade I wonder how it goes when you call it "like that"
why exactly does BI not follow the a3 format:
private _curator = blah;
//vs
private["_curator"];
_curator = blah;
because it was written before private varname was allowed
one is probably made before pa.... oh wait there's param in there
because old
param is younger than private _var isnt it?
nope
older*
then yup 😄
i guess maybe at one point they did a regex for this select or something
@Dedmen ok, so now i have removed other eventual conflicting scripts from the equation, i can now tell that my triggers IS spawning on the server by using "allMissionObjects "EmptyDetector". so i see all 5 triggers are there, but still wont fire when passing trough them, still with the setTriggerActivation to ANY,PRESENT and i have tried both true and false on the Global/Local state. im out of ideas for now..unless its something with the forEach loop, could the variable name of the trigger doesnt really matter when it executes within a script right? or do it have to be unique for every trigger created?
yes
im connecting to the server 😛
and if your hint is only executed on the server then you can obviously not see it if you are not the server
That is why self-hosting works but dedicated doesn't
but its not only the hint in the statements
its not undefined, its the variable of the CreateVehicle earlier in the script
and _trpD is the driver
Variables only carry over to lower scopes. Aka when you call a script
the trigger statement is a new script instance
nothing carries over to that
yeah
hm, how could i pass it to the trigger? with setVariable?
yeah. for example that
and make a unique one
that explains alot
@Dedmen so if i use
_trp setVariable ["transporter", _trp, true];
and then use the "transporter" variable within the triggers it could work?
no
you need to use getVariable
Setting the variable on the thing you don't have but want to find won't be of much use
as you cannot getVariable it off again if you don't know what it is
ah ok. so i would use getVariable to fetch the value of _trp first, and then set a new one with that value?
this is confusing
yeah sure you could do that. Don't understand it's use though
all i want is to be able to use the local script's variables WITHIN the trigger statements 😛
setVariable onto the trigger object
you can use thisTrigger inside the statement to get the trigger
and then get the variable back from the trigger
why the true at the end though?
why do you need it global if the trigger only runs on server
public?
oh
so thats what global is?, is it like broadcasting between clients, not on server, and local is only that particular client, and server is yeah well server?
that part has always confused me
ah ok
but as the script is only running on the server it doesnt need to broadcast it then?
sorry if im a pain in the ass, but im spending all my time in getting into arma3 scripting, i am reading alot on forums and biki aswell as you guys here, i have learnt alot, but some things are still confusing 😛
@winter rose ahhh thx
will that particular variable be able to call with thisTrigger[3]? i guess the variable gets added to the array when you create the trigger, or how do i fetch the value after i have stored it in the trigger ? 😛
or is something like thisTrigger Transport enough?
i have now tried setting variables to a trigger in the editor, but i cant seem to fetch them, what am i doing wrong here?
_trigger = CreateTrigger ["EmptyDetector", [7198.262,11039.27,0], true];
_trigger setVariable ["vehc", transport3, false];
_trigger setVariable ["tD", transport3D, false];
_trigger setTriggerArea [30,30,3, false];
_trigger setTriggerActivation ["ANY", "PRESENT", true];
_trigger setTriggerStatements ["this", "
thisTrigger vehc setFuel 1;
thisTrigger vehc setVehicleAmmo 1;
thisTrigger tD disableAI 'MOVE';
_vel = velocity thisTrigger vehc;
_dir = direction thisTrigger vehc;
_speed = 20;
thisTrigger vehc setVelocity [
(_vel select 0) + (sin _dir * _speed),
(_vel select 1) + (cos _dir * _speed),
(_vel select 2)];
", "thisTrigger tD enableAI 'MOVE';"];
The statement works if i just use the transport3 variable, its thisTrigger var i have problem with
i dont know how to get the variable after storing them in the trigger. i've googled far and wide, about thisTrigger, but cant find anywhere on how to get data out from it other than "you can then use thisTrigger, to get your variables" but nothing precisely on how its done. should i count the vars in the trigger itself so its like thisTrigger[3] or something?
getVariable?
yeah just, looked at that, so i should make like thisTrigger getVariable "vehc" then i guess?
@winter rose hm apparently passing objects into the trigger array, doesnt work, as the statement just see it as a value and not the OBJECT itself. so it errors out on wrong type
I am really not sure what you are trying to do here
for the 3rd day in a row, im still working on a AI bridge clearance script. and the script will be running serverside , so i have for example _trp which is the unit itself, anbd the _trpD which is the driver unit. as soon as i try to call these variables within the trigger they are undefinied, so by talking to Dedmen i got advised to store the variables in the triggerobject itself and then get them with thisTrigger, however, now it errors out because on the statement functions the expected type is wrong. it is expected OBJECT but it is an ARRAY. so im not sure where to go from here
in direction, where is no triggers.
the statements themselves work. if i use public variables, but i just want the trigger to use the variables defined within the script's scope
@meager heart ?
triggers 🤢
_trigger = CreateTrigger ["EmptyDetector", [7198.262,11039.27,0], true];
_trigger setVariable ["vehc", transport3, false];
_trigger setVariable ["tD", transport3D, false];
_trigger setTriggerArea [30,30,3, false];
_trigger setTriggerActivation ["ANY", "PRESENT", true];
_trigger setTriggerStatements ["this", "thisTrigger getVariable 'vehc' setFuel 1;
thisTrigger getVariable 'vehc' setVehicleAmmo 1;
thisTrigger getVariable 'tD' disableAI 'MOVE';
_vel = velocity thisTrigger getVariable 'vehc';
_dir = direction thisTrigger getVariable 'vehc';
_speed = 20;
thisTrigger getVariable 'vehc' setVelocity [
(_vel select 0) + (sin _dir * _speed),
(_vel select 1) + (cos _dir * _speed),
(_vel select 2)];", "thisTrigger getVariable 'tD' enableAI 'MOVE';"];
for reference the transport3 value is the vehicle itself created with createVehicle
maybe i should just use nearestObject and use that value as reference instead of trying to push a variable trough the trigger
setPlateNumber can be used from server side?
you can define in the statement " vehC = thisTrigger getVariable 'vehC' " yes
ok getVariable is the wrong type, i cant for example setfuel 1 to transport3 if its not an OBJECT, how can i make sure the reference being correct?
i have also tried with nearestObject [getPos thisTrigger, ['vehicle_classname'_goes_here'],30] setFuel 1;
throws the same "set fuel Type ARRAY, expected Object"..
is there a way to convert array values into objects?
no wait, it's all wrong here. when it says object, it means a game object
transport3 - you want to set fuel to it? then it's a vehicle. define transport3 to be a vehicle
so you can't convert array values into objects, this simply doesn't make sense.
what you should do (besides not using triggers):
trigger setVariable ["myVehicle", veh];
// then in the trigger statement
(thisTrigger getVariable ["myVehicle", objNull]) setFuel 1;
hm ok
can i define more than one variable to the trigger?, for example the AI_driver aswell?
is it the same there objNull?
objNull is the default value the getVariable command returns -if- the variable could not be found
aha
also, from the documentation: https://community.bistudio.com/wiki/setVariable
Triggers are not referenced as supporting setVariable.
but maybe it finds itself under Object, I don't know for sure.
can you setVariable without error?
yup
and getVariable? try something simple, remove the rest
@winter rose i think that did the trick, thanks!
you're welcome
World would be such a better place if people could read the wiki
@obsidian chasm they kinda pointless...
no 😄
something else what lol
some options ?
you are the one who said they are pointless though..
correct
This is just trying to break your own neck just to be able to use triggers
what should you use instead?
^
triggers are good for all 3den-made missions, but I invite you to drop them whenever possible
i wouldnt know how, only started doing stuff a little while back
If you can just use triggers. Then just do
But almost breaking your own neck just to somehow make triggers somewhat useable.. Is just dumb
im just trying to add something new every time
i mean my missions arent very complex anyway lol
i just make them for me and my friends
somehow 300+ people subbed to it 🤣
_unit = cursorTarget;
if (alive _unit AND !captive _unit AND side _unit == civilian) then{
_unit addEventHandler["FiredNear",{
hint format ["1%",(_this select 0)];
selectrandom [
([_unit, "ApanPercMstpSnonWnonDnon_ApanPknlMstpSnonWnonDnon"] remoteExec ["switchmove", 0]),
([_unit, "ApanPercMstpSnonWnonDnon_ApanPpneMstpSnonWnonDnon"] remoteExec ["switchmove", 0]),
([_unit, select random ["ApanPercMstpSnonWnonDnon_G01","ApanPercMstpSnonWnonDnon_G02","ApanPercMstpSnonWnonDnon_G03"]] remoteExec ["switchmove", 0])
];
}];
};
why is (_this select 0) a number? is supouse to be a Object
That selectRandom is not how scripts work.
you selectRandom between nil,nil and syntax error
And that format string is not how format works
Everything but the first 3 and last 3 lines is wrong.
so bulli
last 3 lines lol
Well atleast the number of braces/brackets is correct. That's something.
Well somewhat correct. The line with format has one pair of () too many
if (alive _unit AND !captive _unit AND side _unit == civilian) then{
_unit addEventHandler["FiredNear",{
hint format ["%1",(_this select 0)];
_unit = (_this select 0);
selectrandom [
[_unit, "ApanPercMstpSnonWnonDnon_ApanPknlMstpSnonWnonDnon"] remoteExec ["switchmove", 0],
[_unit, "ApanPercMstpSnonWnonDnon_ApanPpneMstpSnonWnonDnon"] remoteExec ["switchmove", 0],
[_unit, select random ["ApanPercMstpSnonWnonDnon_G01","ApanPercMstpSnonWnonDnon_G02","ApanPercMstpSnonWnonDnon_G03"]] remoteExec ["switchmove", 0]
];
}];
};
now it is working
no it's not ^^
your selectRandom is still broken
and the syntax error is still in there
and the braces are still too many.
and you could move the _unit line one higher and use it in the format. Instead of calling the same _this select twice
why i am not seeying thoses?
@astral tendon select random → selectRandom
Have fun fixing that ^^ Goodnight
Yeah, allot of fun.
have a good night! see you tomorrow :p
selectRandom [hint "1",hint "2",hint "3"];
yeah i notice that was only selecting 3
fak me clockwise
I was testing to do that and i would later on put a condition to check before a new animation like unitReady
though, i just dont know what to do with selectRandom , since the exemple in the wiki dont have anything like that.
if (alive _unit && {!captive _unit} && {side _unit == civilian}) then {
_unit addEventHandler ["FiredNear", {
params ["_unit"];
hintSilent format ["%1",_unit]; //--- debug hint ?
private _randomAnimation = selectRandom [
"ApanPercMstpSnonWnonDnon_ApanPknlMstpSnonWnonDnon",
"ApanPercMstpSnonWnonDnon_ApanPpneMstpSnonWnonDnon",
"ApanPercMstpSnonWnonDnon_G01",
"ApanPercMstpSnonWnonDnon_G02",
"ApanPercMstpSnonWnonDnon_G03"
];
[_unit, _randomAnimation] remoteExec ["switchmove"];
_unit removeEventHandler ["FiredNear", _thisEventHadler]; //--- need remove this EH ?
}];
};
@astral tendon hint selectRandom ["1", "2", "3"]
also google lazy eval, Roque_THE_GAMER
what ?
when i copy your code it put some spaces that put another one automatically
oh lol press TAB 😀
oh thats nice
does the EAST side have a name like GUER is called resistance?
opfor
str east gives "EAST"
you have
OFP: west, east, resistance
Arma (2?): blufor, opfor, independent
assuming the type is side
I am talking about string'ed sides - like format ["%1", west]
this will give you "WEST", as str blufor will
ya
blufor, opfor and independent are just aliases according to wiki
yup
Anyone have an idea how to open rear doors on an RHS_Mi8
JNF_GovHeli2 animateDoor ["ramp_anim", 1];
JNF_GovHeli2 animateDoor ["door_rear_source", 1, false];
Thankyou!
What's that bi function that rotates the camera around some ao before the start of missions?
Like UAV cam
Thanks
be just informed it must be used with spawn, not call.
So I am wondering if I am going about this the wrong way. What I'm looking at is creating a container full of stuff that can be unloaded and moved around via ACE interact, and one of the objects can be activated which then creates a Teleport from the main base.
To do this I have the following scripts and where they run
Crate setup/creation (server) -> calls object settings (clients)
Addaction script (client) -> calls teleport creation (addaction and markers) (clients) + create teleport pole (server)
5 scripts in all for one simple idea. Is this right?
I mean it works. But seems overly complicated.
you can fill a crate from the server, afaik
you can also have "everything" serverside. remoteExec the addAction from client->server.
The actual executing the action is the only thing that needs to be on client I think
Yeah. That's how I "push" the ace settings by remoteexec the second script file.
I couldn't see how to just have everything in the one file
well you can put multiple scripts into a single file if you wanted to. But that would get messy/chaotic
Hmm
Dedmen
I was thinking, and do u know how inArea works ?
So inArea 30 would basically be like, x > x2-30 && x < x2+30?
No
I mean
inarea with a square of 30 meteres
How does it check it
Does it use pythagoras?
How does it work?
Pythagoras for a square? Isn't that only triangle?
yeah, but how does it know it's in that area?
for distance between 2 points, it's pythagoras
topLeft = center-[a,b,0]
bottomRight = center+[a,b,0]
return objectPos2D > topLeft && objectPos2D < bottomRight
atleast for angle==0
if the square is rotated.. uh.. ¯_(ツ)_/¯
How about circle, does it use cosinus and such?
I guess
okay
That's how I would do it
exactly
I guess for rotated square
You can always just calculate 4 positions
And check for those
Interesting stuff, food for thought 😄
or distance, or distance2D
That's ez. Get point a get point b, make a triangle between them, use pythagoras
It's just inarea is faster, therefor it should be less complex for computing, so I wanna know how they do that
faster than what?
distance
you have
a, b,
c = (sqrt (a² - b²)) ... Holy crap.. maffs. Gimme a minute
yea, all that 2 and sqrt cost
https://math.stackexchange.com/questions/190111/how-to-check-if-a-point-is-inside-a-rectangle Have fun :D
I'll try to scribble down what Arma does
if isRectangle is true.
p1 = center + [cos angle * a, 0, sin angle * a];
p2 = center + [sin angle * b, 0, cos angle * b];
p3 = p1 - center;
p4 = toTestPos - center;
p3size = magnitude p3 (x*x+y*y+z*z That's magnitude right?)
test = (p3 * p4) / p3size;
if (test < -1 || test > 1) return false;
p3 = p2 - center
p3size = magnitude p3;
test = (p3 * p4) / p3size;
if (test < -1 || test > 1) return false;
return true
I think that's correct ish.
if isRectangle is false
func sizexy(vector){
p = x*x+z*z;
return p * InvSqrt(p);
}
c = sqrt (a²-b²);
diff = [cos angle * c, 0, -sin angle * c];
p1 = center - diff;
p2 = center + diff;
t = sizexy(toTestPos - p1) + sizexy(toTestPos - p2);
return t <= 2.0 * a:
Don't ask me. I don't understand this 😄
@queen cargo Y u delete 😮
well you can put multiple scripts into a single file if you wanted to. But that would get messy/chaotic @still forum so I read that as I'm probably doing things the right way just about.
Probably not the best code of course but it works.
If u inted coding ever again, just make separate files, more reusability and if u need something in future, u can just get the exact script and add it
@still forum - what editor do you use for scripting? Notepad++ or something else?
Visual Studio Code also has SQF support if you want
Notepad++/Atom/VSCode
sublime 3 ^
quick stuff in n++. Bigger projects in Atom
Only recently started using VSCode and didn't have any big SQF projects since then to use it for
"bigger projects"
crashes on "large" files 😄
lmao
@still forum wanted to edit but missclicked ... (was in train and rewrite did not came through so ... fuck it)
short version: works the same way as in rectangles, and afterwards you just check if it is in the correct triangle
theoretically there also still is arma.studio in the realm of code editors
though ... i kinda dropped it as nobody uses it or contributes
Yeah. Wanted to mention that too. But it's not really useable as it's not polished enough
it is damn usable
just outdated as hell
last update fixed the nasty problems with auto-complete
now it just would need more into the auto-complete and stuff like code folding
middlemouse click to close tabs? Drag tabs out into new window? proper autocomplete like in Atom/VSCode? 😄
It needs a lot more work
but why implement if nobody bothers?
^ exactly
draging out tabs into new windows? works
middlemouse to close? works too
both was in ArmA.Studio since it was released
linting inbuilt? yes
for configs too? yes
preprocessor support? not yet but mainly due to not being able to keep the offsets, could be implemented easily if that was not a thing
open source? sure
but nobody is interested thus i do not waste my time to further implement new features
same thing will probably happen with sqf-vm
for me it's just annoying to use different editors for things
It's why i quite like atom, because it has support for most things i need. I tried VS Code as well and it's okay but i did much prefer atom still
I'm so confused, my players seem to sometimes not spawn with their primary weapon, whereas this has never been an issue before on my mission.
@peak plover For how to implement, I did this long ago before inArea or params: https://pastebin.com/pr6r0E3h . For how to do. For a rotated rectangle and a point, basically compute the points relative position to the rectangle (e.g. so the center of the rectangle would be (0,0) from the perspective of the point). Then rotate the point same as angle, now the point is relative to a rectangle centered on (0,0) at 0 angle. Then it is a simple matter of checking if the X and Y of the point is in the box.
🙀
would someone be willing to point me in the direction of functions or methods for reducing a players explosive charge count by one, in multiplayer?
c4 ?
explosive charge
Vanilla plz
i saw that, was worried it would remove all of the item. does it only remove qty 1?
yup
Considering there is removeItems which is plural
awesome thank you guys.
Why would there be removeItem and removeItems if both remove multiple items ^^
Why would there be getDammage and damage, if one is just wrong?
Real question is why TF do they have a command to remove 1, a command to remove all of a given class, rather than just the command to remove X
Probably some backwards compatibility or something
these don't exist
Because the commands were made when you couldn't carry two hundred items, i.e when the inventory system made sense.
wiki says they are Arma 3 though
Agree. From memory any of the *item* commands are Arma 3.
Dammit how to make literal '*' around text
\*
Really.. Discord supports escaping, but not even quoting.
In arma it would be **
Hm? What are asterisks used for in Arma?
one day, one day we'll get quotes
@strange urchin nothing. Was a joke
Multiplication.
it should be × really 😄
Yeah, I never understood that. Dumb typewriters.
ASCII too
You don’t really see an × for multiplication after grade school anyway
We need a LaTeX for Unicode. (just the commands I mean)
Here it's never used. Just the dot.
It’s called Alt-Codes
is removeItemFromBackpack global or is there a function for that. i cant find one

