2007.09.16, 06:33 PM
DIM3 UNIQUE MARKS TUTORIAL
INTRODUCTION
This tutorial will teach you how to make your projectile scripts use different marks when they hit different textures. This is usefull because a metal hole on glass wouldn't look good, nor would a glass hole on cloth. So instead of turning off marks to avoid this, you can script projectiles to work with the textures.
STEP 1: MATERIALS
The first thing your going to want to do is open your map in dim3 Editor. Now, double click the first texture in the texture tablet (But only ones used in the map, not skybox or fog textures), a window with various settings will appear. Type the name of a material into the material text box. The material is a group of textures, and can be changed per map. Repeat this for every texture, but make sure to use the same capitalization. Remember, every texture doesn’t need to be different, just metal glass wood concrete cloth and maybe dense metal should be separate.
STEP 2: Scripting Hitscans
And define mode at the top of the script and set it to 0.
You’ll have to change the damage to how much damage your gun does.
Okay, time for some explaining. This script currently makes the projectile do something different every other time it’s fired, as you can see, with mode 0 and 1. If you fire the projectile TWICE in a row from the weapon script it first finds the material then fires again with the mark.
Tricky huh?
Right now the script assumes the marks are named EXACTLY the same as the materials. You don’t even have any marks yet.
Go make some marks.
Now make them square of 2 PNGs and put them into the bitmaps<marks folder.
Now go to the settings folder, open marks.xml.
You’ll have to make one of these for each mark:
Change the settings to what you like, but make sure the mark name is the same as the material you want to use it on.
Now, type
twice into your weapon script, one after the other. You have to change the YOUR PROJECTILE NAME of course, but keep the quotes.
The last thing you have to do is look fix the particles. You’ll have to change the
To whatever materials you use and make the correctly named and capitalized particles, in the settings<particles.xml folder.
NOTES ON NON-HITSCAN PROJECTILES
Okay, you understand all that, but how the heck do you do that for a non hitscan projectile? Actually, its rather easy. All you need to do is spawn another melee projectile from the original that will immediately make a mark. If you really want more info on non hitscan projectiles, email me at msnsupercatatyahoodotcom and if I think enough people want more information I’ll continue this tutorial.
INTRODUCTION
This tutorial will teach you how to make your projectile scripts use different marks when they hit different textures. This is usefull because a metal hole on glass wouldn't look good, nor would a glass hole on cloth. So instead of turning off marks to avoid this, you can script projectiles to work with the textures.
STEP 1: MATERIALS
The first thing your going to want to do is open your map in dim3 Editor. Now, double click the first texture in the texture tablet (But only ones used in the map, not skybox or fog textures), a window with various settings will appear. Type the name of a material into the material text box. The material is a group of textures, and can be changed per map. Repeat this for every texture, but make sure to use the same capitalization. Remember, every texture doesn’t need to be different, just metal glass wood concrete cloth and maybe dense metal should be separate.
STEP 2: Scripting Hitscans
Code:
if (mode==0) {
proj.action.damage=15;
proj.mark.on=true;
proj.mark.name=proj.hit.materialName;
proj.mark.size=90;
proj.mark.alpha=.5;
mode=1;
if (proj.hit.materialName=='Glass') {
spawn.particle(proj.position.x,proj.position.z,proj.position.y,'Gun Hit Glass');
}
if (proj.hit.materialName=='Metal' || proj.hit.materialName=="Dense Metal") {
spawn.particle(proj.position.x,proj.position.z,proj.position.y,'Gun Hit Metal');
}
if (proj.hit.materialName=='Cloth') {
spawn.particle(proj.position.x,proj.position.z,proj.position.y,'Gun Hit Cloth');
}
} else {
proj.action.damage=0;
proj.mark.on=false;
mode=0;
}Code:
var mode=1;You’ll have to change the damage to how much damage your gun does.
Okay, time for some explaining. This script currently makes the projectile do something different every other time it’s fired, as you can see, with mode 0 and 1. If you fire the projectile TWICE in a row from the weapon script it first finds the material then fires again with the mark.
Tricky huh?
Right now the script assumes the marks are named EXACTLY the same as the materials. You don’t even have any marks yet.
Go make some marks.
Now make them square of 2 PNGs and put them into the bitmaps<marks folder.
Now go to the settings folder, open marks.xml.
You’ll have to make one of these for each mark:
Code:
<Mark name="Cloth">
<Setting time="80000" fade_in="10" fade_out="1000" no_rotate="true" />
<Image file="mark_cloth" count="1" time="200" loop="true" />
</Mark>Change the settings to what you like, but make sure the mark name is the same as the material you want to use it on.
Now, type
Code:
weap.projectile.spawnFromCenter('YOUR PROJECTILE NAME');The last thing you have to do is look fix the particles. You’ll have to change the
Code:
if (proj.hit.materialName=='Glass') {
spawn.particle(proj.position.x,proj.position.z,proj.position.y,'Gun Hit Glass');
}
if (proj.hit.materialName=='Metal' || proj.hit.materialName=="Dense Metal") {
spawn.particle(proj.position.x,proj.position.z,proj.position.y,'Gun Hit Metal');
}
if (proj.hit.materialName=='Cloth') {
spawn.particle(proj.position.x,proj.position.z,proj.position.y,'Gun Hit Cloth');
}To whatever materials you use and make the correctly named and capitalized particles, in the settings<particles.xml folder.
NOTES ON NON-HITSCAN PROJECTILES
Okay, you understand all that, but how the heck do you do that for a non hitscan projectile? Actually, its rather easy. All you need to do is spawn another melee projectile from the original that will immediately make a mark. If you really want more info on non hitscan projectiles, email me at msnsupercatatyahoodotcom and if I think enough people want more information I’ll continue this tutorial.