#arma3_scripting
1 messages ยท Page 467 of 1
for prevent duplicate items
Where is this script located?
two and more players in one vehicle open inventory and with clicker drop items. Vehicle bugged and items duplicate
@little eagle i'm run it on editor
with debug console
Clicker, you mean like auto clicker?
yes
๐ค
SpeedAutoClicker
Does it display the hint text this?
There are probably macros you can setup with some mice as well
@little eagle no,just for example
What?
Does it display it or not.
Of course it is for debugging.
But knowing the results of the debugging would help a lot.
btw idd is 602
uiNamespace getVariable "RscDisplayInventory"
Is the woke way to write this.
ChewDev, this will not prevent people from duping items anyway. You could just access the inventory from outside the vehicle.
Arma is a game for closed milsim servers. You should get used to that. Only play with people you know and trust, (and you can punch ban if they misbehave).
commy2, from outside dupe fixed
idk, now trying to solve it
You don't know if the hint is displayed or not? Why don't you try to open the inventory?
Why would you disable it if you want to see if it works or not? This makes no sense to me.
// initPlayerLocal.sqf
params ["_unit"];
_unit addEventHandler ["InventoryOpened", {count crew cameraOn > 1}];
Personally I would do this.
ty will try add to initPlayerLocal
get it working ๐
player addEventHandler ["inventoryOpened",{
_this call {
if !(objectParent player isEqualTo objNull) then {
if (count (crew vehicle player)>1) exitWith {
hint "ะะตะปัะทั!";
true;
};
};
};
}
];```
This looks unnecessarily complicated, but it's essentially the same as mine. So ๐
ura ๐
as i understand all event handlers for correct work must contain _this call {...} ๐
No, they must not.
For some reason you insist on using exitWith though.
And that is bugged inside the main scope.
So you have to open a child scope.
You could instead of _this call {...} also write isNil {...} or if (true) then {...} and it would be the same thing.
OR
Just don't use exitWith to begin with.
Like I did.
hmm, ty will remember ๐
also if you have _this in eh, probably you missed params or just in slightly wrong direction imo ๐
except those with one param maybe ๐
can anyone help and tell me what button this is on my keyboard "37450"
Hey guys, Could someone help me?
@cedar hollow Sure it's not life code and it is a control id?
yeah its for dialog, just remembered
I'm wanting to create a mission, that has three main 'paths' each path is per faction. And I'd like 'faction specific buildings' to be chosen based on the 'path' chosen. These 'faction specific buildings' will be for example; the Medical Tent, which has three types: AAF, NATO and CSAT. How can I utilise the hideObjectGlobal command to be able to hide the 'faction specific buildings' that aren't the players faction?
Anyone? ^
Hello guys! I'm currently in the process of making an Exile server and looking for a Dev to help out.
Casually copy and pastes all over ^
lol what's your issue?
No issue, it doesn't inspire confidence if you can't take a moment to change it slightly
Why does it need changing
lack of effort. Plus, why did you not use #creators_recruiting ? @molten quartz
Anyone able to help me out with my query up above ^^^^^^^^
how does one select the path to take?
I'd say give each building a variable
make script files for each path with a bunch of hideObjectGlobal for each building
That's undefined at the moment, just wanting a simple and expandable hideObject command file(s).
So for ref: I have natoFlag, affFlag and csatFlag. These are all object variables.
make script files for hideNatoObjects.sqf hideAAFObjects.sqf hideCSATObjects.sqf
in each of them just list all the objects like natoFlag hideObjectGlobal true;
and then after the path was chosen. You just execute both the hideObjects scripts of the paths that were not chosen
I also have: natoTent , aafTent and csatTent. is there a way to include all variables that have nato etc.
Sweet. Sounds good. (I'm hoping to have it as a parameter in the lobby.)
you can use allVariables missionNamespace and then filter the ones that start with nato yeah
but I wouldn't use just nato that could get you in trouble.
Use some more unique tag
I could do two arrays:sqf FactionArray = [nato,aff,csat]; ObjectArray = [Flag,Tent,]; ahh allvariables.
like CAP_NatoObject_
and then filter by that
{(missionNamespace getVariable [_x, objNull]) hideObjectGlobal true; } forEach ((allVariables missionNamespace) select {_x select [0,15] == "CAP_NatoObject_"})
keep in mind that it should be executed on the server
Yup.
Does isServer I forgot what the command is exactly.. something along those lines.
I can't believe dedmen thumbed his own post ๐ฎ
Capwell said he wanted to react. So I gave him the button so he could click it
but he didn't ๐ข
there you get one from me as well
๐๐ป
I posted it in 2 channels Is that considered spam now?
Yes.
#rules read them
Also as #rules says. Post in the right channel. You posted in two channels that are not right.
I did @still forum
I was busy ๐
@still forum Do you suggest a way to have the file author and info at the top of a script?
yes. one sec
https://github.com/CBATeam/CBA_A3/blob/master/addons/common/fnc_addItemCargo.sqf#L1-L30
or
https://github.com/acemod/ACE3/blob/master/addons/attach/functions/fnc_getChildrenActions.sqf#L1-L16
I personally prefer the ACE style as it's more compact
But for the CBA variant there are automatic scripts whihc generate documentation like: http://cbateam.github.io/CBA_A3/docs/files/common/fnc_addItemCargo-sqf.html#CBA_fnc_addItemCargo
But you probably don't need to generate documentation ^^
/*
* Author: Capwell
* Hides all object variables names start with "C_NATO_Object_".
*
* Arguments:
* None
*
* Return Value:
* Actions <ARRAY>
*
* Example:
* if (isServer) then {
* execVM 'hideNatoObjects.sqf';
* };
*
*/
{
(missionNamespace getVariable [_x, objNull]) hideObjectGlobal true;
} forEach ((allVariables missionNamespace) select {_x select [0,14] == "C_NATO_Object_"});
systemChat "All NATO Objects: Hidden.";``` this okay? ๐
maybe
* Arguments:
* None
Bahh. I need to rewrite what I just deleted :U
Your description and return value are wrong
Awww
it returns what systemChat returns which is Nothing
it doesn't return the variables.
Oh
it hides all objects who'se variable names start with C_NATO_Object_
also your _x select [0,15] is wrong now. You change the length of the name. You also need to change the entry on the select.
your name is now 14 characters long. not 15
ye
_x is the variable name
select [0,15] cut's off the first 15 characters
and you then compare these first characters
Oh nvm then. I thought that's what you where asking me. xD
the number has to be the length of your C_NATO_Object_ string
Yup, got iot.
you could theoretically just write count "C_NATO_Object_" instead of 15. But that will count the length of the string at every iteration and probably halve your speed
Okay.
I won't do that.
๐
_FactionSelection = "FactionSelection" call BIS_fnc_getParamValue;
_NATO = createGroup west;
_AAF = createGroup independent;
_CSAT = createGroup east;
if (_FactionSelection == 1) then {
if (isServer) then {
execVM 'hideNatoObjects.sqf';
} else {
if (playerSide != west) then {
[player] joinSilent _NATO;
};
};
};
if (_FactionSelection == 2) then {
if (isServer) then {
execVM 'hideAffObjects.sqf';
} else {
if (playerSide != independent) then {
[player] joinSilent _AAF;
};
};
};
if (_FactionSelection == 3) then {
if (isServer) then {
execVM 'hideCsatObjects.sqf';
} else {
if (playerSide != east) then {
[player] joinSilent _CSAT;
};
};
};```
=== is invalid
isEqualTo is similar to ===
playerSide isEqualTo east || independent is invalid. independent is not a boolean
no. = assigns variables.
yes
๐
playerSide isEqualTo east || independent -> playerSide != west
Changed above
Oh okay.
I want to do the check, as I could make each faction slots.
(separate missions - slots)
if (isServer) then {
execVM 'hideNatoObjects.sqf';
};
if (playerSide == east || independent) then {
[player] joinSilent _NATO;
};
->
if (isServer) then {
execVM 'hideNatoObjects.sqf';
} else {
if (playerSide != west) then {
[player] joinSilent _NATO;
};
};
doesn't make sense to check playerSide or player on serverside
Why the else?
I don't understand. I thought that the two if statements are separate?
yes..
That's the problem
you are checking playerSide on the server too. Which doesn't make sense. The server doesn't have a player
How? the isServer is within it's own scope.
Or can I place the playerSide above isServer??
๐คฆ
I don't understand..
You are executin the execVM part only on the server. That's correct.
Yup.
but the joinGroup part is executed on server AND client
serverside that check doesn't make sense though
execute what?
[player] joinSilent _NATO;
using the else exactly like I posted above
you still didn't fix the other syntax error I told you about
Sorted
So if a gun fires 1000rpm, it fires a round every 60 ms?
Yes... Unless it is a trick question, in which case... maybe?
haha, not really trying to trick anyone ๐
Hehe, could have fooled me... And you almost did ๐
Real question is if no one is around when it fires, does Arma make a sound?
โ ๐ค ๐ ๐ค ๐ ๐ฅ
Future games will be written entirely in emojis
๐ ๐ซ ๐ <- I just played Arma 4
Problem is.. That is indeed a legit question.. Does Arma make the sound and tell other units that a sound was just made at that location
I'd say it probably does. Because checking if anyone is around would be way too expensive
yeah and you can hear many things from huge distances
Actually it is more complicated than that. Example, if you join (or maybe you were already joined but not loaded the following area) a MP session that has been running. But earlier in a location far away from your spawn point, a helicopter was scripted in and destroyed, you will still hear the explosion when you get closer.
fix > _heli setDamage [1, false]; ๐
I'll take your word for it, much of my experience with that was before that optional argument was added.. Though you will still experience it with game modes that creates dynamic mission (e.g. side missions), then the spawn scripts screws up and puts a vehicle inside a too small garage or something.
yeah ^ also if that was just "accidental explosion/destruction/collision with explosion" sometimes you can hear it even if that vehicle already was deleted
plus for "sound weirdness" is cool mods, with models that have some ambient sounds... you just delete that vehicle, but sound still there ๐
Hello, Is it possible for a script executed server side, to detect if a player has a variable set to a given state (0 or 1) in a script executed locally for the player(s) ?
That's what I thought... Logical I most admit
1 tick = 1 ms
I wanna make forceWeaponFire shoot at 4000 rpm exactly
Can't @peak plover
๐ค
you can shoot once per frame
You could maybe custom spawn multiple projectiles via script though
so shoot 1 bullet at first frame. And shoot 5 bullets at next frame because the time interval was too long
๐ค
Will look very nice in multiplayer when you have 5 fps and your mates look at you shooting bursts
lol
So Arma does what I said by itself then
firing for 1 second
scheduled script == unreliable
WEll
well
I can't get more than 246 fps even with 640*480 at 50% 3d resoltuion
I can't really do this in unschedueld can i?
eachFrameHandler
you can disable sound to get a little more fps
-noSound parameter
each frame handler, but
it's limited to fps
while loop terminates after only 1 bullet in unscheduled
ie. 10k loops
for _i mite work 'tho?
yes
also you can try -noLag and -gibFPS startup params /s
gl
๐
Freeze stops after this is hit
But yeah unscheduled freezes it, like it should
only 1 bullet fired
tbh
I was stupid to use while in scheduled, beacause if like you said, max 1 bullet per frame, it can run 3ms of fire, but 1 bullet will still fire
Just like what happend now
I guess it's because reloadTime is at min 0. But reload is done in simulation cycle. Which runs once per frame
if you want more you can still go shotgun mode
atleast I think you can spawn projectiles via script.. There has to be a way
for loop ran 588k times with 1 second
yeah that can be done
I'm just gonna try investigate how fast can I shoot and how much does fps play role
just clicked more info in vscode helper (hover on box) and got on vigorgame page...wtf ๐
lol
isNil < try that one, nigel
@lavish ocean ^ Wiki still redirecty to Vigor page sometimes
@meager heart for what?
I cannot reproduce that though
https://community.bistudio.com/wiki?title=Special:Search&search=remoteExec&go=Go
does this not reproduce?
which browser?
firefox
nope
chrome here
probably like a cache
maybe they broke the DNS and I still have to old nonbroken one
for what?
i mean press 'more info' forisNilcommand (that what i did) https://gyazo.com/7df345d661b1b776dff9524f533f081f
oh... i thought you are using vscode
you should already get used to vscode. Because poseidon won't get the debugger soon ๐
Ohh, that's hella nice
looks promising ๐
lol
i am waiting for something like that for a long time
we already had it a year ago. But the IDE was too deep in development and no one really cared about it
java debugger spoiled me good.
So
remotExec has to be sent to server even if you do it as object local to player as target?
That's a haard question. We don't know
easy way to test. log diag_tickTime in your code.
if delay is very low then it doesn't. If delay is about the same as the servers ping... then.. you know
Please test it and add the info to biki. Many people asked that question and no one knows so far
๐
@still forum I unplugged cable, nothing happed until I plugged cable back in
SO it's confirmed, ```sqf
remoteExec ['spawn',ten_man];
https://i.imgur.com/1Mqy22p.jpg
didn't run until I plgged it back in
ten_man local = true
RE seems to always go to server
Wouldn't call that confirmed
there might be other things which cause that to not run before you are connected to the server again
Wait... What's this? https://discordapp.com/channels/105462288051380224/105462984087728128/458232151079649281
We can now link to messages ๐ฎ
Maybe this means we'll get quoting support soon
Nice.
Cannot do this as normal user.
uhm @still forum I've broke what "we" where creating. Could you check it over for us, been trying to sort it myself for 40 minutes.
show me code
@digital jacinth guess could be debug mode only then. It's under the debug mode Copy ID button
ah, yeah running in browser, so no debug anywhere in sight
Debug works the same in browser
interesting
factionSelection.sqf : ```sqf
_FactionSelection = "FactionSelection" call BIS_fnc_getParamValue;
ifReady = false;
_NATO = createGroup blufor;
_AAF = createGroup independent;
_CSAT = createGroup opfor;
t1pos = getPos Tank1;
t2pos = getPos Tank2;
t3pos = getPos Tank3;
t1dir = getDir Tank1;
t2dir = getDir Tank2;
t3dir = getDir Tank3;
if (_FactionSelection == 1) then {
if (isServer) then {
execVM 'hideAafObjects.sqf';
execVM 'hideCsatObjects.sqf';
} else {
if (playerSide != blufor) then {
[player] joinSilent _NATO;
playerSide = blufor;
ifReady = true;
Playernato = true;
};
};
if (_FactionSelection == 2) then {
if (isServer) then {
execVM 'hideNatoObjects.sqf';
execVM 'hideCsatObjects.sqf';
} else {
if (playerSide != independent) then {
[player] joinSilent _AAF;
playerSide = independent;
ifReady = true;
Playeraaf = true;
};
};
if (_FactionSelection == 3) then {
if (isServer) then {
execVM 'hideNatoObjects.sqf';
execVM 'hideAafObjects.sqf';
} else {
if (playerSide != opfor) then {
[player] joinSilent _CSAT;
playerSide = opfor;
ifReady = true;
Playercsat = true;
};
};``` Continues -
if (Playernato) then {
globalChat "Players Joined: NATO.";
globalChat "Hiding AAF and CSAT Assets";
};
if (Playercsat) then {
globalChat "Players Joined: CSAT.";
globalChat "Hiding NATO and AAF Assets";
};
if (Playeraaf) then {
globalChat "Players Joined: AFF.";
globalChat "Hiding NATO and CSAT Assets";
};
if (ifready) then {
C_NATO_Object_Tank1 setPos t1pos;
C_NATO_Object_Tank1 setDir t1dir;
C_NATO_Object_Tank2 setPos t2pos;
C_NATO_Object_Tank2 setDir t2dir;
C_AAF_Object_Tank1 setPos t1pos;
C_AAF_Object_Tank1 setDir t1dir;
C_AAF_Object_Tank2 setPos t2pos;
C_AAF_Object_Tank2 setDir t2dir;
C_AAF_Object_Tank3 setPos t3pos;
C_AAF_Object_Tank3 setDir t3dir;
C_CSAT_Object_Tank1 setPos t1pos;
C_CSAT_Object_Tank1 setDir t1dir;
C_CSAT_Object_Tank2 setPos t2pos;
C_CSAT_Object_Tank2 setDir t2dir;
globalChat "Faction-specific, Tanks have been placed at Range 9.";
};```
why so complicated?
dedmen how do i embrace vs code and not hate it?
Because I couldn't do systemChat inside the if statements of sqf [player] joinSilent _CSAT; playerSide = opfor; ifReady = true; Playercsat = true;
And I wanted all Vehicles gone (hidden) before I put them all on the same position.
t1pos = getPos Tank1;
t2pos = getPos Tank2;
t3pos = getPos Tank3;
t1dir = getDir Tank1;
t2dir = getDir Tank2;
t3dir = getDir Tank3;
C_NATO_Object_Tank1 setPos t1pos;
C_NATO_Object_Tank1 setDir t1dir;
C_NATO_Object_Tank2 setPos t2pos;
C_NATO_Object_Tank2 setDir t2dir;
C_AAF_Object_Tank1 setPos t1pos;
C_AAF_Object_Tank1 setDir t1dir;
C_AAF_Object_Tank2 setPos t2pos;
C_AAF_Object_Tank2 setDir t2dir;
C_AAF_Object_Tank3 setPos t3pos;
C_AAF_Object_Tank3 setDir t3dir;
C_CSAT_Object_Tank1 setPos t1pos;
C_CSAT_Object_Tank1 setDir t1dir;
C_CSAT_Object_Tank2 setPos t2pos;
C_CSAT_Object_Tank2 setDir t2dir;
->
{
_x params ["_tank1","_tank2","_tank3"];
_tank1 setPos (getPos Tank1);
_tank1 setDir (getDir Tank1);
_tank2 setPos (getPos Tank2);
_tank2 setDir (getDir Tank2);
if (!isNil "_tank3") then {
_tank3 setPos (getPos Tank3);
_tank3 setDir (getDir Tank3);
};
} forEach [[C_NATO_Object_Tank1, C_NATO_Object_Tank2], [C_AAF_Object_Tank1, C_AAF_Object_Tank2], [C_CSAT_Object_Tank1,C_CSAT_Object_Tank2]];
your globalChat is syntax error
playerSide = opfor; syntax error. You cannot set commands.
Does it need a person? global
Click the link and read.
Will do.
those discord "messages links" works if you paste them anywhere (another servers chats, browser...etc)
_FactionSelection = "FactionSelection" call BIS_fnc_getParamValue;
_NATO = createGroup blufor;
_AAF = createGroup independent;
_CSAT = createGroup opfor;
if (_FactionSelection == 1) then {
if (isServer) then {
execVM 'hideAafObjects.sqf';
execVM 'hideCsatObjects.sqf';
} else {
if (playerSide != blufor) then {
[player] joinSilent _NATO;
debugGuy globalChat "Players Joined: NATO.";
debugGuy globalChat "Hiding AAF and CSAT Assets";
};
};
if (_FactionSelection == 2) then {
if (isServer) then {
execVM 'hideNatoObjects.sqf';
execVM 'hideCsatObjects.sqf';
} else {
if (playerSide != independent) then {
[player] joinSilent _AAF;
debugGuy globalChat "Players Joined: AFF.";
debugGuy globalChat "Hiding NATO and CSAT Assets";
};
};
if (_FactionSelection == 3) then {
if (isServer) then {
execVM 'hideNatoObjects.sqf';
execVM 'hideAafObjects.sqf';
} else {
if (playerSide != opfor) then {
[player] joinSilent _CSAT;
debugGuy globalChat "Players Joined: CSAT.";
debugGuy globalChat "Hiding NATO and AAF Assets";
};
};
{
_x params ["_tank1","_tank2","_tank3"];
_tank1 setPos (getPos Tank1);
_tank1 setDir (getDir Tank1);
_tank2 setPos (getPos Tank2);
_tank2 setDir (getDir Tank2);
if (!isNil "_tank3") then {
_tank3 setPos (getPos Tank3);
_tank3 setDir (getDir Tank3);
};
debugGuy globalChat "Faction-specific, Tank has been placed at Range 9.";
} forEach [[C_NATO_Object_Tank1, C_NATO_Object_Tank2], [C_AAF_Object_Tank1, C_AAF_Object_Tank2, C_AAF_Object_Tank3], [C_CSAT_Object_Tank1,C_CSAT_Object_Tank2]];```
@meager heart I guess they join the server then?
yes afaik
@drowsy axle for a normal chat message you can also use systemChat
playerSide == blufor; wtf are you trying to do there?
debugGuy globalChat "Faction-specific, Tank has been placed at Range 9."; you are spamming that 3 times.
I was using that, but it wasn't working. I'll change it back when everything else is.
Oh I don't need it xD
And I know.
lol
Sorted above ^
still spamming. Otherwise I don't see any errors anymore
Yup, it's just for testing :/ So I know it's doing it over.
Do I need to change anything for this to work in SP?
no
or wait..
the else of the isServer. You won't get moved into the group if you are the server. Which you are in SP
also you are missing the }; for every else
Sorted the }; for else
How would I change the else?
To be both SP and MP compat.
(If PlayerUID == _SP_PLAYER_)??
How did you get the link to your post
@peak plover copy it
right side of message. press the 3 dots and Copy Link
@drowsy axle replace the else by a if (!isDedicated)
Okay
capwell probably needs to start with SQF basics
: (If PlayerUID == _SP_PLAYER_)
that isnt anything at all
He has been here for almost half a year now @austere granite
He just isn't able to learn. We tried MAAANY times
if (_FactionSelection == 3) then {
if (isServer) then {
execVM 'hideNatoObjects.sqf';
execVM 'hideAafObjects.sqf';
};
};
if (!isDedicated) {
if (playerSide != opfor) then {
[player] joinSilent _CSAT;
debugGuy globalChat "Players Joined: CSAT.";
debugGuy globalChat "Hiding NATO and AAF Assets";
};
};
};``` like this?
no
no
do you have the wiki bookmarked?
I do, I have it open
if (!isDedicated) {
if (playerSide != opfor) then {
i mean... that should instantly tell you something is up
Also if you want actual side switching the better solution is to use selectPlayer
{
STATEMENT1;
...
}
else //just (!dedicated)
{
STATEMENT2;
...
};```
{
STATEMENT1;
...
}
(!dedicated)
{
STATEMENT2;
...
};```
no
yeah
if (_FactionSelection == 1) then {
if (isServer) then {
execVM 'hideAafObjects.sqf';
execVM 'hideCsatObjects.sqf';
};
if (!isDedicated && playerSide != blufor) then {
[player] joinSilent _NATO;
debugGuy globalChat "Players Joined: NATO.";
debugGuy globalChat "Hiding AAF and CSAT Assets";
};
};
Here take that.
That is what I put, but with extra }; which you could have told me...
{
if (someAmmo player) then
{
hint "The player is alive and has ammo!";
}
else
{
hint "The player is out of ammo!";
};
}
else
{
hint "The player is dead!";
};```
why extra };?`
What I just posted is completly different of what you posted
if (!isDedicated) {
if (playerSide != opfor) then {
Do you not see the problem tehre?
Because I applied some logical thinking and programming knowledge to optimize that script in my head
if (_FactionSelection == 3) then {
if (isServer) then {
execVM 'hideNatoObjects.sqf';
execVM 'hideAafObjects.sqf';
};
if (!isDedicated) {
if (playerSide != opfor) then {
[player] joinSilent _CSAT;
debugGuy globalChat "Players Joined: CSAT.";
debugGuy globalChat "Hiding NATO and AAF Assets";
};
};
};```
I don't
if (_FactionSelection == 3) then {
if (isServer) then {
..
if (!isDedicated) {
if (playerSide != opfor) then {
one of these things is not like the other
I've given you the solution. Now go. And stop making yourself a fool.
if _something then {
if _something then {
if _something
if _something then {
one of these things is not like the other!
can you spot it?
You have been at this for almost 1,5 years now. And still don't have the basics
if (_FactionSelection == 3) then {
if (isServer) then {
execVM 'hideNatoObjects.sqf';
execVM 'hideAafObjects.sqf';
};
if (!isDedicated) then {
if (playerSide != opfor) then {
[player] joinSilent _CSAT;
debugGuy globalChat "Players Joined: CSAT.";
debugGuy globalChat "Hiding NATO and AAF Assets";
};
};
};```
is that correct?
I've already sent you the solution above..
no
๐ฆ
That's why the syntax highlighter also highlights it as command
:/
does anyone use that? I was ocnfused why the syntax highlighting was even highlighting it
It was only intro'd in a3
well. it's the opfor side.. If you want the opfor side then you use that yeah
EAST ๐๐ป
east is shorter than opfor. So east is obviously the better choice
i bet opfor just points to east in c++ as well doesnt it? ๐
just like config / "something" points to >>
just like config / "something" points to >>
yeah
wasn't / slower then >> ?
so it is not the same
it does that. / points to >> internally
I can point at you. Am I you now?
i could use some coffee
..
or that the bloody girl i met last friday responds
both are acceptible options
"""""girl"""" (male)
Interesting... opfor and east point to different functions. But both functions return SideEast
opfor -> getOpfor -> sideEast
east -> getEast -> sideEast
for comparison
-> getConfigEntry
/ -> >> -> getConfigEntry
if (_FactionSelection == 1) then {
if (isServer) then {
execVM 'hideAafObjects.sqf';
execVM 'hideCsatObjects.sqf';
};
if (!isDedicated && playerSide != west) then {
_NATO = createGroup west;
[player] joinSilent _NATO;
debugGuy globalChat "Players Joined: NATO.";
debugGuy globalChat "Hiding AAF and CSAT Assets";
};
};
if (_FactionSelection == 2) then {
if (isServer) then {
execVM 'hideNatoObjects.sqf';
execVM 'hideCsatObjects.sqf';
};
if (!isDedicated && playerSide != independent) then {
_AAF = createGroup independent;
[player] joinSilent _AAF;
debugGuy globalChat "Players Joined: AFF.";
debugGuy globalChat "Hiding NATO and CSAT Assets";
};
};
};
if (_FactionSelection == 3) then {
if (isServer) then {
execVM 'hideNatoObjects.sqf';
execVM 'hideAafObjects.sqf';
};
if (!isDedicated && playerSide != east) then {
_CSAT = createGroup east;
[player] joinSilent _CSAT;
debugGuy globalChat "Players Joined: CSAT.";
debugGuy globalChat "Hiding NATO and AAF Assets";
};
};
};
{
_x params ["_tank1","_tank2","_tank3"];
_tank1 setPos (getPos Tank1);
_tank1 setDir (getDir Tank1);
_tank2 setPos (getPos Tank2);
_tank2 setDir (getDir Tank2);
if (!isNil "_tank3") then {
_tank3 setPos (getPos Tank3);
_tank3 setDir (getDir Tank3);
};
debugGuy globalChat "Faction-specific, Tank has been placed at Range 9.";
} forEach [[C_NATO_Object_Tank1, C_NATO_Object_Tank2], [C_AAF_Object_Tank1, C_AAF_Object_Tank2, C_AAF_Object_Tank3], [C_CSAT_Object_Tank1,C_CSAT_Object_Tank2]];``` Boom, sorted. Let's see if it works SP and MP this time ๐
an actual girl @austere granite
gah .. fuck damned should have kissed her on that bloody friday
but well .. she was kinda akward from time to time
still enjoyed that
awkward how? @queen cargo
tsundere
Anyway, i've got to get back to work. Only having my lunch break ๐
hard to describe without wandering too much into the offtopic land @drowsy axle
short version is: it was not supposed to get into the โค section that day
_tank1 setPos (getPos Tank1);
I also dont recommend setpos getpos btw
also if you're placing the tank on the position of another tank, bad things will happen probably
setPos height 0 puts it on surface level (Terrain / sea)
getPos height 0 can also be on top of an objectr, so lets say tank is on top of some composition you create, then shit will 100% reliably fuck up
getPosRealWorldModelVisual3D is the patricians command
Get you icky girl talk out of here. This is a nerd channel.
Yeah, this kind of talk threthens the nerd population world wide
Can somebody help me with some code? I wanna make a trigger that activates when the player enters a helicopter and the engine turns on.
waitUntil { player == cargo _T1; };
vehicle player engineOn true;
How do you play the sound?
I'll have to look
Is this supposed to play on only one specific object, or every object of a specific class? Do you use any mods? Is this for a mission or a mod?
@austere granite Don't you think I know this ...
It's for a mission, and it plays for a specific helicopter
It should still be repeated every day. Though idk what he means by getPosRealWorldModelVisual3D. That is not actually a thing.
0 = this addEventHandler ["Engine", {
params ["_vehicle", "_isEngineOn"];
if (_isEngineOn) then {
_vehicle say3D "Alarm";
};
}];
Put this into the init box.
1 fadeMusic 5; playmusic "music1"; in the activation field,
No idea how you play the sound, or which one, so "Alarm" it is.
Oh, so you don't play any sound, but music.
Is this music supposed to play for everyone on the server, or just the pilot?
It plays for just for the player, when they enter the chopper. The chopper is a support
0 = this addEventHandler ["Engine", {
params ["_vehicle", "_isEngineOn"];
if (_isEngineOn && {player == driver _vehicle}) then {
1 fadeMusic 5;
playmusic "music1";
};
}];
This into the helicopters init box.
Cool deal, thank you
Question. Should this music only play once per mission? Or every time the engine is turned on?
every time. In the trigger I have set to repeat
OK, then leave it as I wrote. You can delete the trigger. It is not needed for turning on the engine of a vehicle, and this event handler based solution is better in every way.
Does your code require the player to be the pilot? Would it be player == cargo?
Ok, cause the way I've got it setup is the AI flying the heli
So let's rething this then. The music should start playing for everyone inside the helicopter once the engine is turned on.
Would that make sense?
he had ^ vehicle player engineOn true; aka manually start it and that is wrong > 1 fadeMusic 5; max volume is 1, should be fadeTime fadeMusic volume commy ๐
yes
What if someone enters the heli, but the engine is already turned on?
Yeah, it should probably play then too.
All you need now is strobe lights
and disco ball
hell yeah
Should it start at the beginning of the track or in the middle of it depening on when the engine was started. ๐ค It think now I am overthinking it.
At the beginning. The scene in Blackhawk Down when they're taking off to Voodoo Child, is the inspiration.
0 = this addEventHandler ["Engine", {
params ["_vehicle", "_isEngineOn"];
if !(player in _vehicle) exitWith {};
if (_isEngineOn) then {
5 fadeMusic 1;
playmusic "music1";
};
}];
0 = this addEventHandler ["GetIn", {
params ["_vehicle", "", "_unit"];
if (_unit != player) exitWith {};
if (isEngineOn _vehicle) then {
5 fadeMusic 1;
playmusic "music1";
};
}];
0 = this
reeeeeeeee
Init box, alganthe. And they're using no cba to fix it.
why not just write 0=0 at the end.
Because every statement has to have no return value. Or do you want me to use commas everywhere instead?
every really? uhhh
Sorry, I do have cba
this addEventHandler ["Engine", {
params ["_vehicle", "_isEngineOn"];
if !(player in _vehicle) exitWith {};
if (_isEngineOn) then {
5 fadeMusic 1;
playmusic "music1";
};
}];
this addEventHandler ["GetIn", {
params ["_vehicle", "", "_unit"];
if (_unit != player) exitWith {};
if (isEngineOn _vehicle) then {
5 fadeMusic 1;
playmusic "music1";
};
}];
There.
Happy?
yes
Cheese.
Erm.
This starts the music if:
- the engine of the helicopter is turned on and the local player sits inside the heli
- the player enters the heli while the engine is turned on
The music fades on its own after 5 seconds I believe.
It doesn't. Keeps playing until you enter the heli and give it orders again.
Is that good or bad?
this addEventHandler ["Engine", {
params ["_vehicle", "_isEngineOn"];
if !(player in _vehicle) exitWith {};
if (_isEngineOn) then {
5 fadeMusic 1;
playmusic "music1";
};
}];
this addEventHandler ["GetIn", {
params ["_vehicle", "", "_unit"];
if (_unit != player) exitWith {};
if (isEngineOn _vehicle) then {
5 fadeMusic 1;
playmusic "music1";
};
}];
this addEventHandler ["GetOut", {
params ["", "", "_unit"];
if (_unit != player) exitWith {};
playMusic ["", 0];
}];
Last block turns the music off once you leave the vehicle.
allrighty, testing it out
I guess you can replace the playMusic ["", 0] with 5 fadeMusic 0; to fade the music in 5 seconds.
Works beautifuly. Thanks a million.
what is better option allMissionObjects vs entities vs ... filter is > different kind of weapon holders, TimeBombCore... etc, without any radius or area, just all present at given time ?
Report all weapon holders that contain at least one mine of this type?
just all present in a mission
ty, will try it
Anyone know of a good way to make a waypoint cycle similar to how BIS_FNC_TSKPATROL works? I've got one made up that works, but it has a few quirks, in that sometimes the loop doesn't pan out very well. Also, I'd like a touch more flexibility, like the ability to have elements wait for a time at waypoints before continuing along their route.
_G1 addwaypoint [_this, 2400];
_G1 addwaypoint [_this, 2400];
_G1 addwaypoint [_this, 2400];
_G1 addwaypoint [_this, 2400];
_G1 addwaypoint [_this, 2400];
_G1 addwaypoint [_this, 2400];
_G1 addwaypoint [_this, 2400];
[_G1, 6] setwaypointtype "CYCLE";
That's what I've been using, it works, but commonly the group will get caught in a loop that keeps them only retracing a vew of the waypoints, instead of cycling back to their original waypoint.
i don't remember if your unit uses CBA, but there's CBA version of task patrol too
but apart from that... i think they'll loop with the nearest waypoint
so maybe make sure the last waypoint is near the first?
(unless that's just an editor thing)
Pretty sure it connects to the nearest. So just place the cycle waypoint onto the first one you want to loop to.
^ that discord group. Have I missed something interesting? ๐
Not really, no.
๐ค
what happend to commy ๐
back in A2 there was this UAV Terminal Humvee. Is there a alternative for A3? So a scripting solution? So you don't need a UAV terminal on the player. Rather you are just at an object and can say "open UAV Terminal"
yeah opens the uav terminal so you could connect to a uav
wait kommy is muted?
Couldn't you just fill the vee's cargo with a lot of uav terminals?
that is something I want to avoid
Inconvenient, right?
I want that the player is not able to carry one
so he is forced to be at that object
Take it away from them if they leave the vehicle.
GetIn, linkItem terminal, GetOut unlinkItem, removeItem
naah I just gonna play arround with sqf player action ["UAVTerminalOpen", player];
Does this work when you have no terminal in the inventory?
Well, then there you have your solution. Give the vehicle this script as addAction and you're golden. ... Oops.
well you force him into the action. And after that his terminal will be removed. So he never knew that he had one
because he only can access the terminal via the addAction
If you can figure out the "after that" part, then sure.
@inner swallow, no mods in my group. Thanks for the recommend. The waypoints are meant to be random. I think I'm approaching a solution, but we'll see.
yeah, wasn't sure if it was strict no mods or optional only
for those waypoints ^ DEL-J's question maybe something like this
private _list = [/* coordinates */];
for "_i" from 0 to (count _list) - 1 do {
private _wp = _group addWaypoint [_list select _i, 0];
_wp setWaypointType "MOVE";
};
private _wpCycle = _group addWaypoint [_list select 0, 0];
_wpCycle setWaypointType "CYCLE";
lgtm, but you really could use forEach instead of for loop if you're going to use select _i anyway.
private _list = [/* coordinates */];
{
private _wp = _group addWaypoint [_x, 0];
_wp setWaypointType "MOVE";
} forEach _list;
private _wpCycle = _group addWaypoint [_list select 0, 0];
_wpCycle setWaypointType "CYCLE";
yep ^ even better option
Hmm... How do I grab a single character in a group?
Group select 1 or whatever. What's the correct way?
I don't know which wiki page to check. Tried group, leader, select, and units....
selectRandom units _group
Okay! Wow. That's... easy. Almost what I wanted it to be, but I couldn't find an example. But I don't want it to be random necessarily. Any difference?
Select unit 1 group?
Hmm...
Okay, I'll see what I can do there.
So, I need to give a waypoint to this guy.
I've done it with named units, so I think that means its possible otherwise to give individuals within a group their own waypoints.
You can give waypoints only to groups, not individual units.
How does the "DISMISS" waypoint scatter them? Must I break up the group and reform it as necessary? I believe you about not being able to issue waypoints to individuals, but I know that they can move independently of their group, because of a medic script I'm building.
Most waypoints are internal magic.
I don't understand.
Hard coded in C++, not editable by script.
There are a few scripted waypoints though.
Ah, okay, I see.
This one from CBA is based on doMove, unitReady, doStop partially: https://github.com/CBATeam/CBA_A3/blob/master/addons/ai/fnc_waypointGarrison.sqf
Maybe that helps you putting something together.
DEL-J, for the types check this https://community.bistudio.com/wiki/Waypoint_types
Hmm... There are actions that I've been able to do with my medic script that uses domove and dostop.
@meager heart, I'm familiar with the types, but the "DISMISS" waypoint allows the element to scatter. I want to replicate that myself. I think that domove is the key, as that's what I use in my medic script that has the medic depart his element to fix another group.
You will probably not be able to copy paste and edit the behavior of DISMISS, because it is, iirc, a hard coded waypoint.
I didn't want its exact behavior anyway. If I wanted that behavior, I would just use that waypoint, but it doesn't work for my purposes.
True. But you will have to do something from ground up, probably using doMove, doStop, unitReady etc.
I am building a recon patrol loop. A platoon makes a sweep, rests, and then makes another sweep, but DISMISS breaks the cycle, so I'm going to just have them domove, etc.
Yes.
But I still need to select individuals from the group. Hmm... I may be able to select all of them and just have the domove positions random, but I'll have to have a catch to keep them from forming back up on the group leader when he takes his point.
Probably disableAI "path" in there...
So, something like this, but that works is the objective...
Select units _group domove getpos [(1 + round random 20), (getdir leader (_G3)) + round random 360]), 1];
disableAI "paths";
switchmove selectrandom "animations";```
i didn't follow things really but why not use sqf {_x bla bla} forEach (units group)?
Don't know. Why not?
Mostly because I am not good enough to refactor. I do exactly what I need line by line. I'll refactor later, when I'm literate.
DEL-J, your math of the random distribution in the circle is kind of wrong: http://sqf.ovh/sqf math/2018/05/05/generate-a-random-position.html
fair. just thought it would save the complicated selection process.
The getdir part is also pointless, since you add random 360 anyway.
@inner swallow, you're definitely right, it's just a skill gap.
Good call, @little eagle.
That link for a random position is well over my head. I have to use this kind of thing often for my project, though. I may try to dig in and understand that, then just have a few functions once I figure it out that I can attempt to plug in. That must be down the line, though.
@inner swallow, how would I go about doing the foreach in this case?
erm i think
{
_x doMove getpos [...];
_x disableAI "PATH";
_x switchMove selectrandom "animations";
} forEach (units _group);```
Even if it's not right, at least now I know what I'm working with. Thanks!
Hmm...
Perfect!
I might have to throw a timer or something in there to get them to their domove position before they stop moving, but ultimately, this is great to start with, thanks so much!
private _units = units _group;
private _origin = getPosWorld leader _group;
private _delta = 360 / count _units;
private _start = random 360;
{
_x doMove (_origin getPos [100, _start + _forEachIndex * _delta]);
} forEach _units;
This should make them scatter in a star pattern.
MVP ๐
@little eagle, Very cool. I'll test this as well.
@little eagle Nice link about shapes through distribution. I see you have gone Cyrillic.
Jawohl.
da
Any opinions on the correct use of FSMs for mission coordination? I have the pattern that:
- States create a task in their InitCode block.
- Attached condition(s) check for completion of the task in their Condition block and complete the task in their Action block.
Benefit is you can drag the arrow from Init entry node to any of the states and the mission starts from there (in terms of tasks).
Haven't quite figured out a use for the PreCondition code blocks.
Not a fan of FSM. They are hard to edit, and get diffs from.
They obscure what is going on in my opinion. No value in using them.
atm trying to revive/remake old mission, there was fsm in b4 (beta times) ๐
FSMs still do render as text and can be committed to source control with diffs as long you can tolerate the /%FSM<STATEINIT""">/""/%FSM</STATEINIT""">/ wrapping, but they certainly aren't as readable as SQF.
@meager heart the old mission had FSM and you are trying to remake it without FSM?
yep
tolerate the /%FSM<STATEINIT""">/""/%FSM</STATEINIT
you're not using fsm editor ?
I am using the FSM editor, but it outputs .fsm text files that are really C++ like files with hierarchy of classes that, for some reason, maybe to keep from SQF inside the quotes for class variables from messing up the ability to parse the C++ code, many of the variable values get wrapped with the extra comments.
At least with the scripted compile configuration - there may be other compile configurations that go to a non-text binary format.
Experimentation at this point. Trying different approaches. I've also had success with just Create Task, Set Task State, and Trigger modules in the Eden editor, though that can get a little wonky with lots of lines all over the place.
never tried tasks modules... was enough troubles with just functions in b4
maybe they working now idk
They work well. The challenge is that you need a Create Task module, Trigger, and Set Task State module for every task. Also, one weird behavior is that the notification for the next task assignment appears before the notification that the task you just completed is complete. So you see "B Assigned" and THEN "A completed".
Since you can't order the 'sync to' lines from the trigger to the Set Task State module of the current task and from the trigger to the next Create Task module, I haven't found a way to control which gets executed first.
try this maybe https://community.bistudio.com/wiki/BIS_fnc_setTask ๐
That's what I use now in SQF behind the FSM. I don't put anything but simple logic in the FSM blocks and call out to SQF functions to create tasks, etc.
With the SQF/FSM approach, you can get the right order of "A completed" THEN "B assigned".
if you're using that fsm only for tasks, imo that is pointless and overcomplicated ๐คท
It could be. Just trying it out and gathering feedback at the moment because if I don't try it, I wouldn't know if it is something that could be useful.
@little eagle wtf commy? ๐
I once saw a complete (?) list of all files in a mission folder that were executed/opened when a mission starts (like init.sqf, etc.). Now I can't find it. Anyone know where I can? Nevermind, found it: https://community.bistudio.com/wiki/Event_Scripts
Everytime I update a public variable do I need to call publicVariable "myVar"; again?
Yessir.
You don't have to, but otherwise it will no longer be the same everywhere.
shush
btw ะบะพะผะผั that is "to whom" with extra m, commander > ะบะพะผะฐะฝะดะธั ๐
I know, but the average speaker here only knows the Latin alphabet.
So compromises have to be made.
๐
And I like "whom". Sounds sophisticated and a bit pretentious.
ooooooh! ๐
๐ค
does class Eventhandler work for buildings? editor placed or even as terrain object?
depends on which eventhandlers. I'd say init should work yeah
thanks. BC is too "imprecise" as this is about partial destruction
i guess otherwise on init do a addEH forEach allTerrainObjects "House" basically
Better question. What are you trying to do?
Hey! I'm trying to create a MP mission where 2 players have conversation with KbTell. Player1 = in this case the host and has all the voice lines working, but when player2 says something to player1, it doesn't play neither the sound or display the text of the dialogue.
But if player2 is not controlled by a player, then the voice line works again.
Does anyone know what's going on? Is it possible to have voiced dialogue between players?
I'd say this sounds like locality. Where/how is the player2's "say something" script executed?
It's a ingame trigger with execVM
@still forum handleDamage on buildings to use scripting for custom handling
some is done already via model.cfg and animations, yet door and windows cant be done this way it seems (due to normal animations with opening or breaking)
Like when player enters the zone it execs the .sqf file
so. The script is executed on both players then?
Question: Is there a way to set the amount of space in a box with a line of code in the item's init field in the eden editor?
I suppose so because everything else is working until the 2 players try to have a convo
hq1 KbAddTopic ["introduction","hq1.bikb","",""];
player1 KbAddTopic ["introduction","hq1.bikb","",""];
player2 KbAddTopic ["introduction","hq1.bikb","",""];
hq1 KbTell [player1,"introduction","hq1"]; //playerLine_1 - Class name of the line defined above
waitUntil {
hq1 KbWasSaid [player1,"introduction","hq1",8]; //Search in 3 last seconds
};
player1 KbTell [hq1,"introduction","hq2"];
waitUntil {
player1 KbWasSaid [hq1,"introduction","hq2",1]; //Search in 3 last seconds
};
sleep 1;
player2 KbTell [player1,"introduction","hq2"];
Here's the thingy
last line don't work
unless player2 is not controlled by a player
@leaden quiver no
Well shit. I have a box of items in a mission but it won't let you pull anything out of it.
Interesting.. Biki doesn't say.. But try this
player2 KbTell [player1,"introduction","hq2"];
->
[player2, [player1,"introduction","hq2"]] remoteExec ["kbTell", player2]
does player2 hear himself talking? Does player2 hear player1 talking?
I'm pretty sure I tried remoteExec, but I'm gonna try again
No he doesn't
he's completely mute
Not even text is displayed
from .bikb
Soon we'll know if that works, I think we typoed it earlier.
player2 should atleast also hear the hq and player1 tho ๐ค
Okey now! Be very careful! slowly walk away backwards and make sure to never touch it again
Atleast he's very confident it works, we're testing in 1 sec
I literally tried to google all kinds of shit, but nothing came up
Thank you so much again, my brain was melting because of this
dont think any. Maybe Delete
maybe you can check when projectile will be null with fired... so if that was grenade null > explosion ๐ค
Is it possible to register CBA settings for eden with mission scripts alone? I mean while being in the editor and setting those up.
I'd also like to know how to detect explosives exploding
I think the explosive can also go Null when someone picks it up
Except for grenades
@digital jacinth As I remember CBA has a cba_settings.sqf file which it will parse at mission start and apply settings
Not really what I mean, I do mean the Settings you can set vie "Addon options" in eden. I kind of want to move away form setting values in script for utility scripts of mine.
Oh... I don't know, sorry.
as long as you set them at preInit you can do that
aka description.ext CfgFunctions preInit
๐ค
as in
class addCBASetting {preInit = 1;};
?
ye
Hey, could someone tell me the working version of:
hint GM getPos;
hint str(getPos GM);
When is Killed and Respawn exactly called?
Is killed when the player has health as 0?
And respawn when they spawn in? or when they click respawn?
@digital jacinth, thanks!
@mint kraken killed eh fires if the unit has 1 damage and dies, respawn is when the player respawns and not when they click the respawn button.
Alright thanks
@digital jacinth I am trying to do an incapacitated mode, when someone dies and I do damage to 0, then set them as incapacitated. If someone shoots them again and their damage is 1 will the Killed be called again?
if the killed EH fires, the unit is dead and you cannot "save" that unit anymore
you need to do it with another EH such as Damaged or handleDamage
@still forum thanks that works now
https://cdn.discordapp.com/attachments/258350836080574479/458665111813488642/unknown.png
tho it is a little bit wonky and oyu need to load preview the mission once for the settings to appear in the editor
What did you do? They should appear at first load too when you open the mission.
i added the cfgfunction entry as usual
class diw_unknownwp {
tag="diw_unknownwp";
class functions {
file = "scripts\diw_unknownwp";
class addCbaSettings {};
class init {postInit = 1;};
};
};
and then call it with a Extended_PreInit_EventHandlers like so
class Extended_PreInit_EventHandlers {
class diw_unknownwp_settings {
init = "call diw_unknownwp_fnc_addCbaSettings";
};
};
Is this addon or mission?
Mission
Replace:
init = "call diw_unknownwp_fnc_addCbaSettings";
with:
init = "call compile preprocessFileLineNumbers 'scripts\diw_unknownwp\addCbaSettings.sqf'";
And remove the CfgFunctions entry.
CfgFunctions is not reliable in 3den, especially when defined in a mission.
No, CfgFunctions is just not working correctly.
Sometimes they're defined, sometimes not.
Depends on whether or not you load the map, vs. load a different mission on the same map, and such weird conditions.
diw_unknownwp_fnc_addCbaSettings was just undefined, and the script therefore not executed.
That is good to know, thanks
If this were an addon, you could write:
init = "call (uiNamespace getVariable 'diw_unknownwp_fnc_addCbaSettings')";
to fetch the function from the functions cache.
But the cache will not have this function when you load the mission for the first time iirc, so you have to use preprocessFile etc.
I am. Using the same setup that I've posted in my add on. So far that worked. That whole thing seems. Weird
Because it's only in mission config CfgFunctions.
how would i use a function with a parameter
call what?
like player addAction["Test", myFunc[var]];
no how to use function parameter like in c++ you just make void myfunc(int a, int b) { ...code } and use it with myfunc(10, 5); as an example
it was an example ๐คฆ
you can bind a function to an action
so i've tried it like you said but i getting a error
{
player addAction[str(_x), [str(_x)] call Options];
}forEach allUnits;
};```
error type number, expected string code
i thats not what i want
it says expected string code but i convert it already to a string
this is mostly a bug in the script engine
just help me
i gave you my code + error
without parameter it works fine like player addAction[str(_x), Options];
your parameter code seems to be wrong
so why is it working without then?
without your code to use parameter
this is not what i asked for omg
then maybe read?`
thats not my code if it use that it makes nothing
also that what you provided is using inline function and not a own function thats declared outside
its not its pure shit it isnt working it makes nothing than shit
i get it now
just saw your rank
sqf is a piece of shit ugliest syntax ever
params ["_player"];
removeAllActions player;
player addAction["Kill", {_player setDamage 1;}];
};
getUnits = {
{
player addAction[str(_x), [str(_x)] call Options];
}forEach allUnits;
};``` just tell me now how tf do i get this working
you dont call any functions there thats not what i asked 10 time now
now it says undefined variable
params ["_player"];
removeAllActions player;
player addAction["Kill", {_player setDamage 1;}];
};
getUnits = {
{
player addAction[str(_x), Options,[str(_x)];
}forEach allUnits;
};```
what?
player addAction[str(_x), Options,[str(_x)];
player addAction[str(_x), Options,[str(_x)]];
i fixed that already just sendet the old version from notepad
the error is _player is undefined what doesn't make sense since i defined _players as a parameter
Nah, you set it as a parameter in Options
you didnt set it as a parameter in { _player setDamage 1 }
also
params ["_target", "_caller", "_actionId", "_arguments"];
_arguments params ["_a", "_b"];
as commy said, _arguments is the 4th parameter, but you use use it as first
so that would also be incorrect as second thing
i never used _arguments
this is parameter
it's easier to learn something with a nice and clean syntac
syntax#
player addAction[str(_x), Options,[str(_x)]];
[player, player, 123, [str _x]] call Options
thats what the engine is doing
it's calling Options with [_target, _caller, _actionID, _arguments, Arguments is in your case [str _x] (which is a string, so it won't result in a unit datatype to kill btw)
btw kommy also used it like me
No he didnt
"TEST 123",
_function,
_parameters
];``` what he wrote
because i don't need 2
why would i need to when i only use one?
Because you weant it to work
I assume
And if you look at commys example and understand parameters in SQF then you'll understand
i only need _x so i only need to use one parameter makes sense doesn't it
Except
You didnt read the addAction wiki
player addAction[str(_x), Options,[str(_x)]];
[player, player, 123, [str _x]] call Options
i did but it's so shitty documented that you can't understand anything
Options(player, player, 13, [str _x])
Understand now? ๐
I mean if you're saying that the order is unpredicatable in SQF, then sure i'll go along with that, but if you look on the wiki page it does say in which order they go
i also looked into functions but these guys don't even give an example of how to use function with parameter
they just show to make a function with parameter
but never show how to actually use them
[1, 2, 3] call { params ["_one", "_two", "_tree"]; hint str (_one + _two) }
there now you know SQF!
because bohemia seems to only care about $
k lol
i made mistake ๐ฆ
i mean Bircko all you need to understand is literally this line
[1, 2, 3] call { params ["_one", "_two", "_tree"]; hint str (_one + _two) }
What you are trying to do is ``[1, 2, 3] call { params ["_three"]; hint str (_three) }`
but... _three would be 1 then because thats the first arugment
I don't know C++ but i assume its the same there, its the same in python at least? ๐
explain why do i need more than one parameter if i want to use only one variable it's like making a simple calculator function where you add 2 numbers you obviously need only 2 parameter and then return the result
Because the engine calls it with that many paramaters
apprently arguments is the third parameter so whats wrong
๐ค
object addAction [title, script, *arguments*, priority, showWindow, hideOnUse, shortcut, condition, radius, unconscious, selection, memoryPoint]
i mean if you read 2 lines further
this addAction ["<title>", { params ["_target", "_caller", "_actionId", "_arguments"]; }, [], 1.5, true, true, "", "true", _target _this 50, false, "", ""]; //Default Values ```
it'll tell you that this is how arguments are called from addAction
player addAction[str(_x), Options,[str(_x)]];
[player, player, 123, [str _x]] call Options
why 2 times player if i never used player in the paramters why 123 if i never used 123 in the paramters
???
like if you just used commys couple lines it would be gut already and that's also how the wiki says usihng
Seriously, just read the addAction page
addAction passes more paramters than you define.
it is described properly just fine, addAction page is 100% reliable
thats not how paramters supposed to work if a paramter is not given and it has no default value it will cause an error and not add random things
it should work like any other programming language
okay
So what you're saying is that if i have a python function, i can't pass it through to another function and add/remove some arguments in between there?
i guess python is not a real language now
oh shit ican do that in C++ too? WTF C++ CONFIRMED NOT REAL LANGUAGE
Rip javascript ๐
c++ dont add 3 random paramaters when i only say it should have 1
fuck you're dense
void kill(player); in c++ this would be one parameter and sqf just adds 3 parameters randomly there
(Only when you pass a function and not code)
But you are passing your function as handler to engine functions.
said the muted guyx
[1, 2, 3] call {
params ["_one", "_two", "_three"]; // -- notice how argumetns aren't magically added
["fuck", "you're", "dense", _one, _two, _three] call {
params ["_one", "_two", "_three"]; // -- REEEEEEEEE NOT REAL LANGUAGE!!! WHERE DID THESE ARGUMENTS COME FROM!!!
};
}
If you were to do sqf player addAction["Do the thing",{[arguments] call gna_fnc_doTheThing},"". . . you'd probably get closer to what you want
no he wouldnt lol, that's not even correct :p
Like you if you pass your function to jQuery each you always receive index and value as the library calls your handler function with these arguments.
jQuery isn't real though!
I'm too lazy to do proper syntax. Basically call the function in code with your parameter, rather than "fn_func,argument"
just make my function working and maybe i get it then
No offence but if you can't understand that and you are refusing to read what others have written you should look for help somewhere else.
and explained why it wasnt working
and then also explained what you're missing on the page that you're looking at that supposedly doesnt tell you how it works
Kommy is my favorite guy honestly
params ["_player"];
removeAllActions player;
player addAction["Kill", {_player setDamage 1;}];
};
getUnits = {
{
player addAction[str(_x), Options,"",[str(_x)]];
}forEach allUnits;
};``` this doesn't even look simular to his "solution"
lmao there is not even the usage of setDamage so tell me how would his be working
๐คฆ
i know how to do that that still doesn't explain how to use it in addaction....
well i expect him to want it to always show right?
that would be limited on range to _target
so it would only show within 15 meters
also _target is no where defined
like that doesnt make any sense to me.... ๐
but its what he wrote, not me!
yes it is
it should kill a selected unit in the action thing
params ["_player"];
removeAllActions player;
player addAction["Kill", {_player setDamage 1;}];
};
getUnits = {
{
player addAction[str(_x), Options,"",[str(_x)]];
}forEach allUnits;
};``` is it so hard to understand what i try to do????
JustFuckMyShitUpFam = {
params ["_fuck", "_this", "_gay", "_earth"];
removeAllActions player; // This is terrible to do, l2compatibility
player addAction["Kill", { params ["", "", "", "_shutup"]; (_shutup select 0) setDamage 1;}, [_earth]];
};
reeeeeeeeee = {
{
player addAction[str(_x), JustFuckMyShitUpFam,"",[_x]];
}forEach allUnits;
};
call reeeeeeeeee; // happy now
there
i fixed it for you okay
@tough abyss we usually teach people how to fish
i think literally every line has a mistake
but i fix np adanteh best guy 2018
kek
i fix np
i tried staying as close to the original as i could
params ["_player"];
removeAllActions player;
player addAction["Kill", {_player setDamage 1;}];
};
getUnits = {
{
player addAction[str(_x), Options,[str(_x)]];
}forEach allUnits;
};
player addAction["Units", getUnits];``` i fixed now and still not work
FUCK YOU
;_;
i mean
just make my function working and maybe i get it then
i did make your function
use iit now
i want to make a list of all units on and then when i select one i get the option to kill the selected unit
and thats what my script should make but when i got it to work it only killed me but not the selected target
๐ฟ
Options = { // shittyfunction name, learn to prefix
params ["_player"]; // incorrect params, _arguments is the 4th param
removeAllActions player; // Would fuck other actions up, basically never use this command its shit
player addAction["Kill", {_player setDamage 1;}]; // what is _player? NOTHING IS WHAT
};
getUnits = { // shittyfunctioname pt2.
{ // This is actually correct
player addAction[str(_x), Options,"",[str(_x)]]; // str _x is wrong, you want to pass the object, not a serialzied name of the object
}forEach allUnits; // no space between bracket and foreach, disgusting honestly
};
there
@little eagle it does when the player use the added action
even gave you comment on original code
setDamage is basiclly same as getUnits so is setDamage also a shitty function name
setDamage also a shitty function name yes, setDammage much superior
The thing is that those are engine commands, yours are sqf functions, they work different and have different syntax when being called, thats usually why you want to call them differently
Also if you have overlap between other mods shit will have a high chance of fucking up, plus if some command gets added with the same name as your functions, then your functions will also break
@little eagle thats not what i asked for i want to select a unit than it goes to a submenu in addaction where i can have different options for a unit like kick it from the server kill it or mute it
you just added commends lol
2fast4u
JustFuckMyShitUpFam = {
params ["_fuck", "_this", "_gay", "_earth"];
removeAllActions player; // This is terrible to do, l2compatibility
player addAction["Kill", { params ["", "", "", "_shutup"]; (_shutup select 0) setDamage 1;}, _earth];
};
reeeeeeeeee = {
{
player addAction[str(_x), JustFuckMyShitUpFam,"",[_x]];
}forEach allUnits;
};
player addAction ["units", reeeeeeeeee]
here
i mean, it's going to be fun when the // This is terrible to do, l2compatibility comment clicks
@little eagle if i wanted to do everything in one function i wouldn't even be here because that i can do myself omg
๐ค
is there a physics enabled invisible object in the game which I can attach some simple object to and throw in a direction? So far I am trying "WeaponHolderSimulated", but that gets auto deleted as it does not contain any items.
The UAV's are the smallest iirc.
grenades
it would probably weird that there are 2 items flying away.
hideObject
Hide the physics item, yeah ^
But care it has local effect
wouldn't that looks weird in MP then?
yeah that is what i was thinking
well
yeah
Am still wishing BI would allow you to attach ropes to non-physx objects ๐ฆ
jip is not really a problem as it will be delted after a few seconds.
maybe just "groundweaponHolder" ๐ค
params ["_p"];
removeAllActions player;
player addAction["KillPlayer",
{
params ["_target", "_caller", "_actionId", "_arguments"];
_arguments params ["_p"];
_p setDamage 1;
},
[_p]
];
};
getUnits = {
{
player addAction[name _x, Options,[_x]];
}forEach allUnits;
};
player addAction["Units", getUnits];```` your methode doesnt work at all it just kills myself
You are using params wrong in first function
Your arguments array is passed as fourth argument to action handler function.
First three arguments are supplied by engine as described on wiki.
You need to extract the unit from arguments array like in your internal addAction function. Currently you are passing _caller (you) as _p
๐ค nah the simple object will be still stuck mid air.
private _groundHolder = createVehicle ["WeaponHolderSimulated", position ace_player, [], 0.5, "CAN_COLLIDE"];
_groundHolder addItem "HandGrenade_Stone";
[_groundHolder, true] remoteExec ["hideObjectGlobal", 2];
private _dummy = createSimpleObject[_model,getPosASL ace_player];
_dummy hideSelection ["zasleh",true];
_dummy attachTo [_groundHolder,[0,0,0]];
_dummy disableCollisionWith ace_player;
// _dummy setDamage 1;
_groundHolder disableCollisionWith ace_player;
_groundHolder setPos (ace_player modelToWorld [0,.2,1.2]);
private _dir = getdir ace_player;
private _speed = 1.5;
_dummy setVelocity [_speed * sin(_dir), _speed * cos(_dir),4];
after 10 seconds both _dummy and _groundHolder get delted, but before that they stop
oh damn! i thought i did
i am blind
Simple objects have no physics afaik