Hi,
I have ship and my problem is, that i want to make damage map, so hitting some part will give more damage than others, and some parts will be easier to shoot thru then other, and also, on some parts will be bigger chance to make fire,…
My goal isnt to make it easy to script, but to make it easy to import damage maps on new ship meshes.
Hey, I hope your day is going well
There are a few ways to approach this problem however one thing should stay the same: do it server side to prevent the player editing how much damage they give/receive.
Option 1:
Group all your parts into folders with the same properties so all the parts that catch fire into one folder, all the ones that explode in another etc.
When a part is damaged, check the name parent and deal the damage accordingly. (It is easiest to call the folders something along the lines of fireDamage
and explosionDamage
)
Option 2:
Similar to option one, but add integer values as children to all the parts. Each int value will be called something along the lines of fireDamage
and explosionDamage
, the higher the number it holds, the more damage is done. The advantage of this option is that you can have multiple types of damage on the same part.
Option 3:
Name all your parts according to a key you can set up in a script e.g. fireDamage1
then in the script:
local fireDamageKey = {
"fireDamage1" = 1
"fireDamage2" = 2
}
OR
Call the parts multiple names e.g. fireDamage1explosionDamage2
and then check each name to see if it has a particular string in it and use the key system similar to above.
There may be more effective solutions out there however these are just a few ideas I came up with quickly to get the ball rolling and you in the correct mindset to possibly think of better solutions that fit your game better than how I imagine your game is set up.
Sry, but no, I am using mesh and by part, i mean some part of the ship, as front, back, … and now, i give damage 2k, when it get hited anywhere, but i need to make some map, that it will detect, how many damage i need to give, even when I have 30 diferent damages on 1 part.
You could place parts over certain parts of the mesh to act as special hit boxes, if there is no part on a part of the ship it just deals standard damage. So for example you could place a part over the fuel tanks or ammo storage then use my solution above.
Hope this helps
This is good idea, but problem is, how to dettect, what is the hitbox on specific pos of ship, bec i cant make hitboxes connected to touch event.
Idk, anything, it can be some png (as texture (as roblox height or material map)) (ok, this not, bec roblox cant read png by script (as get color of specific pixel)), hitboxes, …
There is problem, that region 3 is square, and parts can be of any shape
You could either use a part and ray casting or there is a module for different shaped region3’s.