EDuke32 Scripting "CON coding help"
#2931 Posted 25 July 2022 - 05:44 AM
This post has been edited by VGames: 25 July 2022 - 05:57 AM
#2932 Posted 25 July 2022 - 10:52 AM
The safest way to remove an enemy's palette - or for that matter, any sprite's properties set in the map editor - without unexpected side effects is during EVENT_SPAWN:
appendevent EVENT_SPAWN
{
switch sprite[].picnum
{
case PIGCOP
case PIGCOPDIVE
case PIGCOPSTAYPUT
case LIZMAN
// and so on...
seta .pal 0
break
}
endswitch
}
endeventI'm not actually sure if you have to check specifically for the dive, stayput, etc. variations but it would be easy enough to test. Also if you ever wanted to store the PAL for some use in the future, you'd do it here (with a per-actor gamevar) before setting the PAL back to 0.
This post has been edited by Reaper_Man: 25 July 2022 - 10:54 AM
#2933 Posted 25 July 2022 - 11:31 AM
Reaper_Man, on 25 July 2022 - 10:52 AM, said:
The safest way to remove an enemy's palette - or for that matter, any sprite's properties set in the map editor - without unexpected side effects is during EVENT_SPAWN:
appendevent EVENT_SPAWN
{
switch sprite[].picnum
{
case PIGCOP
case PIGCOPDIVE
case PIGCOPSTAYPUT
case LIZMAN
// and so on...
seta .pal 0
break
}
endswitch
}
endeventI'm not actually sure if you have to check specifically for the dive, stayput, etc. variations but it would be easy enough to test. Also if you ever wanted to store the PAL for some use in the future, you'd do it here (with a per-actor gamevar) before setting the PAL back to 0.
Hey thanks for that explanation. I understand completely and I’m glad u knew exactly which enemies have a different palette setting for a reason in the maps. I really just need to alter the pigs and octabrains as far as i can tell so I should be safe.
Got another one for u. Is there any way to force the jet pack to turn on when wielding a certain weapon?
#2934 Posted 26 July 2022 - 08:57 AM
Danukem, on 22 July 2022 - 11:27 AM, said:
i've noticed that event_getshotrange also doesnt apply for custom bullet projectiles ( whatever they are called ) only for shotspark1
or maybe im just doing it wrong
#2935 Posted 26 July 2022 - 12:24 PM
jimbob, on 26 July 2022 - 08:57 AM, said:
or maybe im just doing it wrong
It is only intended to work for hitscan projectiles when fired by the player.
#2936 Posted 26 July 2022 - 04:02 PM
In EVENT_EGS:
switch sprite[].picnum case 5236 // THIS IS SPRITE 1 FOR MY MUZZLEFLASH case 5237 // THIS IS SPRITE 2 FOR MY MUZZLEFLASH seta[].shade -127 cstat 32768 // make initially invisible break endswitch
This is a statement outside of any events or actor code:
// M60 MUZZLEFLASH var M60FLASH 0 2 defstate M60_FLASH displayrandvar M60FLASH 1 add M60FLASH 5236 ends
This is called within EVENT_DISPLAYWEAPON in the section for my M60:
ifvare player[].curr_weapon PISTOL_WEAPON
{
ife player[].kickback_pic 1
{
state M60_FLASH
rotatespritea 195 135 95536 0 M60FLASH -127 0 4096 -255 windowx1 windowy1 windowx2 windowy2
}
}
I've also tried implementing the sprites both of these ways in the tilefromtexture section of my mod:
texture 5236 { pal 0 { file "SOB_SPRITES/5236.png" } }
texture 5237 { pal 0 { file "SOB_SPRITES/5237.png" } }
tilefromtexture 5236 { file SOB_SPRITES/5236.PNG }
tilefromtexture 5237 { file SOB_SPRITES/5237.PNG }
Neither way helped
This post has been edited by VGames: 26 July 2022 - 04:07 PM
#2937 Posted 26 July 2022 - 08:01 PM
VGames, on 26 July 2022 - 04:02 PM, said:
Did you add blendtables to your project? The negative value in your orientation parameter is trying to invoke a blend mode, which means you need blend tables.
Since you are already working from AMC TC, I suggest you see how it's done there. (disregard if you have already that and this is some other issue)
#2938 Posted 26 July 2022 - 09:02 PM
Danukem, on 26 July 2022 - 08:01 PM, said:
Since you are already working from AMC TC, I suggest you see how it's done there. (disregard if you have already that and this is some other issue)
Are u referring to the negative alpha value? The orientation value is positive. Either way no I did not set up a blend table. Can u point me in the right direction for that? I knew I was missing something.
#2939 Posted 26 July 2022 - 11:36 PM
VGames, on 26 July 2022 - 09:02 PM, said:
I think you can get blend modes working just by pasting this code into your duke3d.def file; (The nofloorpalrange command is optional I presume)
nofloorpalrange 10 25
numalphatables 128
blendtable 255 // Screen
{
glblend { both { src ONE dst ONE } }
}
blendtable 254 // Multiply
{
glblend { both { src ZERO dst SRC_COLOR } }
}
That was copied from the AMC mod - I take no credit here.
#2940 Posted 27 July 2022 - 01:17 AM
#2941 Posted 27 July 2022 - 04:28 AM
MC84, on 26 July 2022 - 11:36 PM, said:
nofloorpalrange 10 25
numalphatables 128
blendtable 255 // Screen
{
glblend { both { src ONE dst ONE } }
}
blendtable 254 // Multiply
{
glblend { both { src ZERO dst SRC_COLOR } }
}
That was copied from the AMC mod - I take no credit here.
I will give this a try. Thanks for the help.
@Danukem ok good. I thought I had the orientation and alpha values backwards in that line of code.
#2942 Posted 27 July 2022 - 11:38 AM
Danukem, on 26 July 2022 - 12:24 PM, said:
yes thats what i meant, custom hitscan projectiles. i made my own because i needed more damage variation but the custom ones always have zero spread unless i make it shoot a SHOTSPARK1 or other original hitscan projectile.
#2943 Posted 27 July 2022 - 04:22 PM
#2944 Posted 28 July 2022 - 10:10 AM
Reaper_Man, on 27 July 2022 - 04:22 PM, said:
i'll check the code
defineprojectile 5233 PROJ_WORKSLIKE 1048609 // 1056801 defineprojectile 5233 PROJ_SOUND THUD // impactsound needs to change defineprojectile 5233 PROJ_SPAWNS SMALLSMOKE defineprojectile 5233 PROJ_DECAL 5232 defineprojectile 5233 PROJ_EXTRA GARANDDAMAGE defineprojectile 5233 PROJ_EXTRA_RAND 5 defineprojectile 5233 PROJ_XREPEAT 4 defineprojectile 5233 PROJ_YREPEAT 4
guess its projectile_accurate flag
This post has been edited by jimbob: 28 July 2022 - 10:13 AM
#2945 Posted 28 July 2022 - 11:06 AM
What’s the best way to stop weapon bobbing/swaying for certain instances like shooting a weapon?
Is there a way to add push back or force to bullets so that enemies are thrown backwards when shot without increasing the damage a lot?
This post has been edited by VGames: 28 July 2022 - 11:07 AM
#2946 Posted 28 July 2022 - 12:39 PM
jimbob, on 28 July 2022 - 10:10 AM, said:
I don't think it's documented very well, but what that flag does is exactly the behavior you thought was a bug, and skips doing all horizontal/vertical spread even when using EVENT_GETSHOTRANGE. The flag PROJECTILE_ACCURATE_AUTOAIM is similar, this makes projectiles snap to enemies when you hover your crosshair over them - AKA autoaim - but otherwise obey weapon spread. I only noticed this looking at the source when looking at the GROWSPARK behavior, which always uses autoaim, even if the player has it disabled.
Actually looking again, it seems like there's some logic issues in P_PreFireHitscan, where if a projectile is passed as having accurateAim, but the player has auto aim disabled, it won't snap to the enemy with auto aim but it won't apply spread either.
#2947 Posted 28 July 2022 - 12:54 PM
Reaper_Man, on 28 July 2022 - 12:39 PM, said:
Actually looking again, it seems like there's some logic issues in P_PreFireHitscan, where if a projectile is passed as having accurateAim, but the player has auto aim disabled, it won't snap to the enemy with auto aim but it won't apply spread either.
well thats one of my major gripes with the WIKI, basically it either says "yeah this thing exists" and leaves you to figure out just how to implement or use it, or its just so vague that basic descriptions are just that... basic at best.
for a novice user its just hell to navigate.
either way i'll delete the accurate flag and see if that fixes shit.
#2948 Posted 28 July 2022 - 01:42 PM
I agree it would be great if the wiki could be more descriptive, but this sort of odd behavior makes explaining things succinctly difficult. I'm not even sure I'm explaining the behavior properly, even if we assume the auto aim option bug didn't exist.
#2949 Posted 31 July 2022 - 04:00 PM
Is there a way to add push back or force to bullets so that enemies are thrown backwards when shot without increasing the damage a lot?
#2950 Posted 31 July 2022 - 04:29 PM
VGames, on 31 July 2022 - 04:00 PM, said:
Is there a way to add push back or force to bullets so that enemies are thrown backwards when shot without increasing the damage a lot?
You can minus the additional ammo in EVENT_DOFIRE (assuming that your alt fire still increments kickback_pic). The advantage of doing it during that event is you don't get lag where you can see the ammo changing more than once in the hud when firing. You can also use GETSHOTRANGE if that event is triggered. It's the player.ammo_amount X stuct that you want to minus from.
I find that the hardcoded knockback is pretty broken so I make my own. The victim's .htang is the angle that the projectile is coming in at, you can use that information in conjunction with .htextra (the damage) and then apply movesprite to the victim to knock them an appropriate distance at the angle. That's what I do.
You have the advantage of doing stuff that some of us have already done so you can look at our code. My AA mod as well as DT both use that system although it is implemented a big differently in each.
#2951 Posted 31 July 2022 - 05:36 PM
Danukem, on 31 July 2022 - 04:29 PM, said:
I find that the hardcoded knockback is pretty broken so I make my own. The victim's .htang is the angle that the projectile is coming in at, you can use that information in conjunction with .htextra (the damage) and then apply movesprite to the victim to knock them an appropriate distance at the angle. That's what I do.
You have the advantage of doing stuff that some of us have already done so you can look at our code. My AA mod as well as DT both use that system although it is implemented a big differently in each.
Ok cool thanks a lot.
I got another little issue. I made a new shrinkspark that has a big blast radius but I can't get it to shrink the enemies. I made a new growpsark already that works just like the original. But for some reason the new shrinkspark fails to work. Is the original shrinkspark the only projectile allowed to shrink enemies or am I missing something? I just copied all the ifwasweapon SHRINKSPARK sections of code and made duplicates of them with the name changed to my new shrinkspark. I also made sure to add an "else" where needed.
#2952 Posted 31 July 2022 - 05:51 PM
#2953 Posted 05 August 2022 - 05:46 PM
#2955 Posted 07 August 2022 - 09:15 AM
Danukem, on 05 August 2022 - 08:47 PM, said:
Ok so I got the detonator to stop showing up and I got the weapon to shoot the new projectile but I can't keep the gun from dropping down off screen and then popping back up after shooting the projectile. Any idea how to stop this from happening?
#2956 Posted 07 August 2022 - 12:28 PM
https://wiki.eduke32...IPEBOMB_CONTROL
Even if you do that so it's not switching to the detonator, it will still go down and up. I guess I would change the WEAPON5_WORKSLIKE to a different one that behaved closer to what you want (but be aware that you have to redo the display code). I talked about this at length with jimbob when he was doing something similar on the laser tripbomb slot, turning it into a sniper. It's essentially the same issue.
#2957 Posted 11 August 2022 - 04:27 AM
Also is it possible to keep the devastator from shooting 2 projectiles every time it shoots? I’ve adjusted the shots per burst amount and tried everything else I can think of but the sucker shoots 2 projectiles no matter what. Even if I specifically force it to shoot a projectile at a certain frame of the animation. I even set the shoots parameter for it to -1 and force projectiles at certain frames and it still shoots 2 projectiles.
This post has been edited by VGames: 11 August 2022 - 04:33 AM
#2958 Posted 11 August 2022 - 12:24 PM
VGames, on 11 August 2022 - 04:27 AM, said:
Also is it possible to keep the devastator from shooting 2 projectiles every time it shoots? I’ve adjusted the shots per burst amount and tried everything else I can think of but the sucker shoots 2 projectiles no matter what. Even if I specifically force it to shoot a projectile at a certain frame of the animation. I even set the shoots parameter for it to -1 and force projectiles at certain frames and it still shoots 2 projectiles.
For the projectile you could try applying the NOCLIP flag (htflag 2048) to it after it spawns: https://wiki.eduke32...iki/Spriteflags This might not work on a projectile, though, it might need to be a regular actor, I'm not sure.
For the devastator, make sure you have changed the WEAPON7_FLAGS on it and not just the shots per burst value. But it might just be really hardcoded to fire that second shot, in which case you would have change the player's current weapon slot, at least at the moment of firing.
As a general comment, it seems like you are trying to do a lot of things that go against the grain of the game. With some planning, you might be able to avoid these problems.
#2959 Posted 11 August 2022 - 01:17 PM
Danukem, on 11 August 2022 - 12:24 PM, said:
For the devastator, make sure you have changed the WEAPON7_FLAGS on it and not just the shots per burst value. But it might just be really hardcoded to fire that second shot, in which case you would have change the player's current weapon slot, at least at the moment of firing.
As a general comment, it seems like you are trying to do a lot of things that go against the grain of the game. With some planning, you might be able to avoid these problems.
Yeah I am definitely trying to make some changes to long standing weapon characteristics, but I don't mind running into walls like these. Better to know the limitations of the engine now and I don't mind wasting time on things that will never come to be due to limitations. I got time right now.
Thanks for the tips.

Help
Duke4.net
DNF #1
Duke 3D #1


