I made that sound effect and it's working. Here's the code:
state Dukesound208
ifvare hitag 0 nullop
ifvare hitag 1
{
ifvare monstflags 16384
{
ifpdistl 16384
{
ifrnd 1
{
ifrnd 21 { soundonce WAR_AMBIENCE1 } else
ifrnd 21 { soundonce WAR_AMBIENCE2 } else
ifrnd 21 { soundonce WAR_AMBIENCE3 } else
ifrnd 21 { soundonce WAR_AMBIENCE4 } else
ifrnd 21 { soundonce MOTO1 } else
ifrnd 21 { soundonce MOTO2 } else
ifrnd 21 { soundonce TRAFFIC1 } else
ifrnd 21 { soundonce TRAFFIC2 } else
ifrnd 21 { soundonce TRAFFIC3 } else
ifrnd 21 { soundonce TRAFFIC4 } else
ifrnd 21 { soundonce TRAFFIC5 } else
ifrnd 21 { soundonce TRAFFIC6 } else
resetactioncount
}
}
}
}
ends
It's simple and I actually did it on my own, without getting any mods or even using AI.
The main idea behind this was to do something different from what is already in the game through Musicandfx. In Musicandfx, there are certain environmental sounds (like some city sounds) that play when you enter a sector (I think with a certain probability). In the effect I made, when I am not inside a sector, but within the radius in which the sound plays, in this case 16384, there are several sounds that play randomly. These sounds play with a probability of 21 in 256 each, and this chain of probabilities only plays within a probability of 1 in 256. The idea is that these sounds play alternating between them, but not too frequently. Otherwise it will look weird, sounds of a troubled city playing all the time when there is almost no one in sight. These sounds are from both Duke Nukem 3D and Shadow Warrior and they seem to fit together perfectly. When they play together, it is as if you are in a bustling city, despite being attacked by aliens. It's really cool! I know the effect is very simple and needs to be improved, but at least it works.
Lotag for the effect, hitag for the sound context and extra for the range of sounds.
Oh, and the code that loads this state is in:
ifvare lotag 208 // Dukesound
{
state Dukesound208
}
which is inside a SECTOREFFECTOR case, which is inside EVENT_GAME.
With this, I can load several ambient sounds that play randomly without having to keep placing several Musicandfx sprites on the map, which will allow me to save on sprites, since the Mapster32 engine limits you to around 16 thousand sprites. I still intend to add different sounds for different contexts. The next ones I intend to add would be related to the aliens' environments, but I think I'll make them play in a different configuration inside another hitag. For example, instead of several random ones, different sounds will play according to the distance in relation to the sector sprite.
Without having to place several Musicandfx sprites on the map. But this is still just an idea in development.
In addition, I have already managed to create several variations for several enemies on my own. For example, Pigcop has 10 variations including the normal color. Each variation (palette color using Exclut) shoots a different projectile. In one of them, it releases toxic smoke. In another, it explodes when close to me, and in another variation, it is practically invisible.
The idea is to make some enemies sneaky and deadly. I also modified that Sonic Resonator weapon to shoot the Darkstaff's projectile from Rise of the Triad along with its projectile. The idea was to turn that weapon into a combination of human technology and alien magic. Certain enemies explode when hit by it, except for the invisible variations. I added several projectiles from Rise of the Triad and made certain enemy variations use some of them.
The idea is to integrate the new projectiles into the enemies and weapons.
For each color, Pigcop shoots a different projectile, in addition to being immune to the projectile it shoots, except for shotgun bullets and other projectiles from certain weapons. To give you some examples, the Pigcop that explodes is immune to missiles and explosions. The one that shoots ice is immune to that, and the one that shoots fire is also immune to fire. The invisible one is immune to a weapon that is in Legacy, the one that shoots a sonic projectile.
In addition, the variations that explode and are invisible to all enemies that have them have more HP than the others. To make enemies immune to certain projectiles, I did this:
ifspritepal 19
{
ifwasweapon ROCKETPROJ { setactor[THISACTOR].extra 75 cstator 257 break }
else
ifwasweapon RADIUSEXPLOSION { setactor[THISACTOR].extra 75 cstator 257 break }
}
That is, every time a certain projectile hits the enemy in a specified range, instead of removing HP until the enemy is killed, it keeps the HP at a certain value. Pigcop's total HP here is 350 for this explosive-immune range. But when hit, even if Pigcop doesn't die, he is weakened. So to kill him, you can use the projectile he is immune to to weaken him, and then hit him with another projectile that kills him, like the one from the pistol where I made it shoot lasers instead of bullets. And it works perfectly!
I put cstator 257 because sometimes the enemy that was hit would become invisible to the projectiles. That solved the problem.
For this to work, I had to deeply change the checkpighitstate state. Each palette variation has its own list of projectiles that will or will not affect each of the variations. And that's just for Pigcop, not to mention several others. And this didn't affect the game's performance in any way. I was inspired by Naferia, but regarding the code, I did everything myself this time, writing line by line.
In other words, for some time now I've been learning how to modify CON scripts on my own, without using AI for this. Yes, I'm starting to learn how the whole thing works. But there's still a lot to learn about this language.
That's in addition to the changes I learned to make to some weapons. At first, it was hard to understand those codes, but now I can better understand what some of them mean. I turned that RPG BLASTER from Legacy into a real atomic bomb, with a damage radius of 16384. When it explodes, the screen goes white when you look in the direction of the explosion, the screen shakes and the damage is 1000 HP. More or less like what happens in Shadow Warrior.
I've been exploring Eduke32's wiki a lot, but I still think there's a lot missing there, like... how to do a ton of stuff.
In addition to all this, I also made some codes on my own so that when I hit textures on monitors and machines, they explode. They're not wall textures, but sprite textures. There are also those slot machines from Shadow Warrior and you even have a small chance of winning an item.
There are also sprites that simulate those traps from Shadow Warrior and Rise of the Triad. There are also the GADS and I even managed to make the player follow the movement of the GADS while standing still, whether horizontally or vertically. There's also that fire projectile that comes out of the wall in ROTT and also those semi-transparent glass that breaks.
All of this was transferred to Duke Nukem 3D. Not exactly the same, but similar.
I made new floor textures that would cause me damage and when the player touches them, the damage sound is different. The same goes for certain sprites that would simulate wall textures. I just haven't managed to make textures on the wall cause me damage, without involving sprites. The same goes for wall textures that, after being modified by a weapon hit, emit sound or make spark sprites appear. I don't even know if that's possible in the game.
Although in certain cases I had to use AI to help me with more complex configurations involving timers, none of this was taken from any mod.
Regarding the sprites themselves, there are several from Redneck Rampage, Shadow Warrior, Rise of the Triad and Dark Forces that can be broken, some that emit sound or explode. I also made a state in which, when carried by a sprite explosion, when I'm close, the player stays very close to the ground, as if he had fallen and then gets up again.
And on top of that, there are those textures of Duke Nukem's face in the HUD, because I wanted to bring something from Doom to Duke Nukem. I got those textures from somewhere on the internet and made modifications, including making an animation of the player's face when his HP is very low. As for the code, I initially took something from Imagination World TC, but the code has changed so much that it is practically unrecognizable from the original.
It doesn't work exactly like in Doom, but at least the texture reacts to certain situations, such as in relation to my HP level, when the player shoots or takes damage, when he falls from a great height, when he becomes immortal and one that when he makes a brutal attack when the enemy's HP is low or when he hits the enemy with that laser chainsaw from Legacy.
I also took the sound of the chainsaw from Doom and replaced the Caterpillar's with Doom's, although the weapon's appearance is still the same. Now we have a real chainsaw. The shotgun now, when it shoots (the black one) and hits an enemy, there are small explosions. Explosive shotgun. As for the white one, the shot is much faster, as if it were an automatic rifle.
Regarding the brutal attack, I wrote the code myself, although I was inspired by Alien Armageddon. But I did it my own way, in which when Duke punches the enemy, the sprite of when he punches the sprite that is at the end of each stage appears. The hand sprite makes a simple movement of going up and down during the act. Meanwhile, the enemy explodes. Because Duke's punch is atomic.
Experimental and simple, but very fun!
Speaking of atomic, when Duke Nukem kicks or jumps, he sometimes farts. And this fart hurts enemies and affects sprites. Even Duke Nukem's fart is atomic.
In addition to other things that I also did on my own.
So yes, for some time now, I have evolved quite a bit in terms of coding, even though I don't master it or don't know how to do a ton of things yet.
The next big thing I'll be doing after that is starting to code entire new enemies, for the ones from Rise of the Triad and Dark Forces.
The last thing I plan on doing is creating an entirely new weapon, because that's one of the hardest things to do in the CON language.
And also because the weapon coding in Legacy is very complex and it will be difficult to add an entirely new weapon there (be from Rise of the Triad or Dark Forces).