#arma3_scripting
1 messages ยท Page 78 of 1
nope
Basically, they've been flying around without a care in the world for several missions in a row and it's time to make them feel unsafe
:)
A basic example would be:
_vehicle addEventHandler ["HandleDamage", {
params ["_veh", "_part", "_damage"];
_damage min 0.5;
}];
Is it possible to force an invisible object to be visible? Maybe make it drawn as wireframe?
I'm not sure that this is guaranteed to prevent destruction with vehicles though.
you can draw the bounding box yes
Also you'd need to ensure that your handleDamage is the last one added.
I don't think a single Titan AA can usually smoke a ghost hawk...
oh, they do.
In vanilla? Straight down IIRC.
If you have advanced vehicle damage enabled in ACE then you may need to delay installing this EH.
Or work with it, but that involves reading ACE code :P
I haven't messed with it much, especially with helis, but generally ACE advanced vehicle damage prevents vehicles from dying fully. It might just go full red and lose all its fuel.
messing with macros, can't figure out my error:
// Mission
#undef TAG
#define TAG "IFA_UK_DES_"
#undef MISSION
#define MISSION TAG+"M01"
// Macros
#undef GMVAR
#define GMVAR(var1,var2) missionNamespace getVariable [var1,var2]
#undef SETMVAR
#define SETMVAR(var1,var2,var3) missionNamespace setVariable [var1,var2,var3]
// UI
#define LAYER_BLACKSCREEN "hyp_blackscreen"
// Common
#define MISSIONSTARTED "hyp_missionStarted"
#define PLAYER_SIDE resistance
#define VIEW_DISTANCE 1000
#define TERRAIN_GRID 12.5
// Triggers
#define TRIGGER_TICKRATE_DEFAULT 0.5
SETMVAR(MISSIONSTARTED, true, true);
[""] remoteExec ["hintSilent"];
/* ERROR
19:38:09 Error in expression <awned
} == -1;
};
("hyp_missionStarted", true, true);
[""] remoteExec ["hintSil>
19:38:09 Error position: <, true, true);
[""] remoteExec ["hintSil>
19:38:09 Error Missing )
I thought SMVAR should be building an array?
That doesn't look like you quoted the code that's triggering the error?
yes but the error has a remoteExec on the next line.
your code does not.
oh i copied the wrong thing, you're right one sec
its actually SETMVAR that must be erroring then
I have no idea what I did but I fixed it... split the file into multiple includes... must have had a typing error before... its saving variables correctly.
Hey guys, how do I make the player walk for a while at the beginning of a single player mission like in the arma campaigns
Probably just a bunch of PlayMoves
anyone know how i can customize the menu screen? like adding a button or graphic that will load the server without direct connect?
Is there still no fix for ai drivers unable to cross small bridges on altis? scripted, modded, etc fixes?
I fixed my problem but now I have a new one:
Can i make the AI move at the same time as doing an animation?
Like, I want to apply a walking animation to the AI but they just walk in place whenever I do
Do not use Artwork Supporter
Wym?
Oh the mod
What do I do otherwise then?
Cuz im putting it in the init.sqf of the mission and I want to end it with a trigger
By some scripts. People who want to use AS to make missions often say such
I am doing scripts though
At the moment I'm really trying to use BIS_fnc_scriptedMove
Funny Enough I do exactly that for my Own Group
https://sqfbin.com/ehuhipuduqocivesutix
class JoinMainServer has most of what you want to change.
This adds a button like so, obviously I changed the Name in the sqfBin
You can simply use switchMove/playMove
I tried and he would just walk in place
AI1 switchmove "Acts_welcomeOnHUB01_PlayerWalk_5";
This didn't cut it
Then you have attached the AI to something I guess
I don't know how to do that lol
Is it possible using hit or hitpart to know what the previous damage properties of the damaged part or vehicle health was?
I want to know if a vehicle was at 0% damage before it was hit
Or maybe if a killed event handler fires before the vehicle is killed, is it possible to stop the vehicle death? Or is that already hard coded to happen
Hit and HitPart no, handleDamage yes; it fires before the new damage is actually applied, so getting the current damage works, and you can override the final damage to prevent death.
Oh interesting.
The locality note still kinda confuses me for vehicles though. Could I add this handler on the vehicle from a server side script and it would be fine? Or do vehicles somehow change locality if players are in it? Would headless clients cause an issue?
Vehicles regularly change locality - they are typically local to the driver in order to have driving work well in multiplayer
The locality note means that the EH can be added to something that's not local, but will only fire on the machine where it is local. For vehicles this means it's usually best to add the EH everywhere.
How would I "tag" a unit that respawns so I can check if it's a tagged unit OnPlayerRespawn?
There's these three players that need a couple of things setup for them for accessibility reasons and these things are reset upon death
Ideally, I'd assign a trait like "helper" and check in onrespawn "if helper"...
In the initfield of the unit:
This setVariable ["helper",true];
Then in a script inside onPlayerRespawn.sqf:
_tag = player getVariable ["helper",false];
If (_tag isEqualTo true) then {
// code here
};
Or run a script that checks from a list of player UID if you aren't making special slots...
myUIDList = [494037,730406,749604];
If (_uid in myUIDList) then {x}
oic thanks
hey
I am trying to resize a banner, I use *banner name* setObjectScale 1.8;
when I try it on my end in multiplayer it works, but when it's on my server it goes back to normal size, why?
https://community.bistudio.com/wiki/setObjectScale
setObjectScale exists at the very furthest edge of what the engine can support, and has a number of serious limitations. This is one of them.
The wiki page contains more information. tl;dr (but do read it): for non-Simple Objects, the scale must be set every frame to work at all
In multiplayer the only working solution I've found is using local only simple objects
so set the banner as simple object and local only? will it still show the custom texture?
Alright thanks, I will try it
Hey guys
I'm trying to add a held action to a truck that only appears once a Large Dug-In IED is placed in its inventory, like "If this is true, then create the action.
It'd be helpful to know how to use the return value of BIS_fnc_hasItem to do it (the "if this is true"), but I don't know how to do that exactly
I've mostly been guessing and looking on the wiki for consistencies and patterns but it's just not clicking.
if ([/*stuffhere*/] call BIS_fnc_hasItem) then {};
Ooh thanks, I'll try it out
No need to say like if ([stuffhere] call BIS_fnc_hasItem == true) then {}; or something?
I guess that's why I was messing up, I thought you had to say "if function is true, then...
no because the return is a bool.
if you did it that way it would be
bool == bool which is unneeded
instead of just bool
depends on what you got
lets see what you want
Well let's say I wanted to turn a number of OPFOR in an area, say 5 for example, into a "true" statement, alongside anything below it; anything above 5 would be "false"
Would that be super complicated or is that kinda casual?
Oh okay, so it'd be if {count units east <= 5} then {hint "Script Works"};?
that would state, if 5 or less units on side east exist, hint something, plus use () for the if statement and {} for then statement
if takes only a boolean not a code
if (count units east <= 5) then {hint "Script Works"};```
There's a difference? I always though they'd be pretty much the same and are only different for organization
() <- this means nothing but only to execute early
{} <- this is a code, to put any script statements that needs to run
Oh okay
Okay what am I doing wrong here?
if ([STARTINGTRUCK1, "CUP_IED_V4_M"] call BIS_fnc_hasItem) then {hint "Truck Works"};
do you have script errors turned on? it should tell you
blah blah blah... is not how to tell us what is the error
I know I was trying to get it. I can't memorize so much text so fast lol
/temp/bin/a3/functions_f? sounds not even normal
idk, I know i didn't make that file lol
What is STARTINGTRUCK1?
That's the variable name of the truck I'm checking the inventory of
I'm going to add a hold action to it that starts the mission
But as for now a hint will do
use "CUP_IED_V4_M" in itemCargo STARTINGTRUCK1 for now (if CUP_IED_V4_M is the correct letter case)
just noticed the banners don't have the simple object in the attributes, then what?
so it'd be if ("CUP_IED_V4_M" in itemCargo STARTINGTRUCK1) then {hint "Truck Works"};
?
setObjectScale can scale any object after all, it will just turn into normal scale whenever the object is updated. Which I mean, a static object is pretty fine to use regardless is a Simple Object or not
Seems to have fixed something since it's running the rest of my init.sqf but I don't see the hint coming up so I don't know for sure
Oh wait nvm
so if I add a custom texture to it, it counts as the object updated and it won't resize?
A texture update is not a update
So what am I doing wrong? I am using object setObjectScale #; it works when I test it but on the server itself it won't resize
Really depends on how you've ran it
What do you mean?
AKA depends on the context around the code
I still don't understand what you mean by context around the code ๐
why is it so difficult to resize a damn object
Because the setting scale is done in a really hacky way AFAIK and only introduced really recently
Where do you actually put the code?
in the init of the object itself
I give it a variable name, then I replace object with the variable name then setObjectScale 1.5;
How about sqf if (local this) then {this setObjectScale 1.5};?
I will try
Okay back to the if-then stuff:
I wanna say "if (this is true) then {some trigger activates};"
How does one do this?
Why you need to activate a trigger when you can run any script in this statement already?
To give the player a task. I'm just much more familiar with doing task stuff with triggers and whatnot but if you know an easier way to do it in an .sqf file, by all means
?
given the amount of questions regarding MP, I think a big red warning box will have to happen ๐
Did you put something and delete it? Lol
yeah, missed the ref message
Ah
Cause triggers are much easier to place and understand visualy for newer players.
And if it can be done with triggers, why not?
You have any ideas, Marko?
That's the point too
btw we have https://community.bistudio.com/wiki/BIS_fnc_sideType ๐
Cc @grim cliff ^
I havent messed with tasks myself much. But i can take a look later, if nobody helps you by that time.
Alright
Oh, indeed a much nicer way of doing it.
if anyone thinks call compile is faster than getVariable they are ... not smart.
I understand tasks well enough, it's mostly just getting the script to begin them (hence the triggering of a trigger)
we had a number of call compiles in ACRE2 a while ago and we switched them all out for getVariable and there was a marked speed improvement
call compile has to spin up the entire overhead of the lexer/parser
getVariable on missionNamespace just does what every global variable does, which is call into the gamevar hash for that namespace
it is super fast
Aye
Thanks. But that link is not working. I am looking to either replace the boxes in the middle of the screen with my links or remove them and have tabs on screen.
This may help: #arma3_scripting message
Spotlight is the big middle button on dashboard
Careful tho, cause some map makers delete whole spotlight for no apparent reason...
We got this. It's a simple config edit. Can send it to you if you want it.
Actually I did this for FNF too. You can find it here:
https://github.com/FridayNightFight/FNF/tree/4.0.0/client_mod/fnf_logos
didn't work
My apologies the SQFBin must have timed out before you got to it
I have been meaning to look into replacing the Boxes on the main screen too, Its just at the bottom of my priorities at the moment
This is true right?
object: Object - must be either an attached object or Simple Object
let's say it is supposed to be simple object, there is no simple object option in the attributes of a banner, so what do I do?
what does attached object mean
clicky clicky linky linky
so if it isn't attached to anything it won't resize...........?
if simple, won't resize
if normal, must be attached and must be reapplied every frame
Thanks!
Thanks. Would love to see if I can get it to work. Are there ways to graphically change the button?
My ultimate goal is to replace the big box. Sounds like that is spotlight
If you need any help with it, shoot me a message.
Yeah, you can edit it as much as you'd like. You can even replace it for a image.
If you got only one server, I would add the connect function to the logo at the top, where the A3 logo usually is, if you are replacing it
Ah, big box you mean in the middle?
whyyyyyyyyyyyyy why ist it like thattttttttttttttttttt
i am just trying to resize a stinky banner ffs
Yeah
why is arma so stupid with stuff like that
I may shoot you a message later when Iโm off work
because not - planned - for - MP - only an aesthetic feature people want to force there ๐
(I am updating the page with note + examples)
How big is the banner?
setObjectScale is not planned for MP
use the banner as you like
1.5-1.8
oh yeah let me add a WHITE BANNER for my use yes
1.5 meter? Centimeter? Pixel?
CAN YOU STOP SHOUTING
it's just 1.5 by the game, where it says 1.5 in the banner option
the banner's colour has nothing to do with setObjectScale btw
I have to or I will kill myself from this DUMB SHIT
I am aware but a banner the size of a damn tea table is not helping me
Okay, what if you use user texture 10x10 meters, and resize actual image using paint or w/e? Like make it transparent?
make your banner mod or script that workaround, ez
ehh, I will try it
see how it goes
It will go hot. And you dont need to rescale anything
there is another thing I am trying to rescale, a parachute target, how will I do that..? since I can not attach it to the ground and no simple object option
That I don't know how to do exactly. Looking at the config, it does seems to be the Spotlight2. But can't find the onClick functions
You can attach it to lets say user texture or a pen and hide model.
updated https://community.bistudio.com/wiki/setObjectScale, btw
Damn, would be nice when we were recreating Factory from Tarkov
this took us a long time to debug
oh yeah ok
Well time to make miniature oreokastro and drop miniature cluster bomb from miniature plane, called in by miniature miller, using his miniature laser designator. In multiplayer.
all local and manually synchronised, of course
_mffdz setObjectScale 2.5;```
did I do right?
see the updated setObjectScale page ๐ if _mffdz is a local simple object, yes
I used the same principle to get Objects animated in Multiplayer, Local Object and separate Loop to move it on each client
it's on local only but can't do simple object, still counts?
then each frame
Dont be silly, too much effort. Ill just spawn each object as simple for every frame of the 120 fps animation. Then use show hide model to "play" it.
So, did you get it to work?
I'm trying to detect when server shutsdown but for some reason this code never triggers ```sqf
addMissionEventHandler ["PlayerDisconnected",
{
diag_log format["QUITTING %1", _this];
}];
Because when it shuts down, all scripts stop execution.
But then again how do you shut it down? end mission first, then shutdown?
Or just straight up kill it, with eg taskman?
editor multiplayer ending
probs MPEnded would be better?
tried that too
is this supposed to do something on client?
just server
or server rather?
also in editor multiplayer, server continues running if you go back to editor, i believe
i'm trying to make a mission like a conquest in battlefield with sector moudles
no luck with that either, im using debug console to test
the sector has spawned at right place but it's not showing up
_sector = selectRandom _possible_sectors;
_possible_sectors = _possible_sectors select {(_x distance _sector) > 300};
_sector_logic = (createGroup sideLogic) createUnit ["ModuleSector_F", getPos _sector, [], 0, "NONE"];
_sector_logic setvariable ['BIS_fnc_initModules_disableAutoActivation',false, true];
_sector_logic setVariable ["Name", (_sector_name # _i) # 0, true];
_sector_logic setVariable ["Desnignation", (_sector_name # _i) # 1, true];
_sector_logic setVariable ["OnOwnerChange", "[_this # 0, _this # 1, _this # 2] spawn conq_fnc_sectorOwnerChanged", true];
_sector_logic synchronizeObjectsAdd [logic_west, logic_east];
_sector_logic setVariable ["Sides",[ east, west ], true];
CONQ_sectors pushBack _sector_logic;
weird none of the disconnect HEs work. I tried with new mission too (from the editor) and I get no logging via diag_log . is this working for everybody else?
Any way to limit FiredNear eventHandlers Activation Distance. I saw the Params section in the wiki just not too sure how it would work in this context
if distance > 20 exit?
this addEventHandler ["FiredNear", {
params ["_unit", "_firer", "_distance"];
if (_distance < d) then {
"code";
};
}];
or attached in MP, no?
๐ค
perhaps ๐ฎ
does this code work for anybody when disconnecting from editor server? (Run in console) ```sqf
addMissionEventHandler ["PlayerDisconnected",
{
diag_log format["QUITTING %1", _this];
}];
โฆtry? :3
it's supposed to print "QUITTING" and some vars
(just to be sure: it must be done on server)
yes, but on which machine is the code run? client or server?
my machine is both when launching editor-MP.
it might not consider yourself a disconnection
if you have another machine connecting then I believe it should trigger yes
ok it seems to only work on dedi just tested
it's not that
it's that when you are player-hosted, you are the server, you do not "connect" to it
have you tried having another machine connect-disconnect as you host?
dont have another
so i need workaround for same PC "disconnect"/mission ending handling.
Kinda
At the moment, i just used scripts to assign the "Load IED Into Truck" task after the MC and an NPC talk but I don't have anything else
I dont think my script to check the truck actually activates
I just dont think it works
mission ending? there are event handlers and event scripts for that
such as? didnt yet find
thx. I tried "Ended" but it doesnt trigger
it should trigger on mission ending
not on server restart
no luck, maybe its only for SP
MPEnded?
are you trying all that in Eden or in a "normal" MP environment?
eden
thx will try that one
If you'd wanna use trigger you can replace this condition with:
"CUP_IED_V4_M" in (magazineCargo STARTINGTRUCK1)
And i would set trigger interval to something like 10 seconds.
So every 10 seconds it would check if STARTINGTRUCK1 has CUP_IED_V4_M.
Funny trigger notes. Once non repeatable trigger has activated, it will continue evaluating the condition.
Also there seem to be no way to retrieve Trigger owner :o?
Yo i just did something simpler thats effectively the same:
I just made it so the player requires it and when they're ready to start the mission they just get in the truck
Now what I need to do is make it fade out once they get in and teleport them into another truck that has simulation enabled and the same kit as the trigger truck.
Its going to be driven by one of the NPCs
In my testing thru all
this link is broken for me, but I'm interested in seeing it
Give me a sec I'll grab a new one
use pastebin cause i think sqfbin is down atm
Yeah I saw that
Oops added the server details with it Kekw
Removed private info, that's what I get for just having woken up XD
https://pastebin.com/5TKAqwW0
span class="re5">
UI stuff makes me sad so I figured it out then just forgot about it XD
Thats because you design sad ui. You need to start making happy ui.
Once I am able to wrap my head around UI stuff easily then I will Hahahaha
How can you detect if a mine has been placed within a trigger's boundaries
Im trying to make a task for the player to place an IED on a road
You could check for all mines owned by the player and see if they are in the Triggers Area
Slight Caveat getAllOwnedMines, I don't believe works with ACE
Ah okay
My next best guess is just have the trigger call a tiny function to look through all the objects in the Area of the Trigger and find classnames that match, could get very expensive though
Yeesh yeah
Another solution I have seen is to use the FIRED Eventhandler on the player and see if it happens within the area
Ive seen that too but have absolutely no idea abt how to use it atm
Oh Wait, better idea https://community.bistudio.com/wiki/inAreaArray
count ( ["mineClassName1","mineClassName2"] inAreaArray _trigger ) > 0
You can even change the 0 to what ever minimum amount of mines you want in the area
Another Alternative
count (allMines inAreaArray _trigger) > 0
Completely indiscriminate, all Mines are included
Ooh I'll check that out
Nevermind false alarm, ["mineClassName1","mineClassName2"] inAreaArray _trigger doesn't do what I thought, but I did find another alternative that is super small. count (allMines inAreaArray _trigger) > 0
Is there a way to get all paths for gun turrets on a vehicle (not including "person turrets" or the driver or commander stations without a gun)? Or more specifically, is there a way to get all paths for empty instances of that kind of gun turrets on a vehicle?
https://community.bistudio.com/wiki/allTurrets can let you exclude FFV, using that you can just get instances using this https://community.bistudio.com/wiki/turretUnit that Return a Null Object
My Bootleg test
Damn dude ur popping off
is it possible to get the kind of turret from just a turret path?
Alright Ill check this out
Is _trigger the varName of the trigger I want it to trigger or does it have to be _trigger?
_trigger is just me representing the trigger, it can be the variable Name of the trigger or if you slapped it straight into the condition you can just use thisTrigger
Okay thx
https://community.bistudio.com/wiki/weaponsTurret seems to do it, weaponsTurret returns an Array of Strings, in case the Turret has several Weapons like a Tank's turret for example.
Tbh i think im biting a bit more off than I can chew with this project lmao
Cuz after this I now need to make a trigger create a convoy that runs over the IED, then a helicopter that lands after to act as a reinforcement, then turn all this plus howevermany more missions Im making
Hm, it doesnt seem to be working anyway
Im gonna try without ace
My tiny test seemed to work with Ace
I guess i messed something up
Ill try again
That was how i set it up tho
At least I thinl
Ill quadruple check
The mines need to be activated fully to count as well
not โnearestMinesโ?
Did I miss that? ๐
for the homies trying to belittle 0.001ms
That's a huge amount of time for such a simple call
If that was all you were doing it would be the difference between 170 FPS and 150 fps.
It's new-ish apparently.
that being said, the performance test is for 10k iterations.
Anyone have experience working with the ryan zombies and demons mod?
Trying to ease up the server load of the ai, but it seems headless client makes things worse.
When I make the zombies local to a client, they suffer a huge amount of ai lag. Like they stand still, take a couple steps, stand still again, while the Server local ones perform fine.
All I can think is that the server is taking over the AI, but having to execute it remotely or there's some other conflict going on.
Could someone point me in a good direction for a money system script. Been looking and came up empty
Is the only way to unlock faction clothing via addons and not scripts?
I wasn't trying to "belittle" it, I was just joking around -_-
And @spice kayak you can use forceAddUniform or something like that to forcefully add clothing.
Thats correct @sullen pulsar whistle
No, he asked if the only way was by addons and not scripts.
What you talking about? I wrote nothing (pls wait with answers, until i changed my posting)
"7:47 Dscha: He wanted to do it by Addon @sullen pulsar" QFT
LOL
If only there was a real quote function </3 discord
@sullen marsh grr, me hatin ya!
<3
[] spawn {
AI addEventHandler ["AnimChanged",
{
_aunit = _this select 0;
_curanim = _this select 1;
aunit playmove "ApanPercMrunSnonWnonDf";
_aunit setAnimSpeedCoef 1.5;
}];
[] spawn {
while{true} do {
waituntil{((AI distance player) <= 59)};
AI setDir ([AI,player] call BIS_fnc_dirTo);
};
};
while{true} do {
_targetPos = getpos player;
AI DoMove (position player);
waitUntil{(count(_targetPos nearEntities [typeOf player,(AI distance player)/5]) == 0) && ((AI distance player) >= 1.5)};
};
};
hey i made this script that makes ai follow me, but for some reason the script majes the ai animation look choppy
Your code need some optimizing. you could add all in 1 spawn , and use sleep and if statement to check conditions. And without sleep/uiSleep while is pretty heavy code to use.
And in EH
You are missing _ from aunit
there is some old outdated code there too, like โbis_fnc_dirToโ
how could i set the speed of a jet? looked on wiki it gives velocity of a object but that not work any help would be appreciated
call compile str
everything
Might be a dumb question, but why not just have a Waypoint for the AI attached to the player or a relative position to the player that doesn't complete on it's own?
Call compile mission.sqm
call compile call compile call compile call compile call compile call compile call compile
Try to imagine the escape characters for that many nested compiles.
If you mean player controlled ones, you can't
For AI controlled ones try forceSpeed and limitSpeed
And waypoint speed
call compile ""end1" call bis_fnc_endmission"
done
of course make it local as well
Cheers bud ill give it ago, its a ai one I want to try get one to fly over and break sound barrier for a cinematic shot
Call compile mission.sqm
You say that; the amount of execVM I've seen in some missions ...
Hello
How do I turn off respawn markers form showing on the map?
idk if its relevant to scripting or not exactly but cant seem to find a good awnser
use the System > Empty marker. that shouldn't be visible.
hu?
How exactly does your Respawn work, are you using the respawn Module in the editor?
yeah
something like that
When I place a respawn in editor or zeus, it comes with a marker that is displayed to atleast their own team
like this
If you are doing it in Zeus it's gonna be a pain to change, but in the Editor that's fairly straight forward
There shouldnt be any additions on zeus needed
I want one group to respawn on closest squad member, and one pilot to respawn at HQ
neither should know where the other is
the far away group shouldnt even know where they are
as is map markers for respawn kinda ruin it
and respawn on death position is not optimal cuz
pilot may crash and end up in the water
Well first off just like Ampersand said use the System > Empty marker. that shouldn't be visible. You can use a Empty marker
After that you can give it a very special variable name as dictated in the Multiplayer Attributes window for Respawns.
really daft question @sweet zodiac but im new to all this and ive wondered a few times, why is your editor orange and mine green is there a reason? i will remove this question once answer btw
there is a colours Menu in the Options, I have haven't changed my menu colours from when I installed the game Some 5k hours ago
Apex owners get the green color by default when they first launch the game
ahhhh i see, thank you for that, i have changed it now i like the orange, i could never figure it out though
Has anyone ever, or does anyone have a script for a shooting range that keeps score looking to build a range where I can have folks shoot a set of targets on a time thing and have it scored
Alright I have another question. Is it possible to set respawn on closest teammate, or attach a respawn to teammates.
using this method
with the module its just attaching the thing to a player
Hmm, well I suppose you could just run a loop that moves the position of the Respawn to the Group Leaders position
There might be an easier method but I can't think of anything at the moment
alright
is there anything that can be done to make a respawn group specific?
I have a weird pseudo solution of having a respawn room and just having one specific trigger in there teleport the pilot to the spawn but
I feel like something more optimal could be done
I can think of a way yeah
did it the other day for another fella
having this executed locally for the people in question.
[player, getMarkerPos "MarkerName", "SpawnName"] call BIS_fnc_addRespawnPosition
and this wouldnt add a module with the respawn thing on it?
Don't believe so but I would have to double check
okay
a roundabout solution is to set that different players get teleported to different places on the map when they get to the spawn room
hmm maybe secondary solution
I have some scripts that sets back the loadout on respawn
I wonder if I can put something in my onPlayerRespawn.sqf that makes it so that
if the player is part of a surtain group
they get teleported to the nearest player
if they are not, they go to somewhere else
If they stay in the same group you can probably just player setPos (getPos leader player)
If it's in onPlayerRespawn you shouldn't need an If
well I would want it to be player specific
if player is in group A, then ....
if player group B, then .....
That short snippet will grab the leader of their current group, so if they are in Group B they will TP to Group B's leader and the same for Group A
hm
might be an issue if the respawn pos of gorup B is fixed
I would need to have still ai as leader then
In that case then you would want one yes
look the premise is
2 groups, the rescue and the survivors
the survivors are split into small teams (in the same group so that its unpredictable who will be with who) and they dont know where the heck they are
and the rescue pilot
the rescue pilot should only respawn at the base
the survivors should respawn on closest survivor (or closest player since that will always be another survivor)
When respawning, if the respawning person is group survivor, they should be moved to nearest player
if the player is group rescue, they should be moved to a set location
thats the if statement I would need to construct
with G_Survivor and G_Pilot
onPlayerRespawn has 4 Params you can play with that might help, specifically _oldUnit
If you are a Survivor getNearest Survivor to the oldUnit/Body then TP there
hm
How do i know if a mine has exploded or has been deactivated by a person?
Ta Da
params ["_newUnit", "_oldUnit", "_respawn", "_respawnDelay"];
switch (typeOf player) do {
case "G_Survivor": {
_teammate = nearestObject [_oldUnit, "G_Survivor"];
player setPos (getPos _teammate);
};
case "G_Pilot": {
// Do Nothing
};
default { };
};
You just need to set the Respawn for your Pilot where ever you want using a similar setup in the initPlayerLocal and you should be golden.
Wow
I am only used to basic programming with C# so arma stuff confuses me alot
thank you
Mind you this is untested so I can't guarantee that it will work.
yeah
I would assume the best standard thing to set is also respawn at position of death too
just to not potentially mess with anything related to it finding locations
I would use custom Position instead
Well if you respawn on your death position you bypass any Spawn Positions
ah
so I should have respawn on custom position with no set respawn module or marker?
I would have a marker somewhere so you can use it with BIS_fnc_addRespawnPosition so that way you can at least set a location for your Pilot, and since the survivors get TP'd anyways their spawn pos doesn't matter.
I think I will have a respawn room with the respawn module
and then have it TP player to pilot spawn
as to not give away the respawn location of the pilot
or no, that wouldnt be a problem
I dont need that
I'll do as u said
Either option work really
the players can know the pilot's spawn location
thats fine
its on an island
yeah got a place for the module
The Teleport should happen fast enough that the players likely won't even see the place they spawn
well the Survivors at least
The Pilot should be fine unless you plan to Tele them too
I guess in testing this I need an AI teammate
If your mission is setup to respawn on Start it may complain the first time
since _oldUnit won't exist until the first death
nah
I set it to
respawnOnStart = -1;
strange
it appears I have respawned where I died
is respawn selection a needed thing too?
Put atleast 1 second delay on the respawn
there is 20
Interesting
Wait a minute, I need to test something Yeah it works fine from what I can see
I do have respawn Position enabled
Okay, I have the feeling that it's picking up the body, lemme change it up real quick
setPos getPos can lead to headaches
setPosASL getPosASL
``` or ATL is cleaner
(not related to your problem though)
onPlayerRespawn.sqf
params ["_unit", "_corpse"];
if (isNull _corpse) exitWith {};
player setUnitLoadout (getUnitLoadout _corpse);
_primaryWeapon = _corpse getVariable ["Hmch_Saved_primWeapon",["",[""],[""]]];
_secondaryWeapon = _corpse getVariable ["Hmch_Saved_secWeapon",["",[""]]];
player addWeapon (_primaryWeapon select 0);
player addWeapon (_secondaryWeapon select 0);
{
player addPrimaryWeaponItem _x;
} forEach (_primaryWeapon select 1);
{
player addPrimaryWeaponItem _x;
} forEach (_primaryWeapon select 2);
player addSecondaryWeaponItem ((_secondaryWeapon select 1) select 0);
deleteVehicle _corpse;
//params ["_unit", "_corpse"];
//player setUnitLoadout (getUnitLoadout _corpse);
//params ["_unit", "_corpse"];
//player setUnitLoadout (_corpse getVariable ["Saved_Loadout",[]]);
//player setUnitLoadout (player getVariable ["Saved_Loadout",[]]);
player setUnitFreefallHeight 50;
params ["_newUnit", "_oldUnit", "_respawn", "_respawnDelay"];
switch (typeOf player) do {
case "G_Survivor": {
_teammate = nearestObject [_oldUnit, "G_Survivor"];
player setPos (getPos _teammate);
};
case "G_Pilot": {
// Do Nothing
};
default { };
};
yeah just bugging you to save some potential trouble
I have a script that restores player loadout by taking the things from when they died and the gun from their body then removing the body
so something thats body-dependent has a good chance of not working
Ah yes I forgot How horrendous these commands are, makes you wonder why despite being named similar they aren't meant to be used together
First off you have params twice, you can simply remove the params line I gave you and replace _oldUnit with _corpse
Okay that was quite the annoyance, Probably not the most clean solution.
Replace the inside of the "G_Surivivor" case with this, unless I have made a mistake this should do the job, I did test it
if !(_corpse isEqualTo objNull) then {
_nearPlayers = nearestObjects [_corpse, ["G_Survivor"], 500, true];
_teammates = _nearPlayers select {alive _x && _x != player};
player setPosASL (getPosASL (_teammates select 0));
};
I would also move the deleteVehicle _corpse to beneath the Switch
Alright
I put deleteVehicle _corpse; last in the file
That way the Corpse will exist long enough to get the teammates from it
It will work for AI teammates too
-_-
as in I respawned without TP to teammate
there is an AI squadmate
params ["_unit", "_corpse"];
if (isNull _corpse) exitWith {};
player setUnitLoadout (getUnitLoadout _corpse);
_primaryWeapon = _corpse getVariable ["Hmch_Saved_primWeapon",["",[""],[""]]];
_secondaryWeapon = _corpse getVariable ["Hmch_Saved_secWeapon",["",[""]]];
player addWeapon (_primaryWeapon select 0);
player addWeapon (_secondaryWeapon select 0);
{
player addPrimaryWeaponItem _x;
} forEach (_primaryWeapon select 1);
{
player addPrimaryWeaponItem _x;
} forEach (_primaryWeapon select 2);
player addSecondaryWeaponItem ((_secondaryWeapon select 1) select 0);
//params ["_unit", "_corpse"];
//player setUnitLoadout (getUnitLoadout _corpse);
//params ["_unit", "_corpse"];
//player setUnitLoadout (_corpse getVariable ["Saved_Loadout",[]]);
//player setUnitLoadout (player getVariable ["Saved_Loadout",[]]);
player setUnitFreefallHeight 50;
if !(_corpse isEqualTo objNull) then {
_nearPlayers = nearestObjects [_corpse, ["G_Survivor"], 500, true];
_teammates = _nearPlayers select {alive _x && _x != player};
player setPosASL (getPosASL (_teammates select 0));
};
deleteVehicle _corpse;```
here is the whole file
if there are any obvius issues
then it must be the if
I dont think its another script
onPlayerKilled.sqf
params ["_oldUnit", "_killer", "_respawn", "_respawnDelay"];
_primaryWeapon = [primaryWeapon player, primaryWeaponItems player, primaryWeaponMagazine player];
_secondaryWeapon = [secondaryWeapon player, secondaryWeaponMagazine player];
player setVariable ["Hmch_Saved_primWeapon",_primaryWeapon];
player setVariable ["Hmch_Saved_secWeapon",_secondaryWeapon];```
Well I just tested it again, and It works here
I am unsure what could be causing it
The If just checks if the corpse exists, if it does then look for the teammates using it's position
just BTW: are you only saving primary/secondary weapon on purpose?
I made it with big help from people here
it worked, and I payed it no mind thereafter
its made that way due to a mod that makes it dificult to save loadout on death
since its revive state removes weapon mags
you could getUnitLoadout player then player setUnitLoadout loadout.
We save it when players exit arsenal or base.
I want it to save when dying or just before
its a survival op
there is no prep phase
oh okay
getUnitLoadout _oldUnit
Regardless, is that what would cause the issues?
No, not at all
also, what if you try if !(_corpse isEqualTo objNull) exitWith {
That is also buggy
https://community.bistudio.com/wiki/setUnitLoadout
" Empty or used magazines in loadouts will be refilled under specific circumstance, even if the refill argument is false. This seems to happen if amount of used magazines is 2 or more. "!
uhh, yeah for us its not an issue. But it could be for survival type ops
In my version I also delete the corpse at the end to see if it would stop the teleporting, No dice
here is the help I got on that script for respawn save
I could try to remove that part
or make it into a comment so I can undo it if need be
as I tend to
Also, this script of yours, if corpse is null to begin with, whole script wouldnt execute
you wont get teleported to teammate in any case
cause line 2 if (isNull _corpse) exitWith {};
It returns false upon death
It just helps you avoid any issues with respawnOnStart
Since in that case your Corpse wouldn't exist since you haven't died yet
what if GC, gcs it?
I mean potentially but that is a very specific and rare case I would say
idk rearranged, but it doesnt handle first spawn... soDontUseIT
He wants to teleport though
teleport what?
Certain Players he wants to teleport
god dang nang it
Move the Else into the main and remove the Else all together
at the start teleporting is no issue if thats a question
just respawn
tho I think ive made that clear
ye
The If statement I made was because I was testing with respawning at start, It shouldn't have made any difference for you
I still don't understand why it's failing to teleport I can confirm it works in a vacuum at least, the only difference is I used a different Classname
So unless the className is wrong I don't understand why it's not working
So if i understood correctly this whole process:
- First spawn: spawn on original position, dont alter gear
Respawn spawn on corpse if available, restore gear from corpse and remove corpse- Respawn on nearest player. Restore gear from corpse.
Always respawn on Teammates in the case of the player being of "G_Survivor" Class
idk why it would respawn on corpse but ig?
ah. gotcha
"G_Survivor" Class or part of the group with "G_Survivor" as its variable?
idk maybe that just is the class
is G_Survivor the className or the Variable Name?
well It couldn't be variable because each player would have to be different I suppose
Oh my god
Lol
amm, why not just get random groupman?
He has two sub groups within that group and he wants them to join back with their own sub Group
So we can't use the group as a whole
hold your hourses
B_Soldier_unarmed_F
I want it to respawn the player on the nearest teammate to where they died
that is always one of the people within that "sub group"
OPTRE_UNSC_Marine_Soldier_Unarmed (Player_1)
OPTRE_UNSC_Marine_Soldier_Unarmed
thats the class ๐
Put that instead of "G_Survivor" and it should function
unless every single one is different class.
I thought only the variable names mattered ยฏ_(ใ)_/ยฏ
I hope not
nah
Also do that inside the SCRIPT not the group variable name
Man here I was thinking G_Survivor was a class
what matters depends on what you are doing.
In this case he was searching for nearest unit by class, that means class is needed ๐
ah
I mean it looked like one to me so I just assumed it was XD
I thought one could just search for nearest unit by side or something
Many ways to skin a cat
Since there are no allied troops in this mission outside of the HQ itself
My solution isn't the best but I think it works better than just finding the closest blufor, since that could potentially be the other group and the Pilot
I thunk you had some modded unit G_survivor, cause (I/O/B)_Survivor_F are valid
sooo
what happens if they get squad wiped
?
Well It would find the closest of that class within 500 at least with my numbers
I have not yet accounted for that I do admit and I would hope that they respawn on body pos or something so I can manually sole that
in zeus
it can be further than that
2000m
You can change it as much as you want, I just used 500 for my test
well script would error out. and idk what your default respawn setting is
custom position
its fine
actually no, youd be sent to [0,0,0]
I dont expect a group of mostly scattered people to get wiped together. even If they do I will take responsibility and TP them back
at that point me as mission maker can be blamed
if i would zeus that, id just hint "Get rekt, git gud" and leave them to swim to main land
you do you
I didnt prep my boys for a titanic op
Now back to what I need to actually change
if !(_corpse isEqualTo objNull) then {
_nearPlayers = nearestObjects [_corpse, ["G_Survivor"], 500, true];
_teammates = _nearPlayers select {alive _x && _x != player};
player setPosASL (getPosASL (_teammates select 0));
};
deleteVehicle _corpse;```
if I replace `G_Survivor` with `OPTRE_UNSC_Marine_Soldier_Unarmed` it should work right?
I'd imagine so
If it doesn't I will cry
which I had not done before
great! you will test squad wipe scenario
here I am with dancing bob
lets try it out
YES
it worked
(picked up some clothes to test that too)
now im going to kill him
I don't think AI respawn
oh no, not the dancing bob
Oh yeah
so I will kill him and see where I end up
dementia
I ended up in the backrooms
as I call it
it was the old respawn hub
if you go through the green blob you end up on the beach near the spawn
unless you are pilot in which case you end up at base
or not, but, thats my problem
Thank you gentelmen
FSM is best used for statemachines
Well this is going to sound dumb but its a machine that runs through States, Its mostly used for AI, I believe googling it will do a far better job at explaining it
Hmm well the only real one I have is a small attempt at making an AI that tries to capture zones, But you could also use it for Dialogue
This is the only example I have on hand, It ain't much but it's honest work
Scenario Flow is another use for it as well
Basically anything that can go through multiple states
Yeah that is one way to use it, I would use it for anything that can branch off several times at several points
good example is AI decision making
Im going to try and make AI Dialogue using it tomorrow, just for fun points
Does anyone still use sqs?
Its effectively deprecated for Arma 3
sometimes
Does it actually have any benefits?
just like Batch
If you really like one-liners its the script language for you
Why im asking is
can be used for scripts but not for functions
Does that just mean you cant define funcs in there? Or?
it just means that CfgFunctions takes SQF or FSM, nothing else
private _myFunc = { hint _this }
~1
"Hello there" call _myFunc
```works in SQS
no, I am currently lying to you
Umm ext=".fsm"...
missionFlow.fsm iirc is a thing, and is called every mission start - same as init.sqf, you can have yours in a mission dir
You still have to prefix it with fn_ correct?
nope - memory served me correct, see https://community.bistudio.com/wiki/BIS_fnc_missionFlow
How do you call fsms later in mission? If they are defined in cfgfunctions. doFsm or execFsm both seem to take file paths? Do you simply spawn it like [arg] spawn TAG_fnc_myfsm?
@nimble hill that's not the correct escapes. That'll throw an error. Should be like call compile " ""end1"" call bis... ";
I've sinned.
Mass converting bis_fnc_MP to remoteExec, I wonder what will break :s
you dont have to prefix anything with fn_, i didnt for the first year of making scripts and shit
i do
Oh...
i just prefix with fn_ for readability now
i macro it
Still seems like a waste of bytes if system does it for you.
Well i have mine organised as per wiki and works fine.
I only use file to specify folder if within mod.
I assumed fn_ was required
because on multiple cases it failed to load without it
I just use it as gospel because setting file for every single Func is hilariously inefficient
Not if you do class myFunc {file="asdf.sqf"};
But i agree its a bit redundant.
i have functions folder with them in
file= just dislikes me
(Its user error im just lazy)
There is no wrong way of doing it, just personal preference.
But for folders i use
class myTag/myCategory
{
file="myFolder"
//functions (without file, fn prefixed)
};
Yeah I use that pretty frequently
That's the best way imo
In mission setting you dont even need file folder if your folder has same name as category
But still how does one exec fsms defined in cfgFunctions?
Simply calling it?
Well fsms can't be called (unless the fsm gets compiled into sqf, and afaik it does but I've never seen a dedicated command that does it)
Last I checked there's only execFSM
Those take paths to file, at least according to wiki
I know
Then there is that ^ and call is used here
So what would be the purpose of defining fsm in cfg functions, besides auto init?
#define QUOTE(var1) #var1
#define MACRO_FUNCPATH(FUNCNAME) KJW_CapitalShips\functions\fn_##FUNCNAME
#define MACRO_FUNCTION(FUNCTIONNAME) class FUNCTIONNAME {\
file = QUOTE(MACRO_FUNCPATH(FUNCTIONNAME).sqf);\
};```
is just what i use
Eww. But i understand
I'm not sure if there is a use for it really
not having to bother with precisely getting my config just how arma wants it
although I see a couple FSM commands that don't specify filepath rather just the name like these.
https://community.bistudio.com/wiki/commandFSM
https://community.bistudio.com/wiki/doFSM
Not sure if these are correlated though or if it's just outdated
commandFSM says fsmFile as param.
And doFSM says fsmName as param, but examples show its a file.fsm
Ill try calling one later and see what occurs
Mostlikely error...
I'm betting on it just being outdated and it does require a path
Yup It's file path
Just tested it
crazy person
Then ping lou to fix it.
I'm at my ends wits with this one. I have barricades where i add an event "Explosion". This works locally but then when i try on my dedicated server the event does not get triggered.
Here is the code for the event that triggers on all clients according to the documentation.
addBarricadeHitEventHandler = {
getMissionLayerEntities "Barricades" params ["_barricades", "_markers"];
diag_log format ["Barricades: %1", _barricades];
{
_x addEventHandler ["Explosion", {
params ["_vehicle", "_damage", "_source"];
diag_log "Explosion";
_explosiveTypes = ["gm_explosive_charge_petn","gm_explosive_charge_plnp"];
[getPosATL _vehicle, 10] remoteExec ["fnc_huntGroup",2];
if(typeOf _source in _explosiveTypes) then {
[_vehicle] remoteExec ["deleteVehicle", 2];
deleteVehicle _vehicle;
}
}];
diag_log format ["Barricade: %1", _x];
} forEach _barricades;
};
Here are the logs of the server. There is a lack of explosion in it.
11:15:53 "Barricades: [7f259aa16800# 1928666: barricade_01_10m_f.p3d,7f259c89a000# 1928667: barricade_01_10m_f.p3d,7f259aa17000# 1928668: barricade_01_10m_f.p3d,7f259aa17800# 1928669: barricade_01_10m_f.p3d]"
11:15:53 "Barricade: 7f259aa16800# 1928666: barricade_01_10m_f.p3d"
11:15:53 "Barricade: 7f259c89a000# 1928667: barricade_01_10m_f.p3d"
11:15:53 "Barricade: 7f259aa17000# 1928668: barricade_01_10m_f.p3d"
11:15:53 "Barricade: 7f259aa17800# 1928669: barricade_01_10m_f.p3d"
but will only fire on the PC where EH is added and explosion is local
In your case will only fire on server
Here is the code for the event that triggers on all clients according to the documentation.
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Explosion
It can be assigned to a remote unit or vehicle but will only fire on the PC where EH is added and explosion is local, i.e. it really needs to be added on every PC and JIP and will fire only where the explosion is originated.
No need to post all that log
EHs only trigger where the object is local
Add event handler on all clients+server, then remoteexec the content
So the code is executed on every client. But the barricade is only on the server? So the explosion triggered by a client doesn't trigger because the barricade is* on the server?
The event handler runs on every client, but according to wiki, only the client that created explosion will report it
Ok i think i get it know. IF i look in my local logs. It can't find any barricades.
So how do i add a local event to a remote object?
Also you see in the wiki you see GA on top, that doesnt mean global effect, but global argument.
Just add eh on every client+ server. One of them will fire it, when explosion occurs
It doesn't otherwise i wouldn't be here.
Like none? At all?
The real question is where do you call that function?
Like i show in the logs. The event doesn't trigger in the client because no barricades can't be found. And because the explosion has to be local before it triggers it doesn't trigger on the server although it got added there.
Log doesnt show not found
Is there anyway to write a script that forces a certain ammunition on a class of vic's ( I m having problems with setting some default ammunition for rhs tanks to spawn with ) I have looked in the wiki and experimented with some stuff but none if it worked
How do you even call function above, and where?
Ah reason: getMissionLayerEntities only does on server. Clients dont get such info
So one way would be to remote exec your function from server to all, passing barricades as params
have you investigated https://community.bistudio.com/wiki/addMagazineTurret?
Eg ```if (isServer) then {[getMissionLayerEntities "Barricades"] remoteExec ["addBarricadeHitEventHandler"];};
//addBarricadeHitEventHandler
params ["_barricades"];
//rest of your code```
I did however it doesn't always apply to the vic
The Arguments need to be local so you either need to own the vehicle or execute the command where the vehicle is local.
One example would be to get the Owner of said Vehicle and execute it on them.
_ownerID = owner _vehicle;
[_vehicle, [magazineName, turretPath, ammoCount]] remoteExec ["addMagazineTurret", _ownerID];
I'm thinking about just doing
private _barricades = nearestObjects [getMarkerPos "AOmarker", ["Land_Barricade_01_10m_F"], 1000];
Whatever floats your boat, i just gave you an example if you wanna use layer.
Something I never understood was using private, isn't that the same as using _ on your variables?
private _lol=1;
while {something} do {
private _lol = 2;};
hint str _lol;
``` maaaybe
I can't say I can think of many uses where I would need to use private it seems to just mean that lower scopes can't read what it was higher up
Maybe I'm just too stupid for it
ยฏ_(ใ)_/ยฏ
Idk what purpose it would serve within the scope of the function, but i just roll with it.
The Wiki states that Params more or less serves the same purpose so to me it just seems like a round about way of declaring a variable
Well params has other uses
Like [1,2,3] params ["_v1", "_v2", "_v3"]; instead of _v1 = [1,2,3] # 0
That's super handy, I forgot you could use params like that
At the start of the function it does the same. So you dont have to use _this select 0 for first param etc.
Yeah I already use it in Functions and Spawns
I got it to work with the getMissionLayerEntities .๐
Awesome
[(getMissionLayerEntities "Barricades")#0] remoteExec ["addBarricadeHitEventHandler",0,true];
that's precisely the usage yes
it prevents called functions to interfere with the higher scope's variables
basically, whenever you define a variable, use private
Sooo like this ```sqf
Asdf = {_lol = 2;};
_lol = 1;
call Asdf;
hint str _lol;
That would still hint 1 i believe, even if no private was used?
Or can lol somehow escape scope of the function?
It hints 2 like that
Asdf = {private _lol = 2;};
_lol = 1;
call Asdf;
hint str _lol;
Hints 1
it makes run the code faster acording to https://community.bistudio.com/wiki/Code_Optimisation#private
Why use private of any sort in aboce case is the question?
Like instead of private _a = 1; just _a=1;
Because called code can change local Variables in the Parent script too if it isn't privated
Ah. Nvm misread your test result.
Yeah I can see it's use case now
i guess is a safty measure, being sure that _a its what i want to be and nothing else in this scope.
_myvar = 123;
systemChat str [_myvar]; //ย [123]
call {
systemChat str [_myvar]; //ย [123]
private "_myvar";
systemChat str [_myvar]; //ย [any]
_myvar = 345;
systemChat str [_myvar]; //ย [345]
};
systemChat str [_myvar]; //ย [123]
now... what happen if i do private _this = _this 
I think _this is defined before your code starts running within the function. So it wouldnt change
It would just be private "_this" potentially
But even then in any scope I feel like it would be overwritten by the Engine because it's reserved
It would let you mitigate any potential issues with reusing certain variable names that aren't defined by Params
for example _count or some variation of _unit that isn't directly apart of your initial params but is also used in the parent scope that called the code in the first place
private does not make code run faster no
It ran faster simply because the scope didn't need to create nor destroy the definitions
everything, throw it away :D
anyone mind helping me with something real quick? Trying to set up a respawn on an OPTRE corvette for an event on my server, but players spawn under it in a parachute for some reason
player setUnitFreefallHeight 1000; in an onplayerrespawn.sqf. failing that,
use an onplayerrespawn.sqf to move them to the correct position or spawn them into crypo pods
how do I make cryo pods respawns?
ah, many thanks
so im trying to force all ai units to stand at all times instead of going prone when they come into contact, I tried the following simple code but they didnt seem to care. Any better suggestions?
{
// Current result is saved in variable _x
_x setUnitPos "UP";
} forEach (allUnits);
this is in the init.sqf btw
singleplayer mission?
try adding a little sleep 0.1; before it
Anyone able to help with this, its a missdrop script, but it only works for one player when called upon
_aircraft = _this; _aircraftPassengers = assignedCargo _aircraft; _aircraft setDamage 0.5; _aircraft setFuel 0; { moveOut _x; _xCordNum = [-400,400] call BIS_fnc_randomNum; _zCordNum = [-400,400] call BIS_fnc_randomNum; _yCordNum = [1,15] call BIS_fnc_randomNum; _currentPos = position _x; _xCordPos = _currentPos select 0; _zCordPos = _currentPos select 1; _yCordPos = _currentPos select 2; _xDropCord = _xCordNum + _xCordPos; _zDropCord = _zCordNum + _zCordPos; _yDropCord = _yCordNum + _yCordPos - 30; _x setPos [_xDropCord,_zDropCord,_yDropCord]; _x action ["OpenParachute", _x]; _unconTime = [4,12] call BIS_fnc_randomInt; [_x, true, _unconTime, true] call ace_medical_fnc_setUnconscious; } forEach _aircraftPassengers;
multiplayer
if it only works for one player, perhaps its a locality issues and you should look into something like remoteExec?
i've found even the ai avoids prone mod doesn't stop ai going prone recently tbh
make sure you run that on the server,
try the delay thing,
try using setUnitPosWeak as well
make sure you run that on the server,
it should run on all clients + the server if its in then init.sqf right?
and ill try the others now
correct
from what we have seen so far (not much use yet as server provider died and brought our server with it), I think isky's ai skill tweaks helps with that, only reason im not using it is because this is a custom mission and I dont think we need everything else it does right now
also - if you have AI mods, good luck - support here stops at vanilla
ah, yep im using lambs lol. Guess ill just need to cry about it later.
probably lambs suppression
isnt that a separate mod from them? im just using the main mod
LAMBs Danger is the main one
oh
either way they both use that command (setUnitPos)
so it conflicts with yours
basically there's no AI mod that doesn't use that command ๐
gotcha gotcha
I encountered this in a mission recently. I ended up just adding a loop that does setUnitPos on all relevant units every x seconds (not too fast).
As a bonus, it also catches any units that were created after mission start.
if you dont want to loop you can use the animchanged handler and catch the units that try to go prone
assuming setunitpos is getting adjusted by a mod
Hey guys, how would I get the tilt of an aircraft? Like how much it's banking left or right?
asin (vectorSide _veh # 2) would be one way...
not accurate tho
oh vectorSide is dev only rn
then vectorDir _veh vectorCrossProduct vectorUp _veh instead
https://community.bistudio.com/wiki/BIS_fnc_getPitchBank (bearing in mind the caveat mentioned there) or maybe you could try to find the animation source for its artificial horizon and read the value of that
idk what bug it's talking about but if it means what I mean then it's not a bug
what I mean is that when the vehicle has both pitch and bank it's hard to define what banking is anymore 
depending on pitch
I guess yeah it means what I mean then
Perfect, thanks guys
Yes. You add vic, and with that you also get control of each of its crew
i wonder how we can join two ladders together
so player tops out on one and connects to bottom of the next
not possible right now
unless you script the whole process
(i.e. motion is controlled by your script not engine)
Anyone know if import RscDisplayOptions as RscDisplayTest; actually works in mission config?
I can get it to just import without the as, however when I use it I just get File ..\..\file.h, line 0: /: 'a' encountered instead of ';'
I think that's for v2.14
RIP, thanks
= or setVariable?
Hey, has anyone here ever seen the error "GIAR pre stack size violation"
yeah, it's one of those where your SQF error confused the SQF interpreter so much that it fell over.
Hmm
baffling
I'm just trying to pass a thing to TFAR once everyone already has their radios
Yes, but some part of the way in which you tried to do it was highly illegal
It's usually just some kind of bracket screwup :P
switch (getnumber (configfile >> "CfgMagazines" >> currentmagazine player >> "Count" )) do {
case _x<100: {hint "SmlMag"};
case _x>100: {hint "BigMag"};
default { hint "Broken"; };
};
}];
trying to make a switch to execute code base on how many bullets a magazine has by default, but i dont want to list every number from 30 to 500 just to do something for only certain sizes in between.
private _count = ...;
switch (true) do {
case (_count > 100): {hint "bigBoi";};
...```
Would you mind looking at it?
It's got CBA/TFAR complicating it
Post it (on sqfbin if it's long) along with the full and exact error. If I can't figure it out someone else may be able to, but only if they can see the code
I need to run it in RPT mode or something to get the Full And Exact One, don't I
Please tell me you're not developing with -nologs
ok yeah found the checkbox
no, I just didn't have -debug on while putting together some casual zeus missions
If you saw the script error on screen, it should have been logged to the .rpt file in %localappdata%\Arma 3
ok, I'll check there.
Not sure if -debug helps with that one but worth a shot.
Only 'think' I had to take special care of when using remoteExec was ensuring that the function used (not command) was defined in the library. Didn't seem to like functions stored in -serverMod / filepatched + pv'ed. Result was just using one scripted function for remoteExec and using a case switch, instead of having a bunch of whitelisted remote exec functions.
ok cool I found the full error in the RPT
FULL ONPLAYERRESPAWN.SQF: sqf [{call TFAR_fnc_haveSWRadio}, { TFAR_currentUnit = call TFAR_fnc_currentUnit; // so it also works for Zeus private _tf1 = TFAR_currentUnit getVariable ["tfar_t1", false]; private _tf2 = TFAR_currentUnit getVariable ["tfar_t2", false]; [(call TFAR_fnc_ActiveSWRadio), 1] call TFAR_fnc_setSwStereo; // Set primary channel to be in left ear [(call TFAR_fnc_ActiveSWRadio), 2] call TFAR_fnc_setAdditionalSwStereo; // Set additional channel to be in right ear if (_tf1) then { // set alt channel to 3, which is 71 [(call TFAR_fnc_activeSwRadio), 3] call TFAR_fnc_setAdditionalSwChannel; } if (_tf2) then { // set alt channel to 4, which is 72 [(call TFAR_fnc_activeSwRadio), 4] call TFAR_fnc_setAdditionalSwChannel; } if (!_tf2 && !_tf2) { systemChat "Aaaaa you're not in a squad aaaaaaaaaaaaaaaaaaaaaagh"; } }, [] ] call CBA_fnc_waitUntilAndExecute;
RESULTING ERROR: ```sqf
22:09:55 [ACE] (common) INFO: Extension version: ace_fcs: 3.8.4-ef4d289
22:09:55 CallExtension loaded: ace_advanced_ballistics (D:\SteamLibrary\steamapps\common\Arma 3!Workshop@ace\ace_advanced_ballistics_x64.dll) [3.12.0-8ddde18]
22:09:55 [ACE] (common) INFO: Extension version: ace_advanced_ballistics: 3.12.0-8ddde18
22:09:55 [ACE] (nametags) INFO: TFAR Detected.
22:09:55 [CBA] (xeh) INFO: [12921,458.879,0] PostInit finished.
22:09:56 [ACE] (common) INFO: Settings initialized.
22:09:56 [ACE] (common) INFO: 14 delayed functions running.
22:09:56 Error: Cannot create custom post effect(type: 5), PE with same priority(400) already exist.
22:09:56 Post process effect creation failed
22:09:56 [Crows Zeus Additions]: Zeus initialization complete. Zeus Enhanced detected.
22:09:56 Fresnel k must be >0, given n=1.4,k=0
22:09:56 โฅ Context: #(ai,64,64,1)fresnel(1.4,0.0)
22:09:57 CallExtension loaded: task_force_radio_pipe (D:\SteamLibrary\steamapps\common\Arma 3!Workshop@Task Force Arrowhead Radio (BETA!!!)\task_force_radio_pipe_x64.dll) [ย฿ฌ]
22:09:57 Mission id: f1bb3ec4ba2a23a18d0d8bc1dc0b4f6f05113413
22:09:57 Error in expression <all TFAR_fnc_setAdditionalSwChannel;
}
if (_tf2) then {
[(call TFAR_fnc_active>
22:09:57 Error position: <if (_tf2) then {
[(call TFAR_fnc_active>
22:09:57 Error Missing ;
22:09:57 File C:\Users\Black\Documents\Arma 3\mpmissions\00-TrainingRange.VR\onPlayerRespawn.sqf..., line 12
22:09:57 โฅ Context: [] L35 (/temp/bin/A3/Functions_F/Respawn/fn_initRespawn.sqf)
[] L197 (/temp/bin/A3/Functions_F/Respawn/fn_selectRespawnTemplate.sqf)
22:09:57 Error in expression <all TFAR_fnc_setAdditionalSwChannel;
}
if (_tf2) then {
[(call TFAR_fnc_active>
22:09:57 Error position: <if (_tf2) then {
[(call TFAR_fnc_active>
22:09:57 Error Missing ;
22:09:57 File C:\Users\Black\Documents\Arma 3\mpmissions\00-TrainingRange.VR\onPlayerRespawn.sqf..., line 12
22:09:57 โฅ Context: [] L35 (/temp/bin/A3/Functions_F/Respawn/fn_initRespawn.sqf)
[] L197 (/temp/bin/A3/Functions_F/Respawn/fn_selectRespawnTemplate.sqf)
22:09:57 Error in expression <all TFAR_fnc_setAdditionalSwChannel;
}
if (_tf2) then {
[(call TFAR_fnc_active>
22:09:57 Error position: <if (_tf2) then {
[(call TFAR_fnc_active>
22:09:57 Error Missing ;
22:09:57 File C:\Users\Black\Documents\Arma 3\mpmissions\00-TrainingRange.VR\onPlayerRespawn.sqf..., line 12
22:09:57 โฅ Context: [] L35 (/temp/bin/A3/Functions_F/Respawn/fn_initRespawn.sqf)
[] L197 (/temp/bin/A3/Functions_F/Respawn/fn_selectRespawnTemplate.sqf)
22:09:57 Error in expression <all TFAR_fnc_setAdditionalSwChannel;
}
if (_tf2) then {
[(call TFAR_fnc_active>
22:09:57 Error position: <if (_tf2) then {
[(call TFAR_fnc_active>
22:09:57 Error Missing ;
22:09:57 File C:\Users\Black\Documents\Arma 3\mpmissions\00-TrainingRange.VR\onPlayerRespawn.sqf..., line 12
22:09:57 โฅ Context: [] L35 (/temp/bin/A3/Functions_F/Respawn/fn_initRespawn.sqf)
[] L197 (/temp/bin/A3/Functions_F/Respawn/fn_selectRespawnTemplate.sqf)
22:09:57 Error in expression <-TrainingRange.VR\onPlayerRespawn.sqf"
[{call TFAR_fnc_haveSWRadio},
{
TFAR_cur>
22:09:57 Error position: <[{call TFAR_fnc_haveSWRadio},
{
TFAR_cur>
22:09:57 Error GIAR pre stack size violation
22:09:57 File C:\Users\Black\Documents\Arma 3\mpmissions\00-TrainingRange.VR\onPlayerRespawn.sqf..., line 2
22:09:57 โฅ Context: [] L2 (C:\Users\Black\Documents\Arma 3\mpmissions\00-TrainingRange.VR\onPlayerRespawn.sqf)
22:10:03 ["TFAR_SendRadioRequest",["TFAR_anprc152"],0.031,5.045]
22:10:03 "TFAR_RadioRequestEvent [[""TFAR_anprc152""],gm_player] 466.476"
22:10:03 "Send TFAR_RadioRequestResponseEvent [1] 466.477"
22:10:03 ["TFAR_ReceiveRadioRequestResponse",[1]]
You're missing a then
...is that all??
I don't think it works even without the third if-statement
but I'll check
Nah, few semicolons too.
ok so do you need a semicolon after every if()then{}; ?
I'm being confused by having scripted in like 3 other languages
You need a semicolon after every close bracket that's not immediately followed by another close bracket.
Config is different syntax.
(NOT the ones that are enclosing code types in arrays)
If (!_tf2 && !_tf2) then {
...
}
Missing too ; and is there reason why check same 2 timez
so later I would replace that with a Switch statement
but I'll be similarly careful with ; on the switching statement
that did fix it I think tho
This specific one does not require a ; (although it won't hurt) because it's immediately followed by another }
and yeah, commas are fine too :P
I'm so used to stuff like C# where you don't ; after }
It's kinda odd in SQF because { } actually declares a code data type.
it hwat
; in SQF is not specifically related to }, it just means "end of this instruction, next bit is separate". } usually has one because it's usually at the end of an instruction, but not always
Aa, true. Sqf.
Hokay I'm gonna give this a try.
[{call TFAR_fnc_haveSWRadio},
{
TFAR_currentUnit = call TFAR_fnc_currentUnit; // so it also works for Zeus
private _tf = TFAR_currentUnit getVariable ["tfar_squad", 0];
[(call TFAR_fnc_ActiveSWRadio), 1] call TFAR_fnc_setSwStereo; // Set primary channel to be in left ear
[(call TFAR_fnc_ActiveSWRadio), 2] call TFAR_fnc_setAdditionalSwStereo; // Set additional channel to be in right ear
switch (_tf) do {
case 0: {systemChat "You are Zeus or some other #0 person, setting your alt to 73"};
case 1: {systemchat "Radio configured for Fireteam 1 (Alt=70)";
[(call TFAR_fnc_activeSwRadio), 1] call TFAR_fnc_setAdditionalSwChannel; };
case 2: {systemchat "Radio configured for Fireteam 2 (Alt=71)";
[(call TFAR_fnc_activeSwRadio), 2] call TFAR_fnc_setAdditionalSwChannel; };
default: { systemchat "You aren't in a recognized squad, so I didn't set your additional channel."};
};
},
[]
] call CBA_fnc_waitUntilAndExecute;```
In most languages } is an implicit end-of-expression because they don't have the form { } command
default syntax is wrong, shouldn't have a colon.
A Code data type is kind of like a string, but for code. It says "don't process this yet in the immediate context, just collect it in its entirety ready to use". That's why it's used for the switch cases, for example - it lets the code exist without being actually executed unless the case is chosen.
(Sometimes it is then immediately executed in the current context, by the command you feed it to, but you can save it for later as well)
anyone know how to fix disapearing slots?
because on a hosted game it works, but as soon as I put the mission in my server they do a dissapearing act
You mean all?
found the offender, friggin ;
Any idea of what to put into a trigger's activation field to set all the groups in it to be Aware, when by default they're careless?
Would {_x setBehaviourStrong "AWARE";} forEach thisList do it?
NVM, THEY STIL GONE REEEEEEEEEEEEEE
yes
whats your respawn settings in description
Are you sure is not a Modded Unit's iffy?
None, I have it on respawn on custom positions, select respawn location and synced the respawn module to a cryopod (OPTRE, counts as vehicle)
If I test it in LAN it works no problem
It works in LAN, that's the wierd part
Yes, I tripple checked, found a wrongly placed ; then tried again, slots still gone
Can you post your server rpt nonetheless?
Ye, you mean the @prime jayd thingy right?
The what?
Arma generates a .rpt log file each time it's run, which contains a lot of information like the loaded mods, or any errors that appear, this log file can be very useful for troubleshooting problems.
To get to your RPT files press Windows+R and enter %localappdata%/Arma 3
Additionally see the wiki page for more info: https://community.bistudio.com/wiki/Crash_Files
To share an rpt log here, please use a website like https://sqfbin.com/ to upload the full log, that way the people helping you can take a look at it and try to figure out the problem you're having together with you.
Note: RPT logs can hold personal information relevant to your system, the game or others.
can't find it in my server, there is configstore, connection logs, content log and stats_log, I am in vc, may be easier if I screenshare
I DMed you some questions btw
Disappearing slots sounds a lot like mod mismatch, particularly if they're all disappearing.
Serms to be a corruptef file on the server... Trying to upload mission to workshop to see if itworks
does anyone know how to get a jet to target another jet, then land itself after shooting down the target?
actually i know how to do the 2nd part
but i dont know how to do the first
nvm i think i got it
I wish there was some way to make a helicopter tougher but not invincible
without a mod
You indeed simply call fsms, if anyone cares. Just like a normal function. [Args] call Tag_fnc_myFsm;
You can do so with:
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HandleDamage
Like have a variable heliHealth=10000; and while heliHealth>0 just return 0 in above mentioned handleDamage EH.
Just make sure your EH is last
I gotta figure out how this works in the morning, the wiki has no examples...
good thing documentation words explain how it works ๐
this addEventHandler ["HandleDamage", {
params ["", "", "_damage"];
0.5 * _damage
}]
actually you need to use the current damage ๐
this addEventHandler ["HandleDamage", {
params ["_unit", "", "_damage", "", "", "_hitIndex"];
private _currentDmg = if (_hitIndex < 0) then {damage _unit} else {_unit getHitIndex _hitIndex};
private _takenDmg = _damage - _currentDmg;
_currentDmg + _takenDmg * 0.5;
}];
the above code will halve the damage you take
Will that work on a vehicle?
yes
Do you still need to return _damage at the end, or am I recalling a fever dream?
Or i guess _currentDmg in the above case
Ah, I see now.
I learnt a fun lesson in scripting. If you have to use remoteExec to play sounds and run a script, use them differently.
Had a script that played sounds and also spawned 2 explosions - so to make sure the sounds would work for all 9 players on the server, I used 0 for the 'targets' to execute it on every device.
Now imagine my surprise when 18 explosions spawned instead of 2, before I realised that I had made a serious fuck-up
Of course, this never appeared in my testing - because I was the only one on the server
Or you can, within same script
Obj playSound ...;
if (isServer) then
{
//spawn explodar
};
```and remoteExec it with 0
Sometimes the easiest answer to locality is 'screw it, YOU figure it out if youre so clever'
I might have to start doing that as failsafes, because I will make this mistake again
Also good for anything you put in an objects Init field, since that gets run every time someone connects (iirc)
Objects init field is good for addActions, since you dont have to do it manually for everyone
getPosATL measures from model 'feet", getPosWorld from some model point. How do I get delta between those? Considering there is no chance that terrain underneath is at ASL 0
quick and dumb question
why?
no.
the wiki really didnt give much for examples
getPosWorld player vectorDiff getPosATL player;
I would say
I just want the new vic to respawn without ammo
where is the "Vehicle Respawn" doc?
then it would be 0
passed arguments
means_this
I'm... not sure what that supposed to do since vectorDir works with objects rather than positions.
I also stumbled upon
https://community.bistudio.com/wiki/getModelInfo
Do you happen to know what 'Placing point' is? Is that what I'm looking for?
I meant vectorDiff sorry
muscle memory