Home   Help Search Login Register  

Author Topic: Mortar script problems.  (Read 536 times)

0 Members and 1 Guest are viewing this topic.

Offline Messiah

  • Honourary OFPEC Patron & Drinking Buddy of Wolfsbane
  • Honoured Contributor
  • ***
  • OFPEC Veteran
    • Project UK Forces
Mortar script problems.
« on: 02 May 2003, 11:36:18 »
i got some help a while back from MI_Fred with this script... it worked fine, but now i get some errors - erros include the mortars exploding at the spawn point, not the target and also errors come up on the top of the screen:

Quote
_shells = _shells - 1 |#|': Error Generic Error in expression

and

Quote
_shells == 0 |#|': Error ==: Type Array, expected string,object,side,group


heres the scripts:

Arty Strike:

Code: [Select]
;==MIF_MortarFX v0.8==================;
;   \--arty_strike.sqs (this)         ;
;    \--arty_trail.sqs            ;
;=====================================;
;[objectname,,amount of mortars,amount of shells,[random x dispersion,random y dispersion,z-vector velocity],delay,"shellname"] exec "arty_strike.sqs"
;==USAGE:
;objectname is the the origin of the shells
;amount of mortars
;amount of shells
;random x dispersion is how much the shells spread in the target area x-vector
;random y dispersion is how much the shells spread in the target area y-vector. must be less than z-vector velocity
;z-vector velocity depicts how far the shells hit, being the angle of the barrel      
;delay is the delay between creating shells
;"shellname" is the shell to create
;==NOTES:
;random dispersion must NOT exceed z-vector velocity
;dispersion grows along distance to target, due to minor randomizing of the origin of the shell
;after 'amount of mortars' (_guns) have shot 1 shell each, there's a reload delay, mess with it if necessary, adjust the ~ #reload
;you can also set only 1 gun to fire multiple shells. set 'amount of mortars' to 1 and 'amount of shells' to how many you wan't it to fire
;==LIMITS:
;z-vector velocity: depending on the y-vector dispersion, 110 is the maximum for z while y is 5.
;this equals about 1300 meters. After that the shells disappear due to game engine limitations.
;===CHANGERS from v.0.7===;
;- added parameter 'amount of mortars' to be added in exec line
;- fixed bug with counting shells and reloading
;- changed trajectory to gain more height
;- added firing and incoming sound
;- added a firing smoke and increased dropped particles
;==================================;

_obj = _this select 0
_guns = _this select 1
_shells = _this select 2
_rvec = _this select 3
_delay = _this select 4
_sname = _this select 5
_ra = _rvec select 0
_vzr = _rvec select 1
_vz = _rvec select 2
_dir = getDir _obj
_odir = getDir _obj

? _vzr > _vz : Hint "random y dispersion exceeds the angle of the barrel, f4t4l 3rr0r!!111 =)"; exit
_fired = 0
#launch
_rocket = _sname camCreate [(getPos _obj select 0)-5+(random 5*2),(getPos _obj select 1)-5+(random 5*2),(getPos _obj select 2)+1]
_rocket setVelocity [_vz*(sin(_dir)),_vz*(cos(_dir)),_vz -_vzr + (random _vzr*2)]
[_rocket] exec "arty_trail.sqs"
_rocket Say "mlaunch"

_dir = _odir
_shells = _shells - 1
_fired = _fired + 1
~random _delay

_dir = _dir - _ra + (random _ra*2)

? _shells == 0 : exit
? _fired == _guns : goto "reload"
goto "launch"


#reload
_fired = 0
~7
goto "launch"

and smoke trail:

Code: [Select]
;==MIF_arty_strike v0.8==================;
;    \--arty_trail.sqs               ;
;========================================;
_rocket = _this select 0
_sounds = ["whiz1"]
_sound = random (count _sounds)
_sound = _sound - (_sound mod 1)
_snd = (_sounds select _sound)
_pos = getPos _rocket
_sndplayed = false
drop ["cl_basic", "", "Billboard", 0.2, 2, _pos, [0,0,0], 0, 1.230, 1, 1, [0.5,2,5], [[0.5,0.5,0.5,0.1], [0.8,0.8,0.8,0.4], [1,1,1,0.2], [1,1,1,0]], [0,0], 0, 0, "", "",""]

#trail
_pos = getPos _rocket
_rz = getPos _rocket select 2
drop ["cl_basic", "", "Billboard", 0.2, 3, _pos, [0,0,0], 0, 1.230, 1, 1, [0.5,1,1.5], [[0.5,0.5,0.5,0.1], [0.8,0.8,0.8,0.4], [1,1,1,0.2], [1,1,1,0.01]], [0,0], 0, 0, "", "",""]
? _rz < 0.5 : exit
~0.0001
? (getPos _rocket select 2) < _rz && (! _sndplayed) : _rocket Say _snd
goto "trail"


the scripts are executed using the following synthax:

Code: [Select]
[mgl,12,[3,3],11,.5,"mortarshell"] exec "arty_strike.sqs

i cant think whats wrong... it worked fine before, now suddenly it does  ::)this  ::)
Proud Member of the Volunteer Commando Battalion

Offline MI_Fred

  • Members
  • *
  • AA
    • OFP Team Finlanders
Re:Mortar script problems.
« Reply #1 on: 02 May 2003, 20:39:40 »
I believe it's only the exec line. as you see...
Quote
_obj = _this select 0
_guns = _this select 1
_shells = _this select 2
_rvec = _this select 3
_delay = _this select 4
_sname = _this select 5
_ra = _rvec select 0
_vzr = _rvec select 1
_vz = _rvec select 2
_dir = getDir _obj
_odir = getDir _obj
you need:
[objectname,amount of mortars,amount of shells,[random x dispersion,random y dispersion,z-vector velocity],delay,"shellname"] exec "arty_strike.sqs"
straight rip from the file itself  ;D You've just left out the amount of mortars or shells, and the vectors are entered in the wrong place. I know why... u've mixed versions 0.7 and 0.8. All you need is to enter what the exec line says in the file itself.

That should do it. That's the way they are in versions 0.8 and 0.9, except 0.9 has a script to enter the vectors after calculations. It's not very well done, as it counts down the z-vector velocity in a straight with an if else line, as it should be a parabel or some sort of mathematical überFunky thingy, which I know nothing of.
« Last Edit: 02 May 2003, 20:40:56 by MI_Fred »
There's gooks over there, there's mines over there, and watch out those goddamn monkeys talk, I'll bite ya.

Offline MI_Fred

  • Members
  • *
  • AA
    • OFP Team Finlanders
Re:Mortar script problems.
« Reply #2 on: 03 May 2003, 01:16:32 »
On 2nd thought, you might want to check out the pending list in the editors depot  ;) heh, even I didn't see that one coming. It should beat my attempt  ::) I mean Sentinel artillery.

There's gooks over there, there's mines over there, and watch out those goddamn monkeys talk, I'll bite ya.