#arma3_scripting
1 messages · Page 541 of 1
How can I allow the camera created with the camCreate to move around with the mouse cursor?
thanks, i fix it @young current
u can't i think, only doing a script with an eventhandler @astral tendon
class UTF {
tag = "UTF";
class functions {
file = "functions";
class InsigniaProvider {};
class A3LogExamples {};
};
};
Does anything seem amiss with this functions.hpp?
I have fn_InsigniaProvider.sqf and fn_A3LogExamples within the functions directory
Though VS Code says the functions cannot be found
And I get "fn_InsigniaProvider.sqf not found" in game
└───scripts
│ #readme.md
│ functions.hpp
│
├───EXT
│ └───IgiLoad
│ │ IgiLoad.sqf
│ │ IgiLoadInit.sqf
│ │ supported.txt
│
├───UTF
│ └───CheckJIP
│ │ checkJIP.sqf
│
├───Functions
│ fn_A3Examples.sqf
│ fn_InsigniaProvider.sqf
I use fn_ in the filename
Its a mission
scripts\functions should be the path then
Try that.
Giving it a go
So far I know it always starts at mission's root
Awesome, was looking for that thanks
Hi all. How to ignore this restriction?
Attempt to override final function
I want to override functions with debug console which was be declared in CfgFunctions.
allowRecompile = 1; in your description.ext
You can't ignore it because it's a security feature from preventing the function from being hijacked.
can't remember if it was allowrecompile or allowfunctionrecompile
Yes, thank you.
this newbie have a few dumb question to professional. :/
the addon and mod is same thing?
seriously i cant understand about the difference between them.
a mod is, let's say a whole lot of addons in order to make a full game modification ( = mod)
an addon is "just" a file with content in it
oh so addon is something like parts of the mod?
it's new knowledge to me, thank you for the answer
1 addon could be a mod or 10 addons
I have this in init in an object:
{ _x addEventHandler ["Killed", {null = [_x] execVM "death_sounds\player_ded.sqf";}]; } forEach allUnits;
and this in my addon:
stype = floor(random[1,18,38]);
music = format ["death_sounds\deathsound_%1.wav", stype];
_aslPos = getPosASL _PO;
playSound3D[music, _PO, false, _aslPos];```
And I get an exception that _PO is undefined...
Why does it happen?
_x is undefined
you are passing a undefined variable, thus _PO is also undefined
local variables carry over into lower scopes
but you don't have a scope there. you are creating a new script
But isn't _x the object in forEach loop?
Even if it is undefined, then how does it successfully add event handler?
So how would I fix it?
_x addEventHandler ["Killed",
{
params ["_unit"];
null = [_unit] execVM "death_sounds\player_ded.sqf";
}];
} forEach allUnits;```
```sqf too
What you have all units screaming when a unit is killed?
Well why not,but why do null=?
no reason to
habit from init / trigger fields
Would prefer _dummy instead, 1. it is local 2. it removes any questions "why null"
some do 0 = (…)
@tough abyss I am not 100% sure but I think these fields throw an error if you use local vars too =\
Yeah in init yes. Stupid just like not allowing return value stupid
There is no reason for either by the way
that's what I think too
historic code… never changed
Arma wouldn’t be Arma if not for little surprises like these
just use _ = ... shortest you can type and it's local.
I think these fields throw an error if you use local vars
Yeah you can also have variable with name ""
a = ^^
I could fix the = returning nothing bug. And maybe allow for things like
var1 = var2 = 5;
But... That means you couldn't write any code in init boxes anymore.. so you're not gonna get that fix
I would gladly sacrifice init boxes for that 😄
Hi guys!
im trying to add the ACE action to make an object able to be loaded in ace cargo.
The object is the type of dog with a custom variable name of klt_dog
[klt_dog, 1] call ace_cargo_fnc_setSize;
I tried using this function that do give me the ACE interaction to load the object, however when I load the object into a vehicle the object does not dissapear,
and i get the text. "this object cannot be loaded".
any clues?
f- init boxes yep!
they simply shouldn't exist 👀
server/clients/both
none
i have a question ? how to hide a smoke create by the command "create vehicle" ?
hideObjectGlobal should do it if it's made with createVehicle
Is there away to disable colorSelectBackground. Setting the alpha to 0 hides what you have selected
You mean you wan't it so u can't see whats selected? Set it to the same value as the background? @white sky
Hi guys! Where can one find a list of such visual effects as ObjectDestructionFire1Tiny and others? Thanks!
Found one small list under the configfile >> "CfgVehicles" >> "ModuleEffectsFire_F" >> "DestructionEffects" "
@plain current Then it hides whats selected I have the background alpha set to 0 as I'm using a image for the dialog
hello again!
any better way to get a position opposite of another position instead of doing
pos1 select 0 - (pos1 select 0 - pos2 select 0)
etc etc
?
something like "pos0 getVector pos1" (not actual function)
im having an infantry group move opposite direction of a position which markes their attacking enemy. and im really to lazy to type out all the "select 0" -shit-
shoot
I would use the origin getPos [distance, heading] syntax
ahhh that looks very interesting
very nice thank you for pointing me in the right direction
can i use selectRandom to select from code? if yes how would i do that?
im trying to do something like defining function stuff somewhere and then be able to call it fast
_doThisStuff = {hint "Hello im hinting"};
_dothisstuff;
but it dont work
call _dothisstuff;```
ouuu mesmerizing. thanks
which of the following do I use to add a voice to the arsenal? Item?
BIS_fnc_addVirtualItemCargo
BIS_fnc_addVirtualMagazineCargo
BIS_fnc_addVirtualWeaponCargo```
I'd say none
well, people are complaining that they can't load their loadout because the item novoice is not included
voices(CfgVoices) are not items(CfgVehicles)
I cant unload my DLC trought steam anymore, is there other way to disable it?
So is this the update which has provided the createSimpleObject command the ability to use classname rather then shapename as a local object? Or am I too early still
it is.
but it's not a separate command
what we got is createSimpleObject for local only
nevermind I thought he wanted local, sorry too hot today.
Objects created with Syntax 2 can be textured. The default direction should match the direction of the object if it was created with createVehicle.
Whats that talking about exactly? Its 😖 me
you can only retexture if you spawn from class
not from shapename
as shapename are "super simple object" not just simple
it just says "this spawns just like createVehicle, everything is completely normal and nothing very weird and unexpected happens"
Oh, ok, fair enough 😄
whereas syntax 1 says "it's sometimes wrong"
🤣
like if you createVehicle an object, it always points northwards
but syntax 1 might spawn it pointing southwards
Sorry for the plethora of questions, can simple objects have eventhandlers added? I see it supports set/getvariable but nothing about EVH's
I'd say no
they don't get hit
so
what other EH's are there?
they don't respawn..
don't get damge
Hmm, was wondering whether I'd be able to use hit/handledamage, as maybe with BIS wizardry it works but just doesn't damage the object as such
nu
Cheers for the help 👍
Now CVL is being set off default, might aswell get using createSimpleObject
If you addEH on initPlayerLocal will it be lost if the player dies?
this addEventHandler ["ace_firedPlayer", {
params [
"_unit",
"_weapon",
"_muzzle",
"_mode",
"_ammo",
"_magazine",
"_projectile"
];}
];
Whaaaaat
Is this wrong?
that's not a valid eventhandler
Lol
Okay, I must have misunderstood how it works
Ace prefix should give plenty of clues
Like this then?
[
_unit,
_weapon,
_muzzle,
_mode,
_ammo,
_magazine,
_projectile
] call ace_firedPlayer;
Mhmm, am reading it
till the end
is there away to get the loadouts saved to my profile? kind of wat like liberation does
ah nvm
sorry
Do I always need to add event handlers, or can I just call them? Those from ACE/CBA
eventhandlers aren't called
they handle events
the bottom of the page I told you to read has examples
"Gear" with the action command don't trigger the InventoryOpened event handler. This is right?
It should
I will re-test
https://community.bistudio.com/wiki/Description.ext#unsafeCVL
https://community.bistudio.com/wiki/createVehicleLocal
Interesting point here, they're saying opposites for what the default value should be?
Just repeating the question, is there a new way to disable DLC for testing my missions with out DLC assets?
You can disable the dlcs within the steam Library
you can untick all DLC in steam but I dont know if this will work
The launcher also allows you to enable/disable DLC's (just like mods) in the DLC tab
When I put this script on a whiteboard object
And go singleplayer (or client-host multiplayer but with 1 person (only me)) then images load well.
But when I host it and someone else joins, then everyone BUT MY client has those images loaded... Why I don't have those loaded when in multiplayer?
anyone got any scripts to auto convert buildings/objects from livonia to cup cherno?
@summer trout try remoteExec'ing it
waitUntil {
_TargetThatUnitCanSee = allplayers;
_targets = [];
{if ([objNull, "VIEW"] checkVisibility [eyePos _unit, eyePos _x] >= 1 AND alive _x) then {_targets pushBack _x}} forEach _TargetThatUnitCanSee;
if ((count _targets) > 0 or (!alive _unit)) then { //error here?
_unit call VoiceCivSpotedOfficer;
true;
};
};
This script start to give error afther this DLC, its saying type any expecting bool. what happened?
Hi all.
How to localize text for each client when server do BIS_fnc_taskCreate?
[_side, format["DeliverTouristTown%1", _side], [format[localize"STR_WF_M_DeliverTouristTownDesc", _twn], localize "STR_WF_M_DeliverTouristTownTitle", "Attack"], _twnPos, "CREATED", 0, true, "Attack", true] call BIS_fnc_taskCreate; //This code localize text for a server. and all clients get text, which localized for server locale
@wanton swallow remote exec a function that will create the task locally
Hey, need a little help, I'm spawning a random object from array on a marker, I have 4 locations as coords in an array, the object spawns on a marker but I need it to be spawning on these 4 random locations.
When I was using only one object it worked fine. Not sure how I can do this code.
Here's the code I'm using to spawn a random object.
_randomSpawnBox = _boxes select floor (random (count _boxes)) createVehicle getMarkerPos "marker_2";
It spawns fine on marker_2.
I need it to be something like this but a way that will make it work :)
_randomSpawnBox = _boxes select floor (random (count _boxes)) createVehicle getPos _randomLocations;
Cheers
select floor (random (count _boxes)) no
^ yes
for random locations do the same. also selectRandom one of them
yea
so basically this
_boxes = selectRandom ["O_supplyCrate_F","Box_AAF_Uniforms_F","CargoNet_01_box_F","Land_Pallet_MilBoxes_F"];
from what I understood
var name would be private _boxClass =
private _boxClass = selectRandom ["O_supplyCrate_F","Box_AAF_Uniforms_F","CargoNet_01_box_F","Land_Pallet_MilBoxes_F"];
perfect! 👍
variable names are really important to code understanding ;-)
comments shouldn't explain how the code works, if any
they should explain why you coded this way
nice
selectRandom is far better than what I was doing 😄
thanks for that
so how do I get it to spawn on random location
_spawnBox = _boxClass createVehicle getMarkerPos "marker_2"; I have this now
works fine, it spawns randomly
the box I mean, object
depends if you have an area or a position array 😄
i have an array of coords
selectRandom at it again!
I know that part hehe
but in createVehicle
cant figure it out
_spawnBox = _boxClass createVehicle getPos _boxLocations
private _creationPosition = getMarkerPos selectRandom ["marker_1", "marker_2", "marker_3"];```
for createVehicle, check the wiki
https://community.bistudio.com/wiki/createVehicle
so now I have _creationPosition variable that selects random marker right
if you have an array of coordinates
but how do I implement that variable
then getPos on a coordinate won't make sense
Why change getAmmoCargo and other get cargo commands? They used to return infinite number in case of entity not having any ammo cargo.
Checking returned value with finite was a great and easy way to know if vehicle can rearm\refuel\repair
what they return now?
0
Logically they should return 0
so if not getPos what should be used
well they fixed a bug then I guess
More like cut down a feature
https://community.bistudio.com/wiki?title=getAmmoCargo&diff=123811&oldid=121633 seems like KK is responsible
Not I have to do config check instead of quick and simple finite getAmmoCargo _vehicle
why can't check for 0?
because that would also detect rearm vehicles that are just empty?
This only works if vehicle is fresh with full cargo
In my mission I set cargo to 0 and do custom behaviour
set a variable onto the vehicle, before you set to 0
And clients did this check too to quickly know if custom rearming behaviour should be used
Yeah, still a totally uncalled for change
same as waitUntil, and breaking assignedTeam for no apparent reason. and the waitUntil chaos. And tons of other commands that have new return values now which aren't listed at all in any changelog
_spawnBox = createVehicle [_boxClass, _boxLocation, [], 0, "CAN_COLLIDE"];
how can I get _boxClass to work here, i switched classname for that variable but its not working which is logical, how would one implement it so it would work
_boxClass, array of classnames for object, _boxLocation, array of coordinates for spawning
setMagazineTurretAmmo no longer can set ammo above magazine limit. Got told its a measure against cheaters.
Except cheaters have myriad of other ways to mess game up while useful feature of having more ammo in non-modded environment is gone.
@maiden warren use selectRandom...
private _boxRandom = selectRandom [["O_supplyCrate_F","Box_AAF_Uniforms_F","CargoNet_01_box_F","Land_Pallet_MilBoxes_F"], [7908.46,10229.1,0.147013],
[7911.83,10241.3,0.128614],
[7915.92,10244.7,0.144957],
[7926.76,10233.1,0.145]];
🙄
_randombox = selectRandom [box1,box2,box3]
_randomposition = selectRandom [pos1,pos2,pos3]
what you just posted is wrong
I know
private _boxClass = selectRandom ["O_supplyCrate_F","Box_AAF_Uniforms_F","CargoNet_01_box_F","Land_Pallet_MilBoxes_F"];
private _boxLocation = [
[7908.46,10229.1,0.147013],
[7911.83,10241.3,0.128614],
[7915.92,10244.7,0.144957],
[7926.76,10233.1,0.145]];
where's your selectRandom for box location?
it was in
but I was testing different ways to try to make it work
what i dont get is the createvehicle part
private _boxClass = selectRandom ["O_supplyCrate_F","Box_AAF_Uniforms_F","CargoNet_01_box_F","Land_Pallet_MilBoxes_F"];
private _boxLocation = selectRandom [
[7908.46,10229.1,0.147013],
[7911.83,10241.3,0.128614],
[7915.92,10244.7,0.144957],
[7926.76,10233.1,0.145]];
_spawnBox = createVehicle [_boxClass, _boxLocation, [], 0, "CAN_COLLIDE"];
on spawnBox if i use the classname in quotes it works fine
but then the box is not random
yes
turns out you can
lol
it works
for some reason
well, thank you for your help, I appreciate it very much
the ammo(etc)cargo were calculated as cargo/maxcargo, the max cargo for vehicles not capable of this kind of cargo was 0, you see where it is going. It doesn't return -INF because it was division by 0. I can try to request that in this case it returns -1 maybe?
And tons of other commands that have new return values now which aren't listed at all in any changelog
99.99% of those returned NOTHING with null object as argument instead of default value. Mostly edge cases this is why no reason to list them all maybe?
You can set negative ammo with setAmmoCargo so -1 is not perfect either
Honestly, don't see a reason why -INF was an issue at all
You can set negative ammo with setAmmoCargo so -1
Is this a feature or a bug? if a bug this could be fixed
returning default with many commands has been expected for years tho.
like trusting alive objNull to return false. I use that quite alot
default values are useful. If you want to extra check for null then you can do that.
returning nil however causes undefined variables and kills scripts
undefined behaviour
For a second I thought that alive objNull doesn't return false anymore
I don't actually know. didn't try
It does
I don't see the sense in now changing things that have been like that for years, and never really bothered anyone
Sure a programmer might see "ugh that's ugly" or "that shouldn't be like that if we were to make it nice" but that's true about most of SQF.
but it is correct default value
Its a cut feature of the command, if you ask me.
if you set ammocargo to -1 does it deplete your ammo when you resupply from it?
It doesn't
Not really, just saying that returning -1 is not as precise and perfect as infinite
Actually, I might change vehicles that have cargo to -1 myself and then do check against -1
No changes to command needed
you could set -1 on objects you want to pass as not having this capabilities
so make it return -1 if cannot have that kind of cargo?
Right now I'll just set cargo to -1 if vehicle had any cargo on spawn. And have clients check for -1 to see if vehicle is capable of rearming\repairing\refueling.
so it will be compatible with proposed change in the future?
That too, yeah
Still, infinite was perfect there. Also a useful case for finite command usage
Hm, spawned ammo truck with APC nearby, after some shooting and instant rearming, getAmmoCargo still returns 1 🤔
Are all cargos infinite now?
transportAmmo = 1e+012;
Oh, they practically are
I guess BI couldn't fix infinite rearming from remote vehicles and made it infinite everywhere? 👌
i have a question do you know how to force connect the pipe between scba and gas mask please ?
You mean force it on land?
wait i will send a screenshot
hiddenUnderwaterSelections[] = {"hide"};
shownUnderwaterSelections[] = {"unhide","unhide2"};
These are selections that get shown\hidden when you're near water
Easiest way would be to create mod with rebreather that always has these hidden or shown.
when i add the scba in a script
and when i use the CBRN specialist
and i add the scba in arsenal before launching the mission
@meager granite so do you know how to do that ?
Its backpack's texture
Don't know proper texture for it, gonna have a look
There's probably also a BIS function for it or something
Hi guys. How can I get some unique ID of exact spawned Object?
netid?
@meager granite thx i think it's that but how to see the new function of dlc contact ?
should have a new category for it under the function viewer
ok thx i will se it
Yeah, it's A3_Enoch
@high marsh yes xD we have a function called "CBRN_Hose_Init"
@meager granite yay! Thank you!
ok but how to run the function ?
[player] spawn BIS_fnc_CBRNHoseInit; but it doesn't work
Its bin_fnc_CBRNHoseInit
For some reason
[player] call bin_fnc_CBRNHoseInit
Doesn't seem to be multiplayer-compatible either
Check function source in functions viewer, its really simple
You could make it MP-compatible yourself with setObjectTextureGlobal
Though these hoses might appear visible when you drop the backpack on the ground but its lesser evil
Currently trying to make a guy talk with sound. Prepare for questions soon.
@meager granite i have copy all code of the function and i have change to settextureglobal and it work perfecly so thx you
called by [_unit] execVM
What's a good way to make a permanent text to show on screen?
Like a HUD, to show score, money, etc.
make a hug cutRsc thigny
@ornate sky just create a UI layer for your text myLayer1 = ["layernamethatfitsyou"] call BIS_fnc_rscLayer;
And then spawn some text to it: [ _mystring, 1, 1, 60, 0, 0, "layernamethatfitsyou" ] spawn BIS_fnc_dynamicText;
Function description will get you through the parameters of the function, they are mainly for text positioning, color and animation
how can I make sure that the text stays on the same place on every resolution?
Test it resizing the game screen?
A question: how on Earth this piece of code
playerZeus = getAssignedCuratorUnit z1;
playerZeus setVariable ["myDemons", [], true];
gets me an Error Error setvariable: Type String, expected Namespace,Object,Group,Display?
Like I can't declare that a variable stores an empty array? o_O
And when did [] become a string?
it reports left side
playerZeus is string
maybe getAssignedCuratorUnit now suddenly returns string instead of objNull if z1 is objNull or smth?
or you run in scheduled
Why does your global variable not have a tag
and can't it be local?
any way to read if a unit completed its "domove" command? i want to disableai "path" upon reaching thier position
@spark turret if there is no command to check if the unit has reached its destination, why not just check if the unit is moving?
was more looking for an eventhandler type thing that doesnt require a while look that checks
but i guess that would work too
But z1 is 100% not objNull the script does tons of logic with it before these strings. @still forum
even better, will use a small marker that checks if said unit is in it at the wanted desttination
Could it be that getAssignedCuratorUnit returns string instead of Object?
@spark turret sure, that works
Use tags for global variables.
Which tags? 😃
MYTAG_myVariable
kinda dumb that "domove" exists but there is no way to check if a unit was assigned "domovev" or how far the unit is in completing its command
rok_playerZeus
@dull drum you thought about doing something like diag_log str playerZeus; or even better putting it in the watch field in the editor
make your variable names unique
@plain current I actually did and got me 15:12:46 "Zeus player is 2_1378"
@spark turret just check the distance between the unit and the end point and compare it with the distance from start point to end point to get how much of the trip is completed
Oh, thanks @still forum that will be handy not to mess with Arma list of vars, didn't think about it
Fixed with tag, but it is still a String. I wonder if it returns an object netId string instead of object itself
That would be fun.
The thing is that this string does not look like a netId at all: 2_1424. It looks like some player ID. Which is a total mess because instead of getting a reference to the particular unit I'm getting a multiplayer ID of a person lol.
so it does actually return a string?
It does.
If you call "str" on a object, it can also turn objects into strings
so are you 1000000% sure it's a string?
Hmm, then - no.
When you execute getAssignedCuratorUnit z1 in debug console
what do you get back
or better yet typeName getAssignedCuratorUnit z1
Just execute that without a diag_log string?
It gives me an Object, which is right. Let me try to assign a global var with array to it.
Strangely enough it also got me to set the empty array there. From the console. But from the sqf it still gets me a "String" error
my guess is that because you don't have a tag, and your variable is not unique. maybe some other mod/script is writing into same variable
or maybe the error is giving you the wrong line of code?
But I've changed it and set the tag.
and the error is just nearby?
That's possible.
I think I will get my black chicken cut it's throat and do some voodoo to know better.
Thanks for all the help, guys.
how would i detect if someone is using cheat scripts?
you dont
BE
[
"ace_firedPlayer",
{UTF_fnc_LogPlayerFired} // Even if contains nothing
] call CBA_fnc_localEvent;
Any idea what I'm doing wrong with this event handler?
It causes ace to spit out errors about undefined variables in functions I dont even call.
Okay, listen, can you PLEASE help me
What's so hard with following a example
https://ace3mod.com/wiki/framework/events-framework.html#34-example
// Event handler added on a target machine
["ace_interact_tapShoulder", ace_example_fnc_onTapShoulder] call CBA_fnc_addEventHandler;
This is the example
doesn't look like your code
You have used the "calling an event" example
why do you skip the "add eventhandler" example and jump to the "calling an event" example. While you are trying to add a eventhandler
it's even called fnc_addEventHandler
I was under the impression ace events were already "added" by the mod
they are
a handler is not a event
a eventhandler handles a event
it is not an event
and you yourself are speaking of adding a eventhandler the whole time
don't understand how you can think addEventHandler might be the wrong thing for adding a eventhandler
Thanks, man, that is exactly the kind of help I need.
I know you like to assume people know stuff and just link them documentation all the time.
That's cool, learn the hard way, put in the reading work and all that, but at what point do I have to beg you to give a guy a little guidance?
Apologies, but every time I come here, you treat me like shit, so perhaps you should avoid answering my questions in future.
Well, I mean, go for it, but if you're going to answer me with a URL all the time, Ill just have to return tomorrow to ask another question if I cant figure the documentation out myself. I'll just leave it at that mate, probably best you do my messages a fat skip or something, else you'll only frustrate yourself. Thanks.
@winter rose but cheaters bypass my battleye scripts.txt???
If they're bypassing BattlEye through some means, you're not really going to stop them
they're bypassing the scripts.txt filters from what i've heard
anything i can do about that? any detection method through script? can i disable cheat command?
If anyone would know something about this, wouldn't it be you?
@dusk sage i don't know shit
@plain current your missions can use CfgDisabledCommands yes
ok what command i should disable?
do i disable hint and systemChat because mission does not use them and they use animation notification system?
hi how to disable function viewer ?
You would disable everything not used by your mission
I would assume your mission probably uses hint and/or systemChat
you can disable everything but what a client should through remoteExec
@rancid pecan load up infistar to block fnc viewer
if only the server remoteExecs, disable everything (but the BIS_fnc that are explained on the biki)
u know house is still my fav #1 tv series
i have disabled hint and systemchat and servercommand
is that enough to stop cheaters to do i need to block memory fnc?
block everything *but* what your mission needs
how do i block fncs like server_exit? memory cheater told me he just call server_exit and server goes down
which one?
wait a minute. I was thinking something else
I was thinking of https://community.bistudio.com/wiki/Arma_3_CfgRemoteExec
he say hes just ran server_exit in memory and i can block it with remote exec filter file
I guess extDB or some crap?
@real moat what exactly are you trying to do with the event handlers added by ace?
You are right ace adds event handlers, tho the Eventhandlers themselves have tio be added manually for each Client. So ti say the event fires but you have ti create the EH that reads em
"ace adds event handlers" no it doesn't
it fires events
Event != eventhandler
A event, will be handled by a eventhandler. They are different things
Sorry you re right . It creates events, EH need to be added by the scripter.
"Multiple ppl are typing" oh shit lol
if you know how to script. these are eventhandlers:
fnc_fireEvent = {
{call _x} foreach Eventhandlers
};
fnc_addEventhandler = {
EventHandlers pushBack _this;
};
{handlecode} call fnc_addEventhandler;
Ace or whatever mod then calls fnc_fireEvent in it's code
Why not use bi scripted EHs?
I guess its less about creating the event and more about reading when it happens?
Why not
btw events are never "created" but.... semantics
because CBA events have been there before BI scripted events (I think) and also have builtin support for MP stuff and are probably also more efficient
I was under the impressipn all "fired + x" events arent supported by cba ccording to theor page
So cba events != xeh?
ye
and cba also has player events
which is yet another system
but all work kinda the same under the hood
But now that we are talking about it, how would i create a server/local event? I see and know how ace does it but that id afaik a function called in the code when it executes, f.e.
'''Sqf
_doSomeCoolShit = xxy;
_createvent for xxy;
'''
Which doesnt mean i can add a specific event for something executed by a "foreign" script.
How do i add an event for somethigb i havent scripted/function called myself?
you don't create events
really
you add a eventhandler for some string
and when you fire a event, you just give it the name. And the system checks if there are any handlers for it
so if you fire event "bla bla bla" it will either execute all eventhandlers for "bla bla bla" that were added previously. Or it does nothing if there are no handlers
Well the EH notices the event right? But how do i "create" the event it notices ?
Specifically can i check for stuff happening that i dont cause myself?
Let my build some analogy
Good, my blood alcohol wont allow anything else.
You have a list of names, and phone numbers for each name.
When an event fires, it checks that list, searches for the name and calls all phone numbers that are listed on the name.
The list starts out empty.
If you add a eventhandler, it adds a phone number to the name of the handler
When the event fires, and there are no phone numbers on the name, then it doesn't call any numbers
same as when you add a eventhandler for a name, that is never checked by any event, your number will never be called
ACE itself says in their documentation "there are these names on my list that you can add your number to, to be called if something happens"
So if you want a new event/eventhandler combo, you just say "I now say "myEventhandlername" is a new name on the list that people can add their phone numbers to"
you just make up some name
or other example. Mailboxes.
The eventhandlers are people who check if their mailbox has any mail in it.
And the events just send mail to some mailbox.
If noone checks the mailbox, noone gets the mail.
If noone puts mail into your mailbox, you won't get any mail.
Understood, tje event fires and all eventhandlers for that specific event fire too. Now the question is:
Can i "create" an event for a foreign script f.e. player selects a certain weapon
And will it fire always a player selectd that weapon no matter if by my script or not?
if someone is there to fire the event
then it will probably fire
if noone fires it, then not
CBA's playerEventhandlers do that. They check every frame if the current weapon changed, and fire a event if it does
if a weapon get's changed, even arma itself doesn't know who did it, so it can't say "I won't fire your handler"
all handlers to the event get called, always
Is there a way to find an object's relpos from another object?
Yes
I'm trying to attachTo. without trial and error.
@drowsy axle attachto is in my experience fucked up and not doinf what its supposed to. Its a very tidious way to get the right offset. I use a Testarea marker where i plac stuff at right offsrt in editor, read their pos, attach at 0.0.0 and read again to determine how far real offsrt needs to be. Z value returns bullshit and doesnt attach right tho
Not a pro tho 🤔
z value should be right if you use right position format
Getpodasl before and after.
Then get difference in z value and attach select 2 + z diff. Well Sounds good doesnt work. Probably im doinf sth wrong
maybe getPositionWorld might be better
Noted.
they might use different centers
What center does attachto use?
¯_(ツ)_/¯
Lol
Welcome to arna
Honestly its such a pain in your best space to determine the centers attachTo uses. Its never accurate and always only almsot works. Awful
sorry for darkness: https://cdn.discordapp.com/attachments/597594867715145758/604429683550846988/unknown.png sqf _truckpos = getPosATL truck; _crate1pos = getPosATL crate1; _crate2pos = getPosATL crate2; _relPos = _truckpos vectorDiff _crate1pos; crate1 attachTo [truck, _relPos]; _relPos = _truckpos vectorDiff _crate2pos; crate2 attachTo [truck, _relPos];
so they are under the truck? instead of above?
Yes
Will try, wont expect anything useful tho
They're at Z 0
if you know, tell us so we can add the info to the biki
Try https://community.bistudio.com/wiki/getPosWorld instead of getPosATL
@spark turret ah! getPosWorld wiki page says what the center difference is
I think attachTo also uses model center
also it's center not centre! Someone need fix critical bug in biki
we all die
call the macaronis
it's not 100% but better https://cdn.discordapp.com/attachments/597594867715145758/604430335198887936/unknown.png
Not sure what to see in thaz pic
its only half as high as should be
yup
do they float in air at the right position if you just don't attachTo?
let me see
maybe editor places them too low by itself?
Problem is every time i read offset placed in editor and attach by thst offst its.... off
Will try getposWorld
X and y offset work fine its only t
Z
I've moved them higher in the editor
You need worldToModel
which one?
I highly doubt any posagl will give what we want
Keep in mind that it's world position is "AGL" and not world
Bc diffrenxe in modelcenter = different posagl
... wow worldToModel doesnt take world position. GG
Lel
Did i mention the b in arma is for bugfree,
the truck blew up..
Hey who has the power to change the name of the fuu ction "currentwaypoint" to "indexCurrentwaypoint"?
Or do i need to Protest outside BI hq?
Well bi hq it is
_truckpos = worldToModel truck;
_crate1pos = worldToModel crate1;
_crate2pos = worldToModel crate2;
_relPos = _truckpos ASLToAGL _crate1pos;
crate1 attachTo [truck, _relPos];
_relPos = _truckpos ASLToAGL _crate2pos;
crate2 attachTo [truck, _relPos]; ``` Apparently the truck doesn't exist.
heh I like breaking things... https://cdn.discordapp.com/attachments/597594867715145758/604433203624804383/unknown.png
that is clearly wrong syntax. it takes 2 arguments, you're giving it one
ASLToAGL posASL you mean?
ASLToAGL getPosWorld truck
Edited above.
U sure you ha vw the crates?
uh...
no
you are doing basically the opposite of the right thing
as I said. worldToModel takes 2 arguments
so the wrong thing? 😉
ahhh
_truckpos = worldToModel truck;
_crate1pos = worldToModel crate1;
_crate2pos = worldToModel crate2;
_relPos = _truckpos worldToModel position crate1;
crate1 attachTo [truck, _relPos];
_relPos = _truckpos worldToModel position crate2;
crate2 attachTo [truck, _relPos]; ``` like so?
Maybe my phone aint showing it right idk. :)
Lol
my bad: sqf _truckpos = getPosATL truck; _crate1pos = getPosATL crate1; _crate2pos = getPosATL crate2; _relPos = truck worldToModel position crate1; crate1 attachTo [truck, _relPos]; _relPos = truck worldToModel position crate2; crate2 attachTo [truck, _relPos];
ugh rip
Keep in mind getPosAtL is connected to center and ground below and will likey give bad values
that was right? ASLToAGL (getPosWorld truck );
yes
_truckpos = ASLToAGL (getPosWorld truck );
_crate1pos = ASLToAGL (getPosWorld crate1 );
_crate2pos = ASLToAGL (getPosWorld crate2 );
_relPos = truck worldToModel position crate1;
crate1 attachTo [truck, _relPos];
_relPos = truck worldToModel position crate2;
crate2 attachTo [truck, _relPos]; ```
where do the position crate1 come from all of the sudden?
Example 2: _relPos = player worldToModel position car;
rip yea
and position returns wrong height
It really botherd me that you define _truckpos but dont use is
is?
I don't understand
oh
just the: sqf _crate1pos = ASLToAGL (getPosWorld crate1 ); _crate2pos = ASLToAGL (getPosWorld crate2 ); _relPos = truck worldToModel _crate1pos; crate1 attachTo [truck, _relPos]; _relPos = truck worldToModel _crate2pos; crate2 attachTo [truck, _relPos]; I see now.
How do I params an array? ```sqf
EC_attachTo = {
params ["_object",["_arrayObjects"]];
{
_objectpos = ASLToAGL (getPosWorld _x );
_relPos = _object worldToModel _objectpos;
_x attachTo [_object, _relPos];
} forEach _arrayObjects;
};```
Okay.
so just: params ["_object","_arrayObjects"];
or: params ["_object",["_arrayObjects"]];
"just do everything normally"
so. "just"
kk 😄
Last oe doubles your array
Whoops
Ill take that back
Now i take you figrured out how to place stuff at correcr offset @drowsy axle ?
yes. He posted screenshot of it working
Good. Will steal and sell as my own. ...? Profit
Defintely needs biki entry fpr attachto if it works corrextly
Excuse me sir. Do you want to attach these objects to that thing? just: call EC_fnc_attachTo 😉
Attaches object while keeping same absolute position
.. script
someone wake up lou
@winter rose ?
I think he has been abducted while playing a3.
Or, he got lost in the forest.
is he the cba man?
Like "storm area 51" urgent
Lou is the keeper of the biki :U
CBA_fnc_attachTo = {
params ["_object",["_arrayObjects"]];
{
_objectpos = ASLToAGL (getPosWorld _x );
_relPos = _object worldToModel _objectpos;
_x attachTo [_object, _relPos];
} forEach _arrayObjects;
};``` my babies future looks bright?? 😉 😉
Does it work tho?
Lol
EC_fnc_attachTo = {
params ["_object","_arrayObjects"];
{
_objectpos = ASLToAGL (getPosWorld _x );
_relPos = _object worldToModel _objectpos;
_x attachTo [_object, _relPos];
} forEach _arrayObjects;
};
[truck,[crate1,crate2]] call EC_fnc_attachTo;``` WORKS!
Way to show off you can afford the new dlc
10/10 will steal function fpr own script
aw
@drowsy axle @spark turret I AM BACK
EC_fnc_attachTo = {
params ["_object","_arrayObjects"];
{
_objectpos = ASLToAGL (getPosWorld _x );
_relPos = _object worldToModel _objectpos;
_x attachTo [_object, _relPos];
} forEach _arrayObjects;
};
[truck,[crate1,crate2,crate3,bike1]] call EC_fnc_attachTo;``` https://cdn.discordapp.com/attachments/601850288198123542/604441210471448589/unknown.png | https://cdn.discordapp.com/attachments/601850288198123542/604441398703423672/unknown.png All I need to do now is save the dir.
what is it, mortals?
You did good. Will mention you @drowsy axle
I want too
for attaching object to vehicle and keeping same absolute position
So idiots like me dont need to suffer
same absolute direction soon™
like tbh it's simple..
I know i'm saying this now.
but like, when you think about it.
same position is also same direction 🤔
so wait what should I copy to the Biki 😄 gimme!
Dir isnt includef
I know.. I'm putting it in now, and testing.
//attachTo while keeping same absolute position
_boxPos = ASLToAGL getPosWorld box1;
_relPos = truck1 worldToModel _boxPos;
box1 attachTo [truck1, _relPos];
oi.
Said the australian
lol
Wait
the direction before and after attachto will be different.
Wouldn't I need the relative dir...
Maybe I'm little out of context... But can't u use:
https://community.bistudio.com/wiki/BIS_fnc_attachToRelative?
silence
from the pastDir to the currentDir, because, this: ```sqf
EC_fnc_attachTo = {
params ["_object","_arrayObjects"];
{
_azimuth = getDir _x;
_objectpos = ASLToAGL (getPosWorld _x );
_relPos = _object worldToModel _objectpos;
_x attachTo [_object, _relPos];
_x setDir _azimuth;
} forEach _arrayObjects;
};
[truck,[crate1,crate2,crate3,bike1]] call EC_fnc_attachTo;``` ain't working as intended. https://cdn.discordapp.com/attachments/601850288198123542/604443961913901060/unknown.png <- in game
oh for the direction stuff... yeah..
_obj1 attachTo [_obj2]; The function says that preserves the position
is that really all you needed to do??
If no offset is specified, the offset used will be the current relative positioning of objects against each other. welp
oh
All the work was for nothing
welp, turns out reading wiki pages helps sometimes, who would've thought
The direction. It's changed in the attachTo.
Hahahahaha xD
Azimuth Directional Relativity would that be a thing?
attachTo then setDir iirc yes, and relative to the object it is attached to
If no offset is specified, the offset used will be the current relative positioning of objects against each other. ah I could have told you that, this is how I put crates in the back of my trucks from Eden placement 😄
So the bike starts at: Dir = 66.215
turns out reading biki makes things easier afterall. who would've thought ¯_(ツ)_/¯
I guess we should recommend people to read the wiki 🤔
after attachTo ends at: Dir = 231.255
(231.255 + 66.215) - 360 = -62.53 is the minus counted in arma?
360 - (231.255 + 66.215) would be correct way.
BUT
I don't always know the numbers
Just rotate by 194.96 degrees
How did you get that?
or just use the BIS function that already exists and already does it correctly
231.255 + x = 360 + 66.215
uh
EC_fnc_attachTo = {
params ["_object","_arrayObjects"];
{
[_x, _object] call BIS_fnc_attachToRelative
} forEach _arrayObjects;
};
[truck,[crate1,crate2,crate3,bike1]] call EC_fnc_attachTo;``` works
Thanks @hollow thistle
X is 194.894 hope i could help
no it's not...
anyone found any cool new stuff to play about with from the contact dlc?
about to hunt around in the configs and functions for new stuff rn
Hey guys, don't know why I am brain-farting on this.
I need to get all bluefor within X of a opfor unit.
a count of the blufor within X of a single opfor unit.
inAreaArray
allUnits select side==blufor
count
Checking the wiki for like a findWithin, or something.
inAreaArray?
Yeah that's the count, but what about the.
count if
distance from HVT < 10
inAreaArray does distance
Oh that's a function.
Let me go check that out, thanks.
alt syntax 3
as "positions" you give it array of all blufor units
then you get out all blufor units in range
@jay _enemies = allunits inareaarray _markeratOpfor select {side _x == blufor}
?
I think inAreaArray before filtering blufor might be more efficient yeah
I thought about doing blufor filter first
_enemies = allunits inareaarray _markeratOpfor select {side _x == blufor}
this is almost what I have
I am using the pos of the HVT opfor
I am about to test to see if it follows the HVT's pos tho.
if you want to count you can directly replace the select with count
Not sure how that will work without some lame loop.
Maybe a trigger area would be better, a trigger area that follows the HVT pos.
Since I need to to be checked all the time.
I am trying to start basic
if HVT team alive, fight, if dead, surrender.
Later I can get frisky with it.
Add something like, if team is dead, and no blufor in x radius, run random dir
_numberTeamHVt = count (allunits inareaarray _hvtPosMarker select {_x side == side _HVT};
Yeah, then just chuck a isAlive check right
if (_numberTeamHVT < _enemies) then {surrebder or sth}
Add more conditons into select via "&& alive _x" f.e.
Afaik you wont ve able to avoid a loop that checks.
Wondering, does the pos of the marker update with the unit if I pas a objec?
Ahh
How do I make it non blocking
Call it with spawn?
In the hvt init maybe
What
Obviously I don't want my HVT loop taking up all of the mission right.
Yes. Marker position is static tho. Dont know of you can atta h marker to a unit. Dont think its possible, might be wrong tho
This answers my question about how to include the loop without blocking the rest of the code from doing it's job.
A loop checkign every 2 or 3 second in a 100m marker for hvt team and enemies is not at all performance intensive tho. So wont be proböem
Been a long time, I am too damn rusty
.. why would you not run thaz loop in a scheduöed normal environment?
Just create an hvt_giveUp.sqf and execVm "yourfolder/hvr_giveup.sqf';
that script which includes the loop. Also put: "if !(isserver) exitwith {}; on top to avoid multi init in MP
Put "this execVM "yourfolder/hvt_giveup.sqf" in the hvts init in editor and in tje script run your loop.
Put a "sleep 2" thing in tje loop to avoid perfomance stuff anf you will be fine
Might put extra precautions like
'''Sqf
_this setvariable ["Jay_HVT_giveupscriptrunning",true,true];
If (_this getvariable "Jay_HVT_giveupscriptrunning",false]) exitwith {
_debug = "Hvt script run multiple times for thag unit";
diag_log _debug;
Hint _debug
}
'''
OKay cool
That thing gibes the unit defined in this execVM the variable "jay_hvtwhazeber_alreadyrunning" = true and then checks for that variable, which id global (importna t for mp). If it notices _alreadyrunnign = true, it will ecit thaz script and leave a debug Message
Im drunk and will now sleep.
Later man
Hey
Can you do this in one line.
_hvtGroupSize = count units group HVT;
_hvtGuards = _hvtGroupSize - 1;
I would like to do _hvtGuards = count units group HVT - 1;
But I am getting a Error generic error in expression
_hvtGroupSize = (count units group HVT) - 1;
I have a mission with a p3d object that i want to create server side to any player see it. This object don't have a classname, how can i do that?
I can't find a way to do that.
If i use createSimpleObject, the path on server and on clients are different, so the object will only appears on server when i create then on server.
On clients the path is mpmissions\__CUR_MP.altis\models\helion4_ceil.p3d
on server the path is mpmissions\BRPVP.altis\models\helion4_ceil.p3d
Understand me?
have you seen this:
http://killzonekid.com/arma-scripting-tutorials-mission-root/
Doesn't seem like it. Maybe there is some global var for it? Google foo isn't giving anything.
@ivory lake thanks, but this does not work. Because the path returned in server is one and the path returned in clients is another, they are indeed different because in clients the mission is in the file __CUR_MP.altis.pbo and on server the mission is in the file BRPVP.altis.pbo.
Test his MISSION_ROOT on server and clients, they will be different.
@tough abyss why it doesn’t work?
You need different paths, no?
@tough abyss because when creating the object server side i need to use server side path, then the object is transmited to clients with that path, but since on clients the path is different, the object is not created client side.
It is not created because the path is invalid.
For clients.
Why would you send server path to client, mission root on client is different you need to calculate it in client
The engine sends, not me.
Use local flag and create it everywhere
Then manually sync if you need to
@tough abyss this makes things harder, but seens the only solution.
You are trying edge cases that is miracle even work and complaint it is hard? 😂
💩
Can't i create a classname for the p3d model in description.ext?
No
No you can make mod
Although if you ask ded, maybe.
Zed is ded
:O
No
@high marsh pulp fiction ref https://youtu.be/7Y_NU_OUwvk
So server and client paths will be the same
<- Uncultured
Try it @tough abyss
I'm almost positive this would cause further conflictions.
wondering if i can make AI change positon to middle/down when reloading. "reload" eh doesnt work as it fires too late and the unit will reload, THEN go down.
Should yeah, but those are two seperate events. Might not be perfect.
what is two different events?
One for reload, one for changing to prone/crouch. One might take prescendce over the otjer, I dunno.
no, just to be clear, i added this EH:
if !(_unit getVariable ["IRON_EH_Reloading",false]) then {
_unit setVariable ["IRON_EH_Reloading",true,true];
_unit addEventHandler ["Reloaded", {
params ["_unit", "_weapon", "_muzzle", "_newMagazine", "_oldMagazine"];
_unit setUnitPos "down";
hint str "RELOADING";
}];
};
EH is called reloadED
ffs why wont it show as sqf
But there is muzzle EH Reload that fires before reloading
the EH does fire and work, but its to late uasually
ideally the AI would go prone BEFORE reloading
will look at the muzzle thing m242 suggested
That's exactly what I was talking about.
Unless you want to handle reloading alltogether. Rather than by EH.
do you know by chance the name of that muzlle EH?
how would i cahnge reloading altogether?
Reload
uh .. so exactly the one i use which fires to late?
It is config eh you need to make a mod
...
do weapons not have that event already and i can just read it ?
yep, EH "Reload" is not recognized. ffs
You can’t add eh to a muzzle by script
well why not
i can get the muzzle and i can read events for that muzzle. thats how i understand it
Because muzzle is not an object
ah
right, arma being wierd again with its structure. well then ill just live with AI happily standing in fire while reloading
Arma was always primary config driven and secondary script driven
which makes sense often but i cant make a mod containing all weapons just to make AI duck when reloading
ah wait can i add the config EH for all class "rifles"?
Then you dont let AI auto reload instead force them to reload yourself
interesting approach
how would i check for an emtpy gun? Fired EH that counts ammo in mag each shot?
sounds performance-y
Or you can watch ammo in FiredMan EH and act accordingly
man every time i want to make super small improvements to AI i end up having to rip apart the vanilla one and disable 70% of it to overwrite with my own stuff
Performance? EH only triggered with each shot, unless you have thousands of AI firing full auto at the same time you should be ok
Hacking AI is like hacking UI both suck
Might as well write what you need from scratch or make a mod
yeah
im working on a "AI defense line /trench" script where they leave the trench if they get hammered and its awful to get AI to actually DISengage
they dont know anything else then attacking.
actually i dont even have to disable autoreload. i just add the EH on top, if it notices 0 shots, go prone. AI does the rest
@spark turret
_numberTeamHVt = count (allunits inareaarray _hvtPosMarker select {_x side == side _HVT};
I said half a dozen messages above that you can just replace the select with count, which will be more efficient.
@hearty plover
https://community.bistudio.com/wiki/Scheduler#Unscheduled_Environment
This answers my question about how to include the loop without blocking the rest of the code from doing it's job.
Uh? Unscheduled environment is exactly the wrong thing for that. Because it blocks everything till the code is done.
i was drunk an didnt understand half of what you said 😃
thanks @tough abyss my trench ai now ducks when reloading. did this:
_unit addEventHandler ["Fired", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
if (_unit ammo _muzzle == 0) then {
_this execVM "IRON\Debug\duck_and_reload.sqf";
};
}]; //for each trench guy
//---------in duck and realod .sqf:
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
//--- read units up/down/etc
_pos = unitPos _unit;
hint str _this;
//---------------------------
_unit disableAI "path";
_unit enableReload false;
//Determine what to choose
if (_pos == "Down") then {};
if (_pos == "Middle") then {_unit setUnitPos "DOWN";};
if (_pos == "up") then {_unit setUnitPos "middle";};
if (_pos == "auto") then {_unit setUnitPos "middle";};
sleep 1;
reload _unit;
sleep ((random 2) + 3);
_unit setUnitPos _pos; //set old pos
works like a charm 😃
only issue is they bend over backwards in a funny way when in open fields but thats arma stuff
@tough abyss i created a mod and put my p3d on it, the mod have only this file.
once you made a mod, there is no way back, muahahaha
yes, i liked to do that, this open new possibilities
Whats the easiest way to get an array of all the names of the entries in a listbox in an array so I can compare them to a variable? 🤔
Currently thinking a for loop iterating and pushBack
no other way
have to loop over but then you can compare them at the same time no need to make array
Fair enough, cheers 👍
Ive attempted to make some live feed cameras they work fine in single player but just show a black screen in multiplayer, i have this in my init.sqf: https://pastebin.com/j09QvHUu and this in the init field of a screen: this setObjectTextureGlobal [0, "#(argb,512,512,1)r2t(screen1,1)"];
anyone have any idea how to make this work on a dedicated server?
init.sqf runs for server + each client so thats the first issue
dont know why the screen is black, but besides that you create a camera for each client + the server.
@jagged elbow
I need to run a forEach on an Array that may be empty [] at runtime (but not nil). Will this cause problems?
no
exactly what I need, thanks
now, is there a way to get a distance to an object that is not model center?
eg. if a player is touching a vehicle that distance would be 0
rather than distance to the model center?
yeah you can check for collisions
or you can tinker with boundingbox or boundingboxreal
Hey There. I am new to scripting. Have some trouble figuring out what approach I can take for my problem. Been searching in here and on forums/web but haven't found any real answers.
So I run a function every 5 seconds that needs to find objects designated by Zeus as being "something". I can't change the class and use NearestEntities, as the objects can be moving cars, towers etc.
I have thought about making Zeus set a parameter/property on the objects and then find it that way, but that would require to poll all nearestEntities and then iterate through them, which is not a very good approach to run every 5 seconds.
My current approach is hardcoding the script to look for names like "something1", "something2" and check if they are null otherwise use them. This isn't great as it removes the dynamic I wanted to not be limited in number or specific names.
I have looked a bit in regards to use getMissionLayerEntities and see if Zeus can just add it to the right named layer and thus get the objects, but haven't had time to test that yet.
Ideally Zeus would select a unit, edit attributes and by a checkbox in a custom category select if this object should be a "something". A bit like ACE Arsenal. (Tried to find how they did it in their source, but couldn't locate that part)
Any ideas/thoughts/comments on how to approach this?
you can check for part of the name being something. check f.e. for "something" and it will also recognize "something_0815"
what exactly are your intentions with that script? whats your goal
oh interesting. I did not know it worked like that
but checking everything in the mission every 5 seconds is... well
it works and i do it to for randomized militia equipemnt but its not ideal
It is a script playing around with jamming/boosting and TFAR. So it runs locally on the players pc and checks if a "jammer" is in range of the player every 5 sec. Then calculates distance to jammer and check if any booster (ESM) is in range and it's effectiveness.
Ideally to enable our Zeus to play around with radio jamming etc.
there already are existing very well working tfar jammers
which are zeus compatible. we used one just last week
yeah. I see your point. Not ideal to check something every 5sec. However if talking less than like 10-15 items and I can obtain those objects in a efficient way I would see the impact minimized.
i have an ( at least foe me ) interesting question.i want to gradually change the weather on an event ,not using forceweatherchange.i need the weather turn from totally sh+t to awesome in 120 seconds.well i found out i can return weather parameters but can i do something like this? ```sqf
_translation_base = overcast;
_foglevel = fog;
_rainLevel = rain;
50 setRain (_rainlevel - 0.05);;
120 setovercast (_translation_base - 0.05);
120 setfog (_foglevel - 0.05);
120 setwind 0.2;
120 setWindStr 0.2;
120 setWindforce 0.2; ```
hmm. interesting. Googled around and didn't find any other than some old not-ideal scripts. Do they support ESM? So counter measures to jamming aka a teoretical booster that decrease the jamming efficency??
why dont you turn the script around and run the check loop checking for players near the object instead of object near players?
allplayers is a smaller array than allvehicles so less perfomance impact
@sturdy cape just saw that the function already supports gradual weather change
sounds just like what i am looking for
hmm. I would still need to get the actual object. So whatever the Zeus selected to be the jammer should be obtained by the script.
could you point me to that?
if theres an engine command i´d prefer that over my stuff
you could do sth like:
_startWeatherChangetime = time;
(_startweatherchangetime + 120) setrain 0;
well your stuff already does change gradually so im not sure you even need it
yeah its basically one step
you define a time adn a value and it will smoothly transition from what the rain is now to what the rain will be at time x with value x
i guess what i wrote it obsolete. let me correct
its not. i just tested and it seems that weather is buggy
according to biki you need to use forceWeatherChange for immediate change otherwise server might overwrite the scripted weather values or ignore them
not sure at this point if gradually changing weather is possible
it does seem to work with the gradual change at least for the fog, altough slightly delayed
that was the reason i started thinking about that
just force the change in small steps or something
-needs a for to step do then?
dont recommend forceweatherchange in multiple small steps. it will a. not look smooth and b. biki warns about lag
just try the normal, built in gradual function and maybe @still forum knows more about it
as far as i know the weather will then change only after 50 mins or so which is not what i am trying to do
its an emission event ,the blowout goes off and boom,fog rain and bad mood^^(works because forceweatherchange).then after 2 minutes the weather should be turned back to normal
well you can go and the the for _i thing
hmmm or do the killzoneKid thing
86400 setOvercast 1;
skipTime 24;
//to remain on the same date:
skipTime -24;
86400 setOvercast 1;
skipTime 24;```
and playaround with skiptime,but for all my values?think thats too much
i am attemping to get a brainf+ck again with this i guess but what about that? opinions? ```sqf
_translation_base = overcast;
_foglevel = fog;
_rainLevel = rain;
_windArray = wind;
_windX = wind select 0;
_windY = wind select 1;
for "_i" from 1 to 120 step 10 do {
50 setRain (_rainlevel - 0.05);;
120 setovercast (_translation_base - 0.05);
120 setfog (_foglevel - 0.05);
120 setWind [(_windX - 0.05),(_windY - 0.05), true];
};```
So if I wanted to make a npc move around in real life time how would I do that like by scripting it to move around?
What does real life time mean?
Like let say morning to the next morning at that time it will move around on the next morning if you get what I mean
Like it stay till 8am till the next 8 am by then it would have moved to a new location
I guess there's many ways to do it. Some sort of looping script that loops through acceptable destinations in 12 hour interwall or some such.
Is there all ready a looping script made
Dunno. Perhaps.
@keen tide do you want the Ai unit to actually move around in its village doing "real life stuff" or do you want to have it appear at different destinations when players enter the village according to the time of the day?
bc the second one is far easiert
I want it to appear at different destinations when players enter the area according to the time of day lol so that away I want it to be for a drug dealer for arma 3 so that away cops can’t bust people for it and they have to rp to find it.
well just make a list of the locations with the time when he is soupposed to be there and use that
_DealerSchedule = [[_bedroom,6],[_church,9],[_stripclub,15]];
if (round daytime etc etc etc
look into this:
https://community.bistudio.com/wiki/daytime
and this
https://community.bistudio.com/wiki/Array
and this
https://community.bistudio.com/wiki/findIf
and this
https://community.bistudio.com/wiki/createUnit
-_- so your saying cause of my grammar I don’t have the skills wow judgmental much quicksilver
And ok I will thanks ironsight
read the time, read from your array where he is supposed to be at, then spawn him at that location.
i guess its for some altis life thing??
kinda like that lol
"cops" "have to rp to find it"
thats what the altis life is about. also of course screaming into your headset how you f..ed someones mom
lol well im saving the scripts and ill work on it later and its not about experience when you have friends that know more then you that can help me out they just needed to know how to do it.
all ready have a friend my cuzion lol more then a friend
its much easier to just have family to do it lol