![](https://forums.duke4.net/public/style_images/cgs/_custom/switch.png)
EDuke32 Scripting "CON coding help"
#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 } 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.
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 } 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?
#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
![:o](https://forums.duke4.net/public/style_emoticons/default/ohmy.gif)
or maybe im just doing it wrong
#2935 Posted 26 July 2022 - 12:24 PM
jimbob, on 26 July 2022 - 08:57 AM, said:
![:o](https://forums.duke4.net/public/style_emoticons/default/ohmy.gif)
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.