I spent a couple hours looking through artillery scripts in the COMREF and trying on my own, but I can't figure out how to create a target out of thin air at a random location��Â
.�� I could have missed something obvious, but it doesn't seem that easy. Does anyone know how to set a gamelogic to a quasi-random spot within an area the player is aiming at, without using a mapclick command?�� (i'd like to have the player just set his direction, choose a mortar angle, and thump the shell goes off into the distance)
I am trying to write a mortar script (the insurgent's best friend, next to the satchel "IED" of course) where shells will land X distance from the player with some random dispersion in an area.�� The artillery scripts in the COMREF all have some sort of target designated, which is fine, but the only one with any randomness targets the nearest object and not a random piece of thin air on the map.�� So you can't "Camcreate" the shell at an array position, only at an object like a game logic I'm assuming.�� So there's my question again, how do i semi-randomly place game logics based on the player's position?�� Thanks!�� I appreciate any help!
Below is what I've come up with so far trying to piece together different scripts, but i'm confused with sin and cos (what grade did I get in geometry in school?)
_mortardirection = getdir player
_mortarposition = getpos player
_dist = 90 + (random 20)
_mposx = _mortarposition select 0
_mposy = _mortarposition select 1
_mposz = _mortarposition select 2
hint format ["Mortar angle set at 70 degrees, direction set at %1, press cancel to start over",_mortardirection]
~3
shell = "Bo_GBU12_LGB" camCreate [_mposx + ((sin _mortardirection) * _dist), _mposy + ((cos _mortardirection) * _dist), _mposz]
MortarshellsLeft = Mortarshellsleft - 1
exit