Quote:
1. How can I make bulletholes also appear on models, like barrels, lights etc.?

I think this problem is related to your shooting code if you can't hit the models either. Can you shoot and hit models and is just the bullethole not appearing? Then it might be the 'normal' variable that does not have a right value.


Quote:
2. How can I detect what kind of surface the object is?
(Glass, wood, brick, concrete etc.) So I can use different bullethole images.

Tricky question and there are some complex solutions, and some less complex solutions.
You can detect a whole model's surface type, or the model's skin for a surface type. I'd suggest to check for a whole model first, and then try to figure out how to detect certain material on the skin of the model where you hit.

For checking the whole model, just define a few surface types like:
Code:
#define 1, _SURFACE_METAL
#define 2, _SURFACE_GLASS
#define 3, _SURFACE_BRICK

Then give the model's skill a surface type from one of the defined materials:
Code:
...
barrel.skill12 = _SURFACE_METAL;
...
window,skill8 = _SURFACE_GLASS;

When you hit the model, and place the bullethole, just check skill8 of the hit entity, make a switch for all the different materials and you're set:
Code:
switch(hit_entity.skill8) {
  case _SURFACE_METAL:
    my.skin = 1;
    break;

  case _SURFACE_GLASS:
    my.skin = 2;
    break;

  case _SURFACE_BRICK:
    my.skin = 3;
    break;
}

You could align the "material's definition numbers" with the "model's skin numbers", but it could also mess up, so whatever you prefer. This solution only needs the following code:
Code:
my.skin = hit_entity.skill8;



Quote:
3. Is there a way to make some wood shatters drop down and disappear when I fire at a wooden crate or something? (So it looks more realistic when I fire at it)

You can try particles using effect() or create bitmaps using bmap_create(), or create models of several wood shatters using ent_create(). I'd go for the effect() function but it requires alot of tweaking. ent_create is the easiest solution.


Quote:
4. How can I make the gun "spray" a bit. I mean, now it fires directly at one point, and bulletholes overlaps eachother perfectly, I want to be able to change the accuracy of the weapon.

That is also related to your shooting function.
Just add some random values to the shooting direction using random(x*2)-(x) where x is the amount of deviation. So when x=40 (with a chance of 40 degrees deviation) You'd get random(80)-40, resulting in a shooting range of -40 to 40 degrees.


Click and join the 3dgs irc community!
Room: #3dgs