Home   Help Search Login Register  

Author Topic: enemy see smoke, through smoke  (Read 653 times)

0 Members and 1 Guest are viewing this topic.

Offline baikie

  • Members
  • *
  • I'm a llama!
enemy see smoke, through smoke
« on: 12 Apr 2005, 15:31:02 »
is there a way of making an enemy squad on the map, which see smoke, (REGARDLESS WETHER ITS TRIGGER MADE OR PLAYER MADE). Once the enemy squad sees the smoke, that squad well then throw smoke (or look like they have thrown smoke) towards the players thrown smoke location.

Offline macguba

  • Former Staff
  • ****
    • macguba's operation flashpoint page
Re:enemy see smoke, through smoke
« Reply #1 on: 12 Apr 2005, 15:49:25 »
Yes but it's going to be horrible.   Add eventhandler "fired" to anybody who might fire smoke.    (If the smoke is created by the mission designer, for example in a trigger, then you already know about it so that's easy.)  

Then it gets hard.    I don't know of anyway of detecting who has detected smoke so you'll need a trigger covering the whole  map to give you an array of all enemies, then a script which figures out if any of them have seen the smoke.    Simple version would simply calculate if there are any enemy within say 100m of the smoke thrower and work of that.   Complex version takes account of line of sight and will be very complex, assuming its possible which it may not be.

The easy part at the end is making the enemy throw smoke themselves.
Plenty of reviewed ArmA missions for you to play

Offline RujiK

  • Members
  • *
  • KoKo Puh-Fizzles!
Re:enemy see smoke, through smoke
« Reply #2 on: 12 Apr 2005, 19:24:11 »
Well, i suppose you could try making a dummy smoke grenade for anyone who throws it so you could name it and all. (similar to my bounching grenade script, except no effects, just replace the grenade, or just give it a name)
Then just check ?(_Whoever knowsabout _smoke):Goto"Chuck" or something like that, however this is still pretty vague.
« Last Edit: 12 Apr 2005, 19:25:28 by RujiK »
I like your approach, lets see your departure.
Download the New Flashlight Script!

Bluelikeu

  • Guest
Re:enemy see smoke, through smoke
« Reply #3 on: 25 Apr 2005, 19:18:01 »
basically, you've got the idea about how to check to see if an enemy sees a smoke grenade. Now to make the enemy fire a smoke grenade in the general direction of the smoke grenade.

basic layout:

find linear regression, given the postion of the selected enemy unit, and the position of the smoke grenade.

here's the formula that will get you the slope of the line:

_pos1 is the position of the enemy and _pos2 is the position of the smoke grenade on the ground

_s = (_pos1 select 0) + (_pos2 select 0)
_y = (_pos1 select 1) + (_pos2 select 1)
_q = (_pos1 select 0)^2 + (_pos2 select 0)^2
_l = (_pos1 select 1)^2 + (_pos2 select 1)^2
_p = ((_pos1 select 0)*(_pos1 select 1)) + ((_pos2 select 0)*(_pos2 select 1))
_n = 2;
_d = (_n*_q)-(_s^2)
_m = ((_n*_p)-(_s*_y))/_d


_m is the slope value

Then use this value to set the x and y positions for the smoke grenade

#handle
_pos1 set[1, (_pos1 select 1)+((_m)*_count)/100]
_pos1 set[0, (_pos1 select 0)+(_count)/100]

_count = _count + 1

if(_count == 100)then{_smoke = "smokeshell" camcreate _pos1 ;exit} //When _count is equal to 100, camcreate a smoke grenade there.

Goto "handle"

above will create the smoke grenade. If you don't want to do that, you can order the unit to face towards the direction of the smoke grenade and then order him to fire.

personally that would be better, however, the above script will allow you to check and see if something is blocking the view of the enemy units.

Thanks,
Bluelikeu

Offline Terox

  • Former Staff
  • ****
  • Follow the Sappers!
    • zeus-community.net
Re:enemy see smoke, through smoke
« Reply #4 on: 26 Apr 2005, 15:47:14 »
what you could do, is have the ai group leader launch a smoke grenade after he fires his weapon for the first time

eg, add this to the units init field
(make sure he has a smoke grenade in his possesion)

init=
this addEventHandler ["Fired", {_this select 0 fire ["throw", "SmokeShell", "SmokeShell"]; _this select 0 removeAllEventHandlers "Fired"}]

this would be more erratic and realistic in mho
« Last Edit: 26 Apr 2005, 15:48:00 by Terox »
Zeus ARMA2 server IP = 77.74.193.124 :2302
Teamspeak IP = 77.74.193.123

Offline ACF

  • Members
  • *
  • Llama?? Ain't that French for tanks?
Re:enemy see smoke, through smoke
« Reply #5 on: 26 Apr 2005, 16:45:47 »
The simplest compromise is to pass the 'firer' of the smoke to a script that checks through a list of the opposing units with smoke to see who knowsabout the firer the most, then get him to chuck one back (you can setdir him with trig rather than DoTargetting the thrower - that wouldn't be fair).

I don't think you can detect the smoke itself, can you?

The bit I'm not clear on is why you would want to stoke up your enemy's smokescreen by chucking smoke at him?
« Last Edit: 26 Apr 2005, 21:39:21 by ACF »