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

Jump to content

  • 124 Pages +
  • « First
  • 105
  • 106
  • 107
  • 108
  • 109
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

User is offline   MC84 

#3173

I would like to be able to control SEENINE explosions based on their extra value so that I can have alternate explosion types.

onevent EVENT_LOADACTOR

switch sprite[].picnum

  case SEENINE // Alternate explosions
  { 
   ifn sprite[].extra -1
   geta[].extra extrasaved
  }
  break

endswitch

endevent


I had then initially put the following under EVENT_SPAWN... however I have moved it to EVENT_EGS;

onevent EVENT_EGS

switch sprite[].picnum

  case EXPLOSION2 // Alternate explosions
  { 
   seta[].extra actorvar[sprite[].owner].extrasaved
   ife sprite[].extra extrasaved
	 {
	  action ASMOKEBLAST1
	 }
	else nullop
  }
  break
 
endswitch
  
endevent


However it's now doing the opposite of what I intended - if I leave the SEENINE with an extra of -1; they spawn ASMOKEBLAST1, and if I give them an extra value they play the default EXPLOSION2... I suspect I do not properly understand the following command;

   seta[].extra actorvar[sprite[].owner].extrasaved


Does this assign the saved extra value (extrasaved) from EXPLOSION2's 'owner' SEENINE to EXPLOSION2?

--- I also wanted to know if switch statements can be nested? IE calling a state within a switch statement that also contains a switch statement?

This post has been edited by MC84: 31 December 2022 - 07:53 PM

0

#3174

View PostDanukem, on 31 December 2022 - 02:32 PM, said:

By the way, I don't understand why your enemies aren't already lighting up when they fire. Mine do automatically, and I have not added that flag to them. I do define them as enemy -- are you not doing that?

The actor that was causing problems was BOSS4. I had thought the useractor was only lighting properly because it was using the trooper's firelaser and the newbeast using shrinker.
1

User is offline   Danukem 

  • Duke Plus Developer

#3175

View Postlllllllllllllll, on 31 December 2022 - 08:45 PM, said:

The actor that was causing problems was BOSS4. I had thought the useractor was only lighting properly because it was using the trooper's firelaser and the newbeast using shrinker.


The vanilla BOSS4 doesn't shoot anything. What are you having it shoot?
1

User is offline   Danukem 

  • Duke Plus Developer

#3176

View PostMC84, on 31 December 2022 - 07:29 PM, said:

I would like to be able to control SEENINE explosions based on their extra value so that I can have alternate explosion types.


1. In the load actor event, when you grab the altered EXTRA value into a var, it's best to then set the EXTRA back to -1 (just in case the altered extra does something).

2.

case EXPLOSION2 // Alternate explosions
  { 
   ifn sprite[].owner -1 getav[sprite[].owner].extrasaved extrasaved
   // CHOOSE A SPECIFIC NUMERICAL VALUE FOR THE ALTERNATE EXPLOSION
   // LET'S SAY 2

   ife extrasaved 2 cstat 32768 // we are just turning it invisible for now

  }
  break


3.

Here's the vanilla EXPLOSION2 code:

action EXPLOSION_FRAMES 0 20 1 1  4
actor EXPLOSION2 1 EXPLOSION_FRAMES
  ifactioncount 20
    killit
enda


Here's what should be your version:


action EXPLOSION_FRAMES 0 20 1 1  4
action ASMOKEBLAST1 blah blah blah blah
actor EXPLOSION2 1 EXPLOSION_FRAMES

  ife extrasaved 2 ifaction EXPLOSION_FRAMES { action ASMOKEBLAST1 cstat 0 }

  ifactioncount 20
    killit
enda

2

User is offline   MC84 

#3177

Thanks Dan - Happy new year!
0

#3178

Everything I was having BOSS4 shoot was custom projectiles, and of those there were 2 types that are fired directly by the actor while the others are via spawned sprites. Those 2 being fired directly were not prompting any flash until the badguy flag was set.
I'll test useractors with custom projectiles and BOSS4 with stock projectiles to see if there's anything to that or not but it seems to just be an issue of how BOSS4 was implemented. I'm wondering if it's even included in killcount or not.
1

#3179

And after testing swapping the projectiles around I can't recreate the non-lighting behavior on any of them. Commenting out the htflag changes nothing and I don't understand why given there wasn't anything else that got changed. I checked both polymost/polymer and rolled back to 20211116-9796-dc16f81b2 and it's still displaying correctly now.
The map I was testing on has some stock enemies in a dark room with the custom ones so it's not a case of none of the shot flashes working, and the animations/projectiles themselves are very distinct as not to mix up which are being shot directly and which are shot by proxy.
I was very happy at seeing BOSS4 light up for the first time I'm not crazy really~~
1

User is offline   Danukem 

  • Duke Plus Developer

#3180

View Postlllllllllllllll, on 01 January 2023 - 01:57 PM, said:

And after testing swapping the projectiles around I can't recreate the non-lighting behavior on any of them. Commenting out the htflag changes nothing and I don't understand why given there wasn't anything else that got changed. I checked both polymost/polymer and rolled back to 20211116-9796-dc16f81b2 and it's still displaying correctly now.
The map I was testing on has some stock enemies in a dark room with the custom ones so it's not a case of none of the shot flashes working, and the animations/projectiles themselves are very distinct as not to mix up which are being shot directly and which are shot by proxy.
I was very happy at seeing BOSS4 light up for the first time I'm not crazy really~~


Don't feel too bad -- I have been gaslit by Duke many times.
1

#3181

One other thing was I indexed all of the BOSS4 sprites I drew to duke's palette to reduce the size. Their appearance didn't change ingame since it was being converted to 8bit already but the previous files were 32bit with translucent pixels.
After doing this the load time dropped quite a bit and that was about when I was trying out the htflag.
1

User is offline   VGames 

  • Extra Crispy

#3182

Is there a way to force walls, floors, and ceilings to allow bullet holes? I've noticed that on some walls especially bullet holes simply do not appear. I've tried using damageeventtile to force the specific texture to use the same settings as other wall textures but there's no change.
1

User is offline   Aleks 

#3183

View PostVGames, on 02 January 2023 - 10:35 AM, said:

Is there a way to force walls, floors, and ceilings to allow bullet holes? I've noticed that on some walls especially bullet holes simply do not appear. I've tried using damageeventtile to force the specific texture to use the same settings as other wall textures but there's no change.

This is probably due to these walls being parts of moving sectors (like doors), the bulletholes won't appear on them, as they wouldn't be carried along (and would look stupid just hanging there in the air if the door moves :) ), remember bulletholes are essentially wall-aligned sprites.
1

#3184

You'll end up with decals on exploded walls too.
You should be able to spawn a wall aligned decal on the event where the bullet impacts by getting the angle to the wall etc to get around the default setting preventing it though you'll want to delete them whenever that wall shifts, with the exception of the decal sitting in a rotating sector. If the original decal won't spawn make a dupe of it.

-
Is there a way to pass down a projectile's palette to the sprite it spawns on impact (proj_spawns)? This projectile is using noshade and taking on the palette from the actor shooting it
1

User is offline   Danukem 

  • Duke Plus Developer

#3185

Grab palette off the owner in EVENT_EGS. Or anything else you need to grab. That's going to come up for a lot of stuff, so make a note of that everyone.
1

User is offline   VGames 

  • Extra Crispy

#3186

Ok so I should just leave the walls alone then. I don’t want to add more problems to my plate.

How do I code this model to use different skins for different palettes?

model "models/nailgun/nailgun.MD2" {
   scale 20
   skin { pal 0 file "models/nailgun/nailgun.png" }

   anim { frame0 "shot1" frame1 "shot1" fps 4  }
   frame { frame "shot1" tile0 6872 tile1 6872 }

   anim { frame0 "shot2" frame1 "shot9" fps 40  }
   frame { frame "shot2" tile0 6873 tile1 6874 }	

   hud { tile0 6872 tile1 6874 xadd -0.38 yadd 0.3 zadd 0 angadd 0 }
}


This post has been edited by VGames: 02 January 2023 - 05:01 PM

1

User is offline   Danukem 

  • Duke Plus Developer

#3187

Just add another skin clause, exactly like the one it has already, but make it for pal # and refer to whatever the file name is for the other one.
1

User is offline   MC84 

#3188

Following on from my last query re: custom explosions, how the heck do you override EXPLOSION2's default action EXPLOSION_FRAMES (20 by default)? I have two alternate explosions, SMOKEBLAST1 (16 frames) and SMOKEBLAST2 (33 frames) but they will both play 20 frames when spawned.

action EXPLOSION_FRAMES 0 20 1 1  4
action ASMOKEBLAST1 3743 16 1 1 8 // 3743 tiles from original EXPLOSION2 (1890) = 5633
action ASMOKEBLAST2 3763 33 1 1 4
actor EXPLOSION2 1 EXPLOSION_FRAMES
{
  ife extrasaved 1 
   ifaction EXPLOSION_FRAMES
    { action ASMOKEBLAST1 cstat 0 }
  
  else
  ife extrasaved 2
   ifaction EXPLOSION_FRAMES
   { action ASMOKEBLAST2 cstat 0 }
   
  else
   { ifactioncount 20 
     killit
   }
}
enda


I have also tried placing a CACTOR command, but this just froze the actions on their first frame when spawned;

{
  ife extrasaved 1 
   ifaction EXPLOSION_FRAMES
    { 
	 cactor SMOKEBLAST1
	 action ASMOKEBLAST1 cstat 0 }


And I tried placing the following in EVENT_EGS;

  case EXPLOSION2 // Alternate explosions
  { 
   ifn sprite[].owner -1   // owner being the SEENINE sprite that spawned the EXPLOSION2 actor
   getav[sprite[].owner].extrasaved extrasaved
   
   ife extrasaved 1
    {
	 ifactioncount 16
	 killit
	}
   else
   
   ife extrasaved 2
    {
	 ifactioncount 33
	 killit
	}
    else nullop	
  }
  break


But that doesn't seem to do anything either...
0

User is offline   Danukem 

  • Duke Plus Developer

#3189

action EXPLOSION_FRAMES 0 20 1 1  4
action ASMOKEBLAST1 3743 16 1 1 8 // 3743 tiles from original EXPLOSION2 (1890) = 5633
action ASMOKEBLAST2 3763 33 1 1 4
actor EXPLOSION2 1 EXPLOSION_FRAMES

  ife extrasaved 1 
   ifaction EXPLOSION_FRAMES
    { action ASMOKEBLAST1 cstat 0 }
  
  else
  ife extrasaved 2
   ifaction EXPLOSION_FRAMES
   { action ASMOKEBLAST2 cstat 0 }
   
ifaction EXPLOSION_FRAMES
   ifactioncount 20 
     killit
else
ifaction ASMOKEBLAST1 
  ifactioncount 16
      killit
else
ifaction ASMOKEBLAST2
   ifactioncount 33
      killit

enda


Just change the actor, don't try to mess with the animations in EGS
2

User is offline   VGames 

  • Extra Crispy

#3190

Yeah that kind of stuff dealing with animations needs to be taken care of in the actor’s body of code.
1

#3191

View PostVGames, on 02 January 2023 - 04:21 PM, said:

Ok so I should just leave the walls alone then. I don’t want to add more problems to my plate.

The one thing that should be ok in every case is adding decals to sector 0 masked walls only if you can find a way to exempt textures with alpha. I can't think of any cases where a solid masked surface would create trouble having a bullet hole on it.
1

User is offline   VGames 

  • Extra Crispy

#3192

@Dan
Ok so this:

model "models/nailgun/nailgun.MD2" {
   scale 20
   skin { pal 0 file "models/nailgun/nailgun.png" }
   skin { pal 1 file "models/nailgun/nailgunB.png" }
   skin { pal 2 file "models/nailgun/nailgunR.png" }
   skin { pal 8 file "models/nailgun/nailgunG.png" }

   anim { frame0 "shot1" frame1 "shot1" fps 4  }
   frame { frame "shot1" tile0 6872 tile1 6872 }

   anim { frame0 "shot2" frame1 "shot9" fps 40  }
   frame { frame "shot2" tile0 6873 tile1 6874 }

   hud { tile0 6872 tile1 6874 xadd -0.38 yadd 0.3 zadd 0 angadd 0 }
}


does nothing for the view model of the gun. I tried the multiple skin lines like you said for the pickup model for the weapon and it worked just like you said it would:

model "models/nailgun_pick/nailgun_pick.md2" {
   scale 2.6 shade 0
   skin { pal 0 file "models/nailgun_pick/nailgun_pick.png" }
   skin { pal 1 file "models/nailgun_pick/nailgun_pickB.png" }
   skin { pal 2 file "models/nailgun_pick/nailgun_pickR.png" }
   skin { pal 8 file "models/nailgun_pick/nailgun_pickG.png" }

   anim { frame0 "shot1" frame1 "shot1" fps 4  } 
   frame { frame "shot1" tile0 6871 tile1 6871 }
}


But for the view model it does nothing. Only the pal 0 skin is used.
1

User is offline   Danukem 

  • Duke Plus Developer

#3193

Yeah hud models are a different beast. There's even a whole set of hud commands for models on the wiki: https://wiki.eduke32...wiki/Model_(DEF)

I don't know if you can make them use different pals, though, I don't recall ever trying that.
1

User is offline   VGames 

  • Extra Crispy

#3194

View PostDanukem, on 03 January 2023 - 08:13 PM, said:

Yeah hud models are a different beast. There's even a whole set of hud commands for models on the wiki: https://wiki.eduke32...wiki/Model_(DEF)

I don't know if you can make them use different pals, though, I don't recall ever trying that.


Ok cool. I’ll check this stuff out again. Maybe I missed something
1

User is offline   MC84 

#3195

What is the best way to create an actor that has multiple damage levels? The following code gets stuck after the first ifstrength statement;

useractor notenemy DOORBOARDED 120
{
 cstat 273 // blocked, hittable
 ifaction 0
  {
   ifhitweapon
    { ifstrength 100
      action ONE 
      break 
     }
    else
    { ifstrength 80
      action TWO 
      break 
     }
    else 
    { ifstrength 60
      action THREE 
      break 
    }
   else
   { ifstrength 40 
     action FOUR 
     break 
    }
   else
   { ifstrength 20
     action FIVE 
     break 
    }
   else
   { ifstrength 0
     killit 
    }
   }
}
enda
	

0

User is offline   Danukem 

  • Duke Plus Developer

#3196

View PostMC84, on 05 January 2023 - 12:56 PM, said:

What is the best way to create an actor that has multiple damage levels?




It's easy enough, but first we need to get clear on the intent. What is supposed to happen if you do enough damage to reduce it multiple levels in one hit? Do you want it reduced by only one damage level anyway?
1

User is offline   MC84 

#3197

View PostDanukem, on 05 January 2023 - 01:13 PM, said:

It's easy enough, but first we need to get clear on the intent. What is supposed to happen if you do enough damage to reduce it multiple levels in one hit? Do you want it reduced by only one damage level anyway?


Well I guess in my simplistic understanding I assumed that the 'ifhitweapon' branch included the multiple else statements to handle the possibility that you shoot the actor with an RPG and it takes it down multiple levels... Those actions are relative to the zero/default tile of the actor right? So if the actor was hit by a weapon, and it takes the damage down to 20 (from 120), then action 5 will skip ahead to the 5th damaged state of the actor right? I mean obviously it's not working - but that was the intent!

This post has been edited by MC84: 05 January 2023 - 02:06 PM

0

User is offline   VGames 

  • Extra Crispy

#3198

View PostMC84, on 05 January 2023 - 02:05 PM, said:

Well I guess in my simplistic understanding I assumed that the 'ifhitweapon' branch included the multiple else statements to handle the possibility that you shoot the actor with an RPG and it takes it down multiple levels... Those actions are relative to the zero/default tile of the actor right? So if the actor was hit by a weapon, and it takes the damage down to 20 (from 120), then action 5 will skip ahead to the 5th damaged state of the actor right? I mean obviously it's not working - but that was the intent!


Something like this should work:

useractor notenemy DOORBOARDED 120
{
 	cstat 273 // blocked, hittable
 	ifaction 0
  	{
   		ifhitweapon
		{
    			ifstrength 100
			{
      			action ONE 
      			break
			}
    			else	ifstrength 80
			{
     	 			action TWO 
      			break 
     			}
    			else ifstrength 60
			{
      			action THREE 
      			break 
    			}
   			else ifstrength 40
			{
     				action FOUR 
     				break 
    			}
   			else ifstrength 20
			{
     				action FIVE 
     				break 
    			}
   			else
     				killit 
   		}
   	}
}
enda


Notice where the brackets are.

This post has been edited by VGames: 05 January 2023 - 05:30 PM

1

User is offline   VGames 

  • Extra Crispy

#3199

Is there any way to check what HUD is being used as in the HUD you pick by pressing the - or = keys? I tried messing around with "statubarrange" by getting the value and saving it in a variable, but I don't know what the number is for the specific HUD type I'm trying to mess with.

This post has been edited by VGames: 05 January 2023 - 05:38 PM

1

User is offline   MC84 

#3200

View PostVGames, on 05 January 2023 - 05:29 PM, said:



Something like this should work:

Notice where the brackets are.


Thanks for trying to help - however now when I shoot the actor it goes straight to killit... Although you have taught me something - I now realize that the brackets should have followed the else if statements.
0

User is offline   Reaper_Man 

  • Once and Future King

#3201

View PostMC84, on 05 January 2023 - 12:56 PM, said:

What is the best way to create an actor that has multiple damage levels? The following code gets stuck after the first ifstrength statement;

The way "ifstrength" works is it returns true if the health value is less than or equal to X. The reason it gets stuck after the first one is because every value is less than or equal to 100, so it never enters the other branches. You should be able to easily fix this by ordering your ifstrength statements from lowest to highest, rather than highest to lowest. Also, yes the bracket should go after the next if statement, not after else

ifstrength 20
{
	// something
}
else
ifstrength 40
{
	// something else
}

etc.

2

#3202

View PostMC84, on 05 January 2023 - 12:56 PM, said:

What is the best way to create an actor that has multiple damage levels? The following code gets stuck after the first ifstrength statement;

useractor notenemy DOORBOARDED 120
{
 cstat 273 // blocked, hittable
 ifaction 0
  {
   ifhitweapon
    { ifstrength 100
      action ONE 
      break 
     }
    else
    { ifstrength 80
      action TWO 
      break 
     }
    else 
    { ifstrength 60
      action THREE 
      break 
    }
   else
   { ifstrength 40 
     action FOUR 
     break 
    }
   else
   { ifstrength 20
     action FIVE 
     break 
    }
   else
   { ifstrength 0
     killit 
    }
   }
}
enda
	


It's getting stuck because all of that only fires on IFACTION 0. Changing the action to anything else stops meeting that condition.
After that it is getting stuck on the first strength check because 'ifstrength 100' is true until death (if strength <= 100).

Spoiler

2

Share this topic:


  • 124 Pages +
  • « First
  • 105
  • 106
  • 107
  • 108
  • 109
  • 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