#arma3_scripting
1 messages · Page 327 of 1
I would blame ```sqf
waitUntil {currentWeapon player == ""};
player playMove "Stand";
Maybe it recoqnises no weapon and playMove "Stand" stops weapon from going away?
Animations can't change the selected weapon and currentWeapon should report "" if the weapon was put on back successfully.
didnt work
Hm...
it works fine in game.
but not where i want it 😦
im calling it from the core/init.sqf
ill take a ss of what its doing
mission start?
yeah
player switchMove "FXStandDip";
0 cutFadeOut 5;
[] spawn {
sleep 2;
player action ["SwitchWeapon", player, player, 100];
};
waitUntil {currentWeapon player == ""};
player playMove "Stand";
I tested that, thats not the issue.
private _missionDone = false;
while {!(_missionDone)} do {
if ((_x distance art) < 10) then {
cash=cash+2500;
(uiNameSpace getVariable "myUI_DollarTitle") ctrlSetText format ["Money: %1",cash];
hint "Award for your efforts 2500$";
_missionDone = true;
}foreach playableUnits;
sleep 0.5;
}
its called just before the init for that specific side
is it good?
"private _missionDone = false;
while {!(_missionDone)} do {
if ((_x distance art) < 10) then {
cash=cash+2500;
(uiNameSpace getVariable "myUI_DollarTitle") ctrlSetText format ["Money: %1",cash];
hint "Award for your efforts 2500$";
_missionDone = true;
}foreach playableUnits;
sleep 0.5;
};"
Type"private _missionDone = false;
while {!(_missionDone)} do {
if ((_x distance art) < 10) then {
cash=cash+2500;
(uiNameSpace getVariable "myUI_DollarTitle") ctrlSetText format ["Money: %1",cash];
hint "Award for your efforts 2500$";
_missionDone = true;
}foreach playableUnits;
sleep 0.5;
};"
tildeX3 sqf // starts with sqf syntax
tildeX3 // ends code
Yeah
//private _missionDone = false;
while {!(_missionDone)} do {
if ((_x distance art) < 10) then {
cash=cash+2500;
(uiNameSpace getVariable "myUI_DollarTitle") ctrlSetText format ["Money: %1",cash];
hint "Award for your efforts 2500$";
_missionDone = true;
}foreach playableUnits;
sleep 0.5;
};//
```sqf
blah
```
@peak plover try adding waitUntil {getClientStateNumber > 9};
at the beginning of the script
while {!(_missionDone)} do {
if ((_x distance art) < 10) then {
cash=cash+2500;
(uiNameSpace getVariable "myUI_DollarTitle") ctrlSetText format ["Money: %1",cash];
hint "Award for your efforts 2500$";
_missionDone = true;
}foreach playableUnits;
sleep 0.5;
};```
It looks pretty fucked tbqh
`sqf
Well show me some version of it which is not Fucked
private _missionDone = false;
while {!(_missionDone)} do {
if ((_x distance art) < 10) then {
cash=cash+2500;
(uiNameSpace getVariable "myUI_DollarTitle") ctrlSetText format ["Money: %1",cash];
hint "Award for your efforts 2500$";
_missionDone = true;
}foreach playableUnits;
sleep 0.5;
};
That forEach is just wrong
@simple solstice There is not difference in scripts?
Well tell me how to fix it or show me a better script
I'm pointing out the errors. And that syntax is broken.
Pointing out errors well tell me how to fix them
Takes time, you have to concentrate
Ok
Idk. It's impossible to tell what should happen, because it's so badly written.
Well I want a player on an dedicated server to be 10 m from an crashed heli and there for get money to that player near the geli
heli*
waitUntil{
if ((_x distance art) < 10) exitWith {
{
cash=cash+2500;
(uiNameSpace getVariable "myUI_DollarTitle") ctrlSetText format ["Money: %1",cash];
hint "Award for your efforts 2500$";
_missionDone = true;
}foreach playableUnits;
};
(_missionDone == true)
};
@little eagle Is this in any way better?
Probobly better to add as PFH or something as this mission will most likely have more than 1 loops
No not life server more like an wasteland server more in that way
it is from an randomly generated mission script
Also I've never used uiNameSpace for money
It's just a control
I'd save in profilename space with a key generated by a server to see if it should reset. Also save the value on the server and if it's out of sync then reset it
This is not really a SQF question. Should ask the wasteland devs on how to add money in their mission.
The forEach loop still makes no sense. This is not how you use forEach
//Mehh
private _missionDone = false;
while{true}do{
_nearPeople = nearestObjects[(getpos art),["MAN"],10];//Finding all the players near the object.
waitUntil{(count _nearPeople) > 0};
//Should only add the cash if players are near and the mission has not been done.
if(!_missionDone)then{
(uiNameSpace getVariable "myUI_DollarTitle") ctrlSetText format ["Money: %1",cash];
hint "Award for your efforts 2500$";
_missionDone = true;
{cash = cash + 2500}forEach _nearPeople;
};
};
but yeah, you might need to create a mini function on the client to remoteExec from the server to add the cash
Kappa should read up on how global variables work.
{cash = cash + 2500}forEach _nearPeople;
I don't think this works as intended.
So @ivory vector this script is not "fucked" as @little eagle said mine was?
Why uiNameSpace? Just use player setVariable ["cashmoneydolladollabillyall",100,true];
Ask the devs.
Well my script was bad so I am wondering if yours is going to work?
Or is going to be better then mine atleast
Prob not, i dont know what its trying to do and whether its server or client
{cash = cash + 2500}forEach _nearPeople;
^ this is still just wrong
how does wasteland handle money ?
While {true}do{} <<< never this
I'd always leave a way to leave the loop
While loops are harsh
I don't think this script can be fixed. It would have to be rewritten completely. And you'd need insight on how the wasteland mission handles money.
thats why I have the waitUntil, so it only runs if people are here.
Well I have made my own money system that is the thing with (uiNameSpace getVariable "myUI_DollarTitle")
why not waitUntil {blabla;(false)} instead? Because when people are there it will be running the while loop more than once every frame
Ok check this out
Also
waitUntil{(count _nearPeople) > 0};
This means it will never check again to update _NearPeople
While {true}do{} <<< never this
I'd always leave a way to leave the loop
Of course you can do it. Simple exitWith -> Done.
If I don't need to check or do something more than once a frame I don't use while
If I need something to run more than once a frame I use while, but this is rare
There is barely a reason, to check anything each Frame, unless it's UI / draw3D stuff oO
Can someone just show me a script that works, I am confussed by all the new codes and commads
Yeah the new stuff is rarely used
private _missionDone = false;
waitUntil{
// check for people near art
_nearPeople = nearestObjects[(getpos art),["MAN"],10];//Finding all the players near the object.
// If there are people near the point give them money
if(!_missionDone && ((count _nearPeople) > 0))exitWith{
{
2500 remoteExec ["nig_fnc_addMoney",_x];
}forEach _nearPeople;
_missionDone = true;
};
(_missionDone)
};```
I'd do something like this
And this script adds money to players that are there so not alll players or only admin or server get cash?
Thanks everyone for help ❤
It remotely executes the function nig_fnc_addMoney on clients where a member of _nearPeople is local. This will most likely be the first man within 10 distance from art
There are issues with this
Because why would you even check for multiple people if it will fire as soon as 1 guy is in there
You could check for people in 5 distance range and then give money to everyone in 25 distance range
Also you must make a function which you should call fern_fnc_addMoney
Alright, can you tell me the issues so I can work around them?
alright
fnc got i t
Scripting is a lot of fun, you should experiment a lot
Also like 90% of things you think of have already been made
ik, but I want to get results aswell as experimenting
but I cant find things that I need on google.se but you have been to big help 😃
I find examples of literally everything I think of. It's hard to be original. But this is good, because it's easy to learn. But this is bad, because you can learn something that's not the best
Just google [my scripting idea] arma 3. For ex. Car unfilp script arma 3
@peak plover Fern_fnc_addMoney = {cash=cash}; will that work as an good fnc?
no 😄
What would?
//inside fn_addMoney.sqf
params ["_money"];
(uiNameSpace getVariable "myUI_DollarTitle") ctrlSetText format ["Money: %1",(cash + _money)];
Something like this
Alright thanks
You can just look at some other peoples missions to see how functions work
It's pretty much spending more time to get started, but it's a lot cleaner and better
On big projects it can really save time
Pretty much if you have to use something more than once, make it into a function
repeating code is usually useless
Ohh ok
2500 remoteExec ["Fern_fnc_addMoney",_x]; will that really work?
with 2500 in front?
https://github.com/ferstaberinde/F3 << there are functions used in this mission
Ok, I will show you how to answer questions instead of answering this one
Type in google "arma 3 remoteExec"
You will most likely find this page http://i.imgur.com/VSRsT6C.png
And on the first link you can find anything about the command remoteExec
https://community.bistudio.com/wiki/remoteExec
quoting myself:
Dscha - Today at 12:38 AM
Fav this page:
https://community.bistudio.com/wiki/Category:Scripting_Commands_Arma_3
+Read the examples
OpFern - Today at 12:39 AM
I have done that```
Clearly not...
Read everyhing on that page and rewrite it in a textbook to memorize it. Then have your "friends"(mom) quiz you on them every day. Then re-write all of them from head into another textbook, later check it and take a shot for every mistake you make.
Hey, do you guys have any ideas on how to make 3rd person only available in vehicles? I've been looking for a script but I can only really find 2. One of wich doesnt work and the other just works under or over certain speeds...
is there a way to check if a player has killed another unit of the east side?
EH's @tough abyss
Does anybody know which of the ALIVE functions will load up the tablet? Basically I want to add a map object to the game with an addaction to bring up the tablet
from looking in the function viewer this kinda works.... but not really
[["openMapFull"],"ALIVE_fnc_displayMenu",player,false,false] spawn BIS_fnc_MP;
found the solution.. or at least a good start: http://alivemod.com/forum/1459-alive-command-tablet-as-addaction/0#p5896
How do I check if a stacked EH exist?
theyre saved to missionnamespace
(missionNamespace getVariable ["BIS_stackedEventHandlers_XXX",[]])
So waitUntil {isNull missionNamespace getVariable ["BIS_stackedEventHandlers_XXX",[]]?
"BIS_stackedEventHandlers_XXX" being the EH's key?
@indigo snow nah I tried and I throws an error.
I might post the whole thing here since trying to halt the script is getting ridiculous...
I can't figure out what's wrong with this, please help ```SQF
hint "Click on 2 points on the map to create an AO. Said points will act as the corners of the AO."; // Notify user
openMap true; // Open map
GVAR(mapClicksNum) = 1; // Var for checking how many times the user has click on the map
_ehDone = false; // Local var for checking if below EH is done
// Add a map click EH
[QGVAR(aoPointsEH), "onMapSingleClick", {
switch (GVAR(mapClicksNum)) do {
case 1: {
GVAR(aoPoint1) = _pos; // Assign 1st click pos to var
INC(GVAR(mapClicksNum)); // +1 var to case 2 is ran
};
case 2: {
GVAR(aoPoint2) = _pos; // Assign 2nd click pos to var
_ehDone = true; // Mark EH as done
// Remove our EH to allow compatablity with custom waypoint in nev_a3_overrides
[QGVAR(aoPointsEH), "onMapSingleClick"] call BIS_fnc_removeStackedEventHandler;
};
};
}] call BIS_fnc_addStackedEventHandler;
waitUntil {_ehDone};
// Calculate stuff with points
It refuses to halt on waitUntil 😕
waitUntil {diag_log (diag_tickTime + " ehDebug");_ehDone};
Also you are using macros but instead of lazy evaluation you use switch case?
Just use 2 if's it's faster
Also _ehDone is not in the same scope as your cases
You can't use a local variable
@peak plover can you please explain "lazy evaluation"?
if (a) then {};
if (b) then {};
or
call {
if (a) exitWith {};
if (b) exitWith {};
};
Ok I changed it to an if.
You can use systemChat isntead of diag_log when debugging to get real time feedback
I already used a bunch of diag_logs.
All it really show me is that the script is not stopping on waitUntil.
If you change the variable from local to normal it should work
I'll try it and will let you know.
Related question: I remember reading somewhere that a bunch of ifs are faster because a switch will check all cases after it finds a matching one, is this true?
Fuck ```
12:58:17 Suspending not allowed in this context
Ahh there you go 😄
Yes.
Maybe waituntil is not the best thing, if you want to calcualate stuff with points make it into a function and call it from the eventhandeler
This way you keep it cleaner/faster with more things event driven. Waituntil is not really neccisary as you already have an eventhandeler
It's not that complex of a calculation, just simple geometry.
// Get X and Y of 1st point
_X1 = GVAR(aoPoint1) select 0;
_Y1 = GVAR(aoPoint1) select 1;
// Get x and Y of 2nd point
_X2 = GVAR(aoPoint2) select 0;
_Y2 = GVAR(aoPoint2) select 1;
// Calculate middle
_Xm = (_X1 + _X2) / 2;
_Ym = (_Y1 + _Y2) / 2;
I'd always use functions
/*=============================================================================\\
|respawn_fnc_wave_setup; |
| USAGE: |
| call respawn_fnc_wave_setup; |
| USED IN: |
| respawn_fnc_postInit; type selection |
| PARAMS: |
| NONE |
| RETURNS: |
| NOTHING |
|xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|
| DESCRIPTION: |
| Sets up the instant respawn script aka. "mission_respawn_type" |
| Runs the respawn_fnc_wave_serverTimer |
| NOTES: |
| Run only on the server |
\\=============================================================================*/
"respawn_fnc_wave_setup" spawn debug_fnc_log;
if !(isServer) exitWith {};
// Code begins
// Set wave respawn script as the respawn script
missionNamespace setVariable ["mission_respawn_type","respawn_fnc_wave_onRespawn",true];
call respawn_fnc_wave_serverTimer;
Only because I might need to use this more than once maybe
never know
I've spent more time documenting lately than writing anything useful. But it's fun
Saves a lot of trouble later on when things may get complicated
Dat comment art.
anyone know of a script that would just spawn waves of enimes
On a side note, Poseidon tools should really make that suspention error more obvious in the RPTs.
@peak plover was looking for a more human element
google isnt a new tool to me ha
just a tad overwhelming
when all the links go back like 10 years
@peak plover I tried that one it didnt work :/
@fallen grotto https://xkcd.com/979/
I've used this one
you have to edit it a bit because you don't have the parameters set up
Is _type going to act as a wanted string, and if it isnt preset set _type as ADD?
params [["_type", "ADD", [""]], ["_value", 0, [0]]];
Thanks will give this a go then
for objects there is objNull but idk if there is such a thing for strings other than ""
@peak plover _money is an undefined variable...
alright
@peak plover Maybe a noob question but this would go into the postinit.sqf in the mission?
No
@fallen grotto
//
//
// Variables
_spawnPos = nig_location_1;
_targetPos = nig_location_2;
_aiCount = 100;
_spawnMin = 1000;
_spawnMax = 1500;
_offensive = true;
private _unitList = [
"LOP_TKA_Infantry_Officer",
"LOP_TKA_Infantry_AT",
"LOP_TKA_Infantry_Marksman",
"LOP_TKA_Infantry_MG",
"LOP_TKA_Infantry_TL",
"LOP_TKA_Infantry_AT",
"LOP_TKA_Infantry_Corpsman",
"LOP_TKA_Infantry_Rifleman_2",
"LOP_TKA_Infantry_TL",
"LOP_TKA_Infantry_AT",
"LOP_TKA_Infantry_MG",
"LOP_TKA_Infantry_Rifleman_2"
];
// spawn a group of dudes
_gName = createGroup east;
for "_i" from 0 to _aiCount do {
_pos = [(_pos),_spawnMin, _spawnMax, 1, 0, 20, 0] call BIS_fnc_findSafePos;
_unit = _gName createUnit [(selectRandom _unitList), _pos, [], 20, "FORM"];
// fast attacker ai
if (_offensive) then {
_unit disableAI "AUTOCOMBAT";
};
};
// give waypoint to group
_wp = _gName addWaypoint [(position _targetPos), 69];
_wp setWaypointBehaviour "AWARE";
_wp setWaypointType "SAD";
_wp setWaypointSpeed "NORMAL";
_wp setWaypointFormation "LINE";
_gName setBehaviour "AWARE";
// Fast attacker ai
if (_offensive) then {
_gName enableAttack false;
};
// Add to the list of waves
_groups = missionNamespace getVariable ["nig_wave_groups",[]];
_groups pushBack _gName;
missionNamespace setVariable ["nig_wave_groups",_groups];
try this
Got it to work perfectly 😃 Thanks @peak plover
Great like I said previously
Is great examples of how to set up functions
Description.ext > f\common\functions.hpp > function
@peak plover Thank you for your help I made the Fnc add money and all that it works. Now I need to test it later with a friend to see if it adds money for him and not me.
hey i asked a similar question yesterday,but im still having issues with display control serialization. I have this in my initPlayerLocal.sqf ```sqf
call {
_capProgDisplay = (uiNamespace getVariable "captureProgress");
ctrlTitle = _capProgDisplay displayCtrl 1100;
ctrlCapPoint = _capProgDisplay displayCtrl 1101;
ctrlBar = _capProgDisplay displayCtrl 4020;
};
Sorry dude I am not the guy for this question... xD
all g, i shall wait 😃
Why do you have that in your initPlayerLocal
What are you trtying to do?
Are you trying to grab a value or change it?
Or something else
hey @peak plover, so im simply trying to store a ctrl in a var, so that i can use things like setStructuredText, setText, etc.. I have tried using this ```sqf
_capProgDisplay = (uiNamespace getVariable "captureProgress");
ctrlTitle = _capProgDisplay displayCtrl 1100;
ctrlCapPoint = _capProgDisplay displayCtrl 1101;
ctrlBar = _capProgDisplay displayCtrl 4020;
while {_pPos inArea _trigName} do {
_pPos = getPos player;
_capCt = (abs captureCounter)/40;
if (isNil "captureProgLayer") then {
captureProgLayer = "capProg" cutRsc ["captureProgress","PLAIN"];
};
if (side player == east) then {
if (capBool == 2) then {
ctrlBar ctrlSetTextColor [0.078,0.392,0.898,1];
ctrlTitle ctrlSetTextColor [0.078,0.392,0.898,1];
ctrlTitle ctrlSetStructuredText parseText "<t align = 'center' size ='1.8'>CAPTURED BY CSAT</t>";
_strTextStar = "<t color = '#1464E5' size ='3'> |G| </t>";
_strTextMid = _strTextStar splitString "|";
_strTextMid set [1, nil];
_strTextMid set [1,_flag];
_strTextFin = _strTextMid joinString "";
ctrlCapPoint ctrlSetStructuredText (parseText _strTextFin);
};
};``` in my function, yet i still get the serialization error. This is in a function that is spawned every 0.5 seconds, but the ctrls are only defined once while the loop is running, (you may not be able to set it above, but it works that way).
(findDisplay 42069 displayCtrl 421) ctrlSetText (toUpper (name _target));
_nameDisplay = (findDisplay 42069 displayCtrl 421)
That's how you are supposed to use it, that's an exmple that worked
nvm it dident work
You would have to go to your dialog
Yeah, in there grab your idd
yeah, ok will try, but i swear that it didn't work last time i tried -_-
and the idc of your text
yeah i will try that in a sec thanks
@remote flame doesn't work in mp or does not work period?
Show the function
cash=cash+2500;
(uiNameSpace getVariable "myUI_DollarTitle") ctrlSetText format ["Money: %1",(cash)];
};```
{
class DollarTitle
{
idd = 1;
duration = 999999;
onLoad = "uiNameSpace setVariable ['myUI_DollarTitle', (_this select 0) displayCtrl 101];";
class controls
{
class DollarControl
{
idc = 101;
type = 0;
style = 2;
x = safeZoneX + safeZoneW - 0.4 * 3 / 4;
y = safeZoneY + safeZoneH - 0.2;
w = 0.2;
h = 0.2 * 3 / 4;
font = "PuristaMedium";
sizeEX = 0.04;
colorBackground[] = {0,0,0,0};
colorText[] = {0,1,0,1};
text = "$$$$";
};
};
}; ```
};
ok so classes exist in SQF
I dont know what you mean
change dollartitle idd to soemthing else
wait nvm
This is how you add functions
It's a bunch of reading but it's VEERY important
And in a long run functions are EXTREMLY useful
So adding my functions I do in describtion.exe_
?*
cash=cash+2500;
(uiNameSpace getVariable "myUI_DollarTitle") ctrlSetText format ["Money: %1",(cash)];
};```
that should be in describtion.exe?
no
under cfgFunctions
that is an easy way, keeps everything organised and neat, plus it allows you to not have to worry about defining the functions, as long as the function is named correctly
it also runs better
Well I dont know how to do it since my first langugae is not english and every place is english and all the words used are advanced to me. it is more diffucult
so, functions are basically the same a scripts, butt they're allow for a better way to organise everything. They also are precompiled so they are executed faster, or are less demanding on the engine
soooo
you should try to organise all your functions in seperate folders in you missions directory, naming them with relavent names. Each function is the same as any of your scripts would be, except for the fact that you NEED to name the with the start of fn_myFunctionName.sqf
So I make functions in sqfs? not describtion.exe?
so for a script that finds the distance from the player to an object, you would name it something like fn_playerDistanceFromObject.sqf
yes, all functions and scripts should be a .sqf or .sqs (sqs) is outdated, use sqf
Ok, Do I put all my diffrent functions in one sqf or do I make sepeart sqfs?
what nigel and others were saying about the description.ext before was that you need to "define" your functions from your description.ext so that the engine knows where your functions are
i would put them in separate sqfs
ok, could you maybe make an example describtion.exe and example sqf function? So i can see it
yes
sorry, was just msging someone else. So in your description.ext file in your mission directory, you need reference all of your functions in the cfgFunctions class (this is a predefined class in arma). He is an example ```sqf
class cfgFunctions {
class mld {
tag = "mld";
class myFunctions {
file = "functions\myFunctions";
class mySpecialFunction {};
};
};
};
cfgFunctions uses inheritances, so class mld is the parent clas for class myFunctions. You could have many child classes under the class myFunctiosn class, all using different file pathnames
yeah sorta
ok, I am learning alot off this.
So you would make a function, place it in your functions folder, then you MUST reference it in your csfFuncions class. This is so that the engine knows where to find the function when you try to call it
where did you get bla from?
nowhere it was an example
ahh k
no
so when using cfgFunctions. You would call your functions using ```sqf
call mld_fnc_myFunctions;
call fnc_mld that is right?
haha almost 😃
so tag first then "fnc" then the category?
so the tag is first, then fnc, then the function name
Read this: https://community.bistudio.com/wiki/Functions_Library_(Arma_3)
It explains everything better than this chat can
^ yeah probably should have said that XD
@little eagle "Well I dont know how to do it since my first langugae is not english and every place is english and all the words used are advanced to me. it is more diffucult"
Can anyone give me some info on adding a UAV terminal to the seat of a vehicle
thanks what opFern said above so the wiki may not be so helpful that's alll
Step one is learning English then. More important than playing games any day.
harsh
But true.
but is suppose it is neccesary
I know the language english. I just dont know all the words that are used in the wiki
Use google or a dictionary.
yes, but there is alot of words that needs to be translated
I learned English also by doing "programming" for games.
you really only need the examples
@little eagle Are you suggeting that we shouldn't be spamming this chat for this topic? if so opfern, you want to voip chat for a sec?
Im trying to create a vehicle patch, that would add a UAV terminal and the jets dlc radar w/data link to a vehicle seat, essentially creating a sort of JTAC command vehicle
I'm saying that the wiki is pretty good and that it's better than anyone at explaining it than this chat.
And this chat also is English so I don't get the complaint.
@limpid pewter I am better using chat then talking english...
than*
@covert inlet which vehicle
any ground vehicle, i haven't really decided what vehicle im going to add it to
commanders seat of any old MRAP
You would have to equip the unit in the vehicle slot with a UAV terminal and also remove it again when the slot is changed.
And probably also handle the player dropping the terminal with the inventory menu to prevent cloning it.
ahh yea i was kinda worried that it would be something like that
It will be, because all that UAV terminal stuff is hard coded to the item in that slot.
so you would have to remove and store the classname of the ctab when the player gets in (cause i use ctab) add a uav terminal then swap it back over when the player gets out?
this is for a mission?
Yea for my group's repo we wanted some kind of JTAC command vehicle, that had jets DLC radar and datalink so the JTAC can monitor all the aircraft and radar reports ect, and i thought i UAV terminal would be cool as well
here is what I'd do
- add getIn / seatSwitched eventhandlers to the vehicle that hand out the UAV terminals and store the previous GPS slot item in a variable on the player unit
- the script also adds a loop that checks like every second if you're still in that vehicle and in that slot
- if not, then remove the UAV terminal and give back the old item
and end the loop
Dunno about how to handle dropping the terminal by using the inventory menu when inside...
But if it's for a private group, no one will abuse it, right?!
Greetings gentleman , have i got the syntax right ?
player setCustomAimCoef 0.2;
player enableFatigue false;
player addEventHandler [
"respawn", {
player setCustomAimCoef 0.2;
player enableFatigue false;
}
];
player addEventHandler [
"TeamSwitch", {
player setCustomAimCoef 0.2;
player enableFatigue false;
}
];
TeamSwitch is not an object eventhandler
player setCustomAimCoef 0.2;
player enableFatigue false;
player addEventHandler [
"respawn", {
player setCustomAimCoef 0.2;
player enableFatigue false;
}
];
how about now ?
Well, TeamSwitch is still not an object eventhandler, but now your code at least has no lines that do nothing.
But whats up with the spaces?
Yeah, I just threw up... in my pants...
@little eagle lol
well this is why http://i.imgur.com/XkMYaEt.png
@little eagle brilliant , thank you sir 😄
is that the runescape editor?
It says "Atom", but I am not familiar with that gui.
Yeah thats Atom, looks very different to mine though. Whats the issue with it exactly?
The red squiggly lines are interpreted as syntax errors by us, but the syntax is fine.
Hmm weird, I use https://github.com/acemod/language-arma-atom with Atom, but not sure if thats got anything to do wit hit
@warm gorge are your shure, that Atom really use SQF-Syntax for this file?
What do you mean?
that's how your Code look at my Atom installation
i use Atom 1.18.0 and the same Package for Syntax as you
any scripters here able to help me change the way ai look?
@fallen grotto "look" ?
yeah uniforms and such
i dont want the random ai
to look like police like they currently do
@subtle ore
@fallen grotto please give some context.
So i have the occupation mod
and it spawns random ai in to hunt you down
and at the moment they look like police
I want to change them to look like banits
Oh god, don't tell me it's this shit: http://www.exilemod.com/topic/12517-release-exile-occupation-roaming-ai-more-updated-2016-08-15/
Why don't you read it a bit before anything else
okay thank you.
how can I init a player (in multiplayer) to a side?
That sentence is ill constructed.
I guess you're asking "How can I create a playable unit on a specific side".
But I'm not sure. It could mean something else.
Not worth answering when the question isn't clear.
That could only create more confusion.
you place a unit, which belongs to a side, and set it to playable. any player can then choose to play as that unit?
i wanted two players to spawn in a dlc plane each (same plane) so I had to place them in the same team
but change the side of one of them while being inside the plane
Hey guys, I've got a probably pretty basic question: I want to whitelist these (https://pastebin.com/jTCZTsbc) classnames on an arsenal box. How would i do this?
@iron stream I guess what you want is to change the side of one player during the mission.
The way to do this is to let the unit join a group of the new side.
@jagged halo https://community.bistudio.com/wiki/Arsenal#Add
Thanks @little eagle will this just add either weapons or items or ect? or can i get it to add everything?
One function adds the weapons, one adds the items, one adds the magazines and one adds the backpacks.
It's silly but I didn't make it.
Is there like an easy script command for: All players. When scripting for dedicated servers?
Does it work in dedicated servers or just multiplayer in general?
It works everywhere, but in SP it obviously only reports an array with a single item.
ok so i would have to seperate it into those types and then add it
the stuff thats like uniforms would go in items?
You have to use the "weapon" version for whitelisting a weapon etc. Yes.
yeah
the stuff thats like uniforms would go in items?
I think so, yes
rofl thanks for the help
np yw
can I somehow enable the debug console on my server while the mission is ongoing?
No
not even via linux serverside console access? lol ok
_Bluforplayers = allPlayers select {side group _x == west}; Isn't this supposed to return all blufor players?
it's returning an empty array
that particular expression reports nothing to be exact.
Maybe there are no players on west
Does setcaptive make them civ even to the side return value?
Yes, but side group should fix that.
alright, I'm going to mess with allPlayers and see what it returns
MP?
yes
Actual connected players beside you?
0 :P
even if AI Disabled?
No.
okay
If AI is disabled, then the units temporarily don't exist
And cannot be reported by either command.
ahuh
oh pfft, god dammit. I still have this stupid problem where when I export to MP from Eden it doesn't overwrite the old file
so I need to close the game, delete the old one, relaunch it and rexport
I blame windows.
Rename with every version
Can someone explain what _this select 0/1/2 means?
[0,1,2,3,4] call {
_array = _this;// _this is the array given as parameters
_first = _this select 0; // _first will be equal to the value of the element in the location 0 in the array
_second = _this select 1;
systemChat str _second; // returns 1
};
```sqf
The elements in the array given as parameters can be anything, they can even be arrays
If you are using this in a function you would use params ["_first","_second"]; instead
Because with these you can set default values
Also faster and also makes the variables private
Ok, I think I understand thx
What is the difference in a public and local variable?
A global variable is defined on the whole machine
local variable > _first this is pretty much only available in the script at hand.
A local variable gets deleted when the script ends
publicVariable is something that is transferred across the network to all clients
So an local is just for me, and a public is for every player_
What is "Error Zero Divisor"?
_arr= [0,1,2];
_elm=_arr select 3;//zero divisor
ohhhhhhhh
basically, trying to select something in array that doesnt exist
aha ok thnaks
thanks*
@vivid quartz Do you know if spawning an object is the same as spawning an vehicle?
in script way
in what way? createVehicle returns object
doesnt matter if you createVehicle a house or a heli, return will be object
I am trying to create and script that drops supply drops at markers
so ofc I need to spawn an box
that has the loo
t
Ohh ok I see
i have one on my main pc, but iam not there atm
Ok, I want to have an heli drop it but that is very hard I think. So I am considering if I should just spawn an box already at the ground
waituntil { count allPlayers select {side group _x == west} == count allPlayers select {!alive _x}};
If I have zeus and blufor players, and I want to waituntil all the blufor players are dead, would I be doing this right?
man that's a lot of red
I am new to this but I think that "==" after "west}" is wrong
youll probably need some brackets in there, yea
also no that wouldnt do what youd want it to do
:P damn
youre basically asking if the amount of blufor alive is equal to the amount of dead players
Hey Everyone, Im trying to make a script which well get the nearest groundweapon holder and then return the class names of all the items contained inside of the weaponholder. So far i have had no luck. This is 1 of the things i have tried to make
_cargo = nearestObjects [player,["weaponholder", "groundWeaponHolder", "WeaponHolderSimulated"],3];
{
hint format["Cargo: %1 / ArrayPos: %2", typeOf _x,_forEachIndex];
{
hint format["Iten: %1 / ArrayPos: %2", typeOf _x, _forEachIndex];
} forEach _x;
} forEach _cargo;
well if the only other players are zeus and can't die that shouldn't be an issue?
yeah, use createVehicle,
_myLootBox= createVehicle [classname, getMarkerPos "my_marker", [],0"none"]; _weps=["arifle_katiba_f", "arifle_ak12_f"];
{
_mags=getarray (configFile >> "cfgWeapons" >> _x >> "magazines");
_myLootBox addWeaponCargoGlobal [_x,1]; _myLootBox addMagazineCargoGlobal [selectRandom _mags, floor(random 4)+1];
}forEach _weps;
opfern, idk something like this, replace class name with name of box
omg You are the best @vivid quartz 😘
iam on phone cant type plus cant test
Alright I understand
floor(random 4)+1 > ceil random 4
yeah, that might be better
What does that do? floor(random 4)+1 > ceil random 4
random number from 1to 4
Anyone who has an idea regarding the weapongroundholder?
what errors are you getting?
for one, youre trying to iterate an object at ... } forEach _x;
you cant do that
_clear = nearestObjects [player,["weaponholder"],3];
_clear = _clear + nearestObjects [player,["groundWeaponHolder"],3];
{
_gunclass = typeOf _x;
hint format ["%1", _gunclass];
} forEach _clear;
Tried this and it returned "Groundweaponholder"
yea that looks about right
The thing im having trouble with is how i return the items inside the groundweaponholder
the XCargo family of commands
yeah i tried getItemCargo but with no luck
@plucky beacon
waitUntil {{alive _x && side _x == west} count allPlayers == 0 };
? Maybe?
i think only 1 = is needed on side
@tough abyss why would you need to return whats inside the holder?
unless you arent creating holders by yourself
I want to first delete the weaponholder - I know how to do that
Then i want the content, the weapons and magazines what ever is on the ground to then be added into a crate
yeah, how about setvariable loot on holder?
@vivid quartz setvariable loot? What would that do?
what do you mean non stop?
@botker save an array into holder, and access it later with nearest objects
thats on you
It never stops spawning crates
script only creates one
@remote flame from where are you calling the code?
I still dont see how that would solve my problem though, maybe im just stupid.
MP
so you have multiple people?
yes it is for an dedicated server
then run it on server only
is that done with if (isdedicated) then {};
yeah
will try
initServer.sqf works aswell
is that a init file that only executes on the server?
yeah
well what is the differnce between runing on clients and servers?
If you run that script on server it will only run once, which is when the server starts.
if you use initServer.sqf
It is still shiting out cargo boxes
you cant addWeapon to server, thatd why you run addWeapon client side
or remoteExec it from server to client
and player on dedi is always null
"Hello iam server and i send this message to everyone" remoteExec ["systemChat", 0];
I think it is spawning them half in the ground. a fix for that ?
@OpFern idk how can it still spawn that many try
if !(isServer) exitWith {}; //client doesnt read
put it above crate spawning code
No, I got it to stop spawning 1 million off them
But I think the box spawns in the ground
it cant spawn in ground , marker doesnt have Z
I am using an "empty marker" under "systems in the editor" that is correct?
yeah marker types dont matter
make sure that marker name is string
so the marker name has to be "string"?
y
String: "My super cool string" Not string: My super cool NOT string
getMarkerPos ”mkr”;
it is a string
look here:
fn_arudysupplydrop = {
_myLootBox= createVehicle ["B_supplyCrate_F", getMarkerPos "supplyEvent1"]; [; _weps = ["arifle_katiba_f", "arifle_ak12_f"];
{
_mags=getarray (configFile >> "cfgWeapons" >> _x >> "magazines");
_myLootBox addWeaponCargoGlobal [_x,1]; _myLootBox addMagazineCargoGlobal [selectRandom _mags, floor(random 4)+1>ceil random 4];
}forEach _weps;
};```
I cant find any errors
and I am not getting any
your createvehicle is missing must be
_myLootBox= createVehicle [”B_supplycrate_F”, getMarkerpos ”supplyEvent1”,[],0,”none”];
What is this [],0,"none"];
@remote flame did you not even read the parameters for createVehicle ?
I did
you can use
_myLootBox = type createVehicle getMarkerPos "mkr";
but i never use it
where as type would be your classname, and getMarkerPos 'mkr' would return your marker position
(x,y.z) format
Z will always be zero btw
I'm not sure why you wouldn't. I believe getMarkerPos is the only getter command for marker positions afaik
iam just not used to it, you can do alot more with alt syntax, like spawn jets in air with "fly" state
@vivid quartz I believe you meant to say the createVehicle command, as you had initially said you did not use getMarkerPos. I would have to agree with you however that the createVehicle alt syntax is more useful
ok
@vivid quartz So I made it work it spawns and everything
BUT
It spawns with stuff in it and the stuff that you added
is there away to empty the box and then add what you want?
@remote flame removeWeaponCargo , removeItemCargo, removeBackpackCargo,removeMagazineCargo . If you are in MP then use the global variants of these commands
removeWeaponCargoGlobal
aha
thx
@subtle ore When I googled RemoveWeaponCargoGlobal
only came up "clearWeaponCargo"
is that the same?
Yep.
Does anybody know if you can nest if statements in the case condition for switch do ?
nevermind
So I have this script ```private ["_eh1","_inArea","_pos","_unit","_zone1","_zone2","_dis"];
_unit = (_this select 0);
_zone1 = getMarkerPos "zone1"; // marker name for the areas you want to protect
_zone2 = getMarkerPos "zone2";
_dis = 15; // distance from area safe zone starts
if ((_zone1 distance _unit > _dis) or (_zone2 distance _unit > _dis)) then { //check if unit is in zone when script starts
_inArea = false;
}else{
_inArea = true;
_eh1 = _unit addEventHandler ["fired", {deleteVehicle (_this select 6);}];
};
while {true} do {
if (((_zone1 distance _unit < _dis) or (_zone2 distance _unit < _dis)) && (!_inArea)) then { // check if unit enters
_eh1 = _unit addEventHandler ["fired", {deleteVehicle (_this select 6);}];
_inArea = true;
hint "Safe zone";
_unit allowDamage false;
};
if (((_zone1 distance _unit > _dis) or (_zone2 distance _unit > _dis)) && (_inArea)) then { // check if unit exits
_unit removeEventHandler ["fired", _eh1];
_inArea = false;
hint "You just left the safe zone";
_unit allowDamage true;
};
sleep 1;
};```
But it dosent work...
What does it actually do? What do you expect it to do
I want it to make an "No fire zone" for players so that you cant fire weapons or throw fratgs
frags*
one sec, reading code
alright
Are the zones circular?
yes
does whatever scripting language that this is require these braces around the not statement?
(!_inArea))
Normally I would just write this as ! _inArea
Also when you do the check to see if they have left the area. Couldn't you just do
if(_inArea) instead of having to re-write the massive if statement?
Ok
nvm, you need that
Do each of these scripts run on their own thread? if not you might be locking things up with the while {true}
does the script set in the "file" attribute of params run locally for every player who joins?
Yeah I can't imagine arma spinning up a whole new thread for each script
way too many threads
other than that the logic looks correct
Scheduled vs Unscheduled
Is that how arma handles syncing the update of these scripts?
Well, event scripts like initServer.sqf and init.sqf is all scheduled. Anything executed from that is supposed un scheduled afaik
Yeah it sounds like scheduled is what he is looking for and he should figure out how to hook into the regular update sequence and run the check logic in whatever update function arma uses instead of running in an infinite loop
Yeah generally I like to do it on a need-to-know basis and exit whenever possible.
this is a bit better explanation: http://killzonekid.com/arma-scripting-tutorials-code-performance/
I wish Arma supported C# or C++
Someday
Sqf feels like a mash sorta
if that was running unscheduled the game would just freeze i think
supposed to
easy enough to check if that is the problem though.. just add _this spawn { current code };
Hey Lecks, so I've basically riddled my code down to the following two lines:
_player addBackpack "tf_rt1523g_green";```.
Still no backpack, I don't see why the globalVariant wouldwork differently but yes I have tried that as well.
And uhh...nothing.
i guess 2 reasons it'd do nothing are a typo in the backpack class or _player being null
oh, forgot the most important part. Executed in initPlayerLocal player does return the correct player and the backpack class is correct I triple checked it in the config viewer and checked the tfar github. Tried it all
I'm so fucking stumped.
initPlayerLocal if its already in their, why pass a param for player?
I already used player, and I was just endlessly checking for whatever worked
it still returns the player that player returns.
Seeing as how SQF sometimes doesn't even want to tell me when I'm missing a semicolon 🙄
so u've diag_logged the _player in there?
Heh, yep.
You know what, I'm so done with this shit. _player returns the same player as player. I freaking switch it to player. AND you know what?
It worked.
thought so 😛
Well yes player works. _player also worked in other situations since it was passed by params. doesn't initPlayerLocal pass more than one parameter?
_this would be an array instead of an object in that case
never used initplayerlocal tbh.. don't know if it has any quirks
i pretty much always use preinit or postinit (or init event handlers in objects)
Yeah I do as well, except this time I'm just going with: "Does it work first?"
So I'm going to guess player can't be used in switch do statements? : switch((getArray(configFile >> "CfgWeapons" >> typeOf player >> "displayName"))) do {case "Squad Leader" : {player addBackpack "tf_rt1523g_green";};};
Why not if?
don't see why plaer couldn't be used in a switch
@peak plover Doing multiple cases, just can't get the one to freaking work. Doing each for types of soldiers like engineer, rifleman, but specifically one for each backpack type. Ground versus Command etc
np
🤦 I seriously can't I believe I missed that
@tardy wagon both is supported via extension
Wow @queen cargo read that far up huh?
Watched Netflix the last few hours and wanted to respond since it was posted
SQF works like a charm as soon as one understands the concept behind it
It is less a script language and more like bash
A set of specific tools that can be used to create whatever one desire to
Following a fairly simple rule set
And now days debugging sqf is more simple than ever before
Well sort of. If SQF can't pickup on a missing semi colon or a bracket it's hard to find in a ton of one line shit
Use a good code editing tool
Like what...?
You also can grasp on ArmA.Studio for actual proper debugging
Notepad++ just has highlighting
Atom, sublime and visual studio code have linting
In addition
ArmA.studio sounds promising - built around a3
Early stages still
I'll try it anyways
But usable
Sublime or visual studio code can be more useful for plain linting right now due to the linter available is checking more stuff
ArmA.Studio only starts getting useful later in development
Or when you want to debug code
I've tried sublime before and didn't like it correcting my mistakes much. I like to be able to go back and add something manually. up until this point I've been using notepad.
I'm sure you can call C++ or C# code. But there isn't really any API support for those languages is there?
Intercept adds an api you can use for c++
whats that?
Addon
link?
looks cool. I should get into developing shit for arma. I've been doing game and graphics engineering for 10+ years
Do you know if intercept provides any methods for acquiring the D3D11 device?
Probably not
@queen cargo Where am I supposed to select my workstation at here? I selected my .atlis mission but to no avail
Wow, I didn't see the wik on the github for some reason
you could do all kinds of things with it
Just local
yup
There have been people doing it though
You might better be of using sqf though
And all other stuff
Most shit already is possible using Ingame script commands and Config editing
what kind of graphics API is there?
I want low level access to the D3D11 device and immediate context
Not via SQF, sorry 😃
Is there any known way to access these?
Not that I could tell you sorry. You may have better luck with @still forum though
@tardy wagon what for
Any cool ideas that I might come up with that would involve access to those, as I specialize in graphics and low level engineering
Does anyone here know what the default marker font for markers in default map is?
@queen cargo There is a sqf linter for VSC btw?
@rotund cypress yes
Is there away to make the "cutText" command so it displays for all players?
@remote flame use
remoteExec
[0, ["My awesome text!","PLAIN"]] remoteExec ["cutText", 0];
yeah
alright thx
Just to confirm, can I use execVM outside of the init.sqf?
yes
Has someone an idea how to get the map-position of the spot where my cursor is hovering over a map control?
guys, a command to make chopper have engine on, full rpm and ready to fly?
i have engineOn but not rpm
There is no command to change the rpm.
well i saw some mission there when u just join the chopper and switch on the engine, the rpm go to the max and u get ready to fly
don't know if is a good explain
Idk, but I do know that there is no command to set the RPM.
If you want to do that on mission start: I think if you place the chopper in the air it is on full rpm. you could setpos it down on the ground again
there must be another way, i saw it with chopper on the ground and with engines off
Was it a mod? Some mod choppers are buggy and instantly go to full rpm
yes maybe was a mod
10 meters sounds too high, may break the gears or the skids
i think full rpm is only above 50-100m. set it very high and script it down again, gravity wouldnt be the best idea in my view
did anyone find a way to detect the weapon switcing animations? or weapon switching in terms of when the new weapon is ready to shoot and stuff?
i thought it's all handled like gestures but seems like they did a totally seperate engine solution without adding hooks for people to work with it. i hope i'm jsut missing something
So I got this script, I want it to spawn an crate the randomly between to markers I have placed but it only spawns one then stops.
Can you edit this and add SQF after 3 `?
Doesent work
hint "it works!";
nope
dude
_missionType1 = [_this, 0, ""] call BIS_fnc_param; fn_goissesupplydrop = {
_myLootBox = createVehicle ["B_supplycrate_F", getMarkerpos "supplyEvent2",[],0,"none"]; clearWeaponCargoGlobal _myLootBox; clearItemCargoGlobal _myLootBox;
_weps = ["FirstAidKit","H_HelmetB_desert","arifle_MX_GL_F","hgun_Rook40_F","Rangefinder","arifle_MX_SW_F","U_B_CombatUniform_mcam","hgun_Pistol_heavy_02_F"];
{
_mags=getarray (configFile >> "cfgWeapons" >> _x >> "magazines");
_myLootBox addWeaponCargoGlobal [_x,1]; _myLootBox addMagazineCargoGlobal [selectRandom _mags, floor(random 4)+1>ceil random 4];
}forEach _weps;
_Supplymarker2 = createMarker ["Supply Drop", getMarkerpos "supplyEvent2"];
_Supplymarker2 setMarkerType "mil_objective";
_Supplymarker2 setMarkerColor "ColorRed";
_Supplymarker2 setMarkerText "Supply Drop";
_Supplymarker2 setMarkerSize [1,1];
_myHint ="Supply crate have been dropped!";
GlobalHint = _myHint;
publicVariable "GlobalHint";
hintsilent parseText _myHint;
waitUntil {
_nearPeople = nearestObjects[(getMarkerpos "supplyEvent2"),["MAN"],5];
if((count _nearPeople) > 0) exitWith {deleteMarker _Supplymarker2};
};
_mySChat ="A player have reached the supply crate!";
GlobalSCHat = _mySChat;
publicVariable "GlobalSCHat";
player sideChat _mySChat;
sleep 3;
hint "";
};
_missionDetails1 = switch (_missionType1) do {
case "arudy": {call fn_arudysupplydrop;};
case "goisse": {call fn_goissesupplydrop;};
//case "Corton": {call ;};
};
nul = [] execVM "scripts\supply\supplydropfinder.sqf";
It works just fine.
Well how did you do it?
```sqf
whatever
```
No you didn't
yes I did
Well. Goissupplydrop is defined, the other one isnt.
floor(random 4)+1>ceil random 4 oh dear
Learn by doing. It's the best way.
copy pasting other peoples code is only gonna get you so far
I can't 👍 that, so here it is :+1:
strip it down bare bones, build it back up piece by piece
youll lose an afternoon or so but youll understand
That weird line is a syntax error.
The expression reports a boolean, but addMagazineCargoGlobal expects a number.
its the result of a copy paste. i meant to say he should replace the first part with the second part as a nitpick on the one who originally wrote it
you can search back for most lines in that script in this channel over the last day or two
ctrl + a
shift + del
_mySChat ="A player have reached the supply crate!";
GlobalSCHat = _mySChat;
publicVariable "GlobalSCHat";
player sideChat _mySChat;
🤔
Yup. It should be "has" because it's using the third person singular.
na, not that, i dont get the point of this code
I was kidding.
well its writing something to chat, of course
"A player has reached the supply crate!" remoteExec ["systemChat"];
Can someone help me out on a little script?```player playMove "AinvPknlMstpSnonWnonDr_medic3";
sleep 0.2;
waitUntil { ((animationState player) != "AinvPknlMstpSnonWnonDr_medic3") };
_crate = cursorTarget;
_marker = "test_EmptyObjectForFireBig" createVehicle getPosATL _crate;
_marker setPosATL (getPosATL _crate);
_marker attachTo [_crate,[0,0,0]];
sleep 5;
_marker call fnc_deleteTestObj;
deletevehicle cursorTarget;
["Stash Burned!"] spawn ExileClient_gui_baguette_show;
how are you calling this code?
@vivid quartz execVM 'SCRIPTS\burn.sqf';";
so far i just tried it only locally/server sided thru debug - so far, i just don't understand why the whole script is fired in once even tho waituntil and sleep is involved.
i dont see any problems in this, how is sleep not working
Is there any generic command I can call to solicit string input from a player?
like
_input = ["What is your name?"] call bis_fnc_input;
as soon as i exectue the script: animation starts, fire is placed, object is deleted (but fire not) and ExileClient_gui_baguette_show is spawned - this happens within 1 sec. So i was curious what would be the right way
I made a UI fella last year, not eager to get my noggin into that again 😦
ruuude
Hey guys, does anyone here know what the default font of map markers on default map is? Like this one https://gyazo.com/522583b1447a6563d70ef57454d65e9f
etelka narrow I think
you can look through cfgFontFamilies to find it yourself in future @rotund cypress
yes, etelka narrow medium pro https://community.bistudio.com/wiki/FXY_File_Format#Available_Fonts
good name for a font, very descriptive. font name adjective adjective adjective adjective adjective adjective (professional)
@rancid ruin thanks mate, I was looking through the configs like crazy, but couldn't find it. Never thought of looking through that specific config however, looked through all the map controls.
not specifically an Arma 3 question, but could just as well be:
what would be a good method to find adjacent polygons? e.g polygons representing district borders.
params [
["_amount", 0, [0]],
["_origin", [], [[]]],
["_radius", 0, [0]]
];
private _positions = [];
for "_a" from 0 to 360 step (360 / (_amount - 1)) do {
_positions pushBack (_origin getPos [_radius,_a]);
};
_positions
I've got this script (can't remember who helped me with it on here), for generating x positions around a circle. For some reason it's returning the right amount of positions, however the first one in the returned array is the same as the last. Can't figure out whats been done wrong to cause this.
params [
["_amount", 0, [0]],
["_origin", [], [[]]],
["_radius", 0, [0]]
];
private _positions = [];
for "_a" from 0 to 359 step (360 / _amount) do {
_positions pushBack (_origin getPos [_radius,_a]);
};
_positions
?
@warm gorge
@vivid quartz Cheers, that works 😃
yw ^^
did there something change regarding how to pass a object into a function such as the shooter in a fired EH that needs to be passed into a function call?
i get a syntax error [B Bravo missing ] where the error pointer is inbetween B and Bravo (out of memeory.. not on my pc currently)
the EH is defined in a cfgWeapons class like Fired = "[_this select 0, _this select 1, _this select 2] call MY_fnc_Bla";
this started to appear after i updated to yesterdays devbranch update
Is it possible to overwrite the fuelConsumptionRate or fuelCapacity config values of a vehicle via scripting?
params["_pos"];
_vehicles= nearestObjects [_pos, ["Car","Truck"],20];
if (str(_vehicles) == "[]") exitWith {};
{
_cur= _x;
_dist= _cur distance _pos;
_class= typeOf _cur;
_name= getText (configFile >> "cfgVehicles" >> _class >> "displayName");
_pic= getText (configFile >> "cfgVehicles" >> _class >> "picture");
lbAdd [72003, format ["%1 (%2m)",_name,_dist]];
lbSetPicture [72003,_forEachIndex,_pic];
lbSetData [72003,_forEachIndex, str(_x)];
}forEach _vehicles;
#define LGD(IDC) lbData [IDC,lbCurSel IDC]
_data=LGD(72003);
_ddata= call compile _data;
deleteVehicle _ddata;
any way to lbData an object as string? unstring it? cant get it to work, number is returned
@dusky citrus thats exactly what i need, thank you
Is there some magical thing going on with initDisplay and UI_F config overrides? I'm trying to use a different script for RscDisplayDebriefing, set up tthe configs, however somehow it's still loading the old script
class RscMissionEnd {
idd = -1;
duration = "11+2";
fadeIn = 0.2;
scriptName = "RscDisplayDebriefing";
scriptPath = "FRL_MainUI";
onLoad = "[""onLoad"",_this,""RscDisplayDebriefing"",'FRL_MainUI'] call (uinamespace getvariable 'BIS_fnc_initDisplay')";
onUnload = "[""onUnload"",_this,""RscDisplayDebriefing"",'FRL_MainUI'] call (uinamespace getvariable 'BIS_fnc_initDisplay')";
};
@tough abyss No.
@modern sigil No.
@austere granite No, but instead you should maybe add a dummy control, invisible RscText with onLoad script to not break what's supposed to be executed. This framework is not really meant for mods as it uses hardcoded folder paths.
was just trying to add parameters for things like title and subtitle, so i dont need to make 50 templates
@little eagle any idea what my issue is then? :S
but yea ended up with a workaround, still weird because initDisplay doesn't have any reference. Must be some hidden magic somewhere. The config entries change just fine when checking them, but it still loads the old stuff in somehow
It's not hidden... It's a normal function with some hard coded paths.
The file names are read by config, but the folder path is hard coded.
{
if (getNumber (_x >> "scriptIsInternal") isEqualTo 0) then //--- Ignore internal scripts, they're recompiled first time they're opened
{
_scriptName = getText (_x >> "scriptName");
_scriptPath = getText (_x >> "scriptPath");
if (_scriptName isEqualTo "" || _scriptPath isEqualTo "") exitWith
{
[
'Undefined param(s) [scriptPath: "%2", scriptName: "%3"] while trying to init display "%1"',
configName _x,
_scriptPath,
_scriptName
]
call BIS_fnc_logFormat;
};
_script = _scriptName + "_script";
if (uiNamespace getVariable [_script, 0] isEqualType {}) exitWith {}; //--- already compiled
uiNamespace setVariable
[
_script,
compileFinal
(
format ["scriptName '%1'; _fnc_scriptName = '%1'; ", _scriptName]
+
preprocessFileLineNumbers format ["%1%2.sqf", getText (configFile >> "CfgScriptPaths" >> _scriptPath), _scriptName]
)
];
};
}
forEach ("isText (_x >> 'scriptPath')" configClasses _x);
reads scriptPath entry in the config class, then checks cfgScriptPaths for the path for that
Fired = "[_this select 0, _this select 1, _this select 2] call MY_fnc_Bla";
I see nothing wrong with this.
It's a bit pointless though. Might as well just write:
Fired = "_this call MY_fnc_Bla";
Is that cfgScriptPaths a recent thing?
no, it's been around for quite some time
yea, it used to be initDisplay.sqf (and initDisplays.sqf) in UI_f, but now it's in functions_f
scriptpaths was already in the old version too though
I use it for my loading screen and it works fine there, but not this one somehow
anyway workaraound is good so w/e, still weird though
Isn't this more of a #arma3_config question though? Or does this work with descrition.ext?
class RscDisplayLoading {
idd=102;
scriptName="RscDisplayLoading";
scriptPath="FRL_Interface";
onLoad="[""onLoad"",_this,""RscDisplayLoading"",'FRL_Interface'] call (uinamespace getvariable 'BIS_fnc_initDisplay')";
onUnload="[""onUnload"",_this,""RscDisplayLoading"",'FRL_Interface'] call (uinamespace getvariable 'BIS_fnc_initDisplay')";
};
config is fine, it's some hidden magic somehow
maybe anticheat stuff, because i remember that's how some did it in the past
class RscDisplayLoading {
class Script_Dummy: RscText {
onLoad = "call whatever";
};
};
This looks more reasonable tbqh
well in loading case i wanted to get rid completely off the old one, and that one actually works perfectly fine, but RscMissionEnd doesn't somehow
anyway it's gutgut
moving on
But it's not hidden magic.
if (_this isEqualTo []) exitWith
{
{
{
if (getNumber (_x >> "scriptIsInternal") isEqualTo 0) then
{
_scriptName = getText (_x >> "scriptName");
_scriptPath = getText (_x >> "scriptPath");
if (_scriptName isEqualTo "" || _scriptPath isEqualTo "") exitWith
{
[
'Undefined param(s) [scriptPath: "%2", scriptName: "%3"] while trying to init display "%1"',
configName _x,
_scriptPath,
_scriptName
]
call BIS_fnc_logFormat;
};
_script = _scriptName + "_script";
if (configName _x == "RscMissionEnd") then {
hidden_magicvar = [_scriptName, _scriptPath, format ["%1%2.sqf", getText (configFile >> "CfgScriptPaths" >> _scriptPath), _scriptName]];
};
};
}
forEach ("isText (_x >> 'scriptPath')" configClasses _x);
}
forEach
[
configFile,
configFile >> "RscTitles",
configFile >> "RscInGameUI",
configFile >> "Cfg3DEN" >> "Attributes"
];
nil
};
@little eagle dunno
seems magical tbh
Well everything written in SQF is 'magical' in a way.
okay it's not magic. there's another config entry which already compiles it final and then the one of rscmissionend gets disregarded
Magic
👌🏼
Or... How about that. You're missing something.
😄
Looking for someone to do a task force radio script for me? Willing to pay
@chrome nebula I suggest asking there:
https://forums.bistudio.com/forums/forum/200-arma-3-find-or-offer-editing/
@little eagle i will try ```sqf
Fired = "_this call MY_fnc_Bla";
in the evening but i don't see this being any diffrent
it saves you having to select each argument like you were before..
that's true but i don't see it solving the issue of the syntax error i get for passing the shooter into the function
@tough abyss I'm not really a config guy, but I don't see Fired as being something you can use in CfgWeapons?
https://community.bistudio.com/wiki/CfgWeapons_Config_Reference
it was added last year iirc
never made it into the wiki
Needs updated then 🤔
Added: A new "Fired" Even Handler for muzzle config (example: CfgWeapons/Default/EventHandlers/init = "hint str _this")```
https://dev.arma3.com/post/spotrep-00062
I would ask in #arma3_config though
The EH fires, thats not the issue, bus since the last devbranch update i get a syntax error. I will have a close look at the function again, perhaps i fucked something up
If it isn't a big function, feel free to post here.
i'm in the office right now so no access to it 😛
Alrighty 😃
Hey guys, Is it possible somehow to make a player able to walk while having a display open?
Never mind
alright i've made some tests and i don't get the error if i have the function in the mission and recompile = 1; in cfgFunctions
the function is 1:1 a copy of the one used in cfgFunctions
the exact error i get is:
19:33:41 Error in expression <[B Alpha 1-1:1 (Lappihuan),"ww_weap_K98k_by>
19:33:41 Error position: <Alpha 1-1:1 (Lappihuan),"ww_weap_K98k_by>
19:33:41 Error Missing ]```
file?
that confuses me aswell, it does not show any file nor any line number as it usualy does
or did you ment to see the script?
pastebin seems to be under heavy load, do you know a alternative?
Which is how objects are displayed,
it is a object
But not how you would write code
Yes, but it shouldn't appear as code
Because it's not correct SQF
hmm
no i havent
Two observations:
- no filename, which suggests this code is written in a init box in the editor
B Alpha 1-1:1 (Lappihuan)which is a syntax error
what would be the correct syntax for that?
ooh i tought since the muzzle is interpreted aswell that the object is interpreted too
No, it's just copy pasting code around the error into the RPT
What does the line look like anyway?
i just found out that i probably search to early, one second
I mean you did write this line? No?
[B Alpha 1-1:1 (Lappihuan),"ww_weap_K98k_by ...
^ this one
Well what did you write? Or is it unknown where the error comes from?
checking right now if i search in the wrong place 😛
No file suggest that you either used preprocessFile without FileLineNumber or it's an editor init box based script
maybe even BIS_fnc_addStackedEventHandler?
thats the content of a variable aswell
i found the line:```sqf
}, (_this + [0,_playAction,time+300])] call BIS_fnc_addStackedEventHandler;
the whole script here for more context:
https://pastebin.com/gG6umppd
I guess you could try commenting it out to see if that removes the error
BIS_fnc_addStackedEventHandler is pretty cancer
But it could very well be this script
i got a bit rusty with sqf but could be the array + array is fucking up
or yea maybe the BIS_fnc_addStackedEventHandler
is there any alternative to it? :S
EachFrame mission eventhandler I guess
I'm not convinced the error is in here.
Looks like something else.
Should comment out and see if it disappears.
the problem is i need to comment out half of the script if i want to get rid of that line 😛
That would be the best though. Then you'd know it's in there.
@tough abyss try ArmA.Studio
should give you better insight etc.
as you can pause the script execution to check the script properly
i still need to find time to install and set it up but yea i would really like to use it once i get back to scripting a bit more
"time to install" ... takes a brief moment