OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting Multiplayer => Topic started by: USM-CPT.Dyson on 28 Jun 2008, 16:15:52

Title: CTI_SectorLink Help
Post by: USM-CPT.Dyson on 28 Jun 2008, 16:15:52
Okay I've started work on a CTI. My plan is to implement many realistic scripts. Having an issue with 2 right now. The 1st is Mando Hitching, seems like BASf is causing an issue or possibly I killed it somehow. The 2nd is OFPEC ILS. When I downloaded the example I copied the entire file over, added the correct lines to the description.ext, and then added the init line to the unit. But, when I go into the mission, and select start ILS, it says resource missions ofpec_AirportSelector. Anyone???
Title: Re: CTI_SectorLink Help
Post by: USM-CPT.Dyson on 28 Jun 2008, 19:01:18
If this helps, http://files.filefront.com/CTI+SectorLink+Beta4zip

If someone doesn't mind taking a look that would be great.
Title: Re: CTI_SectorLink Help
Post by: loki72 on 28 Jun 2008, 20:50:20
greetings,

plz edit you first post, instead of double posting... :)

the mando hitching in warfare was discussed and solved in this thread:
http://www.ofpec.com/forum/index.php?topic=31620.0  pages 2-3

dig a little more.. i know the ofpec IL was also addressed for warfare... but i don't remember which thread at the moment.

help it helps

Title: Re: CTI_SectorLink Help
Post by: USM-CPT.Dyson on 29 Jun 2008, 20:46:44
Hmm, well looks like I had an issue with the Hitch that I solved without knowing at at some point. During the process I disabled it for testing purposes, and exported it to the MP Missions. Thus, when I tested in MP it didn't work  :clap:

Next, with OFPEC ILS, I merged the example mission into my mission, which as I figured made it work. The downside, now Mando missiles is having issues. Upon firing any missles/flares/bombs, the missile/flares/bombs count is displayed for ~.2 seconds. As well using the action "Show Ordnance" I get the same result.

I'll assume something in the Description.ext is screwed up.

So, ILS and Hitch are working, I just need to find the error with the "Show Ordnance".

Thanks
Title: Re: CTI_SectorLink Help
Post by: Mandoble on 01 Jul 2008, 07:52:08
Your mission link sends me to nowhere in filefront.
Title: Re: CTI_SectorLink Help
Post by: USM-CPT.Dyson on 01 Jul 2008, 19:59:13
http://hosted.filefront.com/Spyder001/

This will be update with other versions when I add fixes
Title: Re: CTI_SectorLink Help
Post by: Mandoble on 01 Jul 2008, 21:27:19
OFPEC_ILS.sqf modified to make it compatible with MMA 2.3, now everything seems to work for me. Modified script attached below.
Title: Re: CTI_SectorLink Help
Post by: USM-CPT.Dyson on 02 Jul 2008, 00:29:06
Thanks so much mando. If you don't mind telling me, what was wrong with it? I'm slowly wanting to learn how to script.
Title: Re: CTI_SectorLink Help
Post by: Mandoble on 02 Jul 2008, 00:38:41
There was an old version of MandoWorldToScreen in ofpec_ils.sqf, Mando Missile uses a new one but their names are the same, so MandoWorldToScreen in your ofpec ILS was renamed. Also Mando Missile HUD uses cutRsc and OFPEC ILS did use the same (and you can only have a cut or title resource visible at a time, one of each type), now your OFPEC ILS uses titleRsc so you may have at the same time both HUDs working together.
Title: Re: CTI_SectorLink Help
Post by: USM-CPT.Dyson on 03 Jul 2008, 15:47:11
Thanks Mando! Works great, that will finish up all the errors in my mission. Now, when I was using a stinger against a cobra, the pilot deployed flares. The missile exploded multiple times on his side. What setting would cause this? Also, would this setting be in the setupai.sqf (edited by me to only replace missiles, so i changed the name to replace_missiles.sqf)?
Title: Re: CTI_SectorLink Help
Post by: USM-CPT.Dyson on 03 Jul 2008, 16:22:09
Update to beta 6, change log on filefront download.

http://hosted.filefront.com/Spyder001/
Title: Re: CTI_SectorLink Help
Post by: Mandoble on 03 Jul 2008, 16:52:11
The missile exploded multiple times on his side.

What do you mean?
Title: Re: CTI_SectorLink Help
Post by: USM-CPT.Dyson on 03 Jul 2008, 19:49:31
The missile seems to pass him, then explode, causing no damage. I believe this would fall under the same category that ArmA Interactive did on the release of 1.12 Beta Patch. I think the fix was to increase damage, but I am not 100% sure.
Title: Re: CTI_SectorLink Help
Post by: Mandoble on 03 Jul 2008, 22:55:08
aha, I thought you where having multiple detonations from a single missile. Yes, Stingers and Strellas are tuned down a lot in everything, damage, maneouverability and acquisition arcs.
If you want to modify the replacement parameters for these missiles you should modify mando_replacemissile.sqf.
Title: Re: CTI_SectorLink Help
Post by: Mandoble on 04 Jul 2008, 22:51:29
Which setup for the Kamov? Targets available (vehicles, air, REMOTE) ? Kind of weapons (unguided like TOW for AG)?
Title: Re: CTI_SectorLink Help
Post by: USM-CPT.Dyson on 05 Jul 2008, 03:45:44
Well this is weird I remember posting but i no longer see it, and u just replied to it lol. Ah the Kamov is going to have the exact same capabilities as your default Cobra. The only difference is that I need all the controls on the pilot.

Message that was posted in wrong thread

Quote
Thanks Mando and thanks Spooner (especially with getting you other scripts into my mission). So far, in non battle MP testing, all scripts are running great. I ran into an issue a while back with mando missile "Show Ordnance" action, but it seems to be fixed. I think it was because of my init file being such a mess. Also, Mando hitch would leave me with 2 actions to "Pick up", but I also think it's okay now.

Now it's time for the OPFOR side, which is all set-up now EXCEPT for the Su34, Su34B, and Kamov. Mando, I want the gunner to have to target and fire, leaving the pilot with the use of flares. And of course there is only 1 gunner in the Kamov. He needs control over everything. And set-up suggestions as far as the ketset files?
Title: Re: CTI_SectorLink Help
Post by: Mandoble on 05 Jul 2008, 04:43:06
Well, you posted in another thread, I replied here. Actually I have several "default cobras" while you can build as many different types as needed. You can see them in mando_target.sara demo mission:
- Hellfire, boresight lock.
- Hellfire guided with scripted laser designator.
- Hellfire LOBL guided with scripted laser designator (the missile first climbs and later dives over the target).
- TOW, manually guided.
Aside of these AG weapons you may add also AA missiles and countermeasures.
Title: Re: CTI_SectorLink Help
Post by: USM-CPT.Dyson on 05 Jul 2008, 06:47:39
Well I'm currently using the lobl set up. So how do I get that to be used by the pilot?
Title: Re: CTI_SectorLink Help
Post by: Mandoble on 05 Jul 2008, 10:13:32
Check the second argument here (http://www.terra.es/personal2/matias.s/mma_readme.htm#t13), which is the same as second argument of mando_assignlaser_by_type.sqf.sqf (0 > driver, 1 > gunner).
Title: Re: CTI_SectorLink Help
Post by: USM-CPT.Dyson on 05 Jul 2008, 20:39:28
Wow that helped a whole lot! Now I understand what I'm writing. I'll look at the example airwar3.Sara for what I'm going to do with the Su-34. I tried an assign by name, got the pilot to have flares, no luck for the gunner yet.
Title: Re: CTI_SectorLink Help
Post by: Mandoble on 05 Jul 2008, 21:14:57
For Su34 there might be a better example here (http://www.ofpec.com/forum/index.php?topic=29031.0): mma_air_combat.sara.zip attachment in the first post.

Title: Re: CTI_SectorLink Help
Post by: USM-CPT.Dyson on 06 Jul 2008, 03:51:08
Oh my eyes. It looks so much different the what i have for everything in my init. LoL thanks for the help, again.
Title: Re: CTI_SectorLink Help
Post by: Mandoble on 06 Jul 2008, 11:23:19
mma_air_combat setup is for AI and players, designed also to be used in aircraft addons. You may use the setup of air war also, but it is for players only.
Title: Re: CTI_SectorLink Help
Post by: USM-CPT.Dyson on 08 Jul 2008, 02:40:33
Thanks Mando, I'll just use the init lines from airwar until I decide to add AI to my CTI.

Could someone please help me with a scripted objective system. I have no idea what commands I need to use. I've looked in the COMREF but I don't know much to start with!!!

Okay now that I have calmed down. First thing I want is to not have to require me to use multiple triggers per objective. Id rather place triggers, and then write a .sqs to do all the work. First I need to know what commands to use to detect if OPFOR and BLUFOR are present. Anybody?
Title: Re: CTI_SectorLink Help
Post by: Mandoble on 08 Jul 2008, 21:09:01
if you dont want to use triggers, then you may use vehicles array, this special array contains all the units present in the mission so:
Code: [Select]
if (({side _x == west} count vehicles) > 0) then {hint "WEST units are present in the map";};
You also may create triggers inside a script and then check their lists of units:
Code: [Select]
// _pos = position of the trigger, _maxrange = radius of the trigger
   _trigger = createTrigger ["EmptyDetector", _pos];
   
   _trigger setTriggerActivation ["WEST", "PRESENT", false];
   _trigger setTriggerArea [_maxrange, _maxrange, 0, false];
   _trigger setTriggerType "NONE";
   _trigger setTriggerStatements ["this", "", ""];
   _trigger setTriggerTimeout [0, 0, 0, false ];
   Sleep 1;
   if ((count list _trigger) > 0) then
   {
      hint "WEST units are present in the area";
   };
   deleteVehicle _trigger;
Title: Re: CTI_SectorLink Help
Post by: USM-CPT.Dyson on 08 Jul 2008, 22:17:43
Thanks, I'm also now looking into your Power Balance script (Spooner pointed it out). Is this correst for multiple triggers, cause it keeps counting units in the trigger tr_2.

Code: [Select]
checkbalance.sqf

_balance = [tr_1, 10, 20, 1, 2, 1] call mando_getbalance
_balance = [tr_2, 10, 20, 1, 2, 1] call mando_getbalance
;Time to show the results
hint format["Trigger's area power distribution:\n\nBLUFOR power: %1\nOFPOR power: %2\nIndependent power: %3\nCivilian power: %4\n\nBLUFOR ratio: %5\nOPFOR ratio: %6\nIndependent ratio: %7\nCivilian ratio: %8\n\nWinners: %9", _balance select 0,_balance select 1,_balance select 2,_balance select 3,_balance select 4,_balance select 5,_balance select 6,_balance select 7,_balance select 8]
exit

Title: Re: CTI_SectorLink Help
Post by: Mandoble on 08 Jul 2008, 22:58:14
You might also modify mando_getbalance.sqf to accept a list of units instead of a trigger.
Just remove _units = list _trigger; and change _trigger     = _this select 0; by _units     = _this select 0;
and then just pass an array of unit to the function.
Title: Re: CTI_SectorLink Help
Post by: USM-CPT.Dyson on 09 Jul 2008, 01:57:04
_balance = [?What goes here?, 10, 20, 1, 2, 1] call mando_getbalance
;Time to show the results
hint format["Trigger's area power distribution:\n\nBLUFOR power: %1\nOFPOR power: %2\nIndependent power: %3\nCivilian power: %4\n\nBLUFOR ratio: %5\nOPFOR ratio: %6\nIndependent ratio: %7\nCivilian ratio: %8\n\nWinners: %9", _balance select 0,_balance select 1,_balance select 2,_balance select 3,_balance select 4,_balance select 5,_balance select 6,_balance select 7,_balance select 8]
exit
Title: Re: CTI_SectorLink Help
Post by: Mandoble on 09 Jul 2008, 10:12:12
By default, there goes the name of a trigger covering the area you want to check, but if you change the code following my indications above, then that first parameter would be just an array of units. They way you use to fill up that array would be up to you and the check balance function will use these units instead of the units present within the area of a trigger.
Title: Re: CTI_SectorLink Help
Post by: USM-CPT.Dyson on 13 Jul 2008, 16:15:11
Could you post the codes because I'm not understanding this. I'm also going to be have many of these triggers, they will need to be taken in the correct order per side. The goal is to take all points (which have their own markers with changeable colors).
Title: Re: CTI_SectorLink Help
Post by: Mandoble on 14 Jul 2008, 12:26:18
So you already have a list of triggers covering the areas which power balance you want to check?
Code: [Select]
_balance = [tr_1, 10, 20, 1, 2, 1] call mando_getbalancefirst parameter is the name of a trigger or directly a trigger object.

// Parameters:
//    trigger name which units will be tested (usually ANYBODY present type).
//    Added power value per armoured type unit present
//    Added power value per flying type unit present
//    Added power value per ship type unit present
//    Heights control bonus (who controls the heights has its power value muntiplied by this, only with an advantage of more than 5m over other sides).
//    Strategic bonus (all power values for this trgger are multiplied by this, the power presence in some triggers may be
//    more important than in other triggers).

//    This function returns an array with the following format:
//    [BLUFOR power, OPFOR power, Independent power, Civilian power, BLUFOR ratio, OPFOR ratio, Independent ratio, civ ratio, winner sides]
//    ratios are like % of total power present in the trigger's area.
//    winner sides is an array with the side with more power, or more than one side in case of draw

For your case:
Code: [Select]
// check_global_balance.sqf
private["_balance", "_total_balance", "_markers_ranges", "_i"];
_positions_ranges = [["mk_paraiso", 2000],["mk_rahmadi", 1500], ["mk_airport", 1500]];
_trigger = createTrigger ["EmptyDetector", [0,0]];   
_trigger setTriggerActivation ["ANY", "PRESENT", false];
_trigger setTriggerArea [1, 1, 0, false];
_trigger setTriggerType "NONE";
_trigger setTriggerStatements ["this", "", ""];
_trigger setTriggerTimeout [0, 0, 0, false ];

while {true} do
{
   _i = 1;
   {
      _trigger setTriggerArea [_x select 1,  _x select 1, 0, false];
      _trigger setPos getMarkerPos (_x select 0);
      Sleep 1;
      _balance = [_trigger, 10, 20, 1, 2, 1] call mando_getbalance;
      _total_balance = [((_total_balance select 0) + (_balance select 4))/_i, ((_total_balance select 1) + (_balance select 5))/_i, ((_total_balance select 2) + (_balance select 6))/_i,((_total_balance select 3) + (_balance select 7))/_i];
      _i = _i + 1;
   } forEach _positions_ranges;
   
   /* Here _total_balance contains the global % of power for west, east, resistance and civilian sides
      _total_balance select 0: West % of power in the map
      _total_balance select 1: East % of power in the map
      _total_balance select 2: Resistance % of power in the map
      _total_balance select 3: Civilian % of power in the map
   */

   Sleep 1;
};

Code: [Select]
// init.sqf

if (isServer) then
{
   mando_getbalance = compile (preprocessFileLineNumbers "mando_getbalance.sqf");
   Sleep 1;
   []execVM"check_global_balance.sqf";
};

This way you dont need to define any trigger in the map, just some markers and the radius to be checked from each one (_positions_ranges array).
Title: Re: CTI_SectorLink Help
Post by: USM-CPT.Dyson on 26 Jul 2008, 00:01:11
Yes I have pre-placed triggers, but could delete them and only place markers. I really dont understand what I need to change in order to do this.

Here is what I want in the objective script. Could you highlight where I would place the marker names please. Also I didn't follow still what I was changing the post before your last.

__________________________________________________

Here is what I am looking to do

Settings

Min players to start capture: 6 Points
Time to capture: 5 Minutes

Objectives MUST be taken in order

Both linking objectives MUST be taken

No enemy can be present or timer is reset
________________________________________________________________________________

Objective Layout

BLUFOR START | OPFOR END

   Parasio Airport (PA)

      PA1
      PA2
      PA3
      PA4
      PA5
      PA6
      PA7

      Links:
      PA_SM1
      PA_SM2

   Sierra Madre (SM)

      SM1
      SM2
      SM3
      SM4
      SM5
      SM6
      SM7

      Links:
      SM_CZ1
      SM_CZ2

   Corazol (CZ)

      CZ1
      CZ2
      CZ3
      CZ4
      CZ5
      CZ6
      CZ7

      Links:
      CZ_OG1
      CZ_OG2

   Obregan (OG)

      OG1
      OG2
      OG3
      OG4
      OG5
      OG6
      OG7

      Links:
      OG_VC1
      OG_VC2

   Valle De Carmen (VC)

      VC1
      VC2
      VC3
      VC4
      VC5
      VC6
      VC7

OPFOR START | BLUFOR END
Title: Re: CTI_SectorLink Help
Post by: Mandoble on 26 Jul 2008, 00:09:18
The marker names and the range to check from each marker are into
Code: [Select]
_positions_ranges = [["mk_paraiso", 2000],["mk_rahmadi", 1500], ["mk_airport", 1500]];
Title: Re: CTI_SectorLink Help
Post by: USM-CPT.Dyson on 28 Sep 2008, 05:39:28
Was wondering about this. I am looking to replace the BIS smoke grenade with smoke particles of my own. Instead of constantly bugging Spooner and before he blocks me, I was wondering if anyone can point me in the right direction.

okay here is an update made by DaChevs (who wrote the whole thing for me :yes:)!!!

Code: [Select]
//===================================

// Smoke_Check.sqf - Sep 28, 2008
// Created By: DaChevs
// Particle Effects Selected By: USM-CPT.Dyson
// Thanks To: CSL Particle Parameter Utility V2
//     By: ColonelSandersLite

//===================================

while {alive player} do
{
_smoke = nearestObject [player, "SmokeShell"];

if (!(isNull _smoke)) then
{
_log = "Logic" createVehicle (getPos _smoke);


//Put your particle effects here.
//Spawn it using the _xpos,_ypos and _zpos


_particleSource = "#particlesource" createVehicle (getPos player);

_particleSource setParticleCircle [10, [2, 0, 0]];
_particleSource setParticleRandom [0, [0, 0, 0], [0.54, 0.54, 0], 0, 0.25, [1e-005, 1e-006, 1e-006, 0.2], 0, 0];
_particleSource setParticleParams [["\Ca\Data\ParticleEffects\FireAndSmokeAnim\SmokeAnim.p3d", 8, 5, 1], "", "Billboard", 1, 15, [0, 0, 0], [2, 0, 0], 1, 12, 10, 0.2, [5, 10, 25, 35, 45, 50], [[0.9, 0.9, 0.9, 0.4], [0.9, 0.9, 0.9, 0.2], [0.9, 0.9, 0.9, 0], [0.9, 0.9, 0.9, 0]], [2, 1], 0, 0, "", "", SmokeLogic];
_particleSource setDropInterval 0.08;
_particleSource setPos (getPos _log);


//Delete the smokegrenade.
deleteVehicle _smoke;

Sleep 2;
};
Sleep 1;
};

Except it doesn't work. Anyone?

Just kidding, works awesome. Only thing missing now is when the smoke grenades speed reaches 0, it THEN needs to be deleted. Still be help with that bit.

Thanks to DaChevs!
Title: Re: CTI_SectorLink Help
Post by: myke13021 on 30 Sep 2008, 01:59:39
Hmmm, it's odd to use a neverending loop for this purpose....but as you say DaChevs wrote the script......no comment, at least it worked so far.  ;)

IMHO an Eventhandler "fired" would fit better for this purpose. I wrote something that may work, give it a try:

Code: (smoker.sqf) [Select]
//////////////////////////////////////////////////////////////////
// player addEventHandler ["fired", {_this execVM "smoker.sqf"}]
// Created by: [GLT]Myke
//////////////////////////////////////////////////////////////////
_unit = _this select 0;
_weapon = _this select 1;
_stopped = false;
_timestamp = 0;
if (_weapon == "Throw") then {
_shell = nearestObject [_unit, "SmokeShell"];
if (isnull _shell) exitwith {};
_timestamp = time;
while {!_stopped} do {
_velX = velocity _shell select 0;
_velY = velocity _shell select 1;
if ((_velX == 0) && (_velY == 0)) then {
_stopped = true;
};
if (time > (_timestamp + 2)) then {
_stopped = true;
};
sleep 0.1;
};
_smokepos = getpos _shell;
deletevehicle _shell;
_particleSource = "#particlesource" createVehicle _smokepos;
_particleSource setParticleCircle [10, [2, 0, 0]];
_particleSource setParticleRandom [0, [0, 0, 0], [0.54, 0.54, 0], 0, 0.25, [1e-005, 1e-006, 1e-006, 0.2], 0, 0];
_particleSource setParticleParams [["\Ca\Data\ParticleEffects\FireAndSmokeAnim\SmokeAnim.p3d", 8, 5, 1], "", "Billboard", 1, 15, [0, 0, 0], [2, 0, 0], 1, 12, 10, 0.2, [5, 10, 25, 35, 45, 50], [[0.9, 0.9, 0.9, 0.4], [0.9, 0.9, 0.9, 0.2], [0.9, 0.9, 0.9, 0], [0.9, 0.9, 0.9, 0]], [2, 1], 0, 0, "", "", SmokeLogic];
_particleSource setDropInterval 0.08;
};

Should work pretty well although it surely needs to be tested for MP.
Title: Re: CTI_SectorLink Help
Post by: Spooner on 30 Sep 2008, 03:00:27
Yes, using event handlers is 100% better than using the original method, which was CPU intensive and wouldn't really work anyway.

Still, the event-handler version won't work for MP, since FIRED events are only local for thrown weapons (for weapons that shoot, they seem to be global). No idea why, but that is how it is. Even if the handler was global, you'd have a nasty race-state, in that the local version would sometimes delete the thrown grenade before the remote versions did, so they wouldn't know where to put the particles.
Title: Re: CTI_SectorLink Help
Post by: USM-CPT.Dyson on 30 Sep 2008, 06:32:28
Thanks myke! So what I want to know is if fired event handlers are better, but not for MP, is there something the server can to that would better sync it self with the player?
Title: Re: CTI_SectorLink Help
Post by: myke13021 on 30 Sep 2008, 11:16:06
@Spooner

Sorry if i ask stupid questions but in this case, does it matter if the EH is only locally triggered? I know that this method wont work for AI thrown smokeshells but as they use pretty rarely the smokeshells (unless a script tell them to do so) it is manly for players.

As a player throws a smokeshell, the "fired" EH would launch the script locally on players client. But as "deletevehicle" and "createvehicle" are global commands, the smokeshell should be deleted everywhere and also the particlesource should be created everywhere.

Or am i missing a point somewhere?
Title: Re: CTI_SectorLink Help
Post by: Spooner on 30 Sep 2008, 14:06:07
"#ParticleSource" is a local-only object, so even if you attempt to create it globally with createVehicle, it will just exist locally (it is usual to create it with createVehicleLocal to avoid confusion). Thus, all particle effects, whether generated by a "#ParticleSource" object or the drop command, need to be created locally.

You are still a lot better just using the local fired event, but then broadcasting the location at which you wish to produce the smoke (I do something like this for my Molotov script, which needs to be broadcast anyway, so it can damage people locally as well as produce local particle effects).
Title: Re: CTI_SectorLink Help
Post by: myke13021 on 30 Sep 2008, 15:26:01
Ah ok, i see the matter. So to make this MP compatible it would need first the "fired" EH to catch the thrown smokeshell and the place where it landed. then packing these coords into an public array which is broadcasted with publicvariable and finally a publicVariableEventhandler initiated script which creates the particelsource on all other clients.

No big deal as far as i can judge.

@USM-CPT.Dyson

if you need this done, say a word. I guess it will take 10 mins to write it.
Title: Re: CTI_SectorLink Help
Post by: USM-CPT.Dyson on 30 Sep 2008, 20:12:01
Sure Myke if you don't mind. Thanks guys for all the help. I want so much in this CTI that BIS should have added in.
Title: Re: CTI_SectorLink Help
Post by: myke13021 on 30 Sep 2008, 22:29:47
Ok, here i wrote a little thing for you. To activate the whole thing, just insert this line into your init.sqf script.

Code: (smoker_init.sqf) [Select]
if (isServer && (!local player)) exitwith {};
glt_smoker_position = [];
"glt_smoker_position" addPublicVariableEventHandler {nul = this execVM "smoker_updater.sqf"};
player addEventHandler ["fired", {_this execVM "smoker.sqf"}];

As you see, this will add the EH to the player and will also prepare the clientscript to make the smoke appear on all clients.

Code: (smoker.sqf) [Select]
_unit = _this select 0;
_weapon = _this select 1;
_stopped = false;
_timestamp = 0;
if (_weapon == "Throw") then {
_shell = nearestObject [_unit, "SmokeShell"];
if (isnull _shell) exitwith {};
_timestamp = time;
while {!_stopped} do {
_velX = velocity _shell select 0;
_velY = velocity _shell select 1;
if ((_velX == 0) && (_velY == 0)) then {
_stopped = true;
};
if (time > (_timestamp + 2)) then {
_stopped = true;
};
sleep 0.1;
};
glt_smoker_position = getpos _shell;
publicvariable "glt_smoker_position";
deletevehicle _shell;
_particleSource = "#particlesource" createVehicle glt_smoker_position;
_particleSource setParticleCircle [10, [2, 0, 0]];
_particleSource setParticleRandom [0, [0, 0, 0], [0.54, 0.54, 0], 0, 0.25, [1e-005, 1e-006, 1e-006, 0.2], 0, 0];
_particleSource setParticleParams [["\Ca\Data\ParticleEffects\FireAndSmokeAnim\SmokeAnim.p3d", 8, 5, 1], "", "Billboard", 1, 15, [0, 0, 0], [2, 0, 0], 1, 12, 10, 0.2, [5, 10, 25, 35, 45, 50], [[0.9, 0.9, 0.9, 0.4], [0.9, 0.9, 0.9, 0.2], [0.9, 0.9, 0.9, 0], [0.9, 0.9, 0.9, 0]], [2, 1], 0, 0, "", "", SmokeLogic];
_particleSource setDropInterval 0.08;
};
glt_smoker_position = [];
Code: (smoker_updater.sqf) [Select]
_particleSource = "#particlesource" createVehicle glt_smoker_position;
_particleSource setParticleCircle [10, [2, 0, 0]];
_particleSource setParticleRandom [0, [0, 0, 0], [0.54, 0.54, 0], 0, 0.25, [1e-005, 1e-006, 1e-006, 0.2], 0, 0];
_particleSource setParticleParams [["\Ca\Data\ParticleEffects\FireAndSmokeAnim\SmokeAnim.p3d", 8, 5, 1], "", "Billboard", 1, 15, [0, 0, 0], [2, 0, 0], 1, 12, 10, 0.2, [5, 10, 25, 35, 45, 50], [[0.9, 0.9, 0.9, 0.4], [0.9, 0.9, 0.9, 0.2], [0.9, 0.9, 0.9, 0], [0.9, 0.9, 0.9, 0]], [2, 1], 0, 0, "", "", SmokeLogic];
_particleSource setDropInterval 0.08;
glt_smoker_position = [];

As you see, the smoker.sqf does manage the smoke on the client that has thrown the smokeshell and also does update the publicvariable glt_smoker_position which will then launch the smoker_updater.sqf on the other clients so they will also get the new smoke.

As always, test it as much as you can to make sure it work as expected.
Title: Re: CTI_SectorLink Help
Post by: USM-CPT.Dyson on 30 Sep 2008, 23:20:24
I will test as soon as I get to my house in a few minutes. Thanks Myke you rock!
Title: Re: CTI_SectorLink Help
Post by: myke13021 on 30 Sep 2008, 23:28:17
Naw.....Spooner rocks....Mandoble rocks....i am just an Intermezzo.  :D
Title: Re: CTI_SectorLink Help
Post by: Spooner on 01 Oct 2008, 00:22:47
Well, buttering me up often encourages me to help out...(but don't lay it on too thickly ;P).

In MP (unless you are the host), the player object won't exist right away when init.sqf is run, thus you need to wait a little while, or you will add the handler to objNull (which is the value of player until it is created):
Code: (smoker_init.sqf (extract)) [Select]
waitUntil { alive player };
player addEventHandler ["fired", {_this execVM "smoker.sqf"}];

You get more info from the fired handler, which means you can avoid accidentally picking up a smoke grenade that has already been thrown 40m away, when you are firing off your AK:
Code: (smoker.sqf (extract)) [Select]
_unit = _this select 0;
_weapon = _this select 1;
_muzzle = _this select 2;
_mode = _this select 3;
_roundClass = _this select 4;
if (roundClass  == "SmokeShell") then
{
    _shell = nearestObject [_unit, "SmokeShell"]; // Guaranteed to find something, since we know we just threw one.

Objects often don't have 0 velocity when they have apparently stop moving, which you probably noticed. Thus, you might try:
Code: (smoker.sqf (extract)) [Select]
    // Using distance from [0, 0, 0] is a cheat way to find out the magnitude of a velocity vector (i.e. its speed).
    waitUntil { ((velocity _shell) distance [0, 0, 0]) < 0.1 };

EDIT: Had written _velocity when I meant velocity
Title: Re: CTI_SectorLink Help
Post by: myke13021 on 01 Oct 2008, 18:09:06
As i said before: Spooner rocks! *headbanging*

As a sidenote to the smoker.sqf changes given by Spooner:
As in the script there's no use for _weapon, _muzzle and _mode, these lines can be left out completely:
Code: ((smoker.sqf (extract))) [Select]
_unit = _this select 0;
_roundClass = _this select 4;
if (roundClass  == "SmokeShell") then

It doesn't mess up anything if it's there and surely if you start a script it's good to have all properly written down but i guess at the end, eliminating lines that aren't for any use keeps the scripts as short as possible.


@Spooner
Gimme more of this headbanging sound, mate.  :clap: :good:
Title: Re: CTI_SectorLink Help
Post by: USM-CPT.Dyson on 01 Oct 2008, 22:03:14
I musta done something wrong when changing the script how you set it Spooner. It doesn't work :(
Title: Re: CTI_SectorLink Help
Post by: myke13021 on 01 Oct 2008, 23:48:20
Hmmm....at one "roundclass" there's a missing underline.

Code: [Select]
_unit = _this select 0;
_roundClass = _this select 4;
if (_roundClass  == "SmokeShell") then
As you say "It doesn't work" maybe this solves the problem. Else try to be more descriptive. A way to see if a script at least runs, adding hints here and there (best inside if then statements) can track if the script runs and if it runs correct way.

I use most often
Code: [Select]
hint "duh";
if it's only to see if it reaches certain positions. Using
Code: [Select]
hint format ["%1", _a_variable_you_need_to_check];
often helps to check if certain variables have the value they supposed to have there.
Title: Re: CTI_SectorLink Help
Post by: USM-CPT.Dyson on 01 Oct 2008, 23:56:44
Yeah Im sorry I sound like an idiot "Derr, it does not wurk"...

Lol, okay so I added the _ before round class. Works great, except the smoke from the regular grenade deploys before being deleted. Also, my particle effects don't start. Ill try adding in hints.
Title: Re: CTI_SectorLink Help
Post by: Spooner on 02 Oct 2008, 01:07:39
Here is a shortcut from using format, which can be a bit fiddly:
Code: [Select]
hint str [_a_variable_you_need_to_check, _othervalue, andAnother];

Yeah, sorry, when you accept code fragments, you have to assume I can't type properly and I haven't tested it ;P There were several other problems with the script though, which is why it still won't work; I was just pushing you in the right direction, not doing it all for you.

However, something I did double-check is that the speed of a grenade doesn't always go below 0.1mps, so 0.5mps seems like a better minimum speed:
Code: [Select]
waitUntil { ((velocity _shell) distance [0, 0, 0]) < 0.5 };

EDIT: OK, I relented!

Code: (smoke_init.sqf) [Select]
// Run this from init.sqf with:
//   [] execVM "smoke_init.sqf"

if (isServer && (isNull player)) exitWith {}; // Don't run anything on dedicated server

// Precompile functions.
glt_smoker = compile preprocessFileLineNumbers "smoker.sqf";
glt_smoker_updater = compile preprocessFileLineNumbers "smoker_updater.sqf";

// Wait until dedicated clients have spawned the player object.
waitUntil { alive player };

// Do something every time the local player fires.
player addEventHandler ["FIRED", glt_smoker];

// Be informed every time a non-local player throws smoke.
"glt_smoker_position" addPublicVariableEventHandler
{
(_this select 1) spawn glt_smoker_updater;
};

Code: (smoker.sqf) [Select]
_unit = _this select 0;
_ammoClass = _this select 4;

if (_ammoClass == "SmokeShell") then
{
_shell = nearestObject [_unit, _ammoClass];

[_shell] spawn
{
_shell = _this select 0;

// Wait until the grenade comes to a standstill.
waitUntil { ((velocity _shell) distance [0, 0, 0]) < 0.5 };

// Tell all other machines to show smoke.
glt_smoker_position = [getPos _shell];
publicVariable "glt_smoker_position";

// Show smoke on the local machine.
glt_smoker_position spawn glt_smoker_updater;

deleteVehicle _shell;
};
};

Not sure what smoke effect you were trying to achieve, but there were several problems with the stuff you were trying to do. At least here you can move from something that does work:
Code: (smoker_updater.sqf) [Select]
_pos = _this select 0;

_particleSource = "#ParticleSource" createVehicleLocal _pos;
_particleSource setParticleRandom [0, [1, 1, 0], [0.54, 0.54, 0], 0, 0.25, [0, 0, 0, 0.2], 0, 0];

_logic = "Logic" createVehicleLocal _pos;
_logic setPos _pos;

_particleSource setParticleParams [
["\Ca\Data\ParticleEffects\FireAndSmokeAnim\SmokeAnim.p3d", 8, 5, 8],
"", "Billboard", 1000, 15, [0, 0, 0], [0, 0, 0], 1, 12.75, 10, 2, [2, 4, 7],
[[0.9, 0.9, 0.9, 0.4], [0.9, 0.9, 0.9, 0.2], [0.8, 0.8, 0.8, 0.1]],
[0.5, 0.5, 0.5], 0, 0, "", "", _logic];
_particleSource setDropInterval 0.08;

// Keep the particles flowing for a while, but stop them after 60 seconds.
sleep 60;

deleteVehicle _particleSource;
deleteVehicle _logic;

NOTE: Tested in SP only, since I'm not currently using a PC that could run 2 clients without falling in a heap ;P Reasonably sure it would be fine in MP though (but I could be wrong).

EDIT: [] should have been ()...sorry
Title: Re: CTI_SectorLink Help
Post by: myke13021 on 02 Oct 2008, 02:09:18
Quote
Yeah Im sorry I sound like an idiot "Derr, it does not wurk"...
Sorry, didn't want to name you an idiot. Just trying to get as much info as possible to see where it hangs, thats all.
You see the smoke from the real smokeshell sometimes because in Spooners version the timecheck is removed. I've added it exactly because of this behaviour. Smokeshells start to smoke (not only on the water) 2 seconds after being thrown. Sometimes the shell bumps a few time off the ground so it takes more than 2 seconds before it comes to a rest. And thats why you sometimes see the smoke from the shell.
Maybe for this case, implementing the old code in this part is best workaround, although still not perfect. Basically it started your smoke if a). the smokeshell came to a rest or b). after 2 seconds, whatever happened first.
This is a bit of downgrade in realism as the smokeshell won't bump off as much as "untouched". So it's kinda less accurate. It's up to you what you prefer: downgrade in accuracy (but i guess this isn't the major point with smokeshells) or bits of "original smoke" as the smokeshell is still humping around.

I'm off now, looking for my Deep Purple CD...somehow i want to listen to "Smoke on the water" really hard.
Title: Re: CTI_SectorLink Help
Post by: USM-CPT.Dyson on 02 Oct 2008, 03:03:50
Thanks Spooner holy crap your my hero! Yeah the effect I created before looked pretty good from a distance. But, it appears that when you zoom in you can see through a lot of the random smoke. So what you saw was the very 1st smoke effect I created. The newest one is much better. I basically just added a East to West wind and lengthened the lifetime. Thus creating a really realistic and obstructing smoke effect. Like I said those a few problems:

- Zooming with with binoculars is even worse (you see none of the random smoke effects)
- If your in the smoke, just like BIS smoke grenades, you can see see through really well in some instances.

I did a pretty good job with what I have no. The only solution I can think of is adding a "white" effect to players near the smoke. Any suggestions guys?

As far as the script I'll get some guys to MP test tomorrow. But yes the smoke shell will deploy BIS smoke for ~ .5 seconds. So should some variables be tweaked?

Edit: Holy crap using
Code: [Select]
["\Ca\Data\ParticleEffects\FireAndSmokeAnim\SmokeAnim.p3d", 8, 5, 8] made it look way better thanks spooner. Also blocks view MUCH better/ :clap:

(http://screenshot.xfire.com/screenshot/large/aeafda33264d9cf5d9a8fb2df9f532191925afd2.jpg)

Edit 2: Okay last revision lol. I added more to "Alpha". When doing this I need to be careful, to much makes it look really blotchy. Also, Spooner and Myke you guys are awesome. That you so much for helping me I really do appreciate it guys (and Myke you do rock).
Title: Re: CTI_SectorLink Help
Post by: Spooner on 03 Oct 2008, 00:20:02
You really don't want to add any drift to the smoke, since it might not coincide with the actual wind direction in the game. I increased the rubbing (a bad translation of "friction") factor of the particles to make them travel sideways, being pushed by the ArmA wind. Your original particles had very low rubbing, so they were not affected by the wind to any degree.

Yes, Myke, I saw that you had the 2s limit for smoke generation, but I removed it because I think it is better to get a second of "wrong" smoke while the grenade is flying or bouncing, than having the "right" smoke appear mid-air when the grenade is still flying or bouncing. Well, Dyson can decide which is a bigger problem.

As far as seeing through smoke, I think it is intentional decision by BIS. If you are looking through at any distance  smoke you can't see too well, but if you are close to it or inside it then it is barely visible. That is a fundamental trait of using BIS particles, not easily fixable.
Title: Re: CTI_SectorLink Help
Post by: USM-CPT.Dyson on 03 Oct 2008, 18:37:49
I will stick with Spooner's method. That little bit of BIS smoke is fine plus you get more range with your throw. Thanks guys, again, I really appreciate it. Heh, now I need to get back on the main topic of this CTI which is the objectives. I REALLY REALLY want to use mando power. But, sorry mando I read your PM like 100 times, I still can not figure it out.

You said use:

[tr_1, script follows here];
[tr_2, script follows here];

You said that tr_2 would override tr_1. But will that allow me to walk into tr_1, and register me there so I can capture the objective. Then, can I walk into tr_2 and take that objective. I need to get that part so I can get all the objectives placed all around the map and just registering that any BLUFOR or OPFOR are in the zone.