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

Jump to content

  • 105 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 offline   VGames 

#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 online   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

View PostReaper_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 offline   VGames 

#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 online   Reaper_Man 

  • Once and Future King

#2946

View Postjimbob, 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

View PostReaper_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 online   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 offline   VGames 

#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 offline   Danukem 

  • Duke Plus Developer

#2950

View PostVGames, 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 offline   VGames 

#2951

View PostDanukem, 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 offline   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 offline   VGames 

#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 offline   Danukem 

  • Duke Plus Developer

#2954

Yes, it's possible.
0

User is offline   VGames 

#2955

View PostDanukem, 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 offline   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 offline   VGames 

#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 offline   Danukem 

  • Duke Plus Developer

#2958

View PostVGames, 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 offline   VGames 

#2959

View PostDanukem, 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 offline   VGames 

#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 offline   Danukem 

  • Duke Plus Developer

#2961

View PostVGames, 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 online   Reaper_Man 

  • Once and Future King

#2962

View PostDanukem, 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

User is offline   VGames 

#2963

My main issue is that the ammo pickup for the railgun is actually the original HEAVYHBOMB actor because it gives you 1 ammo at a time which is perfect. However, this isn't the ammo sprite used in the HUD for the pipe bombs. That sprite is the big box of pipe bombs which is now a Railgun weapon pickup. So, the Railgun Weapon pickup sprite is what's displayed in the HUD instead of the other one. I'll look into this some more. Thanks for the tips.
0

User is offline   jimbob 

#2964

why not use the ammobox actor then? and ignore the heavybomb actor. change the amount of ammo you get through the user.con code

if that doesnt work, create your own pickup actor, and let it give you whatever ammo you need to get from it.

This post has been edited by jimbob: 14 August 2022 - 01:19 PM

1

User is offline   VGames 

#2965

What I did was set the ammo and weapon pickup sprites like they would normally be. That fixed the HUD issue. Then I created a new weapon and ammo pickup for my railgun that were created when the original pipebomb and pipebomb ammo pickups were spawned. The originals just get swapped out with the new ones. It's all good now.
0

User is offline   VGames 

#2966

Is it possible to change the weapon raise animations? So that maybe u can have a weapon pop out from the side or from above when switching to it instead of it raising up from the bottom of the screen like all the weapons typically do? I didn’t see anything for this in the weapons sample con and I don’t recall any weapons in mods doing this.
0

User is offline   Danukem 

  • Duke Plus Developer

#2967

View PostVGames, on 16 August 2022 - 09:56 AM, said:

Is it possible to change the weapon raise animations? So that maybe u can have a weapon pop out from the side or from above when switching to it instead of it raising up from the bottom of the screen like all the weapons typically do? I didn’t see anything for this in the weapons sample con and I don’t recall any weapons in mods doing this.


You can cancel the hardcoded drawing of the weapon by setting to RETURN to -1 in the weapon drawing event (EVENT_DISPLAYWEAPON or EVENT_DRAWWEAPON). Then you can use rotatesprite and other commands to draw the weapon or whatever else you want to draw on to the screen wherever you want it to be drawn. And that is really the only answer I can give you. There is no simple hack or setting of a variable to make a weapon come in from the side instead of the bottom.
0

User is online   Reaper_Man 

  • Once and Future King

#2968

Yes it's possible. You'd have to completely rewrite the weapon display code for that specific weapon, which sounds harder than it really is, and really is just tedious more than anything. The weapon sample CON would be a good place to start, you'll just have to do your own math on having the weapon pop out from the side or top.
0

User is offline   VGames 

#2969

Ok cool I’ll look into this. I’ve been working out of the weapon sample CON extensively already so I’ll keep adding to it. Thanks.
0

User is offline   VGames 

#2970

ok I've got a little issue with 2 weapons playing off the same weapon using the WORKSLIKE command. They both WORKSLIKE weapon 11 and I got them to play the raise and lower animations like they should as long as you aren't switching between them. When you switch from one of them to the other the art for both weapons will be displayed during the lowering animation of which ever one is currently selected. I have tried everything to get them to wait on each other to finish their lowering animations before displayign their own art but it just won't work. I can't think of a proper if statement or variables to get them to wait on each other.

in the CHANGEWEAPON EVENT I'm using this to set up the wait:

ifvare player[].curr_weapon HANDBOMB_WEAPON
	setvar SwitchTime6 20

ifvare player[].curr_weapon TRIPBOMB_WEAPON
	setvar SwitchTime9 20



in the DISPLAYWEAPON EVENT I got this to make them play the proper animation when their specific SwitchTime variable is active:

	ifvarg SwitchTime6 0
		state draw_LSFire1

	ifvarg SwitchTime9 0
		state draw_4HFire


Now both SwitchTime6 and 9 get reduced by 1 every tick when above 0 I just didn't show that part of the code. This code works good unless you're switching between both weapons. I didn't include all the various sets of script I tried out to try and get them to wait on each other. They were all worthless. Please help if you can.

This post has been edited by VGames: 21 August 2022 - 01:40 PM

0

Share this topic:


  • 105 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