Flat!!! 0 Posted May 5, 2007 Download my carbomb script: Car Bomb Script It has many modes and is not only speed activated... For example once engine is on it will blow after X seconds... ---------------------------------------------------------------- ------------------------Original post---------------------------- ---------------------------------------------------------------- I would like to know how I can make something activate when reached certain speed or goes under a certain speed. For example a car goes over 50km/h and then car setdamge 1 gets activated. Share this post Link to post Share on other sites
fasad 1 Posted May 5, 2007 example: if ((speed _myVehicle > 120) or (speed _myVehicle < 50)) then {insert your action here}; Share this post Link to post Share on other sites
mr.peanut 1 Posted May 7, 2007 Go to the OFPEC Editors Depot Scripts section  here and look for Car Bomb - Speed Activated. Make sure you update the type of explosive to the ArmA name. Share this post Link to post Share on other sites
Flat!!! 0 Posted May 7, 2007 I announce my Car bomb script in 1.0 state. That means that you can download it from Armaholic Please comment And give me ideas If you have problems with the script or would like to see a improvement in something, please feel free to ask Share this post Link to post Share on other sites
Flat!!! 0 Posted May 9, 2007 Any ideas? Modes... General info, How it preforms? Please give me some feed back so I can improve the script and my skills... Share this post Link to post Share on other sites
fasad 1 Posted May 9, 2007 I've had a quick look at the sqs file without testing it in game. Please note, I'm no script guru either <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_unitdir = getdir _object - 0 Why subtract 0? <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#start ? (_mode==0):goto "cantstop" ? (_mode==1):goto "upperlimit" ? (_mode==2):goto "cantstopupperlimit" ? (_mode==3):goto "engineon" ? (_mode==4):goto "engineon2a" If you only have 5 cases, the last line does not need the if condition. It wastes cpu power performing the check. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#cantstop if (speed _object >_speed) then {goto "cantstop2"} ? (!alive _object) : goto "Destroy" goto "cantstop" I would add some sleep to time these loops, checking the speed values as quickly as possible can reduce game performance with no real reason. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">goto Every goto wastes cpu power searching through the entire script from the beginning for the desired label. Try to use while, for etc. They can be easier to read too since the flow of the script isn't jumping up and down the page. It may be better to use a different script for each bomb simulation mode rather than one script with 5 modes. As someone who has only started using scripts in the last year, my general advice is to try and create as efficient scripts as possible. One inefficient script doesn't matter much, but ten running at once can ruin your FPS. Otherwise, nice work! Blowing up cars is somehow very satisfying Share this post Link to post Share on other sites
Flat!!! 0 Posted May 9, 2007 Thx for the reply So I actually have no idea why I used -0 ... pretty dumb of me... Modes... It might be a bit annoying to keep track of 5 diffrent scripts altho I will try to use less goto's in the next version... Again Thx for telling me about those things as I really am kinda new to scripts... ~4-6days Everybody is free to tip me on how to improve... Share this post Link to post Share on other sites
Flat!!! 0 Posted May 10, 2007 How about using @ instead of loops? Would it be better? Share this post Link to post Share on other sites
fasad 1 Posted May 10, 2007 Unfortunately not. Waituntil/@ check conditions very quickly, possibly every frame. It would be slightly better than the loop with goto tags, since it doesn't need to find the label. Use a while () do {} Share this post Link to post Share on other sites
Flat!!! 0 Posted May 10, 2007 New version on the way.... Fixes a explosion bug where there never is a explosion only the vehicle brakes to 1 damage. I used @ for this version I will use @ instead of the goto's as I don't know how to use whole yet... Altho maybe in 1.2 I will implement them. Also there are no goto's except the mode choice... (removed the last check) and in mode 4 where I think it is necessary. I will post the link here and in my sig when it is up... BTW thx for the tips Fasad. Perhaps you can help me understand "while" command? Share this post Link to post Share on other sites
Flat!!! 0 Posted May 10, 2007 I now release version1.1 which fixes: -Explosion in mode 0 -Explosion in mode 1 -Explosion in mode 2 -Optimized performance Link: Car Bomb Script Please post in this topic if you have any ideas or comments. Hope you like it Share this post Link to post Share on other sites
Flat!!! 0 Posted May 12, 2007 I would really appreciate comments and ideas so I could improve the script. Share this post Link to post Share on other sites
Curatalo 0 Posted May 13, 2007 DLing Script now!! !!!!! CANT WAIT TO USE IT! Share this post Link to post Share on other sites
Flat!!! 0 Posted May 13, 2007 Tell me what you think when you have tested it Share this post Link to post Share on other sites
Flat!!! 0 Posted May 14, 2007 Fasad I seriously can not understand in what way I should use the while command. Quote[/b] ]Use a while () do {} Please give me an Example. I am still only in scripting for 1 week which I mostly have had other things to do... So I would really appreciate some tips:) And Can anybody give me Ideas on improvement... that has tested it in game? Thanx in advance Share this post Link to post Share on other sites
fasad 1 Posted May 16, 2007 Sorry for the mistake, correct format should be : <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">while {} do {} When in doubt, check the wiki. I took one part of your script (sqs) and replaced <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">@(speed _object >_speed) or (!alive _object) with (sqf) <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">while {(speed _object < _speed) or (!alive _object)} do {sleep (0.9 + random 0.2)}; Honestly, it is probably complete overkill for this script, since I had to add 100 stationary cars running this script to see any difference in framerate (1 fps) between the @ and the while/do. There may be other factors such as exec vs execVM too. The idea is to reduce the number of checks the game does every frame, especially with things that are do not need to be exact. The random number de-synchronizes the checks for multiple cars. Ah well, hopefully it might help you in the future some day. Share this post Link to post Share on other sites
Flat!!! 0 Posted May 17, 2007 New version v1.2 Carbomb script It adds 3 new modes. 1 is that when you enter the vehicle it will blow after X seconds. Another is similar to the previous only if you get out it wont blow. There is also one that can be used for suicide bombing. If an object gets X meters from another object... KABOOOM Please post any issues. I would rally appreciate comments and ideas Share this post Link to post Share on other sites
Cowburn199 0 Posted May 19, 2007 Hi, great script I've been having some fun with the Bo_GBU12_LGB bomb Was wondering if you could give me some help. I want to make it so the car which has the explosive can travel to a target and explode when it gets within around 5 metres. How do I do this? And the car has to travel quite a distance so if it's possible, I don't want any speed activation. Thanks Share this post Link to post Share on other sites
Flat!!! 0 Posted May 19, 2007 Hi, the script does not only make an explosion when speed activated. The topic name is inappropriate but it can not be changed. Anyway you have to download my script (v1.2) and then type the the following into the init line of the vehicle some thing like: [bMP, 30, 5, "Sh_120_SABOT", carone] exec "carbombv1.2.sqs" In the example the vehicle called BMP will blow up with a M1A1 main gun explosion once it is 30 meters away from carone. For all the modes read the readme.txt file included in the DL In your case: [name of car, 5, 5, explosive, destination] exec "carbombv1.2.sqs" Share this post Link to post Share on other sites
gamble88 0 Posted May 19, 2007 Hey thanks for this master piece. Now i can make some terrorist maps. I have a map called: roadblock duty. and now using your script. But when the car with the bomb come closer to my target unit the car explodes. but all the surrounding units dont take damage. How can i fix this? Share this post Link to post Share on other sites
gamble88 0 Posted May 19, 2007 Sorry i got it. Its a bug in the game. The car explode on the bridge. My units were on the normal ground Share this post Link to post Share on other sites
Flat!!! 0 Posted May 19, 2007 Roger. Keep reporting anything you find I really need someone to report bugs ideas and improvments Share this post Link to post Share on other sites