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

Jump to content

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

EDuke32 Scripting  "CON coding help"

#3113

Was wall alignment the problem?
0

User is offline   Danukem 

  • Duke Plus Developer

#3114

View Postlllllllllllllll, on 23 November 2022 - 12:47 PM, said:

Was wall alignment the problem?


https://wiki.eduke32.../Eventloadactor

Read that entry, especially the phrase "undesired hardcoded effects". Notice in my example a few posts above I don't keep any tags on the sprite, they are moved into vars and then reset to 0.
0

#3115

Yeah that was the problem sorry
Changing it with EGS kept the collapse behavior. I tried using .extra instead then zeroing it out I guess it failed for the same reason.

On the topic of lotagging sprites I made a 'useractor enemy' and then a few more to switch into it like the hardcoded versions (duckshoot, stayput, jetpack, etc). They work as they should up until trying to Lotag them for difficulty settings- the sprite still spawns but as an unresponsive 1st frame.
Is this like RECOG that it must be faked? If so I can use loadactor to prevent their spawn by comparing skill level?
0

User is offline   Danukem 

  • Duke Plus Developer

#3116

View Postlllllllllllllll, on 23 November 2022 - 02:08 PM, said:

On the topic of lotagging sprites I made a 'useractor enemy' and then a few more to switch into it like the hardcoded versions (duckshoot, stayput, jetpack, etc). They work as they should up until trying to Lotag them for difficulty settings- the sprite still spawns but as an unresponsive 1st frame.
Is this like RECOG that it must be faked? If so I can use loadactor to prevent their spawn by comparing skill level?


It's difficult to guess what you are doing wrong with only a vague description and not seeing your code.

My first guess would be the unresponsive sprites are ones that are supposed to be deleted due to the difficulty (i.e. a lotag 3 tagged sprite in a game set on Let's Rock). In that situation what you are describing would happen if you did something to prevent the sprite from being deleted (e.g. changed its size in EVENT_SPAWN). Then the sprite would fail to take statnum 1 and would remain inert.
0

#3117

View PostDanukem, on 23 November 2022 - 08:58 PM, said:

(e.g. changed its size in EVENT_SPAWN).

lol
Are all things of that nature supposed to be in loadactor?
0

User is offline   Danukem 

  • Duke Plus Developer

#3118

View Postlllllllllllllll, on 23 November 2022 - 10:53 PM, said:

lol
Are all things of that nature supposed to be in loadactor?


So in other words I was right.

You can change size in EVENT_SPAWN, just be careful.

For example, here is a case from a switch statement I have in that event:

case SHARK
	ifrnd 32 
	cactor DOPEFISH
	else 
	ifg sprite[].xrepeat 4 sizeat 40 40
break


If the actor is slated for deletion, its size is already reduced. So if you check the size first before setting size, you can do so safely.
0

User is offline   VGames 

  • Extra Crispy

#3119

Is there a way to check when a player picks up an atomic health?
0

User is online   Reaper_Man 

  • Once and Future King

#3120

You mean, other than in the ATOMICHEALTH actor code?

You could capture EVENT_KILLIT and check for ATOMICHEALTH, but strictly speaking that doesn't actually guarantee the player picked it up, only that it was deleted. The game doesn't track what sprite or actor added health to the player. You could maybe use player[].ftq to get the current displayed quote, but that is a gross hack that seems pointless.
0

User is offline   VGames 

  • Extra Crispy

#3121

Ok I’ll check this out. Thanks.

One more quick question. Is there any way to change the position of the button layout in the options menu where u bind your keys to certain commands? I’ve changed the names of several buttons to accommodate some of the new features in my mod they were changed to work for like the look up and look down buttons are used for new fire modes. But I’d like them to be located next to the original fire and alt fire button locations on the key bind menu screen. Is there a way to reposition these button commands so the player doesn’t have to search for them?

This post has been edited by VGames: 29 November 2022 - 06:43 AM

0

User is offline   Mav3r1ck 

#3122

I'm using additive translucency most recently and I'm having a small issue.

I wanted to have the monsters use additive translucency when frozen, I've already done this, and it also returns to it's previous sprite pal when it thaws. However, it maintains translucency when it was frozen. How do I get it to become solid again after it thaws? Doesn't it have something to do with cstator?
0

User is online   Reaper_Man 

  • Once and Future King

#3123

View PostVGames, on 29 November 2022 - 06:42 AM, said:

Is there any way to change the position of the button layout in the options menu where u bind your keys to certain commands?

Nope. They will always appear in the order gamefuncs are defined.

View PostMav3r1ck, on 29 November 2022 - 08:44 AM, said:

I'm using additive translucency most recently and I'm having a small issue.I wanted to have the monsters use additive translucency when frozen, I've already done this, and it also returns to it's previous sprite pal when it thaws. However, it maintains translucency when it was frozen. How do I get it to become solid again after it thaws? Doesn't it have something to do with cstator?

You'll need to modify each enemy's code to reset the transparency cstat (and presumably the blend mode back to 0). You can do this a few ways:

If you already know the desired cstat, just set it back. This is probably fine in 99% of cases. Most enemies use 257 (blocking + hitscan):
cstat 257

If you just want to remove a given cstat value, you can get and subtract the value. This may produce unintended results so for safety you should add some checks before doing this:
geta .cstat TEMP
sub TEMP 2
seta .cstat TEMP

A fun trick is to bitwise AND the negative of the cstat (or cstats, plural) you want to remove, plus 1. This would safely clear both transparency cstats (2 + 512):
geta .cstat TEMP
and TEMP -515
seta .cstat TEMP

0

User is offline   Danukem 

  • Duke Plus Developer

#3124

View PostVGames, on 29 November 2022 - 06:42 AM, said:

One more quick question. Is there any way to change the position of the button layout in the options menu where u bind your keys to certain commands?


Actually you can. Doom64hunter added this feature as a DEF command a while ago. I did not realize that it was completely undocumented until I saw Reaper_Man's post.

If you want your custom keys to be higher up on the list of keys, you can do it via the DEF command:
keyconfig
{
gamefunc_Move_Forward
gamefunc_Move_Backward
gamefunc_Strafe_Left
gamefunc_Strafe_Right
...
}

The gamefunc names are exposed by the source as built-in labels.
the order in which you list the gamefuncs will be the order in which they appear. Those you do not list will not appear. Note that the capitalization follows how they are given here; https://wiki.eduke32...inegamefuncname

If you want to see a full example, you can check duke3d.def in Alien Armageddon.
1

User is online   Reaper_Man 

  • Once and Future King

#3125

Very nice, thanks for the correction
0

#3126

View PostVGames, on 29 November 2022 - 05:34 AM, said:

Is there a way to check when a player picks up an atomic health?

use a var as a flag whenever health is added to the player in atomichealth's actor, then reset it after whatever you're doing upon detecting it
0

User is online   quakis 

#3127

I'm trying to lock the player's horizontal / vertical axis when I have an on screen gui with mouse cursor open. The best result I've managed is saving the last known player .ang and .horiz into variables, then setting those variables back using setp after this gui is open. Locking player movement actions and the mouse cursor works as intended here.

The problem however is moving the mouse(look) causes the screen to shake/jitter around while as if fighting against being forced back into it's stored setp variables while moving around a mouse cursor onscreen works as intended.

The "lockplayer" function would be perfect since the screen remains unmoving, but I can't use that here because it also stops updating mouse cursor movements entirely (I'm using getinput for both .q16avel and .q16horz here) and any EVENT_FIRE actions which I use as a click function.

I've referred to code from other projects and afaik they do similar methods of grabbing and storing previous .ang/.horiz and setting them, without the screen shake issues. The other exception is they're also use "lockplayer" as well while their cursors are still functioning as intended. Been examining their code and tinkering with my own to no better results or understanding. Now I'm stuck or just missing something, need to fix this issue before doing any further gui related stuff.

Can someone help break down exactly what I should be doing to lock the player's horizontal / vertical axis properly under these or similar circumstances?
0

User is offline   VGames 

  • Extra Crispy

#3128

View PostDanukem, on 29 November 2022 - 12:48 PM, said:

Actually you can. Doom64hunter added this feature as a DEF command a while ago. I did not realize that it was completely undocumented until I saw Reaper_Man's post.

If you want your custom keys to be higher up on the list of keys, you can do it via the DEF command:
keyconfig
{
gamefunc_Move_Forward
gamefunc_Move_Backward
gamefunc_Strafe_Left
gamefunc_Strafe_Right
...
}

The gamefunc names are exposed by the source as built-in labels.
the order in which you list the gamefuncs will be the order in which they appear. Those you do not list will not appear. Note that the capitalization follows how they are given here; https://wiki.eduke32...inegamefuncname

If you want to see a full example, you can check duke3d.def in Alien Armageddon.

Thanks a lot. This makes things easier for mod users when setting up the mod for themselves.
0

User is offline   Danukem 

  • Duke Plus Developer

#3129

View Postquakis, on 29 November 2022 - 05:50 PM, said:

Can someone help break down exactly what I should be doing to lock the player's horizontal / vertical axis properly under these or similar circumstances?


The method you are describing that you found in other mods, can still work. But nowadays it requires additional code in a display event. That's because, a few years ago the game was changed so that the player's angle and horiz are updated with drawn frames, instead of only 30 times per second. That change broke a lot of things.

Anyway, here's a solution for you. It assumes that you did a full lock on the player.
onevent EVENT_DISPLAYROOMS

ife player[].movement_lock 31
ife player[].on_crane -1
{
	set cameraang player[].oang
	set camerahoriz 100
}
endevent

1

User is online   quakis 

#3130

View PostDanukem, on 29 November 2022 - 10:22 PM, said:

But nowadays it requires additional code in a display event. [...]

Anyway, here's a solution for you. It assumes that you did a full lock on the player.

That does explain a lot, wouldn't have considered EVENT_DISPLAYROOMS as an answer. Thank you so much for the help, this solution is working wonderfully! Cheers.
0

User is offline   VGames 

  • Extra Crispy

#3131

Ok so I'm trying to include the nice intro cutscenes for the original episodes as seen in Alien Armageddon. For some reason they never show up when you start the episodes. Here's the code I'm using. What am I missing? I of course am not using eveyr bit of code from AA since i don't need it. But are these the only events I should be messing with? Is there something in the player code or anywhere I'm missing?


state cutscene_cleanup
	stopallmusic
	ifvarn SCREENALPHA 255
			setvar SCREENALPHA 255
	ifvarn CUTSCENE_STEP 0
			setvar CUTSCENE_STEP 0
ends


onevent EVENT_PRELEVEL // ************************************************************************************

	ife VOLUME 3
	ife LEVEL 0
	{
			stopallsounds
			stopallmusic
			starttrackslot 0 1 // Play BRIEFING.MID
			redefinequote 230 VOL41A.ANM
			startcutscene 230
			redefinequote 230 VOL42A.ANM
			startcutscene 230
			redefinequote 230 VOL43A.ANM
			startcutscene 230
			stopallsounds
	}
	state cutscene_cleanup
	ifvare VOLUME 0
	{
		ifvare LEVEL 1 // HOLLYWOOD HOLOCAUST
		{
			stopallsounds
			// ADD SOME MUSIC TRACK IF NEEDED
			starttrackslot 7 4
			startscreen    // FIRST SCREEN
			screensound RPG_EXPLODE // SOUND EFFECT AT THE START OF THE SECOND SCREEN
			startscreen    // SECOND SCREEN
		}
		ifvare LEVEL 4 // TOXIC DUMP
		{
			stopallsounds
			// ADD SOME MUSIC TRACK IF NEEDED
			// starttrackslot 7 4
			startscreen    // FIRST SCREEN
		}
	}
	ifvare VOLUME 1
	{
		// note that LEVEL is bumped up by 1 due to start menu shenanigans
		ifvare LEVEL 1 // SPACEPORT
		{
			stopallsounds
			// ADD SOME MUSIC TRACK IF NEEDED
			// starttrackslot 7 4
			startscreen    // FIRST SCREEN
		}
		ifvare LEVEL 4 // FUSION STATION
		{
			stopallsounds
			// ADD SOME MUSIC TRACK IF NEEDED
			// starttrackslot 7 4
			startscreen    // FIRST SCREEN
		}
		ifvare LEVEL 9 // OVERLORD
		{
			stopallsounds
			// ADD SOME MUSIC TRACK IF NEEDED
			// starttrackslot 7 4
			startscreen    // FIRST SCREEN
		}
	}
	ifvare VOLUME 2
	{
		ifvare LEVEL 1 // RAW MEAT
		{
			stopallsounds
			// ADD SOME MUSIC TRACK IF NEEDED
			// starttrackslot 7 4
			startscreen    // FIRST SCREEN
		}
		ifvare LEVEL 5 // MOVIE SET
		{
			stopallsounds
			// ADD SOME MUSIC TRACK IF NEEDED
			// starttrackslot 7 4
			startscreen    // FIRST SCREEN
		}
		ifvare LEVEL 9 // STADIUM
		{
			stopallsounds
			// ADD SOME MUSIC TRACK IF NEEDED
			// starttrackslot 7 4
			startscreen    // FIRST SCREEN
		}
	}
endevent // ************************************************************************************

appendevent EVENT_ENDLEVELSCREEN // ************************************************************************************
	state cutscene_cleanup
	// ifvare VOLUME 0
	// ifvare LEVEL 2 // RED LIGHT DISTRICT
	// {
		// stopallsounds
		// startscreen
	// }
endevent // ************************************************************************************

onevent EVENT_SCREEN // ************************************************************************************

	set z 65536
	
	ifvare RETURN 0
	{
		ifvarg SCREENALPHA 0    // QUICK FADEOUT
		{
			screenpal 0 0 0 SCREENALPHA
			subvar SCREENALPHA 5
		}
	}
	else ifvare RETURN 1
			setvar SCREENALPHA 255

	ifvare VOLUME 0
	{
		ifvare LEVEL 1
		{
			ifvare CUTSCENE_STEP 0    // FIRST SCREEN
			{
				setvar CUTSCENE_SCREEN 6792

				ifvare RETURN 1     // IF THE PLAYER USES ANY KEY TO SKIP THE SCENE
						setvar CUTSCENE_STEP 1     // CHANGE TO THE NEXT SCREEN
			}
			else ifvare CUTSCENE_STEP 1   // SECOND SCREEN
			{
				setvar CUTSCENE_SCREEN 6793
				ifvare RETURN 1     // IF THE PLAYER USES ANY KEY TO SKIP THE SCENE
						setvar CUTSCENE_STEP 2     // CHANGE TO THE NEXT SCREEN
			}
		}
		ifvare LEVEL 4
		{
			setvar CUTSCENE_SCREEN 6794

		}
	}
	ifvare VOLUME 1
	{
		ifvare LEVEL 1
		{
			setvar CUTSCENE_SCREEN 6795
		}
		ifvare LEVEL 4
		{
			setvar CUTSCENE_SCREEN 6796

		}
		ifvare LEVEL 9
		{
			setvar CUTSCENE_SCREEN 6797
		}
	}
	ifvare VOLUME 2
	{
		ifvare LEVEL 1
		{
			setvar CUTSCENE_SCREEN 6798
		}
		ifvare LEVEL 5
		{
			setvar CUTSCENE_SCREEN 6799
		}
		ifvare LEVEL 9
		{
			setvar CUTSCENE_SCREEN 6800
		}
	}

	rotatesprite 160 100 z 0 CUTSCENE_SCREEN 0 0 0 0 0 xdim ydim

endevent // ************************************************************************************


0

User is offline   Danukem 

  • Duke Plus Developer

#3132

Here's the original post from Renegado with the first working version:

https://forums.duke4...post__p__294547

I think it would make more sense for you to start with that rather than copying the Alien Armageddon version which has added bells and whistles and oddities.
0

User is offline   VGames 

  • Extra Crispy

#3133

View PostDanukem, on 10 December 2022 - 08:47 PM, said:

Here's the original post from Renegado with the first working version:

https://forums.duke4...post__p__294547

I think it would make more sense for you to start with that rather than copying the Alien Armageddon version which has added bells and whistles and oddities.


Much appreciated. I’ll check it out ASAP.
0

User is offline   MC84 

#3134

I've got a newbie question - it's for a simple invisible sprite that is used to play a sound for dummy/decorative doors. The following code works fine;

define LOCKEDDOOR 5817
useractor notenemy LOCKEDDOOR
cstat 32784 // invisible, wall-aligned

 ifpdistl 1024
  ifp pfacing
   ifp palive
    ifhitspace
     ifcount 30
	  	 
switch sprite[].pal
	case 0
		{ soundonce DOOR_LOCK_A }
		break
	case 1
		{ soundonce DOOR_LOCK_B }
		break
	case 2
		{ soundonce DOOR_LOCK_C }
		break
	endswitch
	
enda


But when I add an extra command 'quote 4' it creates a recurring loop where the door lock sound plays continuously?

define LOCKEDDOOR 5817
useractor notenemy LOCKEDDOOR
cstat 32784 // invisible, wall-aligned

 ifpdistl 1024
  ifp pfacing
   ifp palive
    ifhitspace
     ifcount 30
      quote 4
switch sprite[].pal
	case 0
		{ soundonce DOOR_LOCK_A }
		break
	case 1
		{ soundonce DOOR_LOCK_B }
		break
	case 2
		{ soundonce DOOR_LOCK_C }
		break
	endswitch
	
enda

0

User is offline   Danukem 

  • Duke Plus Developer

#3135

define LOCKEDDOOR 5817
useractor notenemy LOCKEDDOOR
cstat 32784 // invisible, wall-aligned

 ifpdistl 1024
  ifp pfacing
   ifp palive
    ifhitspace
     ifcount 30
{
      quote 4
switch sprite[].pal
        case 0
                soundonce DOOR_LOCK_A
                break
        case 1
                soundonce DOOR_LOCK_B
                break
        case 2
                soundonce DOOR_LOCK_C
                break
        endswitch
}
enda

1

User is offline   Danukem 

  • Duke Plus Developer

#3136

Also you want "resetcount" inside the braces as well, otherwise the "ifcount 30" isn't really doing anything.
1

User is offline   MC84 

#3137

View PostDanukem, on 19 December 2022 - 12:35 AM, said:

Also you want "resetcount" inside the braces as well, otherwise the "ifcount 30" isn't really doing anything.


Thanks Dan - I had a feeling I was missing brackets.
0

User is online   Reaper_Man 

  • Once and Future King

#3138

Brackets should go around any conditional that contains more than 1 command. In your original code, the switch command was technically a single command although it occupied multiple lines, and so adding the quote command then made only that command run. In other words, the code was then being interpreted like this:

	ifpdistl 1024
		ifp pfacing
			ifp palive
				ifhitspace
					ifcount 30
	{
		quote 4
	}
	  	 
	switch sprite[].pal
		case 0
			{ soundonce DOOR_LOCK_A }
			break
		case 1
			{ soundonce DOOR_LOCK_B }
			break
		case 2
			{ soundonce DOOR_LOCK_C }
			break
	endswitch


Although this is just an example of the literal interpretation the compiler is seeing, there's actually no harm in adding brackets around single command conditionals, and in some cases may make for more readable code. You actually do this with the soundonce commands within your switch statement, and if you wanted you could remove those brackets without change in the code behavior.

You can also safely (and IMO should) put brackets surrounding the content of actor, (def)state, and event code as well:

useractor notenemy LOCKEDDOOR
{
	cstat 32784 // invisible, wall-aligned

	[. . .]

	}
	endswitch
}
enda

1

User is offline   MC84 

#3139

Thanks for the tips!
0

#3140

For the purpose of 2 entries into the same Secret Area is there a way to spoof the player stepping into the sector tagged 32767 when he enters the target sector?

This post has been edited by lllllllllllllll: 20 December 2022 - 03:02 PM

0

User is offline   Danukem 

  • Duke Plus Developer

#3141

The answer will be yes, but you need to ask the question better.
0

User is offline   jimbob 

#3142

had a neat idea the other day, not sure if someone already made something like this but here it is anyway. a bit of code to make the player spawn waterdrips when exiting water.

gamevar ISWET 0 2
define WETTIME 150 // time you stay wet
gamevar WETCOUNT 0 2

state drippingwet
// code to make the player spawn waterdrips when wet.

ifinwater { setvar ISWET 1 setvar WETCOUNT WETTIME break }
ifonwater { setvar ISWET 1 setvar WETCOUNT WETTIME break }
ifn ISWET 0
{ 
	subvar WETCOUNT 1
	ifg WETCOUNT 60 { ifrnd 128 spawn WATERDRIP }
	ifl WETCOUNT 60 { ifrnd 64 spawn WATERDRIP }
	ifl WETCOUNT 30 { ifrnd 32 spawn WATERDRIP }
	ife WETCOUNT 0 { setvar ISWET 0 }
}
ends

and add state drippingwet under APLAYER

i guess it would work for any actor really.
[edit] for a more realistic effect, add this to event_egs
ifactor WATERDRIP
{
ifspawnedby APLAYER
	{
		geta[].z z, sub z 10240 seta[].z z
		geta[].x TEMP addvar TEMP 128 randvar TEMP2 256 subvarvar TEMP TEMP2 seta[].x TEMP
		geta[].y TEMP addvar TEMP 128 randvar TEMP2 256 subvarvar TEMP TEMP2 seta[].y TEMP
	}

}

this makes the waterdrips spread out around the player at a random distance to give a volumetric effect rather than spawning dead center all the time like when unfreezing. coincidentally, when thawing this should also make the thawing effect better. you could add ifspawnedby whatever enemy too.

This post has been edited by jimbob: 21 December 2022 - 12:50 AM

0

Share this topic:


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