Duke4.net Forums: EDuke32 Scripting - Duke4.net Forums

Jump to content

  • 124 Pages +
  • « First
  • 97
  • 98
  • 99
  • 100
  • 101
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

User is online   VGames 

  • Extra Crispy

#2933

View PostReaper_Man, on 25 July 2022 - 10:52 AM, said:

IIRC the only enemy in the base game that has defined alternate pal behavior is the Liztroop, where PAL 21 turns him into the Captain. All other normal enemies don't have any PAL-designated behaviors. Bosses with a PAL other than 0 become "mini bosses", but only the Battlelord works correctly and PAL 21 is the generally accepted normal mini boss palette for them. Some work needs to be done to fix the other 2 if you want them to function as mini bosses, but that's besides the point here.

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
}
endevent


I'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?
0

User is offline   jimbob 

#2934

View PostDanukem, on 22 July 2022 - 11:27 AM, said:

Hmmm if event_getshotrange doesn't apply to it then it might be impossible.

i've noticed that event_getshotrange also doesnt apply for custom bullet projectiles ( whatever they are called ) only for shotspark1 :o
or maybe im just doing it wrong
0

User is online   Danukem 

  • Duke Plus Developer

#2935

View Postjimbob, on 26 July 2022 - 08:57 AM, said:

i've noticed that event_getshotrange also doesnt apply for custom bullet projectiles ( whatever they are called ) only for shotspark1 :o
or maybe im just doing it wrong


It is only intended to work for hitscan projectiles when fired by the player.
0

User is online   VGames 

  • Extra Crispy

#2936

I'm trying to implement a muzzle flash like the M60 muzzle flash from AMC mod but for some reason the sucker won't remove the alpha channel no matter what I do. Here's the code I'm using: If you see something I'm missing please let me know.

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

0

User is online   Danukem 

  • Duke Plus Developer

#2937

View PostVGames, on 26 July 2022 - 04:02 PM, said:

I'm trying to implement a muzzle flash like the M60 muzzle flash from AMC mod but for some reason the sucker won't remove the alpha channel no matter what I do. Here's the code I'm using: If you see something I'm missing please let me know.


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)
0

User is online   VGames 

  • Extra Crispy

#2938

View PostDanukem, on 26 July 2022 - 08:01 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)


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.
0

User is offline   MC84 

#2939

View PostVGames, on 26 July 2022 - 09:02 PM, said:

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.


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.
0

User is online   Danukem 

  • Duke Plus Developer

#2940

View PostVGames, on 26 July 2022 - 09:02 PM, said:

Are u referring to the negative alpha value?


Yes
0

User is online   VGames 

  • Extra Crispy

#2941

View PostMC84, on 26 July 2022 - 11:36 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.

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.
0

User is offline   jimbob 

#2942

View PostDanukem, on 26 July 2022 - 12:24 PM, said:

It is only intended to work for hitscan projectiles when fired by the player.

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.
0

User is offline   Reaper_Man 

  • Once and Future King

#2943

That doesn't seem right... What are your projectile's PROJ_WORKSLIKE flags or value? I assume it does not include the PROJECTILE_ACCURATE value? How are you firing it? I assume you set the WEAPONx_SHOOTS gamevar to your custom projectile. What's the output of ANGRANGE / ZRANGE when you fire it and it doesn't have any spread?
0

User is offline   jimbob 

#2944

 Reaper_Man, on 27 July 2022 - 04:22 PM, said:

That doesn't seem right... What are your projectile's PROJ_WORKSLIKE flags or value? I assume it does not include the PROJECTILE_ACCURATE value? How are you firing it? I assume you set the WEAPONx_SHOOTS gamevar to your custom projectile. What's the output of ANGRANGE / ZRANGE when you fire it and it doesn't have any spread?

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 :o

This post has been edited by jimbob: 28 July 2022 - 10:13 AM

0

User is online   VGames 

  • Extra Crispy

#2945

I got a few more questions I’m sure u geniuses can answer easily.

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

0

User is offline   Reaper_Man 

  • Once and Future King

#2946

 jimbob, on 28 July 2022 - 10:10 AM, said:

guess its projectile_accurate flag :o


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.
0

User is offline   jimbob 

#2947

 Reaper_Man, on 28 July 2022 - 12:39 PM, 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.

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.
0

User is offline   Reaper_Man 

  • Once and Future King

#2948

I just submitted a bug report about the player's auto aim settings not being obeyed. As for the flags, after reading over the source code again, PROJECTILE_ACCURATE_AUTOAIM will make a projectile ignore weapon spread when a player has an enemy in their crosshair, and PROJECTILE_ACCURATE will make the projectile ignore weapon spread independent of the PROJECTILE_ACCURATE_AUTOAIM . Meaning that if you want the weapon to use auto aim, even if PROJECTILE_ACCURATE is set, you still have to use PROJECTILE_ACCURATE_AUTOAIM .

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.
0

User is online   VGames 

  • Extra Crispy

#2949

What's the best way to go about removing more than 1 round of ammo when using an alt fire mode?

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?
0

User is online   Danukem 

  • Duke Plus Developer

#2950

 VGames, on 31 July 2022 - 04:00 PM, said:

What's the best way to go about removing more than 1 round of ammo when using an alt fire mode?

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.
0

User is online   VGames 

  • Extra Crispy

#2951

 Danukem, on 31 July 2022 - 04:29 PM, said:

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.


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.
0

User is online   Danukem 

  • Duke Plus Developer

#2952

90% of your struggles you could get through on your own if you learn some basic debugging. In this case, before the enemy uses ifhitweapon have it grab its htpicnum into a gamevar when it takes damage (htextra > -1), then log that value. That will tell if if it's actually getting set to your shrinker replacement picnum. My best guess is that it is not.
2

User is online   VGames 

  • Extra Crispy

#2953

Is it possible to make the pipebomb weapon act like a basic weapon and not have a 2 part system. I want to make it a rail gun but I can’t figure out how to make it not try to throw an actor and then swap to the detonator.
0

User is online   Danukem 

  • Duke Plus Developer

#2954

Yes, it's possible.
0

User is online   VGames 

  • Extra Crispy

#2955

 Danukem, on 05 August 2022 - 08:47 PM, said:

Yes, it's possible.


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?
0

User is online   Danukem 

  • Duke Plus Developer

#2956

Did you set the predefined gamevar PIPEBOMB_CONTROL to 2?

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.
0

User is online   VGames 

  • Extra Crispy

#2957

Is it possible to make a custom projectile pass through enemy sprites? I’ve tried reducing the clip size to 0 coupled with the flag that forces it to use the custom clip size but it doesn’t work. Any ideas?

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

0

User is online   Danukem 

  • Duke Plus Developer

#2958

 VGames, on 11 August 2022 - 04:27 AM, said:

Is it possible to make a custom projectile pass through enemy sprites? I’ve tried reducing the clip size to 0 coupled with the flag that forces it to use the custom clip size but it doesn’t work. Any ideas?

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.
0

User is online   VGames 

  • Extra Crispy

#2959

 Danukem, on 11 August 2022 - 12:24 PM, said:

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.


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.
0

User is online   VGames 

  • Extra Crispy

#2960

How do you change the ammo sprite displayed in the HUD for the original weapons? I can't find anything in the wiki regarding these ammo HUD sprites. I'm sure it's something that needs to go into the DISPLAYREST event, but I don't know what to variable to use or change.
0

User is online   Danukem 

  • Duke Plus Developer

#2961

 VGames, on 14 August 2022 - 11:04 AM, said:

How do you change the ammo sprite displayed in the HUD for the original weapons? I can't find anything in the wiki regarding these ammo HUD sprites. I'm sure it's something that needs to go into the DISPLAYREST event, but I don't know what to variable to use or change.


If it's a 1:1 change then just swap the art tile for a different one in the .ART file.

Otherwise, you have to disable the entire hardcoded hud display and draw your own from scratch. If you continue modding I'm sure you will end up going that route.
0

User is offline   Reaper_Man 

  • Once and Future King

#2962

 Danukem, on 14 August 2022 - 12:17 PM, said:

If it's a 1:1 change then just swap the art tile for a different one in the .ART file.


Out of curiosity I was wondering exactly what method the source uses to do this, I believe it's this in sbar.cpp:

                int32_t asprites[MAX_WEAPONS] = { -1, AMMO, SHOTGUNAMMO, BATTERYAMMO,
                    RPGAMMO, HBOMBAMMO, CRYSTALAMMO, DEVISTATORAMMO,
                    TRIPBOMBSPRITE, FREEZEAMMO+1, HBOMBAMMO, GROWAMMO, FLAMETHROWERAMMO+1,
                };


So it is literally those tile names. Theoretically you could `dynamicremap` those tiles and create your own ammo pickup actors, if the only thing on the HUD you wanted to change was what ammo sprite it displayed. Otherwise as you said, sooner or later you're probably gonna want to remake the HUD entirely. For example any weapon taking the place of the Boot can never display ammo because it's hardcoded to -1, and later on when the sprite is rendered to the screen, it checks and fails out for any tile ID less than 0.
1

Share this topic:


  • 124 Pages +
  • « First
  • 97
  • 98
  • 99
  • 100
  • 101
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic


All copyrights and trademarks not owned by Voidpoint, LLC are the sole property of their respective owners. Play Ion Fury! ;) © Voidpoint, LLC

Enter your sign in name and password


Sign in options