Home   Help Search Login Register  

Author Topic: Smoke Script needed for MP game  (Read 2227 times)

0 Members and 1 Guest are viewing this topic.

Offline trooper543

  • Members
  • *
Smoke Script needed for MP game
« on: 18 Apr 2009, 13:21:06 »
Hi there again gents

Sorry to trouble you all again with my troubles but i am need of a smoke script with a difference for a clan game test

What i would like the script to do is to allow a smoke grenade to be dropped from a chopper so that it can mark areas for ground elements

if anyone can help me with this request it would be most appreciated. Many thanks in advance
thanks

Offline JamesF1

  • Editors Depot Staff
  • *****
    • JamesBurgess.co.uk
Re: Smoke Script needed for MP game
« Reply #1 on: 18 Apr 2009, 15:27:56 »
You basically need to use createVehicle to spawn a "SmokeShell" at a certain position.  If you read the createVehicle documentation, you'll see it's really easy!

If you're making an MP mission, remember to run this only on the server (see: isServer).

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Smoke Script needed for MP game
« Reply #2 on: 18 Apr 2009, 16:01:20 »
Although you are quite correct that this smoke should only be created once, it should only be created on the player's machine in response to an action available for the pilot of the helicopter. No reason to broadcast the location onto the server just to ensure it is only run once.
Code: (deployHeloSmoke.sqf) [Select]
// Run this script from an addAction with:
//   this addAction ["Drop red smoke", "deployHeloSmoke.sqf", ["RED"], 0, false, true];
// Colours available are red, green or white.
private ["_helo", "_crewman", "_actionIndex", "_params", "_colour"];
_helo = _this select 0;
_crewman = _this select 1;
_actionIndex = _this select 2;
_params = _this select 3;

// Get the requested colour and correct white so the classname will be correct.
_colour = _params select 0;
if ((toUpper _colour) == "WHITE") then { _colour = "" };

// If you want to limit smoke drops, then remove the action with:
// _helo removeAction _actionIndex;

// Create coloured smoke shell under the helo.
("smokeShell" + _colour) createVehicle (_helo modelToWorld [0, 0, -3]);

// Give a general "system" message (rather than have the player talk to himself, which always annoys me ;) ).
private "_system";
_system = "logic" createVehicleLocal [0, 0, 0];
_system globalChat "Smoke deployed";
deleteVehicle _system;
You'll need to add the action to the helo only when the player is in the pilot seat of the aircraft (use getin/getout handlers). I'm just giving you what you absolutely need to get it working and anything more is something to keep you busy...

If this smoke should be scripted, such as the smoke being dropped by AI, then yes, it should be run just on the server in order to ensure it only happens once, but I didn't think this is what you wanted.
« Last Edit: 18 Apr 2009, 16:02:52 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline JamesF1

  • Editors Depot Staff
  • *****
    • JamesBurgess.co.uk
Re: Smoke Script needed for MP game
« Reply #3 on: 18 Apr 2009, 17:32:54 »
True enough, Spooner - the player machine makes far more sense in this case.  :good:

Offline trooper543

  • Members
  • *
Re: Smoke Script needed for MP game
« Reply #4 on: 18 Apr 2009, 19:15:59 »
@SPOONER

Many thanks for this boss!! Your Sir are a scholar and gentleman will let you know how this goes and send feedback sir !

@JamesF1

Thanks again mate you to are a gent and scholar many thanks for your support and response

@ SPOONER

Mate this works spot on, thank you !! If I may ask is there a way to have a second version of this script that will allow a plane to drop a few flares. The reason why is that we would like to include it in our clan night mission where a plane drops an illumination flare to light up the area, Again if you could please assist us in this matter i would be very much in your debt.......

« Last Edit: 19 Apr 2009, 20:43:28 by trooper543 »

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Smoke Script needed for MP game
« Reply #5 on: 21 Apr 2009, 12:59:17 »
I'm assuming you are creating the action as part of a vehicle addon based on your PM, so I will continue to ignore special scripting to prevent you being able to see the action if you are not in the pilot's seat. Probably easier to make the original script more generic than to make a separate script for flares:
Code: (deployFromHelo.sqf) [Select]
// Run this script from an addAction with:
//   this addAction ["Drop red smoke", "deployFromHelo.sqf", ["SmokeShellRed", "Smoke deployed!"], 0, false, true];
//   this addAction ["Drop yellow flare", "deployFromHelo.sqf", ["F_40mm_Yellow", "Flare deployed!"], 0, false, true];
// Colours available are red, green or white.
private ["_helo", "_crewman", "_actionIndex", "_params", "_class", "_message"];
_helo = _this select 0;
_crewman = _this select 1;
_actionIndex = _this select 2;
_params = _this select 3;
_class = _params select 0;
_message = _params select 1;

// If you want to limit smoke drops, then remove the action with:
// _helo removeAction _actionIndex;

// Create coloured smoke shell under the helo.
_class createVehicle (_helo modelToWorld [0, 0, -3]);

// Give a general "system" message (rather than have the player talk to himself, which always annoys me ;) ).
private "_system";
_system = "logic" createVehicleLocal [0, 0, 0];
_system globalChat _message;
deleteVehicle _system;
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline trooper543

  • Members
  • *
Re: Smoke Script needed for MP game
« Reply #6 on: 21 Apr 2009, 15:58:56 »
@ Spooner

Many thanks again Sir, Man this works a real treat, If i may ask a further two questions

1. What would the syntax be if i wanted AI to deploy the flare/smoke in a waypoint?

2. Is it possible to adjust the brightness of the flare and only allow the flare to deploy at certian height and last longer (slower in moving towards the ground)

Again thanks in advance for this it is most appreciated


Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Smoke Script needed for MP game
« Reply #7 on: 23 Apr 2009, 14:13:44 »
1. You'd need to remember the ID of the action and use a "USER" action to fire it off.

2. To change how flares/smoke work would take an addon (not my field and lots of people have already made alternatives for this). You could drop more than one flare at once to get more light (and could spray them out in several directions in order to cover a larger area).
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)