Home   Help Search Login Register  

Author Topic: Make divers vulnerable while underwater  (Read 815 times)

0 Members and 2 Guests are viewing this topic.

Offline Blanco

  • Former Staff
  • ****
Make divers vulnerable while underwater
« on: 07 Jun 2005, 20:23:47 »
Hello,
I've wrote a script to make divers vulnerable while they're diving, but there's a problem with it.
I simply create a FOX invisible target on top of the diver's vehicle (from his ITMS-script) while it's underwater and known by his enemies.
The diver can be shot, but it rarely happen, it's just a scary effect.

Thing is... when I show myself to the enemy, dive into the water, the script won't work.  ???
But when i step out of the water again and make a second dive the script works fine.

Code: [Select]
_diver = _this select 0
_enemy = _this select 1
?side _diver == WEST : _side = "W_"
?side _diver == EAST :_side = "E_"
?side _diver == RESISTANCE : _side = "G_"
#loop
_diverdam = getdammage _diver
_kn = _enemy knowsabout _diver
?_kn > 0.105 && typeof vehicle _diver == "CoC_LAR7SWM": goto "spawntar"
~1
goto "loop"

#spawntar
vehicle _diver Setdammage _diverdam
_tp = "M_"
_tarname = "FOX2_"
_tarname = _tarname + format ["%1", _side]
_tarname = _tarname + format ["%1", _tp]
_tarname = _tarname + "LO"
_tarname = _tarname + "_IT"

 _tgt = _tarname createVehicle _pos

#update
?typeof vehicle _diver != "CoC_LAR7SWM" or !alive _diver: goto "destroy"
_pos = [(getpos vehicle _diver select 0) - 1 + random 2,(getpos vehicle _diver select 1)- 1 + random 2, + 1.5]
_tgt setpos _pos
~1
goto "update"

#destroy
deletevehicle _tgt
?!alive _diver : deletevehicle vehicle _diver;exit
goto "loop"

Below a testmission, the script is still in an early stage.
You'll need the COCdiver and FOX invisible targets.


 
« Last Edit: 07 Jun 2005, 20:24:40 by Blanco »
Search or search or search before you ask.

UNN

  • Guest
Re:Make divers vulnerable while underwater
« Reply #1 on: 08 Jun 2005, 00:29:40 »
Hi,

I'm pretty sure it because your not defining _pos, before you call createvehicle the first time. Once you goto #loop from #destroy, your ok, because _pos has been defined. Which would explain why it works ok second time around.

Offline Blanco

  • Former Staff
  • ****
Re:Make divers vulnerable while underwater
« Reply #2 on: 08 Jun 2005, 02:04:48 »
Omg, silly me... :-[
You are right...
Thanks a lot!

**edit**

Ok, it works pretty good now :)
One thing that needs a second opinion...

I think when you are spotted just before you jump into the water, the enemy shouldn't see your "swimroute" the whole time.
I'm thinking about running the script only a few seconds after your jump to simulate waterripples. I can leave the knowsabout stuff out of my script, the invisible target is  visible anyway (for a few seconds) and the enemy will shoot it when they see it.
Maybe I create small watersplashes via drop?  :P

 
« Last Edit: 08 Jun 2005, 02:37:14 by Blanco »
Search or search or search before you ask.