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

Jump to content

  • 119 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"

User is online   VGames 

#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 offline   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 offline   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 offline   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 online   VGames 

#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 offline   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 online   VGames 

#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 online   VGames 

#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 offline   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

#3143

I mean duke stepping into sector 1 and getting the credit+quote for sector 2's secret place without getting it twice by stepping into sector 2 afterwards,
where sector 2 is tagged with SECRET AREA and sector 1 is not.
0

User is offline   Reaper_Man 

  • Once and Future King

#3144

I don't understand what you're asking at all. It sounds like you have 2 sectors tagged as secrets, and you want them to register as a single secret when collected? Like they're paired or something like that?
0

User is offline   Danukem 

  • Duke Plus Developer

#3145

View Postlllllllllllllll, on 21 December 2022 - 03:12 PM, said:

I mean duke stepping into sector 1 and getting the credit+quote for sector 2's secret place without getting it twice by stepping into sector 2 afterwards,
where sector 2 is tagged with SECRET AREA and sector 1 is not.


Tag BOTH sectors as secrets. Define a special sprite and add one copy of it to each tagged sector, and make the sprites share a lotag. Code the sprite to detect whether the player is entering its sector, when the player does have it look for the other sprite with the same lotag, if it finds it then untag the other sector.
0

#3146

Thanks

I couldn't think of a way to use findsprite and ignore the closest instance of in favor of finding one with a particular lotag.
If I place a Trigger -> Respawn -> Sprite that sets its sector's Lotag to 0 and kills itself,
will I need to also detect and kill the Trigger in the other secret sector to prevent the secret sector duke just entered from being tinkered with later? Or is the game setting Lotag to 0 after tallying the secret anyway?

(both sectors tagged Secret, both sectors have a Trigger linked to the other's Respawn,,, duke enters sector 1 which spawns a sprite in sector 2 and strips sector 2's lotag, then duke enters sector 2 which in turn spawns a sprite that strips sector 1's lotag)
0

User is offline   jimbob 

#3147

View Postlllllllllllllll, on 21 December 2022 - 03:12 PM, said:

I mean duke stepping into sector 1 and getting the credit+quote for sector 2's secret place without getting it twice by stepping into sector 2 afterwards,
where sector 2 is tagged with SECRET AREA and sector 1 is not.

just only tag one sector as the actual secret area, not all of them, it will count every single sector with the tag as an individual secret area. so simply only tag one.
0

User is offline   Danukem 

  • Duke Plus Developer

#3148

View Postlllllllllllllll, on 22 December 2022 - 12:09 AM, said:

(both sectors tagged Secret, both sectors have a Trigger linked to the other's Respawn,,, duke enters sector 1 which spawns a sprite in sector 2 and strips sector 2's lotag, then duke enters sector 2 which in turn spawns a sprite that strips sector 1's lotag)


That should work. I was going to suggest a different method but it would have required you to learn some new stuff, so your method is better in that respect.
0

#3149

Using respawns was making flashes and leaving excess secret totals
define SECRETSPOOF 9999

onevent EVENT_LOADACTOR
  ifactor SECRETSPOOF
  {
    getactor[THISACTOR].lotag othersector
    setactor[THISACTOR].lotag 0
    getactor[THISACTOR].hitag duplicatesecrets
    setactor[THISACTOR].hitag 0
  }
endevent

onevent EVENT_SPAWN
  ifactor SECRETSPOOF
  {
	getplayer[THISACTOR].max_secret_rooms secretstotal       
	subvarvar secretstotal duplicatesecrets
	setplayer[THISACTOR].max_secret_rooms secretstotal
  }
endevent

actor SECRETSPOOF
  getsector[THISACTOR].lotag sectorlotag
  ifvare sectorlotag 0
  {
    setsector[othersector].lotag 0
    killit
  }
enda

var othersector 0 2
var duplicatesecrets 0 2
var secretstotal 0 2
var sectorlotag 0 2


Usage:
Spoiler

No bugs after 20 seconds of rigorous testing
0

User is online   VGames 

#3150

I've noticed something very odd. Explosive projectiles like RPG's and projectiles that explode on contact with enemies that also produce a blast radius cause the enemies to move toward the player as if they're being affected by a reverse pushback system. I thought something about my push back system from projectiles impacting enemies could be causing an issue, but this is happening with enemies that don't even use the push back system along with enemies that do use the pushback system. Has anybody seen this before? I can't keep it from happening.
0

Share this topic:


  • 119 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