#arma3_scripting
1 messages · Page 485 of 1
you can start two clients
and connect to yourself just fine
There's usually two entries in the LAN tab with the non-host and one of them should work, it does for me at least
Sure, maybe not with the vanilla arma launcher, but that one is shit anyway 👌
I use arma3sync for dev related stuff launching, does everything you need
When you disconnect dedi will still run
You can have many clients depends on your hardware how many it can handle
btw you can click play twice in launcher, also in b4 it was possible to join your own host
(iirc was disabled be and -noPause startup param 🤔)
local host with 2 profiles > https://gyazo.com/fe4a19e8a11b78d5bb361ae538a1b2ef 👌
in b4 that was possible too > https://gyazo.com/f7cf3007a5dab256293c391f54f1c85b 😃
I'm confused, I'm getting Undefined variable in expression
but printing the variable with diag_log returns any
and isNil isn't working on it.
addMissionEventHandler ["PlayerConnected", {
params ["_id", "_uid", "_name", "_jip", "_owner"];
if(isNil _uid || isNil _id) exitWith {
diag_log "isNil _uid || _id";
};
}];
so how do I prevent the Undefined variable error?
Use isNil correctly.
also maybe you will need filter __SERVER__ name 🤔
ah so I should surround the variable name with quotes then?
Yush
_uid and _id will always be defined inside PlayerConnected mission EH with that use of params, so why bother checking it?
because he get's nil errors so they apparently... wait...
undefined variable errors don't exist in unscheduled 🤔
ERROR! Error not found
Hehe
Checking EVH params with isNil. That's new.
dedicated _uid > ""
//--- local host
[2,"76562198345855537","player_name",false,2]
//--- dedicated
[2,"","__SERVER__",false,2]
also you can have this >
[1.08018e+009,"76562198345855537","player_name",false,3]
dedicated and client on the same pc ^
Still, how's that around isNil? 😄
undefined variable errors don't exist in unscheduled
Why is this btw?
Its annoying as fuck
@unborn ether i guess he was trying to fix that empty string uid by checking it with isNil 🤷
Can anyone tell if there is a way to add proxies? to a GroundWeaponHolder* like it has something in it?
Why is this btw? that's actually default
scheduled is the special one. It has a setting to handle all undefined variables as error
There isnt some special coin i can insert to enable that for unscheduled im guessing?
sometimes, only on tuesdays.
probably depends on the phases of the moon 🌚
If the furry can't just give me a straight yes then I guess it's a no ;_;
How can I make a Addaction global?
I'm trying to figure out a way to ensure that looping code added to a units init EH is only called about once a second so as to reduce processing load. Does anyone have recomme rations on how to do this? Its sounding like I can't simply use waitUntil? Thanks in advance
huh, what exactly makes it global?
out of translation that is
So if I have something like _vehicle addAction ['Hello world',{hint 'hello world';}];
Also yea, so it's basically available to everybody.
Sorry if that was confusing.
Make a function that adds action to a local player then remoteExec it everywhere but dedicated server
[_object, {
_this addAction ["Action text",{ /* code */}];
}] remoteExec ["call"];
@outer fjord you can try this way 🙄
clients and server
@meager heart Not the best idea to remoteExec objects, Arma doesn't like it.
wut
Apparently, it doesn't like it, since you will start getting Server|Client: object #:# not found on the other end. The more objects sent, the more of them.
It seems that remoteExec and any other way of "publication" has some issues with object pointers validity.
You need to add action for every PC on a object?
Yea, so basically I have a object spawn in with a addaction, but said addaction is only local to the player that spawned it in.
Two ways, one is easier and less optimal, second is more complicated:
- Add addAction to a player on every PC (thru Event Scripts) with condition of specific object variable expected from something like
cursorObject getVariable - Using
... remoteExec ['addAction',-2,true]way, where you don't remoteExec the vehicle reference, usingvehiclesandgetVariable.
If you make addAction JIP persistent you will get one for every joining player, why would you want that?
Also remoteExec and sending objects problem, sounds like a lot of unfounded assumptions
Object not found message was there before remoteExec and is to do with something else, don’t remember exactly what, but it has been investigated
@tough abyss I did not followed the whole conversation. What is wrong with using initPlayerLocal.sqf here? Or is the vehicle spawned by the server ?
In regards to the "all players receive the add action of the vehicle"
I understood it as being suggested to addAction to player and make it persistent
@tough abyss and any other way of "publication" means not just remoteExec
It's not an assumption it's a clarified, but undocumented issue, I was investigating this case since A2.
There was no remoteExec in A2
Oh srsly? So no publicVariable*s and no addPublicVariableEventHandler
I am referring to @meager heart Not the best idea to remoteExec objects, Arma doesn't like it.
Which is horseshit
Ok, horseshit. As for me a call a horseshit when mate is just speaking and giving no practical solution, but calling everything a horseshit.
Boom
Whatever
Definitely.
😃
iirc in a2 was "remExWrite.sqf" ? (not 100% with the filename) aka RE aka functions module
(that what is real horseshit imo 😄)
can I enforce some kind of log rotation? Having my ALiVE Mission running for few days the friggin .rpt is heluva large and unopenable (< cool word)
@unborn ether Apparently, it doesn't like it, since you will start getting Server|Client: object #:# not found on the other end. The more objects sent, the more of them. that's not remoteExec.
There aren't any problems remoteExec'ing objects unless the object is local only
Your stuff is just plain horseshit
@frigid raven no. not with #arma3_scripting
is there a arma server channel?
scroll down in the channellist.
ah skipped that thx
@still forum As I told - if you call it horseshit - ok. I will avoid using broadcast along with vehicles.
I'll believe the guy that knows engine internals 👀
Still haven't seen any explicit explanation of that case for 7 years. 🤔
There aren't any problems remoteExec'ing objects unless the object is local only remoteExecing on stuff that is not present on remoteclients.
remoteExec'ing an object is literally just sending a number
If the number cannot be resolved back it just turns into objNull
Just stop sending objects that don't exist.
Ok, ill just quit arguing, since object not found issue is still present and its not explained, while I checked it with not-null objects via remoteExec
You can continue putting your trust in RV Engine consistency.
it's explained
drop a backpack and pick it back up
and watch the serverlog
There is a feedback tracker entry about it. And bi "fixed" it.. kinda... Not really.
The changelog said "fixed lag caused by" not "fixed bug". And no one ever complained about any lag.. So really no idea what they did
Also as we deviated from original question. this should be enough for "global" addaction.
[
_entity,
[localize "STR", <CODE>, nil, -801, false, true, "", <STRING>, 10]
] remoteExec ["addAction", 0, true];
It's that backpacks are not actually the containers that contain the items.
The actual container is at 0,0,0 and drops tons of errors when it disappears on server because it should be gone, but clients still send position updates
remoteExecCall makes no sense there really.
If you execute a command, remoteExec == remoteExecCall
but one is shorter.
Fixed.
short version > https://discordapp.com/channels/105462288051380224/105462984087728128/490421999022374913 huehue 😄
isnt this less performant?
you're creating a <CODE> with the array etc inside.
instead of just sending an array.
(btw there are no arrays inside)
_object call {_this < object}
[_object] call {_this < array}
there are no arrays inside
_this addAction ["Action text",{ /* code */}];
looks at array
oh... you mean that
How can I make this better...
displayOnLoad
// Make display unclosable if player is dead
if (!alive player) then {
_display displayAddEventHandler ["KeyDown", {
params ["_display","_dik","_shift","_ctrl","_alt"];
if (_dik == 1) exitWith {
[] spawn {
private _interruptDisplay = (findDisplay 46) createDisplay "RscDisplayInterrupt";
waitUntil {_interruptDisplay isEqualTo displayNull};
[] call KPLIB_fnc_respawn_open;
};
};
}];
};
written at 1am after long day of work. 👀
💩
if (_dik != 1) exitWith {} and remove a level of indentation
It's not exactly uncloseable as by blocking the ESC handler but by allowing to open the ESC menu over it and reopening the display after the menu will be closed.
do you use the spawn to delay?
no, i tried once to do (findDisplay 46) createDisplay "RscDisplayInterrupt"; in KeyDown EH and my game crashed.
XD
also you need disableSerialization here
I do? Had no errors.
Ask yourself the question: Is it still there after a savegame load?
So.. Is the display exact display there after a savegame load? no.
No.
Thus you don't wanna serialize
enableSaving false 🙃
Problem solved.
also maybe just >
if (!alive player) then {
_display displayAddEventHandler ["KeyDown", {
params ["_display", "_dik", "_shift", "_ctrl", "_alt"];
if (_dik == 1) then {
call KPLIB_fnc_respawn_open
};
}];
};
```🤔
no point i could return true if i would want that.
and it would block closing.
I want the "intteruptdisplay"
if you load into the mission you are supposed to be able to disonnect without having to respawn.
create that display from the function ? 🤔
Also as liberation is often modified by inexperienced people if you break something in the logic of the respawn you will have to `alt + f4" the game if the display will be unclosable 🤔
🍪 ノ( ゜-゜ノ)
Does anyone know if its possible to have a SubCat inside the 3D Audio module in zeus?
anybody know how i can add an action Id to this action? _heli addAction ["Toggle Basket","uh60m\scripts\toggleRescueBasket.sqf",[_basket,_heli],0,false,false,"",""];
then if its returning it why when i use the action its still there so when i deploy my basket and when its out i still have the deploy basket option but i want it to get taken away once the basket is outside the helicopter
remove the action
you should also get the ID inside your toggleRescueBasked via _this
do i not need to have an id for the add action? so i'd just do _heli removeAction 0; at the end of the script?
you need the ID
https://community.bistudio.com/wiki/addAction
params ["_target", "_caller", "_actionId", "_arguments"];
There. _actionId
Do you guys know why there is none remove functions for cargo ? Must remove content then add what we want ?
there are none because noone made them yet
It's also a bit hard when you get into removing weapons or magazines. Which one to remove if you wanna remove one and there are multiple with different attachments.
You can't really make them :/
I mean without removing all magazines then adding back what you what
yes
that's kinda sad because adding stuff back must generates heavy traffic
Yeah kinda. If you do it in one batch in unscheduled it might batch the network messages together
Is there any engine solution to stop exact WeaponHolder* to be cleaned up, besides creating _scripted variant?
Eh. Dummy item will still be listed and can be taken 😦
Oh engine solution? You can just hook the simulation method and make it skip sim
not if it's a DLC item of a dlc that doesn't exist
🤔 dirty but will work
I just tried to override InventoryOpened with creating a _scripted variant and then using player action ["Gear", _scriptedholder]
Well that didn't go well 😄
@still forum You can just hook the simulation method and make it skip sim more detailed on that?
hey guys, what config property determines if a weapon is gonna show in the arsenal or not? it doesn't seem to be scopeArsenal like i thought cause that returns far fewer results than what i have present
@still forum pink panter music
@tame lion my crystal ball says that 1) wrong channel 2) cfgPatches is incomplete
i was asking for a way in scripting because i need to know which property to pull from a weapon config via getText/getNumber
oh then it is scope first, and scopeArsenal second
if something has scope=2 it appears automatically
Yeah problem is scope ==2 also returnsall weapons that are derived from arsenal weapons for ai. EX: arifle_mx_aco_f wouldshow up in a query but wouldn't show up in arsenal
afaik weapons with predefined attachments "private/hidden" in the arsenal, only base classes there...
I know that @meager heart but what im trying to do is get all these classnames in an array using something to the extent of
_weapons = "getNumber (_x >> 'scopeArsenal' ==2)" configClasses (configFile >> "CfgWeapons"); //This line returns a very small, incomplete list which is missing even some vanilla weapons.
vs
_weapons = "getNumber (_x >> 'scope' ==2)" configClasses (configFile >> "CfgWeapons"); //This line returns every weapon, including all the AI weapons and the vehicle weapons.```
im gonna use this to create a shop system that accommodates for whatever mods are currently loaded where a player can purchase weapons
does setDriveOnPath work for anyone? it does nothing for me
hello, i have on my mission a lot of objects - and getting low fps in the towns. is possible to use script for better FPS?
i try'ed sqf {_x enableSimulation false;} forEach objects; but fps is still low
Or use dynamic simulation
@inner swallow ty, i will read about simple objects and dynamic simulation
Last time I tried driveOnPath it was broken, so never touched it again
My mission keeps kicking me out of zeus after a while. Has anyone encountered that before? Im running it via lan or internet
Kicks me out of zeus interface and doesnt let me back in
I found this online, describing a similar issue https://forums.bohemia.net/forums/topic/217555-script-kicks-me-out-of-zeus-interface/
Could it have to do with cleanup functions?
Anyone happen to know why AI are so obsessed with vehicles and always want to reenter them?
I don't assign vehicle through script anywhere, but just checking assignedVehicleRole quite a bit of units have a role assigned
@inner swallow thank you!
@austere granite afaik that happens only if you kicked them out but the vehicle is still "added" to a group and not "unassigned" for the crew...
you can try [_x] allowGetIn false; > kick them out (with action for example) or just use leaveVehicle that is the same as "remove vehicle from the group" + unassignVehicle + order get out
Yep thanks, decided to go with a GetOutMan EH and leaveVehicle with that
So this message seems to be related to the issue that kicks me from zeus>
15:08:09 A null object passed as a target to RemoteExec(Call) 'bis_fnc_objectvar'
i have no clue what might cause it
hi,
Anybody know why that has only a local effect?
ropesegmentX = player nearObjects ["ropesegment", 20];
{if (typeOf _x == "ropesegment") then {_x setObjectTextureGlobal [0, ""]; _x setObjectTextureGlobal [1, ""]; _x setObjectTextureGlobal [2, "#(argb,8,8,3)color(0.752941,0.752941,0.752941,0.5,CA)"];};} foreach ropesegmentX;
maybe ropes are local?
also player I don't see any relation to the asked question
I don't know where I would
well... we can ask where that code was running
As he says "only a local effect" I would assume on the.. player.
and... why does that matter?
its not a trigger or logic
its if someone throws a fishing rod
everybody can see the ropes, but not the texture changes
Only reason I can see is if ropes are local. Maybe the rope commands say something about that on biki?
I know..
doesn't change anything on my statement
like. Everyone has their own local only ropes
tadam
you could check by getting the netID's of the different rope segments on different clients. If they are not the same then everyone has their own ropes
will check that in a hour
Hello, guys. I have a strange problem: items in the players uniform, which are written into the mission.sqm manualy (just like 3den set loadout), can not be looted in a multiplayer. Same goes for the backpack, but anyone can equip it and make it local for self. Did anyone encountered that?
which are written into the mission.sqm manualy what? how?
but anyone can equip it and make it local for self what? Don't understand what you mean
class uniform {
typename="TRYK_U_B_3CD_Delta_BDUTshirt";
isBackpack=0;
class ItemCargo {
items=11;
class Item0 {
name="ACE_fieldDressing";
count=4;
};
this stuff
theese items can not be looted. My second guess is that it happens because the client gets this in the cur_mp folder
Which i am checking right now)
gets this what?
And why are you doing that manually? why not use Arsenal to specify the loadouts
well, i am wrighitng mission.sqm from the game state
adding slots instead dead guys and scenario goes on
it is like a respawn but mission can be played next week
with a bit of realiability, not to spawn all the things at our 200 people size
🤔
so basicaly you cant loot dead body just like items there are not local to you
You get its backpack, and items are lootable since it is on your back
How do I open vanilla arsenal without all items unlocked?
Do i need the code (["Open", true] call BIS_fnc_arsenal;) in an addAction?
without all items unlocked you just posted the code to open the arsenal WITH all items unlocked
"both"?
yeah, one with all itmesd unlocked, and one without items unlocke
which one is without?
And what's the problem with it?
what does it mean that they don't work?
Ok to symplify the case, guys, you basicaly cant loot items from dead body with custom 3den inventory
unless you put on the container on yourself
Just reproduced it on clean mission
And sorry for my articles)
Does the vanilla arsenal support item amounts? Like 5 AK74s, 3 Pistols etc.
Or can it only have infinite item amounts?
no
Ok thanks
[[cursorObject,clientOwner], {(_this select 0) setOwner (_this select 1)}] remoteexec ['bis_fnc_spawn',2,false]
set owner works it
just, its really strange that you have to do this for mission object though
sorry to bother and thanks for the answers)
Quick question about remoteExec: when remoteExec'ing from one player to one other player, is there any network impact at all on the server or the other players not receiving this?
messages goes from sender->server->receiver
receiver can be a specific player, or multiple, or all, or none
Thanks
I've got a second question, but this one might be a little too vague to really answer, how big is the overall impact of sending a position(posASL) over remoteExec 2-3x per second to a 5ish people on something like a server with 30-40 players on it.
While I've done this without really seeing any negative impact, I've got absolutely no frame of reference for at which point sending data becomes problematic, and am not sure how crazy I should go with the degree of optimisation.
as expected 😄
Need help writing scripts for the Life project
that comment on the BIS_fnc_arsenal page... you can get the arsenal action id with bis_fnc_arsenal_action variable
@paper cove ask it there > #creators_recruiting and remove it from here 😃
when u use a Publicvariableclient to get a var from the server... is it necessary putting a waituntil for waiting the response?
No no waiting. Server sends it and carries on
do u think that its not needed to put a waituntil?
What do you want to wait until?
If u want to ask a var to the server and use the var in the script
the server do not send the var instatly
u need to put a waituntil to wait for receive the var
You mean you send request to the server from client and want the server to send back reply?
You can set event handler so you don’t have to wait and put your code in it or make server call a function on your client with the result
but u need wait for the server do the call
so.. u need to put a waituntil to receive the var
Server can know who sent request and can reply back
No you don’t need wait until you can call function on the client from the server
with remoteexec right?
Yeah
its better do a waituntil
No it is not
Wait until can last longer there is no guarantee it is executed in scheduled could take ages
What?????
?
You are worried about a hundreds of a millisecond while advocating the use of wait until? I don’t even...
in other ways cannot avoid use it
Not to mention that the use of public variables brings insecurity
where is publicvariables?
Don't be shy, I saw you typing
Anyone knows good multiplayer framework for making agent running cycled animations?
Like https://community.bistudio.com/wiki/BIS_fnc_ambientAnim but without that "createunit is global" note
@calm bloom AnimDone|AnimChanged EVH for example.
Yep, i was just thinking if anyone made this together already
somevariable = compileFinal "fucked"; publicVariable "somevariable"; If you used somevariable with publicVariableServer it is now fucked
^ also things like remoteExecutedOwner and isRemoteExecuted gives some benefits to remoteExec family commands not present for publicVariable*
Arma 3 is so far ahead of Arma 2 in terms of scripting improvements you might as well stop looking at old code
How do I use the playerConnected EH correctly?
Right now I have this:
addMissionEventHandler
["PlayerConnected",
{
[] spawn {
params ["_id", "_uid", "_name", "_jip", "_owner"];
if(!isServer)
exitWith { diag_log "Not a server."; };
diag_log [format["HLG: playerConnected.sqf: %1 %2 %3 %4 %5", _id, _uid, _name, _jip, _owner]];
};
}
];```
and it returns "HLG: playerConnected.sqf: any any any any any"
```sqf
your cool code
```
done
you need filter server there ^ ?
?
you are trying to get the "real client" and filter the server with that eh ^ ?
no i just want to get the uid, id, name, etc. of the player that joins
the isServer is there so it doesnt try to do that in SP
private _mehID = addMissionEventHandler ["PlayerConnected", {
params ["_id", "_uid", "_name", "_jip", "_owner"];
if !(_name isEqualTo "__SERVER__") then {
diag_log format ["HLG: playerConnected.sqf: %1 %2 %3 %4 %5", _id, _uid, _name, _jip, _owner];
};
}];
```something like that maybe ^
@meager heart thanks that worked! I guess I need to name all my EH now.
I need to name all my EH now
sorry wut ?
oh ok i see...
that "name" is > Return Value: Number - The index of the currently added mission event handler is returned. 😃
yeah return value
@tough abyss You don't actually need to store them, unless you are willing to remove them later.
hey peeps
👋
is there some way to break out the loadingscreen if gets stuck by an script error? (to avoid restarting the game)
i know back in the A2 days the dev version, had a special key combo for that
press echap ?
doesnt work during preloading/loading screen
Is there a script snippet for a login procedere out there ?
I would like to have some kind of character login - where it loads state from the servers profile out of a cba hash
Just wanna take a look at some examples how others implement a login procedere to get some persisted Player state
@frigid raven i dont think so, i did mine tbh
is there a way to get the pp handle of the Halo jump "RadialBlur" ppEffect? Its created by arma itself, and i need to destroy it.
why do you want to do this ? curious lol
arma sometimes fails to cancel the effect after a halo jump was done. You have to run around forever with that effect and its kind of annoying
so the fix would be to make sure the player does not die? hm
@carmine maple gotta check the A3 scripts and see if the FX leaves a GV to operate with
otherwise not sure if you can overwrite the blur with a second call and then kill it off
ah i see. Handles are just numbers so you boot force kill all effects
@tough abyss thanks that helps alot
Heyho, I have a little question. For a little weather script I want it to create some wind but I don't want to specify the wind direction. I currently have this:
[0,[(random [-5,0,5]),(random [-5,0,5]), true]] remoteExec ["setWind", 2];
Its not working though. I'm sure I missunderstand how random works here. Can someone help me?
at the very bottom of https://community.bistudio.com/wiki/random
there is a comment that explain the function
setWind has only right hand side argument
Why not check wiki for syntax when it doesn’t work?
could someone confirm that with
if (params [
["_type", -1, [0]]
]) exitWith {systemChat format ["{DEBUGGING} {ERROR} {%1}", _type]};
``` the default value would be -1
because when I send 0 through with it, its exiting with the error
omfg
im a damn idiot
i forgot the !
Show the working example pls
if !(params [
["_type", -1, [0]]
]) exitWith {systemChat format ["{DEBUGGING} {ERROR} {%1}", _type]};
I don't see the point of manualy checking params with if. It is logged to RPT anyway if you pass wrong param.
Also you can enable script errors in launcher so they will be printed in your face.
@velvet merlin is there some way to break out the loadingscreen if gets stuck by an script error
endLoadingScreen
@tough abyss While you are right...I'm sorry that I overlooked something, tze!
@hollow thistle why go into the script at all if not needed ?
and for what im doing with this, it wont error
Hi, i'd like some help with a script to remove all NVG's form all spawned in AI. Any suggestion on how to do this?
@tame stream ```sqf
{
if ((side _x) == WEST)then
{
_x unassignItem "NVGoggles";
_x removeItem "NVGoggles";
};
} forEach allUnits select {!isPlayer _x};```
this only needs to be run on server
replace WEST with whatever faction, obviously
and maybe filter by AI because he asked for AI ^^
@still forum audit that change because i'm not 100% certain that's the way to go
moar parenthesis
isPlayer takes object as argument
How can I set a variable to a spawned unit? ```sqf
for "_w" from 1 to 11 do {
wave = false;
for "_ei" from 1 to 11 do {
sleep 2;
hint format["Wave %2: Enemy %1.",_ei,_w];
_unit = "O_Soldier_F" createUnit [position spawnObj, UnitGroup];
_unit setVehicleVarName format["%1_%2_%3",_unit,_ei,_w];
_unit join UnitGroup;
};
if !(alive UnitGroup) then {
deleteVehicle UnitGroup;
wave = true;
};
waitUntil {wave};
};```
@tough abyss nice one mate..cheers
👍
_unit isn't an object.
yes it is
it is...
createUnit returns the object it made
Well how come Arma is telling me isn't?
createUnit - Return Value:
Object - The reference to created unit
(allUnits - playableUnits) @tough abyss
¯_(ツ)_/¯
I saw that @ruby breach
@wary vine expensive to run allUnits twice, you just need to check isPlayer
much cheaper
afaik
do the foreach
oh
@still forum how to call endLoadingScreen via console/etc when stuck and blackscreen?
yeah i guess you could do that too
@tough abyss Much more expensive to loop through many units instead of.. not doing that
@velvet merlin Bind a hotkey to it
there's multiple ways
@tough abyss should i run that via init.sqf?
neat idea. ty
thx
allUnits select {!isPlayer _x};
but it will only remove NVGs for units present at init
private _units = (allUnits - playableUnits);
private _units = allUnits select {!isPlayer _x};
i was litteraly just writing that xD
playableUnits that excludes some AI tho
private _units = (allUnits - allPlayers);
How can I add these? as the + operator doesn't work for variable "merging". _var = _unit + _ei + _w
Use an array?
im want to use this script to remove NVG's from units that get spawned in as players move into an area (Liberation Gamemode), will that script remove AI NVG's if run via initServer.sqf?
if they are strings use format
UnitGroup = createGroup east;
for "_w" from 1 to 11 do {
wave = false;
for "_ei" from 1 to 11 do {
sleep 2;
hint format["Wave %2: Enemy %1.",_ei,_w];
_unit = "O_Soldier_F" createUnit [position spawnObj, UnitGroup];
_unit + _ei + _w;
_unit setVariable ["", nil];
_unit join UnitGroup;
};
if !(alive UnitGroup) then {
deleteVehicle UnitGroup;
wave = true;
};
waitUntil {wave};
};```
@tame stream you can remove the NVGs as you spawn in units then
private _string = format ["%1%2%3", _unit, _ei, _w];
That's what I tried, but within the setVariable area. Thanks
Yes.
He's trying to make "Unit_1_1" style identifiers
Yes. So that I can delete them
private _unitsWithNVGS = allUnits select {(!(isPlayer _x)) && {"NVGoggles" in (assignedItems _x)}};
UnitGroup = createGroup east; ...if !(alive UnitGroup) then { 😮
deleteVehicle UnitGroup; 😱
if !(alive UnitGroup) then {
deleteVehicle UnitGroup;
wave = true;
};```
hides
lol
Also I don't see how waitUntil {wave}; is supposed to work. Unless wave is used elsewhere
Also didn't you already learn that you should use tags on global variables?
Just get into the habit of putting cap_ before any global variable you make
lol xD kk
or whatever tag you want
CAP_UnitGroup = createGroup east;
CAP_UnitArray = [];
for "_w" from 1 to 11 do {
CAP_wave = false;
for "_ei" from 1 to 11 do {
sleep 2;
hint format["Wave %2: Enemy %1.",_ei,_w];
private _unit = "O_Soldier_F" createUnit [position spawnObj, UnitGroup];
private _string = format ["Enemy_%1_%2", _ei, _w];
_unit setVariable [_string, nil];
_string join CAP_UnitGroup;
CAP_UnitArray pushBack _string;
};
if !(alive CAP_UnitGroup) then {
deleteVehicle CAP_UnitGroup;
CAP_wave = true;
};
waitUntil {CAP_wave};
};```
private _string = format ["%1%2%3", _unit, _ei, _w]; that won't work
_unit will stringify to the memory address and model filename of the unit
Means a variable with # and whitespace and dots.
Changed
Also setVariable and setVehicleVarName are very different things
And I don't know anymore what your intention is
And as already hinted if !(alive CAP_UnitGroup) then { will never work.
You just spawned the group. If you are not insta killing the units then that won't work
_string join CAP_UnitGroup;
does join take a string?
no. it doesn't
Why don't you just take _unit? You already have it right there.
O_Soldier_F is created. and given a unique "identifier" variable based on the wave and count within that wave.
I then want to delete all unit's created within that wave before I begin the next wave.
So i guess that's what you want then. Okey.
deleteVehicle CAP_UnitGroup; That will also never work
does deleteVehicle take a group as argument? no it doesn't
Would this? sqf { deleteVehicle _x; } foreach CAP_UnitArray;
Might I suggest that rather than assigning IDs to the units within the group, you just... you know... cycle through the group?
Would this? UnitArray is an array of strings.
Does deleteVehicle take string as argument?
You already have the group
you can use
to get all units in the group
CAP_UnitGroup = createGroup east;
for "_w" from 1 to 11 do {
CAP_wave = false;
for "_ei" from 1 to 11 do {
sleep 2;
hint format["Wave %2: Enemy %1.",_ei,_w];
private _unit = "O_Soldier_F" createUnit [position spawnObj, CAP_UnitGroup];
CAP_UnitCount = count units CAP_UnitGroup;
};
if !(alive CAP_UnitCount) then {
{
deleteVehicle _x;
} foreach CAP_UnitCount;
CAP_wave = true;
};
waitUntil {CAP_wave};
};```
alive CAP_UnitCount
does alive take a number?
Why do all your mistakes amount to you just not reading the wiki?
How do I change the UnitCount into a variable?
What?
It's already a variable
it is a variable
So why is it a number? (yes, it states it on the page, ik.)
Okay. I thought I was grabbing the units to then delete them..
I could delete the group.. but I would need to create it each wave.
CAP_Units = units in CAP_UnitGroup; taken and adapted from: _isInMyGroup = _soldier1 in units player;
It's probably also worth mentioning ahead of you wondering why this doesn't work, that you're creating these units and then immediately trying to delete them
Well they are dead... @ruby breach
So what does make sense??
How are they dead? You just created them.
for one units is a command without argument. Syntax error.
Second in doesn't take array on the left anyway
Third in doesn't take group on right anyway
How the fuck am I meant to get shit from this:
Examples
Example 1:
_myUnitCount = count units group player;
Example 2:
_isInMyGroup = _soldier1 in units player;
units groupOrUnit (CAP_UnitGroup)
none of these matches what you are trying to do
CAP_Units = units CAP_UnitGroup;
you cannot just take something out of thin air. Slam a hammer onto it and expect it to work ^^
Why are the examples over complex?
Well you could learn the basics and it would be a lot easier to understand the examples.
Where from? Please give me a SQF book to buy and read... please
you could read the Biki
many youtube tutorials out there
I've read that.. all of that all the DataTyoes
the one saving grace SQF has is the documentation
All of the Operators
then apply it
lotta google, youtube and trail and error...thats how most here have learned to do it
Well then it means you do not understand what you read.
you asked for a book and you got text
🍵
I spent 2 hours. On the wiki, and trying BEFORE coming here.. 😃
What you have still isn't going to work
If this is your first foray into Arma 3 scripting you're trying to do something mildly complex
It isn't @still forum and I have been "learning" for about 9 months??
Either you're going to delete your spawned units immediately after creating them. Or you're going to spawn your first wave and then never do anything else
xD
Yeah.. And We've explained him everything 5 times already
So why won't CAP_Units = units CAP_UnitGroup; work
https://community.bistudio.com/wiki/units
Returns an array with all the units in the group or group of the unit.
Who said that won't work?
it returns the list of units in that group
I don't see why that's not supposed to work
I even gave you a thumbs up when you posted that above to tell you that's good
@drowsy axle you are asking help for something thats simple for those with experience and immensely complicated for the uninitiated ... i was very much part of uninitiated and had no scripting knowledge, just wanted to make cool missions ... 100's of gaming hours later and as many frustrating hours of learning to script and only now i am getting some what proficient at scripting.
In crease you base knowledge to know how to use the more advanced scripts
He's probably still trying to do alive Group (or alive units Group)
👏
TrigOpfor = false;
CAP_UnitGroup = createGroup east;
for "_w" from 1 to 11 do {
CAP_wave = false;
for "_ei" from 1 to 11 do {
sleep 2;
hint format["Wave %2: Enemy %1.",_ei,_w];
private _unit = "O_Soldier_F" createUnit [position spawnObj, CAP_UnitGroup];
CAP_Units = units CAP_UnitGroup;
};
if (TrigOpfor) then {
{
deleteVehicle _x;
} foreach CAP_Units;
CAP_wave = true;
};
waitUntil {CAP_wave};
};``` Made a trigger with: https://gyazo.com/838730e14ab434db3aefc4b3c52b11cf
The trigger doesn't activate when all dead
😦
gime ve a swec
are you sure the trigger doesnt activate?
try putting something like:
hint "DEAD"; inside the trigger on activation
then try again
Or you're going to spawn your first wave and then never do anything else
yeah i see the problem now too,
it gets stuck on the waitUntil
the code is already past the if and at the waitUntil when the trigger fires
@drowsy axle what are you trying to do? Just tell us, there's probably an easier way to do all of this...
He wants to create a group, wait until they're dead, delete them, spawn another group, repeat
Do I put a waituntil for the trigopfor?
@drowsy axle what are you trying to do? Just tell us, there's probably an easier way to do all of this...
CAP_UnitGroup = createGroup east;
for "_w" from 1 to 11 do {
CAP_wave = false;
TrigOpfor = false;
for "_ei" from 1 to 11 do {
sleep 2;
hint format["Wave %2: Enemy %1.",_ei,_w];
private _unit = "O_Soldier_F" createUnit [position spawnObj, CAP_UnitGroup];
CAP_Units = units CAP_UnitGroup;
};
waitUntil {TrigOpfor};
if (TrigOpfor) then {
{
deleteVehicle _x;
} foreach CAP_Units;
CAP_wave = true;
};
waitUntil {CAP_wave};
};```
ok this is a bit better, but now you have redundant code
the if
and the second waitUntil
you're using waitUntil {TrigOpfor} which waits for TrigOpfor be to true, so the if isn't needed, and the second waitUntil also isn't needed.
You can also edit code instead of copy-paste spamming the same stuff over and over again :u
CAP_UnitGroup = createGroup east;
for "_w" from 1 to 11 do {
CAP_wave = false;
TrigOpfor = false;
for "_ei" from 1 to 11 do {
sleep 2;
hint format["Wave %2: Enemy %1.",_ei,_w];
private _unit = "O_Soldier_F" createUnit [position spawnObj, CAP_UnitGroup];
CAP_Units = units CAP_UnitGroup;
};
waitUntil {TrigOpfor};
{
deleteVehicle _x;
} foreach CAP_Units;
CAP_wave = true;
waitUntil {CAP_wave};
};```
CAP_wave = true;
waitUntil {CAP_wave};
wat
I know
CAP_wave is useless. Get rid of it
Yup Ik.
Also, instead of using a trigger, why not just check if all the units in the group are dead every (x) seconds?
Well, he also wasn't properly waiting to check it, but yes, I agree
Trigger might be more efficient, and he would have to write a check for that (because alive GROUP doesn't actually check if they're alive fast enough, because it takes about 30s for it to update the alive status)
because it takes about 30s for it to update the alive status wat?
wut
That's not true
it is
and also how would a trigger change anything on that?
because alive GROUP doesn't actually check if they're alive fast enough That's also not true
it is
alive GROUP doesn't exist.
Where did you get non existant commands from?
Magic?
Well.. There is a alive GROUP in Intercept CBA.
But we are talking about vanilla Arma. And I know that noone here is using that.
sooo...
there was something for checking if the group is considered alive
Don't believe anything you say anymore 😄
Also, Dedmen can call me an idiot if I'm remembering wrong, but waitUntil is going to be exponentially more efficient for use here because the checks don't need to happen for the entire mission duration (only when utilizing the wave mechanic), and the fact that you can make it check less often than every half second.
true
trigger keeps checking if you don't delete or have it trigger once
triggers are actually known to not be efficient
so I have no idea where you got that from 😄
Got no idea where you got anything from tbh
:(
Easier to make for some people, yes. More efficient, not really
Is there a VIM plugin that ads SQF syntax highlighting?
Literally first result https://github.com/KoffeinFlummi/vim-sqf
Second result https://github.com/ussrlongbow/vim-sqf
Third result https://github.com/sqwishy/vim-sqf-syntax
3x SQF for vim. Is that enough or do you need more?
And vim is 27 y/o 🙃
yeah but VIM's syntax doesn't change
SQF syntax also doesn't change
Haven't seen a single syntax change since SQF was introduced
its a bit of nitpicking tho. You know what the guy meant 😛
¯_(ツ)_/¯
Does not look like it would be hard to add new commands tho:
https://github.com/KoffeinFlummi/vim-sqf/blob/master/syntax/sqf.vim
I made a script to generate the highlight.js lists. Should just be a matter of 5 minutes to modify it to create the list for vim
https://github.com/dedmen/highlight.js_SQFgen here it is
Are you just trying to delete the bodies?
Let's see how well you've been paying attention. Here's everything you need to make a check to wait until they're all dead: ```
https://community.bistudio.com/wiki/waitUntil
https://community.bistudio.com/wiki/sleep
https://community.bistudio.com/wiki/units
https://community.bistudio.com/wiki/select
https://community.bistudio.com/wiki/alive
https://community.bistudio.com/wiki/isEqualTo
you also need spawn
Alternative solution would be
https://community.bistudio.com/wiki/waitUntil
https://community.bistudio.com/wiki/sleep
https://community.bistudio.com/wiki/units
https://community.bistudio.com/wiki/count
https://community.bistudio.com/wiki/alive
Why spawn?
for what?
cant sleep in scheduled
What?
Stop making up things that aren't true
Your third thing today that's just a lie 😄
I've actually never bothered to see which of those two ways is faster. Can't imagine there's much of a difference
Unless the group is extraordinarily large
spawn creates a new scheduled script.
So how does creating a scheduled script help for sleeping. If sleeping doesn't work in scheduled?
That doesn't make any sense
ok unscheduled then
@ruby breach gonna check what commands of those are working in swfvm in a Minute 😂
When and why did you rename it to swfvm? already saw you writing that a couple days ago
Did not really renamed it
But it is simpler from mobilephone
The folders etc. On the other Hand are named like that because that tiny - gets annoying to write each time
Official project Name remains sqf-vm
The real reason is because the project has caused him to re-evaluate it as Status Woe Format (I'll see myself out)
Status woe Format? 😅
You typed swf intead of sqf. Actually, nevermind. It was as terrible in my head as it is written.
hello, i have low fps in the towns on my mission. Changed mission objects to simple. Disabed simulation. FPS now better, but still not enough 😦
i think if i disable damage for all map objects?
I have a hard question. I have a campfire. I want it to have an inventory so you can add food in it to cook. I tried attaching an ammo box but it doesn't allow placing items. How do I make it so I can place normal items?
Anyone? 😦
no
0 spawn {
private _campFire = "Land_Campfire_F" createVehicle (player modelToWorld [0, 5, 0]);
private _supply = "Supply500" createVehicle [0, 0, 0];
_supply attachTo [_campFire, [0, 0, 0.5]];
_supply addWeaponCargoGlobal ["launch_MRAWS_green_rail_F", 1];
_supply addMagazineCargoGlobal ["MRAWS_HEAT_F", 1];
};
better not use "global" commands on the clients, this is just "debug console example" ^
@gleaming cedar
attachTo also has "auto offset" if you mean that
_supply attachTo [_campFire]; < auto offset
ggwp 😃
Why do you need to attach it?
is it possible to create a rope on a player ?
Try it 🤷 ,
may not be possible since not a static or physx object.
any small physxobjects I can create xD
I've seen scripts where the player has to "drag" the rope to something else and "tie" it off. So I would imagine it's possible
i cant get it working
discord wtf
Soda can.
didn't work 😦
@tough abyss Desync can be caused by other people's slow connections to the server, turn on checks for slow connections and limit ping. Your mission could be sucking up net traffic with public variables being thrown at the server at a constant rate.
600 is a lot
your server.cfg
600 is way too much. 200 would be morr suitable
kickClientsOnSlowNetwork[] = { 0, 0, 0, 0 };
👀 open
no
200 is alredy bad
200
also 70 players is quite a lot
and if you got some custom script stuff running those probably will also cause network strain
@tough abyss better place for the "life" related questions with higher chances to get the "right answers" > https://www.altisliferpg.com/ 👌
Altis life is known for being badly made.
bulli
truth is not bullying 😛
💩
😃
Okay this drives me nuts. I renamed my constants.hpp to globals.hpp for reasons. Then I #include it to the files where needed. As I went into game I received the following error:
Include file ...\global.hpp not found. Then I realized that I named the includes wrong - so I renamed them global -> globals via replace.
Now Arma still throws this error even tho I renamed/removed every single occurrence of global. I don't know what to do now 😄
Are you using
#include "...\global.hpp"
```?
More talking about the ...
Is it one directory up?
Are you using .. or ...?
Can you post your directory structure?
sec
just for the dir structure
did not yet pushed the refactoring/renaming of the includes
yes
As I said the repo state does not yet has the fixed naming of the #includes
I renamed them all - still arma tells me through an error that it cannot find global.hpp
even tho I do not reference it anymore
dude, you have this >
#include "..\global.hpp"
```but your file is `globals.hpp`
wtf
I think he is saying he renamed it already?
Sorry but I think I said I renamed that
He's saying his repo is useless for us to look for errors because it's not current
^
Now it is: https://github.com/xetra11/Deployed/tree/feature_intel_items_on_insurgents
So - still Arma tells me to f*** off 😄
Also, while you're in there, https://community.bistudio.com/wiki/isEqualType
@meager heart wtf this is... on my local working set it is changed ??!?!
@ruby breach uh fancy
🤷
witchcraft
is _forEachIndex applicable inside apply?
Noop.
/*
typeName _first isEqualTo "OBJECT" or typeName _first == "GROUP"
*/
_first isEqualTypeAny [objNull, grpNull]
🤔
Wew. Much fancy sld dick, much wow.
btw i hope nobody will read your nick wrong... man that turns horrible
:^)
k
Also, you totally butchered the use of isEqualType
_first isEqualType "GROUP" is checking if it's equal to String, not Group
Also @frigid raven , fair warning, if you intend to do that check on units, dead units are civilians
looks like you have there nice loop(s)...
also iirc there was ticket about "observer" spam
this one > https://feedback.bistudio.com/T82906
Atlis life loops.
hmmmm since when does param [0, [], [[]]] error out when param 0 isn't an array?
isn't it supposed to default to [] if type doesn't match?
Since Arma 3 v1.53.132691, onscreen errors are displayed for when the input is of the wrong type or size.
yet:
expectedDataTypes (Optional): Array of direct Data Types - checks if passed value is one of listed Data Types. If not, default value is used instead. Empty array [] means every data type is accepted.
🤔
That would be working as expected
You just defined default=[], allowed types = array
It's going to error if it's not an array, and will default to []
actually, it doesn't really error. It continues the script but does log the error msg
👍
It does error. It doesn't stop execution. But semantics.
Still not sure what you were saying in the first place, other than it works as it should
Unless you're thinking that param [0, [], [[]]] is the same as param [0, [], []]
bery gud
how would you make a safe zone without using a VM?
You can make a safezone without a virtual machine. I don't understand where you got the idea that you needed one
player addEventHandler["HandleDamage",
{
if(player inArea "SAFEZONE") then {
0
};
}];
make a marker named "SAFEZONE" and execute this local to the client. Bam.
good morning peoples
@frigid raven Waaaa. In the superior timezone (MDT) it's 11:40 PM thank you very much
MDT? MiDnighT ?
Mountain Daylight Time, Midnight for short 😉
it is 07:43 AM for me :0
Because I am very sporty and sexy I was already doing sports... just saying... no bragging
modesty all over the place
First question of teh morning:
When I have a script benchmarked to under 3ms - can I kinda be sure it is executed within one frame of teh scheduler? and therefore is kinda perfect to use scheduled?
Just reading about scheduled environment tho
can I kinda be sure it is executed within one frame of teh scheduler no. You can never be sure about anything in the scheduler
also benchmarking scripts runs in unscheduled
in scheduled every script is slower
no
alright
And you can't know where in the scheduler cycle your script starts
it might start when the scheduler already ran for 2.8ms
and your 3ms script will never fit into 0.2ms of time
Got it
Depends on what else is in scheduler, you script can be in front of the queue or in the middle or at the back, you don’t know how long other scripts in front of it will take. If you script is interrupted at 60FPS it will resume back in about 13ms so you cannot even be sure how long it will run let alone when it will start running
There is a fundamental flaw in scheduler though
It works better for faster PCs
3ms hardcoded makes no sense, it should be flexible value and depend on your FPS
Yea like lower fps should have longer frametime in scheduler eh?
The proportion of time allocated for scripts per frame goes up with faster PC and down with slower which are already struggling
Yes the script simulation duration should be proportionate. On slower PC you can clog the scheduler with too many scripts it will get stuck because by the time it does the sorting which script to execute next, there is no time left for execution
🍿
🐵
So no script is executed except unscheduled but the game runs
This is why every bit of performance you could squeeze out of your script matters
aye - glad u mentioned that isEqualType keyword therefore 😄
New question: I kinda heard fragments of database usage via SQF. At the moment I store my player data in CBA Hashes. Did anybody has experience with this database stuff yet?
extDB3 iniDB and others
is it simple to use? or a pain in the 🍑
extDB3 is pretty simple.
Do not need any full description here - just curious about your experiences
hm gonna take a peek then
MySQL has stored procedures, when I see ppl sending full fledge SQL queries to extension I’m like 🤦♂️
BAM! Suddenly male
extDB3 is very easy to use
uh thx
Is there any good reason to have a script not scheduled?
If you need reliable execution time
It needs to be executed right now and needs to finish right now
I don’t get it, you don’t think that discussion above brought up some reasons against scheduled execution?
Basically everything that you are not okey with if it takes a full minute till it executes the first line of code.
@tough abyss well in my opinion it did not sounded like sheduled execution will slow down the whole world for me. I havent written any heavy or time critical script yet so - no. For me scheduled still sounds like the better choice
I don’t know anything about your scripts or mission, but I know this, trying to choose one or the other and stick with it is equally bad, you need both, just have to be smart about what goes where
@tough abyss Thats why I asked Is there any good reason to have a script not scheduled?
do you know where can i found some document about BE filters ?
@tough abyss But I am aware now. Just needed a bit more insight to play the cards right. Thx bud
@compact maple xcuse me what is a BE filter?
just found something https://github.com/AsYetUntitled/Framework/wiki/BattlEye-Filters
I don’t think there is wiki page for it, would have been good to have with all the uptodate filters listed
yes it would have been nice, cause this :
On a new line add a number from 1 to 7 followed by a single space and then a keyword. For example:
why 1 to 7 ?
thank you
player setVariable ["someId", 23423];
Can anybody tell me the scope of this? I think it is only stored in memory as long the player is connected? After a reconnect it is gone eh?
yep
am at work - so I can not try it out. Just so you can be sure I am not lazy 😄
you can use missionNameSpace to keep a value even if the player is gone
missionNamespace setVariable ["YourString",3];//Same as: YourString = 3;
_yourString = missionNamespace getVariable "YourString";
Well I want to have some kind of login/userProfile
Having a CBA Hash on the server namespace
i did a login system, but with extdb3
And when "logging" in - I want the player who successfully logged in to have id to the hash so setting new values is straightforward
Yea extdb3 will be my nxt step
first trying it with the hash and migrating to extdb3 if I have my own hosted server
yea but want to have live QA after a new feature - so local is not satisfying 😄
Mission namespace is local if you disconnected it is gone unless it is on the server
aye
Did sb. of you ever implemented login with passwords?
To retrieve a user profile like an MMORPG would do
login like stuff is used by lots of people. Basically everyone with a extDB backend. But no password.
Your login is just your steamID
yes i did a login/password system
Anything but swords and wizards @frigid raven
what about players who dont play through steam?
@compact maple steam mission?
@tough abyss ?
Steam missions are different from normal missions maybe this is what xetra meant
idk, he said that people could buy a3, but on another platform than steam
yea thats what I thought
you can buy steam codes elsewhere
Ah ok then no A3 is steam only
Therefore I was unsure how defensive it is to only use steamID
but you have to activate them in steam
got it
Is there some kind of input prompt ?
So I can force the player to type a name or something like this?!
or only "hacky way" with UI and clickable letters 😄
you can intercept chat messages
is this an intuitive approach?
there is obvious bad side of that, if someone typo's whatever you use to filter logins from normal messages
Is there some kind of input prompt ?
RscEdit< this
How do I put code into the dialogs? Like a hint when a button is pressed or something
Nevermind found it.
tons of ways to do dialogue in arma 3
though if you want hint type things i suggest using systemChat
@frigid raven just create a dialog
check
Vauun i was giving hint as an example, also does all dialog code have to be SQS?
umm. no.
I meant the code that a button would trigger for example
In the buttonSetAction biki page it says it has to be SQS
Just make a SQS script that calls a SQF script
Some few legacy things are still SQS only yes
btw we have ctrlAddEventHandler
To call an SQF script with SQS would be execVM or call compile preprocess?
Oh, that makes it easier, thanks sldt1ck, didn't know about that one.
execVM. Or just call a function
dude, bookmark this page https://community.bistudio.com/wiki/User_Interface_Event_Handlers
@tough abyss
also check this > https://steamcommunity.com/sharedfiles/filedetails/?id=287378519
Thanks guys!
Is there a way to rotate an object around a given memory point?. The pivot point is the at the centre of the object by default, but i need it to somewhere else on the model.
I have this const
#define INSURGENT_FACTION "CFP_O_IS"
And want to use this as the type for the CBA_fnc_addClassEventHandler:
[INSURGENT_FACTION, "init", {call X11_fnc_addRandomIntelItem}] call CBA_fnc_addClassEventHandler;
But the handler is not triggered. Using "CAManBase"does work. What am I misunderstanding here?
How are you executing this code?
Is the faction actually a class parent?
Does it work with "CFP_O_IS" instead of INSURGENT_FACTION?
Of the CfgVehicle men that it is
I mean, looking at a glance it seems CFP_O_IS is a CfgFaction entry rather than a unit class.
@tough abyss no
well if it doesn't work with "CFP_O_IS" then it won't work with the INSURGENT_FACTION define
@errant jasper I think I mix up factions and unit classes then
@tough abyss yea my question was more why it does not work with CFP_O_IS
I thought it is like a subclass of CAManBase
never figure out how to list this unit class inheritance of a unit
In the editor, open the config viewer on one of the units, then it will list all parents (ancestors) in the bottom.
If you right-click on a unit in eden and open the config viewer that way you shouldn't need to scroll
I believe each unit has "faction" config entry. And there might not be a neat parent class for the units in the faction. So you can do something like this instead:
["CAManBase", "init", {
if (getText (configFile >> "CfgVehicles" >> typeOf (_this select 0) >> "faction") == "CFP_O_IS") then {
call X11_fnc_addRandomIntelItem;
};
}] call CBA_fnc_addClassEventHandler;```
what is wrong with using only typeOf (_this select 0) isEqualTo "CFP_O_IS" ?
I never understood the use of configFile >> "CfgVehicles" ...
Again you are mixing CfgFaction entries with CfgVehicles
A tank or a soldier has a config of from CfgVehicles. A faction, like CFP_O_IS is under CfgFactions.
Wait, I am missing something, editing. But still you are mixing
K. updated it.
If the unit would be an CFP_O_IS unit wouldn't typeOf _this select 0 yield "CFP_O_IS" or something?
oh
still confused
😄
I dont get the >> operation actually
Well, I can't be sure, cause I don't have the mod or arma running right now. But it seems like CFP_O_IS is not the classname of a unit aka vehicle, but rather the classname of a faction.
configFile is the entire config. configFile >> "CfgVehicles" is the root config of all units and vehicles. configFile >> "CfgVehicles" >> "B_Soldier_F" is the config for a NATO rifleman.
5 seconds of Googling leads me to https://github.com/tupolov/cfp/wiki/Standards#non-state-actors, and yes, that is a faction
I am kind of surprised there isn't a more convenient way to get the faction of a unit
that is why I am a bit confused you know
btw the config viewer shows me those parents: ["cfp_o_is_base","I_Soldier_A_F","I_Soldier_02_F","I_Soldier_base_F","SoldierGB","CAManBase","Man","Land","AllVehicles","All"]
So I can substitue CAManBase with cfp_o_is_base right?
Yeah, you should be able to do that.