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

Jump to content

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

EDuke32 Scripting  "CON coding help"

User is offline   VGames 

  • Extra Crispy

#2911

When u make a gamevar how do u know when to use a 0 or a 2 at the end of the declaration?

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

User is offline   Reaper_Man 

  • Once and Future King

#2912

From the wiki:

Quote

The gamevar's flags define a bitmap that determines how the variable is treated by the game. For instance, a gamevar with flags of 0 is known as a global variable. A global variable exists once in the code, and any time a global variable is set, the new value is seen by all actors and events. A gamevar with flag bit 1 set is a per-player variable, which exists once for each player in the game. A gamevar with flag bit 2 set is a per-actor variable, which exists as many times in the code as there are sprites in the map. This means that each sprite has its own copy of a per-actor variable stored in memory. Note that a gamevar can only be defined as either global, per-player, or per-actor, but not as a combination thereof.


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

User is offline   VGames 

  • Extra Crispy

#2913

View PostReaper_Man, on 21 July 2022 - 06:01 PM, said:

From the wiki:



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

0

User is offline   VGames 

  • Extra Crispy

#2914

Is there any available code out there to make more SCRAP or JIB actors that act like the original SCRAP/JIB actors?
0

User is offline   Danukem 

  • Duke Plus Developer

#2915

View PostVGames, on 21 July 2022 - 08:55 PM, said:

Is there any available code out there to make more SCRAP or JIB actors that act like the original SCRAP/JIB actors?


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

#2916

View PostVGames, on 21 July 2022 - 08:55 PM, said:

Is there any available code out there to make more SCRAP or JIB actors that act like the original SCRAP/JIB actors?

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

0

User is offline   VGames 

  • Extra Crispy

#2917

Ok thanks for the help guys. I understand what needs to be done.
0

User is offline   VGames 

  • Extra Crispy

#2918

Sorry for double posting but I forgot to ask something earlier. How do u increase the spread for Growspark? I’ve tried the event_EGS method explained to me before and I’ve tried using event_getshotrange but neither method works with Growspark. I’ve even used them together to see if it would make a difference but it doesn’t. Anybody try this before?
0

User is offline   Danukem 

  • Duke Plus Developer

#2919

View PostVGames, on 22 July 2022 - 06:51 AM, said:

Sorry for double posting but I forgot to ask something earlier. How do u increase the spread for Growspark? I’ve tried the event_EGS method explained to me before and I’ve tried using event_getshotrange but neither method works with Growspark. I’ve even used them together to see if it would make a difference but it doesn’t. Anybody try this before?


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

User is offline   VGames 

  • Extra Crispy

#2920

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

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


Ok that’s what I thought. Thanks for the info.
0

User is offline   Reaper_Man 

  • Once and Future King

#2921

This actually appears to be an engine bug. Looking at the engine source and testing in game, the GROWSPARK projectile works just fine with EVENT_GETSHOTRANGE, but it doesn't obey auto aim settings. Try setting ANGRANGE / ZRANGE to absurd values and when shooting normally you can see it take effect, but as soon as your crosshairs point over an enemy, autoaim takes effect even when set to "none" in the options menu.

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

User is offline   VGames 

  • Extra Crispy

#2922

View PostReaper_Man, on 22 July 2022 - 01:14 PM, said:

This actually appears to be an engine bug. Looking at the engine source and testing in game, the GROWSPARK projectile works just fine with EVENT_GETSHOTRANGE, but it doesn't obey auto aim settings. Try setting ANGRANGE / ZRANGE to absurd values and when shooting normally you can see it take effect, but as soon as your crosshairs point over an enemy, autoaim takes effect even when set to "none" in the options menu.

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

User is offline   Reaper_Man 

  • Once and Future King

#2923

You can export all of the current gamevars and their values by using the cheat DNDEBUG (or the console command "activatecheat 24"), which includes the pre-defined gamevars controlling weapon behavior.

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

0

User is offline   VGames 

  • Extra Crispy

#2924

I’m shooting the original Growspark via the display weapon event on the frame it’s supposed to shoot. I use a gamevar to decide which projectile should be fired depending on which shoot button is being pressed. How would I make a custom projectile cause grow spark type damage? Which flag do I use for the custom projectile to do the same type of damage?
0

User is offline   Reaper_Man 

  • Once and Future King

#2925

In that case you would setup your new projectile, I already linked to the defineprojectile wiki page. After then you'd change your code to shoot the new projectile name instead of GROWSPARK. Then to make enemies react to it, you'd add or change their behaviors when taking damage in the ifhitweapon / ifwasweapon code blocks from GROWSPARK to your new projectile name.
0

User is offline   VGames 

  • Extra Crispy

#2926

View PostReaper_Man, on 22 July 2022 - 07:24 PM, said:

In that case you would setup your new projectile, I already linked to the defineprojectile wiki page. After then you'd change your code to shoot the new projectile name instead of GROWSPARK. Then to make enemies react to it, you'd add or change their behaviors when taking damage in the ifhitweapon / ifwasweapon code blocks from GROWSPARK to your new projectile name.


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

User is offline   Reaper_Man 

  • Once and Future King

#2927

Pretty much anything is possible depending on how much work you want to put in. I'd start with this event:

https://wiki.eduke32...ENT_INCURDAMAGE
0

User is offline   VGames 

  • Extra Crispy

#2928

View PostReaper_Man, on 23 July 2022 - 06:59 AM, said:

Pretty much anything is possible depending on how much work you want to put in. I'd start with this event:

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

User is offline   jimbob 

#2929

there is an command earthquake XX where XX is the amount of time spent in earthquake mode iirc

[edit]

its quake

https://wiki.eduke32.com/wiki/Quake

This post has been edited by jimbob: 23 July 2022 - 03:03 PM

0

User is offline   VGames 

  • Extra Crispy

#2930

View Postjimbob, on 23 July 2022 - 03:02 PM, said:

there is an command earthquake XX where XX is the amount of time spent in earthquake mode iirc

[edit]

its quake

https://wiki.eduke32.com/wiki/Quake


Thanks
0

User is offline   VGames 

  • Extra Crispy

#2931

I’m using a slaughtermap remix of the original campaign not created by me for the maps in my mod and I noticed some of the enemies were given different palettes I guess to change up their colors from time to time. The Liz troopers look fine because only their vests have a color change but some of the other enemies like the pigs and octabrains look bad because their colors are messed up looking due to the palette changes. Would it hurt anything if I simply set all the pigs and octabrain skin palettes to 0 via the scripts when they’re spawned into the maps? Could it break some of the maps? Are there instances where a specific palette could be used to trigger something in a map? Is that possible?

This post has been edited by VGames: 25 July 2022 - 05:57 AM

0

User is offline   Reaper_Man 

  • Once and Future King

#2932

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.

This post has been edited by Reaper_Man: 25 July 2022 - 10:54 AM

0

User is offline   VGames 

  • Extra Crispy

#2933

 Reaper_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

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

  • Duke Plus Developer

#2935

 jimbob, 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 offline   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 offline   Danukem 

  • Duke Plus Developer

#2937

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

  • Extra Crispy

#2938

 Danukem, 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

 VGames, 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 offline   Danukem 

  • Duke Plus Developer

#2940

 VGames, on 26 July 2022 - 09:02 PM, said:

Are u referring to the negative alpha value?


Yes
0

Share this topic:


  • 124 Pages +
  • « First
  • 96
  • 97
  • 98
  • 99
  • 100
  • 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