#arma3_scripting
1 messages ยท Page 393 of 1
Only to weird people.
if you wanna reload configs without restariing the game you'll need to use arma3_diag.exe of the dev branch
Well in their defense, not everyone is used to this @still forum . playing the devils advocate here but just saying. not everyone here means the ones that legit have questions just not good at asking them.
Repeating your question in all channels is just rude.
and leads up to multiple Convos in multiple channels
Or you just use script commands to write the config values live.
That is true, but some of the answers here have been just... shocking sometimes. One needs a thickkkkkkkk skin.
What means "shocking"?
Laws are laws, never drove too fast? but that's offtopic rly ^^
If you break them you'll get trolled by everyone till a mod comes along and bans you.
Laws are laws, never drove too fast?Until police catches you and gives you a fine. "a fine" in here = making fun/trolling you ๐
Well lets say some of us are lke waiters, see them smile? they just started. See them bark? yeah those are ogs...
I mean I get where it comes from, i lol'd at what passes by sometimes.
Is there a way to pushback multiple ints to an array without the extra []?
That guy didn't answer back anyway. Probably spammed even more places and got his answer somewhere else.
append? @ivory nova
well i'll be
You know, sometimes you just got ppl who try to learn something... but most of the time you got ppl like... erm... no, no names... who just ask stuff, you answer them and give them a solution, they ignore your answer and ask the same question a day later again. And then again. and again .... and again
@cosmic kettle thanks man, had that wiki open too lol
No problem round.
@jade abyss I will never forget you helping me with my heli smoke trails script, +1 thanks from me
@jade abyss yes, and those people will always exist. The hardest part about being the good guy is the shit you see.
i did? Can't remember tbh ^^ @ivory nova
^lmeo he said exactly that when I thanked him... memleak?
Was at least a year ago (: Not reason to remember hehe
Ah, okay =}
The brains of everyone in here are overflowing with bad scripts. No one remembers anything anymore
I'm on Dscha 'list', im sure you remember me
ye
dsha make me trailer truck pl0x ๐ค
My brain only remembers _QS_worldName = worldName;
@jade abyss aww lol https://i.imgur.com/L0XULZ6.png
lul
searches with google
still no clue
leaves joke be
Dscha is famous.
@cosmic kettle my code snippet?
ye ^^
Why would you ever link this again?
Be careful. Might crash your browser
commy2 - Today at 1:33 PM
Dscha is famous.```
awwwwww โค
nooo please don't
to bamboozle us
i thought that was hidden
@cosmic kettle Scripts prolly borken now in MP.
https://forums.bistudio.com/forums/topic/178588-truck-and-trailer-arma-3-standalone-released-22102015/
Not the best (by far), but at least it looks fluid and doesn't need x-scripts to update positions etc (less taxing)
I guess I was wrong. The scheduler can make everything run.
@jade abyss I was joking around, know you need the handbrake to go ๐
and some other stuff ๐
and it is the best version I found really
the one from... erm... "name" was also not bad.... erm... Australian truck thingy (but had the same Probl with the UberHandbreak)
Well say whatever you want, #arma3_scripting is my favourite channel. Spent months on this discord, 90% here lol
and yeah i looked at name but they weren't public right?
The real Arma game is actually the scripting jigsaw puzzle.
^
And i think it's the channel where offtopic gets a little bit tolerated (till a certain point) ๐
Mods don't come here. 't is a haunted place filled with dangers of the deep.
Because mods can't tell the diff between unintelligible off topic and unintelligible scripting lingo.
lol (both)
just add if (script == true OR 1==1 && 2==2) from time to time
explosion 3... 2... 1...
SCRIPT == TRUE ! NO ! FFS! BLABLA!
I was fishing commys... ๐
Some real work here. Is there a way of generating a list of muzzles, without knowing any weapons?
like get all muzzles on the server.
Credits: serena BI forum.
{
private _wpn = _x;
private _asi = 2;
private _asn = ["MuzzleSlot", "CowsSlot", "PointerSlot", "UnderBarrelSlot"] select _asi;
private _cfa = configfile >> "CfgWeapons" >> _wpn >> "WeaponSlotsInfo" >> _asn >> "compatibleItems";
private _res = nil;
if (isClass _cfa) then {
_res = configProperties [_cfa, "isNumber _x"] select {getNumber _x > 0} apply {configName _x};
} else {
if (isArray _cfa) then {
_res = getArray _cfa;
};
};
{
if !(_x in _hint) then {
_LISTOFMUZZLES append _x;
};
} forEach _res;
}forEach _weaponList;
^still needs a weaponclass
List of all muzzle attachments used in a mission?
Yeah
the goal is to spawn one randomly
I managed to 'harvest' some lists, manually
using the above code. but kept itching in the back of my head.
_weaponList = getArray (configFile >> "MuzzleSlot");
Lol thanks, will try
private _allMuzzleItems = [];
{
{
_allMuzzleItems pushBackUnique (_x select 1);
} forEach weaponsItems _x
} forEach allUnits;
_allMuzzleItems - [""]
Maybe, haven't tested it. But in my current mission i am using ```sqf
_sights = getArray (configfile >> "CowsSlot" >> "compatibleItems");
Commy why allUnits? Will be testing both pieces thx guys
Do you want all muzzles used in the mission or all compatible muzzles?
Or just all muzzle attachments in general?
To rephrase; on first missionload I will spawn crates containing weapons/items/etc. I would like the spawnscript to select from a (preferred dynamic as in per server diff.) list of all possible weapons/atttachments on the server and spawn in the boxes.
the goal is to spawn one randomly
Sounded like using a list of all available
So you got a list and then select from there?
So you want all muzzle attachments in the game.
available on that Server (Addons)
Sure.
yeah, ATM I have to harvest each list and feed that to my spawnscript.
if ((_present getVariable "ARM_Events_Present_texture") in ["camo1","camo2","camo3"]) then {
for "_x" from 0 to floor(_baseValue/10) do {
private _weapons = [
// shortened
];
private _muzzles = [
// shortened
];
private _scopes = [
// shortened
];
/*
private _backpacks = [
// shortened
];
*/
private _className = switch (floor random 3) do {
case 0: {
_muzzles select (floor random count(_muzzles))
};
case 1:{
_scopes select (floor random count(_scopes))
};
case 2:{
_weapons select (floor random count(_weapons))
};
};
_present addItemCargo [_className, 1];
};
}
So long story short:
You want a crate, that spawns in randomly selected MuzzleThingys, wich are available on the Server. Right?
above code says it all I guess, but yeah ๐
and atm I feed in those lists
I would rather it be dynamic, so that on any server it'll work with what it has.
Why are you guys having such a hard time understanding the question ๐
I'm awful at phrasing sometimes.
private _allMuzzleAttachments = "true" configClasses (configFile >> "CfgWeapons") apply {
configName _x
} select {
_x call BIS_fnc_itemType select 1 == "AccessoryMuzzle"
};
_allMuzzleAttachments
This?
I have an idea. Gimme a.............. Yes.. That.
Memory. Google. And the wiki.
had the same thing in my hand^^
_ClassList = "true" configClasses (configFile >> "CfgVehicles"); <- from my files
(yeah, i know Vehicles, needed to be adjusted, blaaaaa. Just pasted in what i just found)
You can also read type directly from the config class.
CfgWeapons >> class >> "ItemInfo" >> "type"
301 is muzzle
[201,301,101,302] optic,side,muzzle,bipod
From https://github.com/acemod/ACE3/blob/master/addons/arsenal/functions/fnc_scanConfig.sqf#L40-L55
Okay, I gave them all a try, ofc (and ty) commy's piece works
tbh, just use BIS_fnc_itemType
but intriguingly, Moldisocks piece works ... sometimes.
_ClassList = "true" configClasses (configFile >> "CfgWeapons");
{
if((getNumber "CfgWeapons" >> _x >> "ItemInfo" >> "type") == 301)then{addToYourArray};
}forEach _ClassList;```
Try that also
_sights = getArray (configfile >> "CowsSlot" >> "compatibleItems");
diag_log _sights;
returns array of scopeclasses
_muzzles = getArray (configfile >> "MuzzleSlot" >> "compatibleItems");
diag_log _muzzles;
returns [];
ah, scopes
That is certainly faster than commy's method. But.. I think that might throw RPT errors if ItemInfo is missing.
In ACE Arsenal we have a isClass check for that
Just use BIS_fnc_itemType and store the result in a global.
@limpid pewter fyi , might learn a thing or two here.
I'm just wondering, why the diff between those two scripts?
first one does
Because configu viewer says so, idk hahaha. I'm amatuer. Dude these guys know what they're talking about.
It was my initial reaction
MuzzleSlot doesn't work
Don't worry @limpid pewter just trying out what you gave me, because I had a feeling it wasn't uniform.
it's just a base class that's left there that weapons can inherit from
Makes sense
there we both learned ๐
@cosmic kettle
_array = [];
_ClassList = "true" configClasses (configFile >> "CfgWeapons");
{
_Type = getNumber "CfgWeapons" >> _x >> "ItemInfo" >> "type"; //Get Typenumber
_Scope = getNumber "CfgWeapons" >> _x >> "scope"; //Check the accessibility
if(_Scope == 2)then
{
if(_Type == 301)then{_array pushback (configName _x);};
};
}forEach _ClassList;```
Try that (written as easy as possible to understand)
No more smiley
@jade abyss I try out all code one gives me, even if it is to compare.
@limpid pewter More smiley! ๐ ๐ ๐
isClass? For what? hm
-_-
Because ItemInfo doesn't necessarly have to exist
to check if class or array?
and if it doesn't it could throw error
oh, okay
To check if ItemInfo even exists.
Reading stuff out of a non-existent thingy == not gud
if isNil "_thingy" lmao
another thing I learned just by looking at someone get slaughtered here
There's no problem with it afaik.
null >> "something"
is just null.
The only problem is, when you try to access an entry, e.g. string, as class with this.
Does that throw errors to RPT or do only accesses from engine throw errors?
No error, just null.
getText null -> "" etc.
Only using double meme arrow >> errors when used on entries, not classes.
_array = [];
_ClassList = "true" configClasses (configFile >> "CfgWeapons");
{
if(isClass ("CfgWeapons" >> _x >> "ItemInfo"))then //does ItemInfo exist?
{
_Type = getNumber "CfgWeapons" >> _x >> "ItemInfo" >> "type"; //Get Typenumber
_Scope = getNumber "CfgWeapons" >> _x >> "scope"; //Check the accessibility
if(_Scope == 2)then
{
if(_Type == 301)then{_array pushback (configName _x);};
};
};
}forEach _ClassList;```
Better? ๐ @still forum
Why so much code when I posted the solution already with 3 lines ๐ฆ
Hmm weird, why does your code @little eagle return more than the snippet I found.
Find the error
understandable and "easy" to redo @little eagle
+You didn't checked for scope for example
Well, does it return more because the other thing is missing some?
Scope = 0 can lead to error messages or giving you a baseclass (without Model/proper config)
Oh you're right Commy, you just check it all, I had to feed it weaponclasses.
So you want unusable Muzzles in your crate? ^^
lol yes preferred
Text comms suck
Are you sure BIS_fnc_itemType method would list private classnames?
Sometimes, yeah @limpid pewter
when saying private here we mean scope=0?
@still forum "Find the error" was the meant for me?
yes
wuuuut
private _allMuzzleAttachments = "getNumber (_x >> 'scope') > 0" configClasses (configFile >> "CfgWeapons") apply {
configName _x
} select {
_x call BIS_fnc_itemType select 1 == "AccessoryMuzzle"
};
_allMuzzleAttachments
your script doesn't work because you forgot something
i haven't had cofeve yet, leave me alone
๐
Line? ๐ค
yes please
ah fk, damnit
yeah^^
_array = [];
_ClassList = "true" configClasses (configFile >> "CfgWeapons");
{
if(isClass (configFile >> "CfgWeapons" >> _x >> "ItemInfo"))then //does ItemInfo exist?
{
_Type = getNumber (configFile >> "CfgWeapons" >> _x >> "ItemInfo" >> "type"); //Get Typenumber
_Scope = getNumber (configFile >> "CfgWeapons" >> _x >> "scope"); //Check the accessibility
if(_Scope == 2)then
{
if(_Type == 301)then{_array pushback (configName _x);};
};
};
}forEach _ClassList;```
And yes, i ignore the bis_fnc ones @little eagle
Now fix performance and private variables ๐ :U
not putting spaces in control structures triggers me
}forEach REEEE
if(isClass REEEEEEEEEEE
Same here, but not to a point where it triggers really.
mimimi @austere granite
No lie though @jade abyss it eh broke
Yeah, prolly.
lmao commy
Commy going mental in a moment
what is this thing commy keeps shouting
You're the one thinking about something that was solved 10 minutes ago in 1 minute.
<- eating atm
@still forum "Now fix performance and private variables ๐ :U"
I have been meaning to ask you , why is it best to do sqf private _myVar = something; rather than just ```sqf
_myVar = something;
first. @limpid pewter
But Commy... it's a bis_fnc
@cosmic kettle Why ๐
Because you protect yourself from overwriting other variables that are in a scope higher up by accident
_array = [];
_ClassList = "true" configClasses (configFile >> "CfgWeapons");
{
if(isClass (configFile >> "CfgWeapons" >> _x >> "ItemInfo"))then //does ItemInfo exist?
{
_CfgName = (configName _x);
_Type = getNumber (configFile >> "CfgWeapons" >> _CfgName >> "ItemInfo" >> "type"); //Get Typenumber
_Scope = getNumber (configFile >> "CfgWeapons" >> _CfgName >> "scope"); //Check the accessibility
if(_Scope == 2)then
{
if(_Type == 301)then{_array pushback _CfgName;};
};
};
}forEach _ClassList;```
@cosmic kettle
Come on ded I was citing what you tought me it only took like 10 mins longer.
ok, so unless you think you will be at risk of naming the private vars the same in other scopes, then it isn't an issue? @still forum
Also setting private variables is faster.
Because if you don't private the engine has to check all scopes above it if the variable already exists.
^
It's just good practice and it doesn't hurt
private _array = [];
private _ClassList = "true" configClasses (configFile >> "CfgWeapons");
{
private _CfgName = (configName _x);
if(isClass (configFile >> "CfgWeapons" >> _CfgName >> "ItemInfo"))then //does ItemInfo exist?
{
private _Type = getNumber (configFile >> "CfgWeapons" >> _CfgName >> "ItemInfo" >> "type"); //Get Typenumber
private _Scope = getNumber (configFile >> "CfgWeapons" >> _CfgName >> "scope"); //Check the accessibility
if(_Scope == 2)then
{
if(_Type == 301)then{_array pushback _CfgName;};
};
};
}forEach _ClassList;```
incl. privates
If you don't have any upper scopes you don't have a real benefit. But it also doesn't make anything worse
I bet @little eagle gone mental already and screams around why we don't use the bis fnc ๐
@jade abyss you should really let it go lmao still errors ๐
no
Commy went for a nice and calm walk outside
But remember not to use private ["_var","_var2"]. That one has overhead. And actually quite a lot
Was it that much?
@cosmic kettle May i ask why you have presents in the background of that screenshot? you making a christmas mission?
@jade abyss Infinitly much
@still forum If you mean for defining local vars for parsed parameters, then ok. I usually use params ["_var1","_var2"]; anyway
@limpid pewter exactly, check out #arma3_model around yesterday 2PM ๐
@cosmic kettle Copy the code from above again. I added configName 1 line too late
params [.... is ok, private [..... just isn't imo?
I often see people use
private ["_var"];
_var = 1;
instead of private _var = 1;
Which destroys all performance benefits that private variables have
I'm in a different chat waiting for you guys to realize that I was right again.
params and private ARRAY do different things.
@still forum tbh, thats how it was made before ๐
params has a reason to exist. private ARRAY not really
lol Commy
yeah ok, i understand what params does, just making sure i understand what private does
no @jade abyss You could always local _var = 1;
Waw Dsha your code it work so well and soooo compact.
๐
Add 5 more lines and it even works!
not my concern
Haha.
Executes Dscha code:
["acc_flashlight","acc_flashlight_smg_01","acc_flashlight_pistol","acc_pointer_IR"]
happy
i thought you wanted muzzle attachments
301, thats what @still forum said
try 101
"You can also read type directly from the config class.
CfgWeapons >> class >> "ItemInfo" >> "type"
301 is muzzle
[201,301,101,302] optic,side,muzzle,bipod"
Just joking, It's the concept I'm testing @limpid pewter . As Commy said, easier and compacter code to be found way up there ^
Anyway, you can have a list for all of those now^^
oh lol
Did you just upload a screenshot to prove a point, rather than just quoting
oops ๐
๐
Yep @limpid pewter
-_-
*too many macros*
*OVERLOAD*
reason i said try 101 was :
"[201,301,101,302] optic,side,muzzle,bipod"
from commy's post
Dedmen cannot count commata
lul
was gonna say
๐
tis wednesday for me
im deutschland... fill in
*system shutdown*
I wanna model something. Gimme something easy that I could 3D model and put in Arma
The CBA logo with roadway lods so you can climb on it? ๐
A statue of Dwarden
The CBA logo with roadway lods so you can climb on it? ๐
YES
Off to work!
Can it be a weapon that shoots out bugs instead?
*14:17:11 Error Type Number,Not a Number, expected Number*
Game crashing bugs?
Give it 4k textures, so we can put it in 3.6 and make 90% of the mods filesize this one model.
best errors @jade abyss
Yep, Stickie
Oh gosh I have a better Idea :3 I'll do that first and then the model
i have a good idea
a plane flies over the island and drops players
that'll be 10โฌ
#350?
not another battle royale
How do I generate a NaN in SQF again?
log -1
^when you know you've gone too far
It's
i*pi/ln(10)
with programs that actually can do math.
Did all of your guys start programming with other langauges like C,java and python, then come across and learn this? As a hobby
sqf first 3 years ago.
SQS > SQF > damaged for life
Not me, I did web before don't shoot me
huh, so is this you only langauge?
Nah, a bit C# also
web > SQF > C#
Rudimentary I know a bit of C++, but not really.
Dedmaen dreams in C
And no. I don't. I dream C++
It is terrible when I wake up still sleepy and think about that I first have to initialize the class before I can disable the alarm clock
daaaaadddmmaaaaannnnn *sing*
ok, just wanted to know if i was the only one who had no prior professional experience coding before doing SQF
noob spams question
pow
spam in chat
thump
dedmeeeen
Literally almost every morning my brain is in "writing code" mode. It's so weird.. After that I always think: WTF?
@limpid pewter I personally think A3 is great just for that. You learn to 'play' with code.
Before arma, I played games.
Yeah definitely, but i am now trying to start developing an app at the same time, and all of the debugging techniques you learn in arma (systemChat, hint, diag_log) all are comepletley different, relearn everything -_-
I personally think A3 is great just for that
It's pretty terrible actually
hence personally being the keyword
Well.. You can also use a real debugger in SQF.. That isn't really different from other languages then
Yeah, i just meant generally, i have had to re-learn alot of stuff, sytax and structure wise
@limpid pewter you learn the principles, learning new languages is ike throwing the skillset away and rediscovering that same skillset in the new language. after that phase, you're good to go.
https://www.youtube.com/watch?v=pd-2WQzoG48 The joy of hacking things together.
I personally think A3 is great just for that. You learn to 'play' with code.
Yep, but don't dive in too depp or you kill your thinking, when you start with another language ๐
wait wat, are you actually ...?
@still forum What is this... Arma studio. I have been just using notepad++ and more recently Posiden tools
Oh moldi, don't be like me and waste years of your time
Checkout atom and the sqf lintchecker + ACE3's syntax
It's a Complete IDE with a real script Debugger that has breakpoints and all that magic. Integrated Linter and stuff.
People weren't interested in it so it was put on halt.
"put on halt" So is it still working? can i use it now?
What are you talking about not interested? I learned about linters for A3 like 3 months back and wished I had searched sooner ever since.
The debugger part broke in.. 1.76 I think. When BI made a hotfix and "fixed" something that wasn't even the issue and broke the debugger.
Bugger ๐
Would be about a day of work to get it fixed.. But not really worth the time if just two people would use it
Well a full featured IDE sounds like a great tool. Better than notepad
Count me interested XD
There are two devs on that. I have work and school. Other dev is studying at university. There is better stuff to invest free time into that more people will have a use for
Like.. Write scripts in Intercept and just use any C++ debugger
Seriously though, moldi, use Atom and get a lintchecker.
Yeah cool
Will save you loads of headaches in the meantime.
will check it out, but i have gotten used to sublime text atm
https://dedmen.de/sharex/notepad%2B%2B_2017-12-12_14-58-34.png
doStuff (log -1);
-> Error dostuff: Type Not a Number, expected Number, Not a Number
maybe it wants a number 1 = "hello"
https://dedmen.de/sharex/notepad%2B%2B_2017-12-12_15-03-40.png ๐ Dis is fun
I don't know what that second Generic error thingy is...
Okey enough of funnying around. Let's get dis CBA thingy going
```RiverRaidMusicLoop = addMusicEventHandler ["MusicStop", {"RiverRaidLoop" remoteExec ["playmusic"];}];````
this handle is being called by the server but it seens like if the host is alt+tabed it does not work for clients
is there a wasy to call this handle local to all players connected?
If you are tabbed out there is no music. So I guess that could make sense
You can't call a Handle.
so its only works local?
you could launch it from host and handle locally
how?
it depends on what you want, but I have no experience with musicEVHers so can't help you with that.
Why not use remoteExec to spawn on all clients a function that only does this : ```sqf
RiverRaidMusicLoop = addMusicEventHandler ["MusicStop", {[RiverRaidLoop] spawn playmusic;}];
i dont think that will fix it
if the EH is on the client not the server, then when the server (you) alt-tabs, the client's EH is still running as usual. All i am saying is that you want the EH on the client, but as Stickle said, idk too much about music EHs at all, but if it works similarly to other EHs, then this is what i would suggest
@little eagle Want the bricks to be open on the underside?
Like real legos.
don't tell me your actually modeling lego -_-
I already used the original measurements but it's not open on the bottom. I'll add the opening then
I am ๐
Anyone have any idea what could be going wrong with this vehicle unflip script? Ever since the latest Arma update, if often causes the vehicle to dissapear according to player reports.
private _pos = ASLToATL (getPosASL _vehicle);
_pos set [2,(_pos select 2) + 0.5];
_vehicle setPosATL _pos;
if(local _vehicle)then {
_vehicle setVectorUp [0,0,1];
} else {
[_vehicle,[0,0,1]] remoteExecCall ["DS_fnc_setVectorUp",_vehicle];
};
Error is probably somewhere else.
Dunno why it would disappear, but pretty sure this would make it catapult into the air when used on steep terrain. Half of it would be stuck in the ground.
use surface normal instead ?
Prob best todo all the getpos / setpos / setvectorup commands were vehicle is local shrugs
Never encountered vehicle disappear, but i normally transfer ownership to server first & get server to setpos / setvectorup. Makes it easier to create some BE filters, if you don't allow client to setpos on vehicles
[_vehicle, {
_pos = getPosASL _this;
_this setPosASL _pos;
_this setVectorUp surfaceNormal _pos;
}] remoteExec ["call", _vehicle];
idk
Question: Do i need the extra parenthese around (_aflag_distance - 400)^2 ? ```sqf
1.18343195266272*((_aFlag_distance - 400)^2) + 1.2;
Unless you want 160000, you need the parenthesis in math, sqf, and any other sane language.
i want 1512100
XD
i was meaning to multiply the expression (_aflag_distance - 400)^2, do i need to put brackets arou nd it like this : ((_aflag_distance - 400)^2)?
#WATCHFIELDS
Do you know what the debug console is?
Yes.
Why not ask the debug console then? It makes no mistakes unlike we humans.
Just not thinking straigth, 3 in the morning, should be asleep. Thought it would be easier to ask on here. I apologise
@little eagle The script you privided earlier (3 lines version ^^),for some reason, doesn't return backpacks, rifles, glasses and magazines, even though they are listed on BIS_fnc_itemType wiki.
It's supposed to report muzzle attachments?!
I know, but I modified it:
params [
["_type","",[""]]
];
private _allClasses = "getNumber (_x >> 'scope') > 0" configClasses (configFile >> "CfgWeapons") apply {
configName _x
} select {
_x call BIS_fnc_itemType select 1 == _type
};
_allClasses
For weapons see: https://community.bistudio.com/wiki/BIS_fnc_itemType
I can get that I might need to use CfgMagazines for mags, but Rifles should work?
I did, once you posted the link earlier. Rifle is listed.
Weapon / VehicleWeapon
AssaultRifle
BombLauncher
Cannon
GrenadeLauncher
Handgun
Launcher
MachineGun
Magazine
MissileLauncher
Mortar
RocketLauncher
Shotgun
Throw
**Rifle** ?
SubmachineGun
SniperRifle
Well, what does "Rifle" report?
[], is it that it's never used maybe?
I just base this on the thought they might be different, which indeed they are it seems.
Just because there are so many mods on this one I assumed it was. my mistake.
Who knows. Maybe a typo on the wiki.
It's why I'm pointing it out, in the hopes more experienced folks will maybe notice errors in my way or the wiki
As for backpacks, you have to change CfgWeapons to CfgVehicles.
And for goggles, you have to change CfgWeapons to CfgGlasses.
That's what I mean, I assumed those changes were neccesary, but Rifle is really the odd one out. Guess no rifles here shrugs
It's AssaultRifle, to differentiate it from SniperRifle and MachineGun.
And SubmachineGun.
Shotgun never ๐ฆ
Oh by the way, is it wrong to only load them once, store them somewhere and pick from that pool afterwards?
As in, arrays can get big.
Global variables.
Exactly, so that's what I'll do
Good. That is why it doesn't matter that it uses a bis function. No one cares about a second more as mission load, and this is way less.
Oh btw; I was thinking of making a modification to it to check if a client has the appropriate DLC, is there a BIS function i don't know about that could help me?
I admit I lack the latest one, but I assume peeps might lack more.
private _fnc_getDlc = {
params ["_classname"];
private _dlc = getText (configFile >> "CfgWeapons" >> _classname >> "dlc");
if (_dlc isEqualTo "") exitWith {-1};
getNumber (configFile >> "CfgMods" >> _dlc >> "appId") // return
};
isnt that broken on dedi?
getPersonUsedDLCs is
:/
All, where is the statement in setWaypointStatements run in MP ( https://community.bistudio.com/wiki/setWaypointStatements )?
To be more specific, if I add a setWaypointStatements on the server side on a group, where will it run?
I'd imagine on every single machine (since waypoints are global) but I'd like to be sure
I have list of classes ["I_soldier_F", "rhsgref_cdf_ngd_crew", "rhs_vdv_arifleman"] and I need to sort them by side. Any ideas ? For vanilla classes I can use prefix I_, B_, O_, but how to sort modded classes ?
yes it works @candid jay
it works = runs on every machine?
yes
ok thanks
when you create then it also creates them for every machine and everyone will see their actions
ok great
@real tartan I would iterate through classes, get the class side, store in array that holds but that type and afterwards make an array and append each previous array in the order you want.
@cosmic kettle how to get the class side ?
getNumber(configfile >> "CfgVehicles" >> _className >> "side")
private _return = getNumber(configfile >> "CfgVehicles" >> "I_soldier_F" >> "side");
hint str _return; //2
nice, thx
@little eagle Hey I tried the commy_fnc_firemissile.sqf script, but I get an error when clicking OK after adding it to the init of the soldier
What error.
I'm trying to recreate it
if (isNull delet_1) exitWith {
hint "1";
if (alive player) then{
sleep 3;
playSound ["CmdA423", true];
sleep 17;
playSound ["Play400", true];
sleep 3;
playSound ["CmdA424", true];
sleep 4;
playSound ["Play401", true];
};
waitUntil {
if (!(player in heliDelet)) exitWith {
if (alive player) then{
hint "2";
playSound ["Play404", true];};
sleep 5;
if (count (((player nearEntities ["man", 20]) select {side group _x isEqualTo west}) - [team_1, team_3]) >= 2) then {
hint "3";
(((player nearEntities ["man", 20]) select {side group _x isEqualTo west}) -[team_1, team_3] select 1) say3D ["10MC536", 100];
} else {
hint "4";
Player say3D ["10MC536", 100]
};
true};
};
true};
}; ```
For some reason my script file is stoping here for JIPs, why he cant check the "(isNull delet_1)"?
Roque.
generic error in expression
Line ?
Before you even start, why do you have the entire thing encapsulated in waitUntil? ExitWith? Sleep? Suspension in unscheduled? The hell?
but it just flashed and was gone, not getting it to display again
I get you have the true returns at the bottom, but what is all the rest here?
Do you mean the guided or the unguided one?
This one? https://gist.github.com/commy2/2e5b20710ea7ded8ebd7d6e502af9c63
Unguided
So the one I linked.
to avoid play the sound if the player has now yet spawned or play some sounds out of context
@astral tendon Why not just add a condition? WaitUntil is a one shot event
I removed the first line, then I didn't get the error
is supouse to be one shot event
Don't just remove random lines.
but it is // so it is only tekst for the user? (I'm very very noob)
0 spawn
{
while{true} do
{
if(timeisright) exitWith
{
};
};
};
// is just a comment. Ignored by the compiler
^
also, this is to avoid the sounds to play all at the same time when the JIP join in the server
If it works that's good I guess.
@astral tendon Do you understand why this happens? Because the unit init is considered eevery time a player joins
exacly
if (didJIP) exitWith {}
So don't execute in the unit init!
is not the unit ints
You wouldn't have jip problens in the first place
playSound should have entirely local effects
I added the whole script again and got the following error:
'call{|#|// init.sqf
commy_fnc_fireMissile = {
...'
Error invalid number in expression
the problem is i dont see that hint i put to help me check it
Ah, it's playSound3d
Why is this playsound3d in the initPlayerLocal if you don't want others to hear it?
You need to spawn this to begin with
No reason not to
Sleep 2; //delay to avoid JIP isues
//Game started
hint "o aquivo carregou"; /// <<<< this one actually works
waitUntil {
if (isNull delet_1) exitWith {
hint "1"; /// <<<stops here
if (alive player) then{
sleep 3;
playSound ["CmdA423", true];```
this is the begining of my file
Spawn the wait until
do i have to do it with all the others waitUntil inside the file?
because, as i know if i put too much spawns its gonna cause perfomace isues
Yes, you never use suspension without spawning it
You have a clusterfuck here, way too many suspensions in script to be doing something simple
Suspension: sleep. waitUntil, etc
Scheduled hell.
so, why that only happens to JIPs? since it works if the client joins the game with the host
initPlayerLocal runs local to the player that is joining.
also, you should NEVER suspend init scripts
^
that is not inside the initPlayerLocal , is on a separated file
Dub = execVM "Dub.sqf";
this is in the initPlayerLocal
Why do you need to execVM this?
this is how i find around the internet how to do a script file
You can look a little harder and find something like:
call compile preProcessFile "script.sqf";
Or register it under cfgFunctions in your description.ext
class CfgFunctions
{
class midnight
{
class cool_tag
{
class aFnc{};
};
};
};
@inner swallow In this case there is no need as far as i know: the script handler isn't being used
i mean you don't need to use it...
Yes, but what's the advantages? None, unless you use a script handler, but you could always just use spawn for that
well...advantage is that it's quick and simple
Quick and simple don't equate to effective
they do, depending on one's definition of "effective"
look at it this way, what are the disadvantages?
and then what are the disadvantages in this context?
Well, if you truly want to use execVM. Have at it
But i'd rather have control wether it's scheduled or unscheduled
I've never seen any
I also don't like that i always returns a script handle
Unless there is some other syntax that returns last? I don't see any
execVM is scheduled
execVM is a SQF thing
execVM is just a shorthand for spawn compile preprocessfilelinenumbers
I think one advantage is if there is an error in file with execVM it doesn't prevent rest of your script from running. pretty sure anyways
@inner swallow Yes, but what if i don't want it to be scheduled is what i am saying
I'm having some trouble with the following code. ```_crew2 = creategroup WEST;
_airframe2 = [getMarkerPos "mkr_SpawnApache", 90, "UK3CB_BAF_APACHE_AH1_MTP", _crew2] call BIS_fnc_spawnVehicle;
_wp21 = _crew2 addWaypoint [(getpos heliApache), 0];
_wp21 setWaypointType "GETOUT";
_wp21 setWaypointSpeed "NORMAL";
_wp22 = _crew2 addWaypoint [(getmarkerpos "mkr_SpawnDespawn"), 0];
_wp22 setWaypointType "MOVE";
_wp22 setWaypointSpeed "NORMAL";
_wp22 setWaypointBehaviour "SAFE";
_wp22 setWaypointStatements ["true", "hint 'crew 2';{deleteVehicle _x;} forEach units _crew2; deletegroup _crew2;"];``` The hint shows, but the crew aren't removed. Any ideas why?
_crew2 variable is undefined.
then that's your specific use case midnight
_crew2 is defined otherwise the waypoints wouldn't work no?
A lot of people understand it to be the only method of exeuction: which becomes a problem sometimes
where does the love from execVM and init fields come from?
or using spawn at every sauce
No. _crew2 is not defined in the script with the hint
"hint 'crew 2';{deleteVehicle _x;} forEach units _crew2; deletegroup _crew2;"
That is your script. You never define _crew2
@lone glade I honestly have no clue, maybe it's just easier for beginners?
I still did not got a straight anser to this, but how many spawns we can use before it became a problem?
OK. So it must be entirely blind luck that the units are created, the waypoints assigned and they actually follow it then.
No
In the waypoint script the variables are properly defined. That's a different script.
You have 3 scripts in there
First:
_crew2 = creategroup WEST;
_airframe2 = [getMarkerPos "mkr_SpawnApache", 90, "UK3CB_BAF_APACHE_AH1_MTP", _crew2] call BIS_fnc_spawnVehicle;
_wp21 = _crew2 addWaypoint [(getpos heliApache), 0];
_wp21 setWaypointType "GETOUT";
_wp21 setWaypointSpeed "NORMAL";
_wp22 = _crew2 addWaypoint [(getmarkerpos "mkr_SpawnDespawn"), 0];
_wp22 setWaypointType "MOVE";
_wp22 setWaypointSpeed "NORMAL";
_wp22 setWaypointBehaviour "SAFE";
_wp22 setWaypointStatements ["true", "hint 'crew 2';{deleteVehicle _x;} forEach units _crew2; deletegroup _crew2;"];
Second
true
Third
hint 'crew 2';{deleteVehicle _x;} forEach units _crew2; deletegroup _crew2;
Variables don't magically carry over to scripts that don't know anything about eachother
It's all in the same script?
Clearly you know the answer so can you not just tell me so I actually learn something? I don't follow what your trying to say
He's not misleading you, the script variables do not carry over
I'm not suggesting he is.
Make the variable public if you want to use it across scripts, or pass the variable into the exeuction of another script
I just don't understand what he is trying to tell me
How is it "different scripts"? It's the same fecking file.
Variables only carry over to scripts that you call directly.
You are not calling these
Variables go out of scope when you script ends
Here you just add a eventhandler. Meaning you add the eventhandler (the script is not being executed) your script then ends and your variables go out of scope and get deleted.
And minutes/hours/days later the eventhandler string get's compiled and executed by the engine. It has no Idea where that script came from or what variables were there when it was added as a eventhandler
Variables only carry over when you call a script. Not when you create a new script instance. Spawn/ExecVM/Eventhandlers and other stuff create new script instances
But i'd rather have control wether it's scheduled or unscheduled
Considering the "same file" argument.
script1 = {<code>};
script2 = {<code>};
script3 = {<code>};
Do you also consider these 3 scripts to all be the same script? No. Ofcause not. Because they aren't.
Your eventhandler code is the same. You have multiple scripts inside one file. Doesn't mean they are all the same script
Variables go out of scope when you script ends <-- !! *local variables
And using either spawn or call from initplayerlocal would still give you a scheduled environment
So it really doesn't matter
@still forum ah. Right. The light bulb is on. Thanks. I get it now.
not if you're smart and use cba_fnc_directCall after a canSuspend check taps forehead
The code is already scheduled, it's irrelevant, it's a battle of compiling vs not
drugs it seems
So my answer is to make crew2=_crew2 and change the waypoint statement to reflect that?
Using call from initPlayerLocal, or spawn for that matter, won't help you pick the context it runs it, it'll be scheduled regardless
Unless you use something such as isNil, yada
canSuspend check + cba_fnc_directCall = unscheduled in all cases
We aren't discussing isNil
๐คฆ
@dusk sage why the hell would you put code directly in initPlayerLocal?
I'm not, I'm merely reading the conversation above
Why would you put code there? Because you want to
A bizarre question
https://github.com/acemod/ACE3/blob/master/addons/arsenal/functions/fnc_openBox.sqf#L33
what I meant by canSuspend + directCall
this function is guaranteed to ran in unscheduled
My point was, the argument for execVM/spawn, and call, inside initPlayerLocal, is irrelevant for the scope of contexts
It's the same regardless
wat
Err.
are you trolling?
No
BoGuu, is there something i am missing here?
Suspension from a script executed via call in initPlayerLocal will not work
@sand axledog [3CB]#2890 Yes. But be careful if you run that script multiple times your global var will get overwritten
Damn discord ๐คฆ
And I can't even work around the Discord bug and mention correctly because he doesn't have a avatar
@worldly locust (read ^)
For as many bugs as they squash, that's one that has been around for a while
well, still nothing
///Play all in game dub here
Sleep 2; //delay to avoid JIP isues
//Game started
waitUntil {alive player};
hint "o aquivo carregou"; /// <<<< this one actually works
waitUntil {isNull delet_1};
hint "1"; /// <<< JIP still stops here
if (alive player) then{
sleep 3;
playSound ["CmdA423", true];
sleep 17;
playSound ["Play400", true];
sleep 3;
playSound ["CmdA424", true];
sleep 4;
playSound ["Play401", true];
};````
And i changed to ```[] spawn compile preprocessfilelinenumbers "Dub.sqf";
๐คฆ
the problem still for jips
Gah...
Well, back to triggers.
Yeah no
Giving up easily and falling back to what you know doesn't help you learn
Spawn any code that is suspended
Thanks. @still forum . I couldn't post for "10 mins.." ๐คฆ
The script is only going to run once on the server so no worries about over writing the values. I will make the local variables public.
Unless there is a way of accessing a group from a waypoint it belongs to.
Wait whats the issue? @astral tendon
@jovial ivy JIP players stop the script at waitUntil {isNull delet_1};
I wonder why
even tough that is already true
BoGuu, is there something i am missing here?
Yes, you are, the fact this
Suspension from a script executed via call in initPlayerLocal will not work
Is false
You're going from a scheduled environment (where canSuspend is true), to another scheduled environment, where canSuspend is ditto
And that statements like this:
Spawn any code that is suspended
Are bad advice
@astral tendon Is something resetting that by chance? Maybe when the player joins it is setting it as null or something.
And that statements like this:
Spawn any code
Are bad advice tbqh
Winter scheduler war is coming
Depends tbh
Spawn any code could be too much
However, could be exactly what is needed
@jovial ivy i dont think so, that unit was deleted once the players get on the helicopter
alive and triggeractivated also did not worked
@subtle ore Read up ^, incase you miss it
before i was using triggers in my last mission to spawn the voice acting, but people keep saying thats wrong so i decided to do the "right" way
ohyh
Hey guys, is there anything that should be known of animations syncing across network? I have experienced some animations sync fine over network, i.e. show for all in MP, and some does not which requires it to be remotely executed.
@dusk sage
A) I never said to spawn each code.
B) Suspensions like that should be scheduled.
@rotund cypress any anim players like switchMove and playMovd have local effects. So as far as i know you're going to want to remoteExec that
Turns out playmove is actually global
Am already remote execing switchmove stuff though
A) I never said to spawn each code.
I just quoted what you wrote.
B) Suspensions like that should be scheduled.
Which it is (initPlayerLocal)
But ultimately, the thing I was attempting to get across, was that Suspension from a script executed via call in initPlayerLocal will not work, is wrong, and not how things work at all
@dusk sage We're saying the same thing ffs
No, we're not
Because I wouldn't write
Suspension from a script executed via call in initPlayerLocal will not work
Because it's wrong
A called function may only use suspension (sleep, uiSleep, waitUntil) if it originates in a scheduled environment. If the called function originates in a non-scheduled environment it will return a generic error.
- MattAka Horner
https://community.bistudio.com/wiki/call
Getting 2015 vibes here. I thought everyone figured this out by now.
Whatever works.
Note that while the environment isย Scheduledย (canSuspendย returns true), the engine seems to wait until the script is done executing, essentially behaving similarly to anย Unscheduled environmentย - infinite loops will freeze the game, uiSleep may pause the game for up to ~20secs (postInit), et does this still apply?
Event scripts
That applies to atleast postInit
It doesn't freeze the game. But it has loading screen till the last script is done
is this the weekly spawn discussion again?
please no
Intercept cool. Done.
Intercept did #screenshots_arma
Which helped me make ACE tripod better :3
best place for intercept discussions is probably intercept slack
Thereโs a slack for it?
yip
Where does one find this
Can someone help me with my dialog. I just started with dialogs, but I'm baffled as to why my script called in onload doesn't change the text in the dialog: https://pastebin.com/Wfhtr27e https://pastebin.com/39Hrqg2j
is the script in the root of ur mission or is it in a folder somewhere?
#include "..\scripts\moderation\UID.sqf" suggests its ina folder so put the full filepath to the script in ur execVM
They are in the same folder, so it should work. But i'll try
no it shouldnt work, the UI is included into the description.ext before loading as the missionConfigFile
I think that is actually the problem yea
Yup
I don't know how I didn't think of that. I had the same issue with cfgfunctions
Can anyone tell me why this: ```sqf
drawIcon3D [(MISSION_ROOT + "resources\pictures\AFlag.paa"),icon_aflag_color,[14216,18291.8,15.064],icon_aflag_width,icon_aflag_height,0,"A Flag",0,1.2,"PuristaMedium","center",true];
Screenshot of this
ok.Didn't realise the scale was different to say.. structured text sizes
Thanks, will try
switch (_houses) do {
case ((_houses > 0) && (_houses < 5)): {
for "_count" from 1 to 2 do {
[getMarkerPos _mkr,"Infantry"] call EO_CreateGroup;
systemChat format ["%1 is spawning %2",_mkr,_count];
};
};
case ((_houses > 5) && (_houses < 10)): {};
default {systemChat "Default"};
};
This is always returning default even if _houses is equal to 3 for example
That worked Conner, thanks again
@daring pawn switch true do
Not sure I follow fully, I think I know what I fucked
switch (true) do {
case ((_houses > 0) && (_houses < 5)): {
for "_count" from 1 to 2 do {
[getMarkerPos _mkr,"Infantry"] call EO_CreateGroup;
systemChat format ["%1 is spawning %2",_mkr,_count];
};
};
case ((_houses > 5) && (_houses < 10)): {};
default {systemChat "Default"};
};
``` ?
yea
what u had was basically saying if (_houses isEqualTo ((_houses > 0) && (_houses < 5)) which it never would be cause _houses is a number and the second part is a bool
Hmmm right. Well it is indeed working now. It appears I had a misunderstanding of the operation of switch
cheers
sorry, saw i included switch
Yea changed _houses to true in the switch
Cool
lol
Who here knows a fair bit about drawIcon3D? I would like to pick your brain for a bit
I have issues with scaling the 3D icon with regards to the distance the player is from the icon
@limpid pewter No experience, but what do you mean by this? I'd say vary the width & height params based on player distance.
Yeah, i am doing taht already with a while lopp atm, just using a linear expression to work out size between 1.2 and 3 (maybe these sizes are wrong scale) : ```sqf
while {updateIconSize} do {
//A flag
_aFlag_distance = player distance [14216,18291.8,10.064];
if ((icon_aflag_height > 1.2) && (icon_aflag_width > 1.2) && (_aFlag_distance < 1000)) then {
icon_aflag_width = -0.0018181818181818*_aFlag_distance + 3.004615384615385;
icon_aflag_height = -0.0018181818181818*_aFlag_distance + 3.004615384615385;
};
};
You read the note right?
Use onEachFrame or addMissionEventHandler "Draw3D"
I mean, it works with normal values?
Yeah, to i have this sqf addMissionEventHandler ["Draw3D", { drawIcon3D [(MISSION_ROOT + "resources\pictures\AFlag.paa"),icon_aflag_color,[14216,18291.8,15.064],icon_aflag_width,icon_aflag_height,0,"A Flag",0,0.04,"PuristaMedium","center",true]; }; To initialise the drawIcon3D stuff
Yeah everythin is fine, just needs polishing. When im say 400 m away from icon, the size is fairly large relative to screen, but at 10 meters it gets smaller
Well, for the distances 2 - 100 the number it returns varies between 2.8 and 3.1, is this the behaviour you want?
Somewhat, i want the returned var to be closer to 3 as you get close to the marker, and as you get away, get closer to 1.2
So essentially, i need the marker to be big when i'm close, and small when far
I'd say you need to define yourself what those measures of close and far are and scale accordingly. The difference between 2 and 100m. is but .3, I doubt that is enough.
Dw if too hard, i shall figure something out
yeah so close = 10m, far equals 1000m (as per the linear expression)
And the returned value should be close = 3 and far = 1.2
What you have now does exactly the opposite.
Really?
No, sorry my bad, it does exaclty that.
yee idk. The game seems to already do a simialr thing when the scale is left at 1. But it does it backwards (big far away and small up close), i need to counteract this is what i'm thinking. But anyway, thanks for help. I will just need to fiddle around with it
If anyone wondering how to get SIDE from CLASS, here it is: _side = [east, west, independent, civilian] select ( getNumber ( configfile >> "CfgVehicles" >> _class >> "side" ) );
ok cool, good to know
Also @real tartan the provided code will only work for CfgVehicles, so no weapons/backpacks/goggles
can anyone clarify when using attachTo, attach objectA to objectB whether objectA should still have collision enabled?
i am attaching a 'praetorian 1c' to a 'brick' (to keep it secured in the one place), but in doing so objectA seems to lose it's collision aspect with vehicles. a player on foot walking towards objectA the collision is present, but driving a vehicle in to it, i go straight through objectA.
Sorry, not too familar with attachTo command.
@limpid pewter i just did a quick test and...
getNumber (configfile >> "CfgMagazines" >> "NLAW_F" >> "type")
returns 768, therefore your conditional check of...
if (_type isEqualTo 768) then { <something here> };
will work. and use 'isEqualTo' instead of '=='
oh you deleted the question. 0.o
Yeah, just did same. Mainly just trying to get my head around how to go about determining the type of a magazine, or that is: what weapon the magazine goes in.
Thanks btw soulkobk
np.
you could to a config search for weapons with specific scope that contain that magazine? cfgWeapons and getNumber 'scope' with getArray 'magazines'.
yeah i guess, but was hopeing for a more elegant solution. But nvm ,i shall work something out. Thanks again
gl with it.
@limpid pewter
https://community.bistudio.com/wiki/BIS_fnc_compatibleItems
^ just be aware that the capitalization of the returned strings is seemingly random
so tolower the array and tolower what you wanna compare it to
Ok thanks for the warning
Nothing apply {toLower _x}; can't fix.
๐
Has anyone here experienced target computer freezing and Arma having to be restarted after you have remotely executed a script directly on that player object?
Not really, but with that script you're executing on the player's machine, does it have any loops, waitUntils, etc..?
If short, just post the script up here, it would be useful
@limpid pewter unfortunately I can not post the script, its also way to long. It is unscheduled, so no waituntils, and no loops; however it creates a new thread with loops in it.
remoteexecution -> unscheduled -> makes new thread
by make new thread you mean you spawned a new function, rather than calling one yus? (just trying to ruleout the basic stuff)
^
@limpid pewter Yes spawning a function. It goes from remoteExecCall to then create a suspendable thread in that script.
Problem is, when I use diag_log it doesnt even reach the first one - only code being before the first diag_log is scriptName and scopeName
Ehm, what?
Arma rpt log is spammed since update 1.78
Yes
You can't read shit
Now that you are here Arkensor, I might ask you; have you ever had this problem?
Oh
No I did not but it does not sound correct for me
No matter what happens or what you execute the main thread will kill the script execution after the 0.3 time window
I also must add: remoteExec does nothing, but does not freeze target, only remoteExecCall freezes target.
0.3 ms you mean?
As I said I would doubt it's normal ๐
Go ahead and remove the payload you execute
Put in something non fishy
I also must add - when I host the mission locally - i.e. through host server it works.
Even a single diag log might be ok
Even when its remoteExecCall
Rip arma then
Fucking arma.....
I would post a meme in public but I would be banned for it most likely
So Look into your pm
Will do - please send.
unless you post the script sending the code and the code running no one can help sorry
I've sent it to 4 respected SQF developers already, no one seems to know what the problem is so I doubt anyone here will be able too.
T-thanks.
`does the JIP do not get the variable names?
Sqf developers < sqf hobbyist
lol
i have a brown belt in sqf
I only just got my first sqf, he is nasty
Anyone got an idea how to get the current zeroing of a player, which is in a FFV turret of a vehicle ?
currentZeroing player just returns 0
Thanks in advance ๐
Tried
currentZeroing cameraOn
?
Are you remote controlling a unit or is that your avatar?
my avatar
Then it's probably broken and there is nothing you can do.
If you're by chance running ACE, you might be able to parse the controls text. The display is (uiNamespace getVariable ["ACE_dlgSoldier", displayNull]).
yeah thought about that as well... but not a perfect solution
@rotund cypress remoteexecution -> unscheduled -> makes new thread wat? That's just execNextFrame. There are no Threads in unscheduled at all. And only fake threads in scheduled.
I assume his unscheduled code also spawns some code aswell. But if he is not willing to pastebin it, not much people can do
^^
Its remoteExecCall:ed, then a new thread is spawned inside.
@still forum have you ever experienced something like this?
The freeze you mean?
Have you already tried commenting half of it out?
Write a macro for it
#define COMMENT_THIS_LINE_OUT //
๐ Good macro
#define END_OF_SCRIPT_STATEMENT ;
HAH
๐ even better macro!
#define ADD_THIS +
#define IF_SCRIPT_STATEMENT(A) if(A)then ;
Can someone help me understand what an extdb3 protocol is?
If you're rp then look at the docs
@river meteor @tough abyss Is the best guy to help you with that
Google is cool too
#define THE_BEST_SEARCH_ENGINE google
#define BEST_BROWSER_TO_USE firefox
not according to Richard Stallman
@river meteor its basically picking which method you want to use, i.e SQL = SQL querys , SQL_CUSTOM = Prepared statements via ini file. You could use multiple methods with multiple databases if you want aswell
Example of sqf using extdb3
https://bitbucket.org/torndeco/extdb3/issues/69/set-of-functions-used-to-handle-extdb3-api
Or Addon
https://forums.bistudio.com/forums/topic/211872-oo_extdb3-a-driver-for-extdb3-addon-mysql/
I have compiled some functions that could help begining mission developpers in the task of using extdb3. Most of theses functions are error safe and well optimized. I would be glad to see them improved and included in a pbo next to the .dlls.
Feel free to contact me on steam for any questions.
http://steamcommunity.com/id/youpala
OO_EXTDB3 - A driver for extDB3 addon MysqlLastest version : 0.2 by Code34
GitHub : https://github.com/code34/oo_extdb3.altis
OO_extDB3 is a driver...
Thanks. I'm actually using that first link API and trying to call his db_AddDatabaseProtocol, passing it "SQL" as the protocol, however the 4th parameter is for protocol options. What is protocol options?
https://bitbucket.org/torndeco/extdb3/wiki/extDB3 - SQL i.e TEXT/TEXT2/NULL
Ah I see now. Thanks
#define INVASION_OF_SCRIPTING maybe
โ Would cause an error. Noob
You forgot something.
What would that be commy?
0.5
๐คฆ
because you can't if numbers ....
I remeber making a script for this but i forogt where I saved it,but how can you change a AI's faction with scripts?
is it this?
so say I wanted to make a AI independt would it be
_this setSide east;
@edgy dune [_unit] joinSilent createGroup EAST;
Sorry outside so canโt confirm for myself: is it possible to nest for do loops? If so, will the child for dos complete before returning to the parent?
@ivory nova yes.
@cosmic kettle awesome, thank you
With attachTo, is there any way to just change its offsets. Or do I have to detach then run attachTo again?
Just another attachTo. detach is not needed in that case.
Ohh gotcha. I didnโt know if that would cause any issues.
so I have this weird thing. My friend tried to copy a script of mine form my google drive right. if he copies it form google drive directly the script doesnt work,but if he pastes the script first on say discord or word and then copies it,the script works. any ideas why?
Maybe it replaces the ascii quote marks with the cursive ones.
โ โ instead of ""
u think? cuase other scripts he gets from my drive works and they have quotes too
lemme see about that
the only diffrence between the two codes is that,one is in a for loop,the othe isnt
get your friend to use a program like meldmerge to compare differences between file & copy/pasted text
Probably user error.
aye ill try the compare thing,maybe user error
Hey can someone please check over this https://hastebin.com/coligibipe.php . The function is supposed to act like an out of bounds script, basically it will give the player 10 seconds when they leave the AO area to reenter the AO, and if they don't, then the script kills them.
It works well when the player goes from within the AO to outside the AO, but if the person goes out and then tries to come back in, it just keeps on counting down to killing loop and kills them (it should cancel the loop with the if () exitWith {}:).
The main issue is that the checkstate variable is not getting updated when the player re-enters to AO area, it should asign a 'false' value, but instead it stays 'true'. I have been trying to work it out for about an hour, and i just need a par of fresh eyes to work it out.
This looks extremely convoluted.
@limpid pewter is checkState variable even needed? probably for debug purpose I assume?
and as Commy said, it took a while to take in, not usually a good sign.
It kinda looks like you been chopping & changing the code at random to make it work.
Recommend you add some systemchat lines to help whats happening in the editor or on a testserver.
It needs a concept.
haha yeah ik, but to be able to bring up a display when they leave the AO, you need both a onActivate and onDeactivate part of the script so you can show the display when they're outside of AO and remove dispay once there are back inside.
Yes checkstate is needed@cosmic kettle because it ensures that the code within the if then statement doesn't continually run while the loop is running. If checkState wasn't there it would just constantly keep creating the display when inside the AO (meaning tha there could be many differnet displays open at once.
while {true} do {
waitUntil {
sleep 1;
player-not-in-zone
};
private _startTimeOutside = time;
waitUntil {
if (time - _startTimeOutside > threshhold) then {kill};
sleep 1;
player-in-zone
};
};
You think this would be a good idea to structure it?
wow, nice an elegant. It may work, i will try this out and get back to you. thanks
didn't think of using waitUntil
Me?
Yeah, what the hell. why not just switch this? Or hell a if statement
obviously not the latter
But, why the two waitUntil s?
Because it's essentially a two state fsm.
That's what i did. But it is 'extremely convaluted' and wasn't working correctly, i think commy's willwork
That's what a two state machine is. Two waitUntils. ยฏ_(ใ)_/ยฏ
Yeah. but why.
You have a better idea?
Well something more cleaner would be nice
Always.
fnc_inzone = {
// checks
};
if (fnc_inzone) exitWith {sleep 1;//recheck};
//penalise
?
yeah you should be able to achieve something cleaner with that solution
true, it's not what he asked for.
//penalize does all that handling in my approach
Well we're really arguing method
Uh, what?
My suggestion "works" if you implement the pseudo code.
The other one is a if with //penalize
that apparently handles the tricky part somehow.
Probably a bit big, i shall post to hastebin
Lol hold your horses, I just posted a couple of lines, no need for the tantrum.
I'm just saying.
throws cookie at commy
Moldi, that doesn't work that way. The 3rd waitUntil you added breaks it.
kk
This script is based on state 2 changing back to state 1 immediately via while true.
So reaching the end of one while iteration is "renetering" the zone.
Are you excellent at dodging cookies or something?
I have no idea what your problem is.
that's ok, thanks for the ideas tho, i learned what a fsm is now ๐ Very useful
๐ค
And i understand what you mean about the thrid waitUntil
Don't get too crazy with those waitUntil and at all costs avoid putting them inside each other. They're worse than goto's.
yeah ok. i will try not to ๐
Never thought that I'd defend a while-true-waitUntil-loop against this channel of all places, nor that such a simple concept would be so contentious. ยฏ_(ใ)_/ยฏ
idk what all the arguing was about really, but ithanks everyone for the help
I don't know either. Still waiting for a different idea that is cleaner and actually does the same.
In about 15 mins, i shall test, i have a feeling it will work welll
Yeah it works sorta, just need to polish the timings of it all. thanks
yw
"Template" of the concept:
// initial code (once)
while {true} do {
waitUntil {
// state 1 code (continuous)
sleep 1;
// state 1 -> state 2 CONDITION
};
// transition 1->2 code (once per transition)
waitUntil {
// state 2 code (continuous)
sleep 1;
// state 2 -> state 1 CONDITION
};
// transition 2->1 code (once per transition)
};
For the critics here.
Does deleting projectile entity right in the "Fired" event handler deletes it only on next frame? ๐ค
Event handlers should rununschedyled and suspend everything until the code there is complete
Its not about script, actual deletion doesn't happen until next frame
๐ค
player addEventHandler ["Fired", {_p = _this select 6; systemChat str _p; deleteVehicle _p; systemChat str _p}];
Yeah, think you are correct
Hm, its not just Fired
Maybe you can do sh else other than delete?
Move it to 000 or sth, see if that works
๐คodd
I feel like total noob now for never noticing this before.
Makes you feel like you missed sth, like you should check some code
Hm, is it possible to force player to place explosive charge through script?
unit fire ["DemoChargeMuzzle", "DemoChargeMuzzle", "DemoCharge_Remote_Mag"] works for AI, but not player
Tried UseWeapon with correct muzzle index and forceWeaponFire, neither work ๐ค
Found a way
player action ["SwitchWeapon", player, player, 24];
player fire ["DemoChargeMuzzle", "DemoChargeMuzzle", "DemoCharge_Remote_Mag"];
24 is DemoChargeMuzzle index in my test
_mine setDamage 1;? nvm
Those muzzle indexes change all the time if you drop and pickup weapons. Not sure that is very reliable.
you could use the action command, dunno what action is used for placing explosives tho
Yeah I have a way to find needed index
Event handlers should rununschedyled and suspend everything until the code there is complete
Of course it doesnt suspend if ran unscheduled ๐คฆ
It doesnt work like that
@peak plover
It suspend engine ?
Doesnt work like that, engine and the scripting itself is completely two different things.
Suspension in the engine does not work like suspension in SQF
I would think that the engine just doesnt fire the bullet before the eventhandler is ran.
@rotund cypress when the game goes to execute sqf code it can't do other work
Yeah exactly, which means it doesnt suspend at all
And obviously if it has multiple threads it can do other work at the same time
I think was he meant is that when unscheduled code comes up the engine runs the code as soon as possible and thus "suspends" other work
which is trueish