Delta Commander,
I suppose that you could make a box which follows along with the player, rotating with him, pointing fowards, or whatever direction wished. Make two functions, one which checks collision between the environment and the box, and one which checks collision between the animate enemies and the box.
In a program loop grab the values of these functions in seperate variables. Then, check if they are both 'on'(boolean), as to say that the box has collided with both an enemy and the environment. If so, then check which is closer, as you stated in the beginning of this post. The distance formula for all three axises to check distance between the character and the object/enemy, written in DarkBasic is
sqrt((player_x - object__x)^2 + (player_y - object_y)^2 + player_z - object_z)^2).
Though, this method would be easier to code, I would not suggest it due to high inaccuracy and uneeded polygons.
aks74u,
To make the bullet paths inaccurate, would take a simple method of off-setting it's starting angles by a bit, randomly. Let's look at the piece of code from my program below. I will show you how to impelement a single integer value off-set to both angles. The example is heavily commented for your instruction.
REM << prepare bullet to be shot from player and prepare raycast command variables
if ready = 1
REM << next line uses a simple formula to fix y axis descent problem
REM << apply off-set to angles, randomly choosing a negative or positive off-set
offset = rnd(3)
REM << will make offset a negative value if argument = true
if rnd(1) = 0 then dec offset,offset * 2
REM << adding a negative to a positive value will subtract from the positive value, positive to positive will add to
bulletanglex# = wrapvalue((360 - lookx#) + offset)
REM << refill offset with new random value
offset = rnd(3)
REM << will make offset a negative value if argument = true
if rnd(1) = 0 then dec offset,offset * 2
bulletangley# = wrapvalue(looky# + offset)
bulletx# = x#
bullety# = 7
bulletz# = z#
bulletlife = bulletlifeset
show object 11
position object 11,bulletx#,bullety#,bulletz#
ready = 0
endif

+NanoBrain+