EDuke32 Scripting "CON coding help"
#2905 Posted 21 July 2022 - 10:08 AM
#2906 Posted 21 July 2022 - 11:31 AM
VGames, on 20 July 2022 - 04:24 AM, said:
Normally .htmovflag will be nonzero if a sprite is colliding with something, and then its value can be decomposed to check for what it is hitting (wall, sprite, etc.) However, with a hardcoded sprite like JIBS6 you can't assume that it is moving or clipping the way that your own coded sprite would, and that may be the issue here. You may know this already, but the hardcoded BLOODSPLAT1 (though 4) are already setup to not leave a splat unless they hitscan a nearby wall, so possibly you could just have it shoot those (see state random_wall_jibs).
#2907 Posted 21 July 2022 - 12:07 PM
Danukem, on 21 July 2022 - 11:31 AM, said:
I just remembered the state random wall jibs and I’m planning on trying it today when I get home instead of using shoot Blood. Thanks for the tip
UPDATE: Ok it worked perfectly. is there any way to allow more wall splats to stick around? They don't last very long at all and get removed due to the low count allowed in game at one time.
This post has been edited by VGames: 21 July 2022 - 12:27 PM
#2908 Posted 21 July 2022 - 12:54 PM
VGames, on 21 July 2022 - 12:07 PM, said:
I'm pretty sure they are part of the sprite deletion queue, which you can increase to up to 1024 by editing QSIZE in your USER.CON file.
#2909 Posted 21 July 2022 - 01:26 PM
Danukem, on 16 July 2022 - 01:27 AM, said:
ifwasweapon EGGPROJ add poison 150Again, that goes *inside* the ifhitweapon code block.
Personally I prefer putting that kind of logic inside of event handlers as it allows for a more generic approach rather than copy pasting code across various actors, but now I'm starting to wonder if this has some kind of downside I'm not seeing yet..
#2910 Posted 21 July 2022 - 01:44 PM
Sangman, on 21 July 2022 - 01:26 PM, said:
I don't actually put a ton of copy pasted code directly into each actor. I have a big fat state I have defined called "state monsterai" and I just make sure that each enemy calls that state. Then whenever I want to add code that applies to each enemy, I add the code to that state. They call the state before they process ifhitweapon, because one of the things I use it for is to manipulate their damage effects (e.g. knockback code, applying status effects). I'm not claiming it's superior to other methods, but it's the way I've done it for many years now.
#2911 Posted 21 July 2022 - 05:08 PM
Like gamevar temp2 0 (0 or 2) which number should I use at the end of that? I know 2 is per actor but I’ve seen these used for actors but instead of a 2 a 0 was used instead. I know when 1 should be used but I’m kind of confused on 0 and 2. I’ve tested both and didn’t really see a difference in my tests. I’m missing something.
#2912 Posted 21 July 2022 - 06:01 PM
Quote
https://wiki.eduke32...ar_manipulation
As for why you would use a global gamevar over a per-actor gamevar, that gets into what that specific gamevar and/or code is doing, and if every actor actually needs to store that value individually. Think of per-actor gamevars as things like HP, and global gamevars as things like the number of sectors in a map.
#2913 Posted 21 July 2022 - 06:19 PM
Reaper_Man, on 21 July 2022 - 06:01 PM, said:
https://wiki.eduke32...ar_manipulation
As for why you would use a global gamevar over a per-actor gamevar, that gets into what that specific gamevar and/or code is doing, and if every actor actually needs to store that value individually. Think of per-actor gamevars as things like HP, and global gamevars as things like the number of sectors in a map.
Ok I understand now. Thanks for clearing that up. I read that wiki article too but after seeing it used in multiple mods I got confused. I probably need to look more into the context of when it’s being used.
This post has been edited by VGames: 21 July 2022 - 06:19 PM
#2914 Posted 21 July 2022 - 08:55 PM
#2915 Posted 21 July 2022 - 10:26 PM
VGames, on 21 July 2022 - 08:55 PM, said:
The best method I have found is to define custom projectiles that have the properties you want. Beyond that, you also have to make the killed actor fire them off at random angles and with random negative vertical velocities at the time the actor is jibbed. And of course you will need to have the sounds defined. I also add additional actors that spawn from the jibs when they land on the ground, and code those so that they can be kicked around, destroyed, and delete after a certain amount of time has passed. Here is an example of a custom jib projectile definition I use in Alien Armageddon:
defineprojectile EGGJIBPROJ PROJ_WORKSLIKE 6286 defineprojectile EGGJIBPROJ PROJ_EXTRA 0 defineprojectile EGGJIBPROJ PROJ_TRAIL JIBS6 defineprojectile EGGJIBPROJ PROJ_SPAWNS EGGJIBGROUND defineprojectile EGGJIBPROJ PROJ_HITRADIUS 0 defineprojectile EGGJIBPROJ PROJ_VEL 160 defineprojectile EGGJIBPROJ PROJ_XREPEAT 40 defineprojectile EGGJIBPROJ PROJ_YREPEAT 40 defineprojectile EGGJIBPROJ PROJ_DROP -160 defineprojectile EGGJIBPROJ PROJ_BOUNCES 2 defineprojectile EGGJIBPROJ PROJ_ISOUND -1 defineprojectile EGGJIBPROJ PROJ_BSOUND PL_SQUISH2 defineprojectile EGGJIBPROJ PROJ_CSTAT 128 defineprojectile EGGJIBPROJ PROJ_OFFSET -160
https://wiki.eduke32...efineprojectile
Note that the JIBS6 sprites spawned from the projectile in flight have additional code on them as well, to make them green, small, etc.
#2916 Posted 21 July 2022 - 10:51 PM
VGames, on 21 July 2022 - 08:55 PM, said:
The N64 mod code for JIBS6 looks like they used events to swap it with hardcoded jibs selectively.
That bottem chunk with newbeasts is for green guts at random angles.
define JIBS6 2286
state event_game_6
switch sprite[THISACTOR].picnum
case JIBS1
case JIBS2
case JIBS3
case JIBS4
case JIBS5
case JIBS6
case HEADJIB1
case ARMJIB1
case LEGJIB1
case LIZMANHEAD1
case LIZMANARM1
case LIZMANLEG1
case DUKETORSO
case DUKEGUN
case DUKELEG
case BLOODSPLAT1
case BLOODSPLAT2
case BLOODSPLAT3
case BLOODSPLAT4
ifvare LOAD 0
spritepal 0
break
endswitch
ends
state event_game_8
ifactor JIBS6
ifspawnedby SHOTSPARK1
{
getactorvar[OWNER].OWNER ATEMP
ifvarn sprite[ATEMP].statnum MAXSTATUS
ifvare sprite[ATEMP].picnum APLAYER
killit
}
ifactor SHOTSPARK1
ifvare LOAD 0
ifvarg sprite[THISACTOR].htg_t 8 -1
{
getactor[THISACTOR].htg_t 8 ATEMP
switch sprite[ATEMP].picnum
case NEWBEAST
case NEWBEASTSTAYPUT
case NEWBEASTJUMP
case NEWBEASTHANG
case NEWBEASTHANGDEAD
espawn JIBS6
ifvare sprite[ATEMP].pal 6
setactor[RETURN].pal 6
getactor[RETURN].z Z
addvar Z 1024
setsprite RETURN sprite[THISACTOR].x sprite[THISACTOR].y Z
setactor[RETURN].xvel 16
setactor[RETURN].xrepeat 24
setactor[RETURN].yrepeat 24
randvar ANG -63
addvar ANG 32
addvarvar ANG sprite[RETURN].ang
setactor[RETURN].ang ANG
break
endswitch
}
ends
onevent EVENT_GAME
state event_game_6
state event_game_8
endevent
#2917 Posted 22 July 2022 - 05:31 AM
#2918 Posted 22 July 2022 - 06:51 AM
#2919 Posted 22 July 2022 - 11:27 AM
VGames, on 22 July 2022 - 06:51 AM, said:
Hmmm if event_getshotrange doesn't apply to it then it might be impossible.
#2920 Posted 22 July 2022 - 12:00 PM
Danukem, on 22 July 2022 - 11:27 AM, said:
Ok that’s what I thought. Thanks for the info.
#2921 Posted 22 July 2022 - 01:14 PM
Until / if this gets fixed, your next best choice is to create a new GROWSPARK projectile using defineprojectile and copying the existing Expander flags (minus the autoaim ones of course).
#2922 Posted 22 July 2022 - 03:15 PM
Reaper_Man, on 22 July 2022 - 01:14 PM, said:
Until / if this gets fixed, your next best choice is to create a new GROWSPARK projectile using defineprojectile and copying the existing Expander flags (minus the autoaim ones of course).
What expander flags are you referring to? I didn't see any defineprojectile flags for the expander in the edukewiki?
#2923 Posted 22 July 2022 - 05:23 PM
Internally the Expander is referred to as WEAPON11, and the default values for it are:
WEAPON11_CLIP 0 WEAPON11_RELOAD 0 WEAPON11_FIREDELAY 3 WEAPON11_TOTALTIME 5 WEAPON11_HOLDDELAY 0 WEAPON11_FLAGS 2 WEAPON11_SHOOTS 2448 WEAPON11_SPAWNTIME 0 WEAPON11_SPAWN 0 WEAPON11_SHOTSPERBURST 0 WEAPON11_WORKSLIKE 11 WEAPON11_INITIALSOUND 0 WEAPON11_FIRESOUND 388 WEAPON11_SOUND2TIME 0 WEAPON11_SOUND2SOUND 0 WEAPON11_RELOADSOUND1 4 WEAPON11_RELOADSOUND2 5 WEAPON11_SELECTSOUND 219 WEAPON11_FLASHCOLOR 1324248
https://wiki.eduke32...efined_gamevars
I was suggesting making an entirely new projectile that would mimic the GROWSPARK behavior, and would allow you to override auto aiming with various WORKSLIKE flags. Basically coding a replacement weapon for the Expander that looks and behaves almost identically to it, but shoots your custom projectile. From what I'm reading in the source code, it's specifically the GROWSPARK projectile that has the auto aim issue, not the Expander as a weapon itself. Unfortunately I don't think there's a WEAPONx_FLAGS option that would disable or override auto aim, but maybe someone more familiar with custom weapons has a better idea.
In a previous comment you asked how to disable the Expander as a standalone weapon, as you are replacing it as an alt-fire for the Shrinker. How are your shooting the GROWSPARK from the player exactly? If you are already handling custom weapon behavior and firing, then it should be simple enough to replace your command shooting a GROWSPARK with shooting the new projectile.
https://wiki.eduke32...efineprojectile
This post has been edited by Reaper_Man: 22 July 2022 - 05:45 PM
#2924 Posted 22 July 2022 - 06:41 PM
#2925 Posted 22 July 2022 - 07:24 PM
#2926 Posted 22 July 2022 - 08:38 PM
Reaper_Man, on 22 July 2022 - 07:24 PM, said:
Oh ok. U mean make the enemies react to the new projectile instead of the original Growspark. I thought u were saying there was some flag to set in the defineprojectile settings. I understand complete now. Thanks for all the help.
Is it possible to create a shield for a weapon similar to the one in doom eternal created by the chaingun? One that blocks incoming projectiles but not the ones u are firing?
#2927 Posted 23 July 2022 - 06:59 AM
https://wiki.eduke32...ENT_INCURDAMAGE
#2928 Posted 23 July 2022 - 02:39 PM
Reaper_Man, on 23 July 2022 - 06:59 AM, said:
https://wiki.eduke32...ENT_INCURDAMAGE
Ok thanks again for that.
How do you add screen shaking effects to explosions? I can't seem to find this in the wiki and I'm sure I'm just overlooking it somewhere. It couldn't be that difficult to implement.
#2929 Posted 23 July 2022 - 03:02 PM
[edit]
its quake
https://wiki.eduke32.com/wiki/Quake
This post has been edited by jimbob: 23 July 2022 - 03:03 PM
#2930 Posted 23 July 2022 - 05:52 PM
jimbob, on 23 July 2022 - 03:02 PM, said:
[edit]
its quake
https://wiki.eduke32.com/wiki/Quake
Thanks
#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?

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


