Why did I not stumble upon your videos earlier, great videos. This perfectly forms with other tutorials, I understand so much more, thanks feurex!
@Feuerex7 жыл бұрын
glad I could help.
@EJayWalker3 жыл бұрын
Is there a way to write a script that applies to several characters in one script? Example: I have a horde of zombies. Can I get them all to move to a players position in one script? or would I need a script for each zombie?
@Feuerex3 жыл бұрын
absolutely - and you even have several options to pick from. You can look into arrays, since that's a very convenient method of storing info about multiple objects. Arma also has commands like allUnits, nearObjects, and similar ones, that can create such array for you dynamically. Once you have your selection, you can use ForEach, For...Do, While...Do, or any other kind of command to iterate / loop over the individual objects and execute commands for all of them. You could also use script parameters! If you use a parameter instead of a specific object, and then call the same script multiple times with different objects as parameter, you can achieve the same. it really depends on what exactly you wish to achieve, but you have a multitude of options, so feel free to experiment. I think I have most of these topics covered on my channel in some form, but there's always the official wiki where you'll find everything needed, and much more.
@francoisviljoen98714 жыл бұрын
Nice Tutorial Feurex, i would appreciate some help as im still stuck with the while do loop, i have two addactions on a generator, if you start it, it starts looping a generator running sound, the second add action is switch off, but im having difficulty making the second script stop the while loop. Any help would be appreciated thanks man :)
@brandfoley2 жыл бұрын
2 years late. Did you ever find a solution? I'm using Say3d and objects to produce the sound I can get the sound playing but can't get the loop working :(
@Alpinegremlin7 жыл бұрын
So I`m trying to build upon a simple distance script I was working with earlier. I want the game to tell the player when he is close enough to a building to be considered inside it. "distcheck.sqf" is executed via my init.sqf file. _playerPos = position player; _nearestBuilding = nearestBuilding player; _meters = _playerPos distance _nearestBuilding; while {alive player} do { while {_meters < 6.5} do { systemChat format ["%1 is inside, name player]; sleep 2; }; sleep 0.2; }; The message does not pop up however, regardless of how close I am to a building of class "House". No error messages present themselves and when executed via radio trigger, the script works, but I want it to continually check if a player is the given distance. I will keep looking at your examples to see if I`m missing something.
@Alpinegremlin7 жыл бұрын
EDIT: I fixed it :P my variables were not placed under the loop so I guess the game didn`t know what I was talking about after the script initialized? Another helpful video though! Great work!
@Feuerex7 жыл бұрын
You're never updating the value of your variables. At mission init, you ask for the nearest building to player, but since you are never updating this value, the condition is either always true or always false. I'm guessing you start outside any buildings, which means the condition _meters < 6.5 is false, and you never see the script do anything, since you never tell the game to ask for the distance again. The solution is simple - update the variables with new values. while {alive player} do { _playerPos = position player; _nearestBuilding = nearestBuilding player; _meters = _playerPos distance _nearestBuilding; while {_meters < 6.5} do { systemChat format ["%1 is inside", name player]; sleep 2; }; sleep 0.2; }; With your permission, I'd take this piece of code and use it for a future video about script error types. This is a prime example of a design error, something that people encounter very often, and I'm in need of faulty scripts that don't come from my head.
@Alpinegremlin7 жыл бұрын
Yeah man go for it! If my mistakes can help others than I`m glad to make them XD I wish I had waited another minute to ask as I eventually woke up to what my issue was. I decided to change the while...do to an if...then which seems to work just as well. Thank you!
@skylerslack56776 жыл бұрын
is there a script that has an object spawn, exist for a while, than delete, and have the entire process loop over and over?
@Feuerex6 жыл бұрын
of course. All you need are commands CreateUnit - community.bistudio.com/wiki/createUnit deleteVehicle - community.bistudio.com/wiki/deleteVehicle sleep - community.bistudio.com/wiki/sleep and a simple while.. do.. loop running infinitely.
@skylerslack56776 жыл бұрын
think you could ever make a video tutorial on this? i think it would be VERY helpful for beginners like me who have never made scripts before and mission makers who want ambiance
@Feuerex6 жыл бұрын
I mean... I already have a tutorial on how to start with scripts, this very video explains while..do.. and nearly all other tutorials, mission / script showcases and experiments all show different scripts and how they are all structured ... I don't think such a tutorial is very needed..
@farzitsarzo79787 жыл бұрын
how can i stop a loop with a radio trigger ,somthing like : while ( radio alfa is activated = condition ) do (CODE) thanks by advance !! great videos !!
@farzitsarzo79787 жыл бұрын
name the loop and put terminate nameofloop ; easy as that . Terminate .... in radio trigger
@nob15367 жыл бұрын
Heyhey, nice video. Sadly I still have trouble using it. I want an AI to look at a few different objects and loop that. My command is WHILE {alive _2ndunit} DO {this dowatch stone1; this dowatch stone3; sleep 5;}; Any idea where my mistake is? Thanks in advance, subscribed anyway :)
@Feuerex7 жыл бұрын
you are either using the unit's init box, in which case _ 2ndunit} isn't defined and doesn't mean anything, or you're using script / trigger and _this_ doesn't mean anything. Change the names so that they correspond to actual soldiers. Also, put another sleep 5; in between the two doWatch commands. As it is right now, the soldier looks at stone1, and in the next 0.0001 seconds he looks at the next one.
@nob15367 жыл бұрын
Thx for your reply. I changed {alive _2ndunit} to {true} and added the sleep command. Still no difference
@thedevilonureyes7 жыл бұрын
Thanks that helped a lot ! i liked and subbed
@thedevilonureyes7 жыл бұрын
I sorted the problem out thanks : ) , i tried to click the link of your if condition tutorial but it said that the video got deleted
@Feuerex7 жыл бұрын
Just youtube's abysmal video description system, nothing out of the ordinary. Links have been fixed.
@mieczyslaw41548 жыл бұрын
Ahoj ty jsi Obi_wan, že jo? Mohl bych tě poprosit, kdybys mi dal tvuj email nebo ja tobe poslal bys mi tam nejake navod na ofp editor? Já jsem to kdysi dělal a vrátil jsemse k OFP a už nevím. jak jsem to dělal ;) Díky
@Feuerex8 жыл бұрын
+MIECZYSLAW 41 Můžeš mě kontaktovat na feuerexcz@gmail.com , ale pro OFP už moc materiálů nemám. Je to už skoro 8 let co jsem ty věci psal. Pokud máš zájem o nějaké ucelené informace v češtině, doporučuju Ruprtovu nápovědu pro OFP, spíš než zbytky toho, co jsem kdysi psal já.