![]() |
Ship oil fire effect script
Presenting a small script to create an oil fire on the water after a transport ship is sunk.
How it works: The script tests when an actor is destroyed to see if it's a transport ship. If it is a transport ship, then there is a random chance that a large fire object will be placed on the water where the ship sank. code removed by author |
Great idea! Maybe a smaller fire can be set at locations of plane crashes, especially in cities (with random chance of spreading to the whole city :) ).
|
Great Idea indeed. May I ask for Screenshots/Vids?
|
Hi salmo
Wonderfull scripts for cod-missions this Forum has. Easy to implement in home-made missions, nice to see them perform their specific jobs but not so easy to understand what makes them work. So I decided to enlighten myself a little bit in this respect. I thought I might try to realise this by taking a closer look at a certain script, preferably a relative small one. So I copied your Ship_oil_ fire_effect scrip into Visual Studio Express 2010 as a new project and added the necessary References to it (hereby following Kodiak’s instructions in Tutorial Simple Scripting Lessons I). After this I ploughed myself through the programme, line for line and sometimes the penny dropped, sometimes it got jammed. Much appreciated were the various explanations after double slash. What I failed to understand completely was the line that says: int i = random.Next(0, 100 + 1); Perhaps you would be so kind to help me out. |
You get random Numbers between 0 and 100 ;)
Minimum is 0 Maximum is 100 in the Next- command the first Number is the minimum Value (included) the second is the max Value (excluded) so for all Numbers from 0 to 100 the second Value must be 101. |
Hi LookaLoft, Here's the script again with annotations & detailed comments that may help you get a better understanding of what some of the commands are doing. Copy/paste into Visual C# Express.
code removed by author The int i = random.Next(1, 100 + 1); line generates a random integer between 1 & 100 (inclusive) & stores the value in the variable called i. Hence it's used to determine the "percentage" (1-100) chance of the oil fire occuring. The random integer generated needs to be less than the percent chance you specify for the variable j (int j = 10; ) for the fire object to be spawned. You could change the variable j value to 100 & an oil fire would occur every time a cargo ship was sunk (ie fire occurs 100% of the time), but I thought that might be a bit too boring so I made it just a 10% chance of a fire. I would have liked to have the fire burn for a small (random) length of time, but unfortunately there seems to be no method to de-spawn (destroy) a stationary object via script. |
Thanks a lot salmo and you too Kodiak.
Have a good day. |
All times are GMT. The time now is 05:09 AM. |
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright © 2007 Fulqrum Publishing. All rights reserved.