OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting Resources Beta Testing & Submission => Topic started by: bardosy on 24 Sep 2010, 08:11:31

Title: Geiger counter
Post by: bardosy on 24 Sep 2010, 08:11:31
Realicticly it's not a Geiger counter, but something similar device... I want create a mission, where the player have to stop a civilian who flee with weaponized plutonium in his backpack. The player don't see him, because he left the spot before the player arrived. So player have to find him.

There is no clue what direction the civilian flee, so player have to run in all direction with this device and it will pinging and player have to hear from the pinging, where direction is right... Then he have to follow the "trace" until he have visual contact.

I figured out, in this script have to count the distance between the player and the civvi and add a same time sleep before ping again... But the problem is, it's not a linear thing...
The mission is placed in Takistan... it's deserted, but very hilly. No dense populated area, so the difficulty is not to detect the enemy in a civilian crowd, but to detect the direction... So the pinging period have to change quickly in the farer distance then in closer... When the player is close to 200m, he will see the target, but when he is 1000m he have to hear the difference from pings.

Additionally, I need a good sound for this device and maybe an interface - but it's not so important.


EDIT:

Ok. This is my forst try:

Code: [Select]
_unit = _this select 0;
_target = _this select 1;

LAC_geiger_need = true;

while {LAC_geiger_need} do {
  playSound "geiger";
  _waittime = (_unit distance _target) / 1000;

  Sleep _waittime;

};

It works fine, but it's linear.
Someone can help me to count _waittime to change bigger when target is farer..?
Title: Re: Geiger counter
Post by: F2kSel on 25 Sep 2010, 00:58:10
This probably won't help but I did make it sort of directional and used the hint's ping to act as the sound and it does work reasonably well.

You man need to place function module on the map.

Code: [Select]
LAC_geiger_need = true;

while {LAC_geiger_need} do {
      _unit = _this select 0;
        _target = getpos (_this select 1);
  
  // playsound "geiger";
  
  _amp = [_unit,_target] call BIS_fnc_relativeDirTo ;
  _waittime = (_unit distance _target) / 10000;

if (_amp <0) then
{
_amp = (_amp *-1);
};

if (_amp >180) then
{
_amp =(360 -_amp);
};

hint format ["%1",_amp];
//hint format ["%1",_waittime+(_amp*4)/1000];

  Sleep (_waittime+(_amp*6)/1000);
  
};
Title: Re: Geiger counter
Post by: bardosy on 27 Sep 2010, 08:57:00
Thanks for helping me!

I'll try it tonight... I can't get it yet, but it1s probably change the frequency by the direction? And better direction is produce smaller frequency?


EDIT:

Thanks! I tried it and it works. First time I didn't insert Functions module, just run the sample mission with your script and my brain blown up because the value was unknown and the sleep was practicly zero, so my headphones start to sound a very bad noise... :D But I survive and put the Function module and it works!
Title: Re: Geiger counter
Post by: Mr.Peanut on 28 Sep 2010, 14:39:05
You might find something useful here Bremmer's Geiger Counter (http://www.ofpec.com/ed_depot/index.php?action=details&id=521&game=OFP) even if it is just a sound effect.
Title: Re: Geiger counter
Post by: CaptainBravo on 30 Sep 2010, 17:32:59
Thanks for helping me!

I'll try it tonight... I can't get it yet, but it1s probably change the frequency by the direction? And better direction is produce smaller frequency?


EDIT:

Thanks! I tried it and it works. First time I didn't insert Functions module, just run the sample mission with your script and my brain blown up because the value was unknown and the sleep was practicly zero, so my headphones start to sound a very bad noise... :D But I survive and put the Function module and it works!

Hey bardosy,

Can you share with us an example? I have been trying to get something similar working with no luck.

Great work.
Title: Re: Geiger counter
Post by: bardosy on 01 Oct 2010, 08:58:31
CptBravo:

This is not a simple example mission (http://lacko.pcdome.hu/ArmA2/army07.zip), this is my real mission what uses this geiger stuff. But I hope you can figured out the essence.
If you can't, please note here and I will pack a sample mission for you.
Title: Re: Geiger counter
Post by: Mandoble on 23 Oct 2010, 10:23:32
This might be an interesing addition to be used with MMA Echo/Mando fallout zones. More info with next MMA release.