Home   Help Search Login Register  

Author Topic: For the pros.  (Read 6807 times)

0 Members and 1 Guest are viewing this topic.

B-2-0

  • Guest
Re:For the pros.
« Reply #30 on: 30 May 2003, 08:37:47 »
Keeping the light off......Tommy Cooper style ;D


Light on, light off....light off, light on....light on, light off, light on, light off....


------------------------------------------
;Lightoff.sqs
#A
_this select 0 action ["Light Off"]
goto "A"
------------------------------------------
------------------------------------------
Init field of M2:
[this] exec "Lightoff.sqs"
------------------------------------------

Just like that!! ;)

Offline Chris Death

  • Former Staff
  • ****
  • Finally Death's gonna get ya
    • OFPEC
Re:For the pros.
« Reply #31 on: 30 May 2003, 14:07:21 »
Quote
------------------------------------------
;Lightoff.sqs
#A
_this select 0 action ["Light Off"]
goto "A"
------------------------------------------
------------------------------------------
Init field of M2:
[this] exec "Lightoff.sqs"
------------------------------------------


Well - just another way to let the user press the reset
button on his PC  ;)

If you're running a looping script, then NEVER forget to
include some delay of time in there, or your pc will get stuck.

can be easily done with ~x, where x = time in seconds for
the delay - e.g: ~0.5 would make a half of a second delay.

~S~ CD
Dont argue with idiots....they will bring you down to their level and beat you there with experience.

How to use Waypoint type Scripted

Offline Blanco

  • Former Staff
  • ****
Re:For the pros.
« Reply #32 on: 28 Apr 2004, 16:46:22 »
You're right Chris, but even with a ~0.000000000001 delay, the script wont work...

The only way to fix that damn lightbug is by changing the addon.
The invasion1944 mod did it, but you can't ask a user to download the whole mod for just one m2 without the lightbug. So make me happy and tell me there 's a standalone version somewhere :)

What's scarier than an M2 machinegun shooting you at night?


« Last Edit: 28 Apr 2004, 16:47:59 by Blanco »
Search or search or search before you ask.

Offline Blanco

  • Former Staff
  • ****
Re:For the pros.
« Reply #33 on: 29 Apr 2004, 16:12:08 »
He guys, this is a wonderfull script!
And I could make it even better... :D

Do you remember Manmg.sqs by General Baron?
AI man MG after gunner dies
I combinate his script with yours...

Here it is :

Code: [Select]
;==>MG_salves._manmg.sqs<==

;**credits to MI_Fred @OFPEC forum**
;**original script by MI_Fred
;**original script name below**
;==MIF_FieldGunArty v.0.5==;

;**additional changes by Chris Death
;**altered the script to be used by a single machinegun
;**further additional tweaking by Silverfoot for crazy D-Day madness!
;**An afterthought by Blanco, combination with General Barron's manmg script


;; THIS IS AN AMAZING SCRIPT !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!



;[machinegun,rounds_to_fire, target_group,EXTRA_gunnersgroup] exec "MG_salves_manmg.sqs"
#aimit
_gun1 = _this select 0
_g = 0
_rmax = _this select 1
_tgit = _this select 2
_gnrs = _this select 3
_tgit = leader _tgit
_rcount = 0


#start
_gunner = gunner _gun1


;--the aimpoint, 100 meters in front of the gun, 30 meters above
_aimpoint = [(getPos _tgit select 0)+10*(sin(getDir _gun1)),(getPos _tgit select 1)+10*(cos(getDir _gun1)),(getPos _tgit select 2)-5]
_ax = _aimpoint select 0
_ay = _aimpoint select 1
_az = _aimpoint select 2


;--makes machinegun watch a random point near the aimpoint

_gun1 doWatch [(_ax)-5+(random 5*2),(_ay)-5+(random 5*2),(_az)-2+(random 2*2)]
~1

;--makes the vehicles fire their weapons

#fireloop

;gunner-check
?!alive _gunner : goto "emptygun"

;gun-functionality-check
? (getDammage _gun1) >= 1 : goto "dammaged"
_gun1 doWatch [(_ax)-5+(random 5*20),(_ay)-5+(random 5*20),(_az)-2+(random 2*20)]
~0.05
_gun1 fire (weapons (_gun1) select 0)
~0.05

;ammo-check
? _gun1 ammo (weapons _gun1 select 0) < 2 : goto "lowammo"

_rcount = _rcount + 1
? _rcount < _rmax : goto "fireloop"

goto "aimit"

#emptygun
;hint "no gunner in mg"
goto "nogunner"

#lowammo
;hint "no ammo"
_gun1 addmagazine "Browning"
~.3
goto "aimit"

#dammaged
;hint "mg doesn't work properly anymore"
exit


;; General Baron's manmg.sqs; modified by Blanco to make it all work

#nogunner
?"alive _x" count units _gnrs <= 0 :exit
;if the group manning the machine gun has no units left, exit the script

_gunner = units _gnrs select (count units _gnrs - 1)
;select the last unit in the group

_gunner assignAsGunner _gun1
[_gunner] orderGetIn TRUE
;make him get in the gun


;; when the new gunner got shot on his way to the mg, make sure a new gunner is selected!
#lifecheck
?!alive _gunner : goto "nogunner"
~1
?!(_gunner in _gun1) : goto "lifecheck"

;hint "gunner in"

;The new gunner must unjoin the EXTRA_gunners group,because if he dies the next man won't be selected anymore, i dunno why.
[_gunner] join grpnull
goto "start"

Params are [machinegun,rounds_to_fire, target_group,EXTRA_gunnersgroup] exec "MG_salves_manmg.sqs
PS : I renamed the script to avoid confusion

I even tried it with VIT's KORD en NSV from his APC pack and it works perfectly




« Last Edit: 29 Apr 2004, 18:48:36 by Blanco »
Search or search or search before you ask.

DBR_ONIX

  • Guest
Re:For the pros.
« Reply #34 on: 29 Apr 2004, 16:54:32 »
Just going back to the light prob...
What I think is wrong, is that your tring to make the machinegun turn it's own light off ::)
What (I'm sure) you have to do is
MGLO.sqs
Code: [Select]
_mg = this select 0
_mgop = driver _mg

#loop
_this select 0 action ["Light Off"]
~0.01
GOTO "loop"

And in the M2 INIT
Code: [Select]
this exec "MGLO.sqs"
(BTW MGLO stands for MG Light off, incase you were wondering :P)

Good luck
Will try out Blancos script tonight :)
- Ben

Offline Blanco

  • Former Staff
  • ****
Re:For the pros.
« Reply #35 on: 30 Apr 2004, 16:53:22 »
DBR_ONIX I tried your script, It doesn't work,but it's nice when you need a strobo effect :D

Btw, can somebody move this to the Beta-testing board?
This got nothing to do with Cutscene / sound editing imo ::)
« Last Edit: 30 Apr 2004, 16:56:33 by Blanco »
Search or search or search before you ask.

Offline libriut99

  • Members
  • *
  • 2b or not 2b, who cares ???
Re:For the pros.
« Reply #36 on: 11 Jun 2004, 11:08:27 »
hello to all... sorry to resurrect such an old thread but I have a question concerning the "MG_salves._manmg.sqs" script. how can I make the gunner stop shooting once the target is dead , or fled ?  ???

thanks in advance.
before 'Zee germans get there ...

Offline Blanco

  • Former Staff
  • ****
Re:For the pros.
« Reply #37 on: 16 Jun 2004, 16:38:20 »
once the target is dead the gunner chooses a new target in his firesector (trigger) When the triger is empty he stops shooting. Your trigger is probably too big.



Search or search or search before you ask.

Offline libriut99

  • Members
  • *
  • 2b or not 2b, who cares ???
Re:For the pros.
« Reply #38 on: 17 Jun 2004, 16:13:09 »
Of course ..... thank you Blanco , haven't thought about that .    8)
before 'Zee germans get there ...

Offline Blanco

  • Former Staff
  • ****
Re:For the pros.
« Reply #39 on: 18 Jun 2004, 19:03:19 »
Euh... Libriut99 we are talking about two different scripts.
The one I'm talking about is V2.0

Code: [Select]
;**credits to MI_Fred @OFPEC forum**
;**original script by MI_Fred
;**original script name below**
;==MIF_FieldGunArty v.0.5==;

;**additional changes by Chris Death
;**altered the script to be used by a single machinegun
;**further additional tweaking by Silverfoot for crazy D-Day madness!
;**An afterthought by Blanco, combined with General Barron's manmg script
; ** Further tweaking by Blanco

_enemylist = _this select 0
_gun = _this select 1

; extra gunners are  ** OPTIONAL **
?count _this == 2 : goto "jump"

_xtra = _this select 2

#jump
_rmax = 50
_rcount = 0
_rmax = _rmax / 1.2 + random 10
_mag = (magazines (_gun) select 0)


#waitforenemies
@count _enemylist !=0
goto "pickavictim"

#reset
_rcount = 0
#fireloop
_gunner = gunner _gun
_aimpoint = [(getPos _sucker select 0)+10*(sin(getDir _gun)),(getPos _sucker select 1)+10*(cos(getDir _gun)),(getPos _sucker select 2)-5]

_ax = _aimpoint select 0
_ay = _aimpoint select 1
_az = _aimpoint select 2

_gun doWatch [(_ax)-5+(random 5*2),(_ay)-5+(random 5*2),(_az)-2+(random 2*2)]

;gunner-check
?count _enemylist == 0 : goto "waitforenemies"
?!alive _sucker : goto "pickavictim"
?!alive _gunner : goto "nogunner"

;gun-functionality-check
? (getDammage _gun) >= 1 : goto "dammaged"

_gun doWatch [(_ax)-5+(random 5*10),(_ay)-5+(random 5*10),(_az)-2+(random 2*10)]

~0.05

_gun fire (weapons (_gun) select 0)

~0.05
?random 10 < 0.2: goto "wait"

;ammo-check
?_gun ammo (weapons _gun select 0) < 2 :goto "lowammo"

_rcount = _rcount + 1
? _rcount < _rmax : goto "reset"

goto "fireloop"

#pickavictim
_r = random count _enemylist
_r =_r - _r %1
_sucker = _enemylist select _r
~1
goto "fireloop"

#lowammo
_gun addmagazine _mag
~3
goto "fireloop"

#wait
_r = random count _enemylist
_r =_r - _r %1

_sucker = _enemylist select _r
;hint format ["%1",_sucker]
~2 + random 3
goto "fireloop"

#nogunner
?"alive _x" count units _xtra <= 0 :exit
;if the group manning the machine gun has no units left, exit the script

_gunner = units _xtra select (count units _xtra - 1)
;select the last unit in the group

_gunner assignAsGunner _gun
[_gunner] orderGetIn TRUE
;make him get in the gun


;; when the new gunner got shot on his way to the mg, make sure a new gunner is selected!
#lifecheck
?!alive _gunner : goto "nogunner"
~1
?!(_gunner in _gun) && alive _gun: goto "lifecheck"

;hint "gunner in"

;The new gunner must unjoin the EXTRA_gunners group,because if he dies the next man won't be selected anymore, i dunno why.
[_gunner] join grpnull
goto "waitforenemies"

The use of it is different than the first version

Every machinegun need a trigger in front if it , it represent it's firesector. Since this is only meant for static machineguns, you can perfectly define his firesector. It's a pity we cant "draw" the shape of a trigger in OFP, maybe in OFP2 ... :)

That trigger should be :


Dimensions : It's up to you! Don't make it to big (wide)
Shape : mostly oval, in streetfights I use rectangle, just covering the street
Activation : (Opposite side of MG) detected by (side of MG),ONCE
condition : this
On activation : [thislist,MG1,Xgnrs] exec "MG_salves_manmg2.sqs"


- thislist, just leave it like that
- MG1 is the name of machinegun
- Xgrns is the group name of a group of soldiers seperate to the M2 machine gun. These guys will sieze control of the M2 if/when the gunner dies. This time it's optional.

** CHANGES **

- I removed the rounds parm, the salvo's are randomised and more realistic imo.
- It should work with all third party static machineguns without changing the script.
- The player is not always targetted like in the previous version, The gunner will pick a random victim in his sector adn he will pick another guy between every salvo or reload.
   
** TIPS **

- It works best when the machinegun is on higher ground;
- You can hide your mg's in bunkers, houses, treehouses, whatever... He will schoot every enemy target in his firesector, no matter what.

Known Issues :
- Works in SP and MP, but not recommended in MP, because it uses a tight loop (~0.05)
- The gunner will target every enemytype in his firesector. he will shoot men,tanks, planes, heli's... It think it should be better if he only target men and cars.
Not solved yet.
Search or search or search before you ask.