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

Jump to content

  • 119 Pages +
  • « First
  • 109
  • 110
  • 111
  • 112
  • 113
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

User is offline   MC84 

#3301

I've been messing around with menu display stuff and have been trying to get a 'monitor wall' effect happening, with randomly flickering screens. I've got the monitor tiles all arranged properly using rotatesprite, and have set the picnum to a gamevar that is determined via a switch statment. (There are 20 screens in total)
defstate testDISPLAY

ifcount 2
{
  randvar tempA 19
  switch tempA
    case 0 { setvar tempB 9705 resetcount } break
    case 1 { setvar tempB 9706 resetcount } break
    case 2 { setvar tempB 9707 resetcount } break
    case 3 { setvar tempB 9708 resetcount } break
    case 4 { setvar tempB 9709 resetcount } break
    case 5 { setvar tempB 9710 resetcount } break
    case 6 { setvar tempB 9711 resetcount } break
    case 7 { setvar tempB 9712 resetcount } break
    case 8 { setvar tempB 9713 resetcount } break
    case 9 { setvar tempB 9714 resetcount } break
    case 10 { setvar tempB 9715 resetcount } break
    case 11 { setvar tempB 9716 resetcount } break
    case 12 { setvar tempB 9717 resetcount } break
    case 13 { setvar tempB 9718 resetcount } break
    case 14 { setvar tempB 9719 resetcount } break
    case 15 { setvar tempB 9720 resetcount } break
    case 16 { setvar tempB 9721 resetcount } break
    case 17 { setvar tempB 9722 resetcount } break
    case 18 { setvar tempB 9723 resetcount } break
    case 19 { setvar tempB 9724 resetcount } break
    endswitch
}



{ rotatesprite 128 100 32768 0 tempB 0 0 0  windowx1 windowy1 windowx2 windowy2 }

etc etc



The problem is that this same gamevar will always return the same value; ie instead of having each monitor display different screens at any one time, they all cycle through the same sequence of images in unison. I know there's a very bloated solution to this problem that would involve creating 20 switch statements, with 20 vars but that seems pretty excessive to me... Is there a smarter way to go about this?

EDIT - It just occurred to me that displaying the above during EVENT_DISPLAYMENU doesn't show the animation anyway (I guess ifcount 2 is never true); so I'm not going to bother with this method for now.

This post has been edited by MC84: 06 June 2023 - 08:01 PM

0

User is online   Danukem 

  • Duke Plus Developer

#3302

What menu are you talking about? If it's the regular EDuke32 menu that displays when you press Esc, then the count will not advance because the game world is not running at that time. If you have that code in a display event, then I think count will default to the player actor's count which is doubtless already 2 or more. Then it will take whatever random value it rolls and display that tile and reset the count. With the count reset and no longer advancing, it will then continue to display that same tile since the variable will no longer change.
1

User is online   Danukem 

  • Duke Plus Developer

#3303

I think the read-only variable totalclock does continue to advance in the menu, though.
0

User is offline   MC84 

#3304

View PostDanukem, on 06 June 2023 - 08:37 PM, said:

What menu are you talking about? If it's the regular EDuke32 menu that displays when you press Esc, then the count will not advance because the game world is not running at that time. If you have that code in a display event, then I think count will default to the player actor's count which is doubtless already 2 or more. Then it will take whatever random value it rolls and display that tile and reset the count. With the count reset and no longer advancing, it will then continue to display that same tile since the variable will no longer change.


Thanks for your explanation - I was referring to the current_menu 0 or MAIN_MENU screen. I decided to go for a much simpler approach but I noticed that even when the animation is set through BAFED or a def file it won't play during this particular screen. However when you press escape and enter current_menu 50 / INGAME the animation does play.
0

User is offline   MC84 

#3305

This was one of those '5 minute jobs' that I've spent hours scratching my head over... I just want to make a simple sound 'randomizer' that alternates between 3 sounds. I initially thought this would just be a case of an ifrnd with a switch statement... but the problem I was having was that my sounds starting playing on top of one another. I tried a number of things, and have alternated between using ifcount and using my own timer (soundtimer)...

The following actually seems to work (I put that spawn SMOKEPUFF1 bit in there just to check that the timer is actually counting down to zero ) however it only seems to play one of the 3 sounds. I've sat there in the level for 5 mins and it will just play the same sound over and over...

defstate AIRPORTPAstate
{  

  ifsound AIRPORTPA1 sub soundtimer 1 
  ifsound AIRPORTPA2 sub soundtimer 1
  ifsound AIRPORTPA3 sub soundtimer 1
  
  ife soundtimer 0 { spawn SMOKEPUFF1 set soundtimer 270 }
  else  
 
  ife soundtimer 270
  {
    randvar tempA 2
    switch tempA
      case 0 { sound AIRPORTPA1 break }
      case 1 { sound AIRPORTPA2 break }
      case 2 { sound AIRPORTPA3 break }
    endswitch
   }
   else nullop

  
}
ends


And then my actor itself is very basic;

useractor notenemy AIRPORTPA cstat 32768 state AIRPORTPAstate enda


TempA is a per-actor var (I also experimented with global vars but it didn't seem to make much difference). soundtimer is initiated to 270, as each sound is approx 9 seconds in length.

This post has been edited by MC84: 15 June 2023 - 09:48 PM

0

User is online   Danukem 

  • Duke Plus Developer

#3306

You don't any vars just to do that. This should work for example:

defstate AIRPORTPAstate

  ifsound AIRPORTPA1 break
  ifsound AIRPORTPA2 break
  ifsound AIRPORTPA3 break

  ifrnd 85 globalsound AIRPORTPA1 else
  ifrnd 128 globalsound AIRPORTPA2 else
  globalsound AIRPORTPA3

ends


1

User is offline   MC84 

#3307

View PostDanukem, on 15 June 2023 - 10:09 PM, said:

You don't any vars just to do that. This should work for example:


Thanks Dan - I like simple solutions. Well it works just as well my overly complex code, however it still only plays one of the sounds. I must have done something silly somewhere to cause that.
0

User is online   Danukem 

  • Duke Plus Developer

#3308

View PostMC84, on 15 June 2023 - 11:51 PM, said:

Thanks Dan - I like simple solutions. Well it works just as well my overly complex code, however it still only plays one of the sounds. I must have done something silly somewhere to cause that.


Look carefully at your sound definitions. You may have accidentally pasted the same sound file name in all 3 of them, even though the sounds have different labels. I have done that before myself.
0

User is offline   MC84 

#3309

View PostDanukem, on 16 June 2023 - 12:11 AM, said:

Look carefully at your sound definitions. You may have accidentally pasted the same sound file name in all 3 of them, even though the sounds have different labels. I have done that before myself.


I checked those, and the thing is that when I say it was 'playing the same sound' the sound would actually change between quitting and reloading the map... it's just that it would play the same sound each 'session'.

Anyway I had my sounds defined as 0 0 0 3 0 ... I think I was doing that for ambient sounds? And then I changed it to 0 0 254 0 0 and now it actually cycles randomly through the 3 sounds. Thanks again!
0

User is online   Danukem 

  • Duke Plus Developer

#3310

 MC84, on 16 June 2023 - 12:16 AM, said:

I checked those, and the thing is that when I say it was 'playing the same sound' the sound would actually change between quitting and reloading the map... it's just that it would play the same sound each 'session'.

Anyway I had my sounds defined as 0 0 0 3 0 ... I think I was doing that for ambient sounds? And then I changed it to 0 0 254 0 0 and now it actually cycles randomly through the 3 sounds. Thanks again!


From the original USER.CON file comments:

// BIT 0 (1) Repeat
// BIT 1 (2) MUSICANDSFX (used for)
// BIT 2 (4) A Duke Voice
// BIT 3 (8) Par. Lockout
// BIT 4 (16) Glob. Heard (sndist = 0)


So you had the sounds set on repeat and MUSICANDSFX. Repeat may have been the issue there.
1

User is offline   VGames 

#3311

Ok so I got this little bit of code in EVENT_GAME that makes certain floor textures create particle effects.

switch sector[].floorpicnum
{
	case FLOORSLIME
		ifrnd 1
		ifcanseetarget
			spawn POISONSMOKE
	break
	case FLOORPLASMA
		ifrnd 1
		ifcanseetarget
		{
			spawn BURNINGSMOKE

			ifrnd 1
			{
				randvar zdist -9984  add zdist 1024   randvar angvar 2048  ezshoot zdist EXPLOSIONSTREAM  seta [RETURN].ang angvar
			}
		}
	break
	case PURPLELAVA
		ifrnd 1
		ifcanseetarget
			spawn BURNINGSMOKE
	break
}
endswitch


It works great but when I try to apply this same concept to wall textures it doesn't do anything. What am I doing wrong or is this not possible with wall textures?

switch wall[].picnum
{
	case W_SCREENBREAK
	case 358
	case 359
	case W_HITTECHWALL3
	case W_HITTECHWALL4
	case W_HITTECHWALL2
	case W_HITTECHWALL1
		ifrnd 1
               ifcanseetarget
			spawn BURNINGSMOKE
	break
}
endswitch

0

User is online   Danukem 

  • Duke Plus Developer

#3312

EVENT_GAME processes sprites. The reason the sector switch works is that each sprite does have an assigned sector, i.e. it is in a sector. That's not true for walls. It's not the case that each sprite has an assigned wall. Pretty obvious if you think about it.

I'm a little surprised that the wall switch doesn't throw an error or at least a warning.

EDIT: Since the code doesn't throw an error, I'm assuming there is *some* wall being referred to, but it could be wall 0 every time or some random wall.

This post has been edited by Danukem: 27 June 2023 - 01:40 PM

0

User is online   Danukem 

  • Duke Plus Developer

#3313

https://wiki.eduke32...VENT_DAMAGEWALL
0

User is offline   VGames 

#3314

Ok so this wouldn’t be possible for walls then. I wanted them to produce effects without being damaged first. Oh well thanks for the help.
0

#3315

Make a sprite to put in sectors with wall(s) you want spawning the particles and check the picnum when it cycles through the sector's walls?
0

User is offline   Mark 

#3316

I want to lower the player view a little bit more than default when on water. How would I do this? Any chance it will interfere with the smooth transition from above and below TROR water or when coming back out of the water on to land? Or would this be changing only camera height and not the actual z of the player?

This post has been edited by Mark: 30 June 2023 - 06:23 AM

0

User is online   Danukem 

  • Duke Plus Developer

#3317

 Mark, on 30 June 2023 - 06:21 AM, said:

I want to lower the player view a little bit more than default when on water. How would I do this? Any chance it will interfere with the smooth transition from above and below TROR water or when coming back out of the water on to land? Or would this be changing only camera height and not the actual z of the player?


Just a quick and dirty attempt without testing:

appendevent EVENT_DISPLAYROOMS

ifp ponground ife sector[player[].cursectnum].lotag 1 add cameraz 1024

endevent


See if that works.
1

User is online   Danukem 

  • Duke Plus Developer

#3318

 lllllllllllllll, on 29 June 2023 - 12:14 PM, said:

Make a sprite to put in sectors with wall(s) you want spawning the particles and check the picnum when it cycles through the sector's walls?


Presumably there is already a sprite in said sector for his EVENT_GAME code, he just doesn't know which wall to reference. And he didn't give any context so I'm not going to waste time guessing solutions to an unstated problem.
0

User is offline   VGames 

#3319

I don't want to do it by manually going into mapster and adding a sprite that checks for the change in the texture being used and then creates the effects itself. I wanted to have the texture automatically do it by code like I did with the floor and ceiling textures. But it's ok I'm going about this another way.
0

User is offline   Mark 

#3320

 Danukem, on 30 June 2023 - 11:07 AM, said:

Just a quick and dirty attempt without testing:

appendevent EVENT_DISPLAYROOMS

ifp ponground ife sector[player[].cursectnum].lotag 1 add cameraz 1024

endevent


See if that works.

I'm half way there using your suggestion. When I enter the water from land I drop down to the lower height I wanted. 1024 was just right. but when I come back up from underwater I'm back to default onwater height. I'm going to doublecheck my SE placement above water to make sure it isn't raised when it shouldn't be.

edit: the above water SE is where it should be.

This post has been edited by Mark: 30 June 2023 - 03:23 PM

0

User is online   Danukem 

  • Duke Plus Developer

#3321

 Mark, on 30 June 2023 - 03:01 PM, said:

I'm half way there using your suggestion. When I enter the water from land I drop down to the lower height I wanted. 1024 was just right. but when I come back up from underwater I'm back to default onwater height. I'm going to doublecheck my SE placement above water to make sure it isn't raised when it shouldn't be.

edit: the above water SE is where it should be.


I guess emerging from the water is screwing with the results of ifp ponground

We will need to put in something home-brewed to replace that and give consistent results
0

User is online   Danukem 

  • Duke Plus Developer

#3322

@Mark see how this works for you

appendevent EVENT_DISPLAYROOMS

ife sector[player[].cursectnum].lotag 1 
{
	getflorzofslope player[].cursectnum player[].posx player[].posy RETURN
	sub RETURN cameraz
	ifg RETURN 2048 ifl RETURN 6144 add cameraz 1280
	set RETURN 0
}

endevent

0

User is offline   Mark 

#3323

Same behavior as before with the 2nd attempt.

Unrelated but playing around with water stuff reminded me of something I noticed a looong time ago and that was the ability to press jump when on water and the player is then at a slightly higher Z until it resets itself by going underwater again or up on land. I'm thinking it was discussed way back then but I can't recall what became of the discussion.

This post has been edited by Mark: 01 July 2023 - 05:16 AM

0

User is online   Danukem 

  • Duke Plus Developer

#3324

 Mark, on 01 July 2023 - 05:10 AM, said:

Same behavior as before with the 2nd attempt.

Unrelated but playing around with water stuff reminded me of something I noticed a looong time ago and that was the ability to press jump when on water and the player is then at a slightly higher Z until it resets itself by going underwater again or up on land. I'm thinking it was discussed way back then but I can't recall what became of the discussion.


I actually don't know what you want then because I tested that code and it seemed fine. Yes it is true that jumping in the water will reset the height -- in fact you can end up lower in the water that way as well. You might have to do a full override of the water floating code to create your own custom code from scratch.
0

User is offline   Mark 

#3325

There is a metric ton of code, some I'm not using seeing as how I am doing this mod in the AWOL project and there is always the chance there is some conflict there. I commented out custom code for player jumping height in case that was conflicting but it made no difference, I wasn't expecting it to but... AFAIK there is no custom code concerning water behavior because I don't think any mapper made use of underwater. I'm using TROR water and I don't know if you tested your code with vanilla water mapping or if it makes a difference at all.

Its been an uphill battle trying to streamline out the code I don't need and have to deal with the modified executable. Months ago I should have just cut all ties with that project and attempt to move my stuff to a clean eduke32 but I would have lost some of the AWOL features I liked. So I've foolishly limped along all this time.

Thanks for your help. I will still use what you gave me because it works somewhat. There are only 2 underwater areas on the map and while it would have upped the cool factor with the desired player Z consistantly, it will be good enough getting it half the time.

This post has been edited by Mark: 01 July 2023 - 02:22 PM

0

User is online   Danukem 

  • Duke Plus Developer

#3326

What might work better is dump the displayrooms code and add a block of code into the player actor when "ifonwater ifp ponground { code code code }" where the code pushes the player down with a sine function clamped at around +512 to +1560 z units

EDIT: that might clip the player through the floor though depending on how he sits on the water

This post has been edited by Danukem: 01 July 2023 - 03:16 PM

0

User is online   ck3D 

#3327

 Mark, on 01 July 2023 - 02:13 PM, said:

There is a metric ton of code, some I'm not using seeing as how I am doing this mod in the AWOL project and there is always the chance there is some conflict there. I commented out custom code for player jumping height in case that was conflicting but it made no difference, I wasn't expecting it to but... AFAIK there is no custom code concerning water behavior because I don't think any mapper made use of underwater. I'm using TROR water and I don't know if you tested your code with vanilla water mapping or if it makes a difference at all.

Its been an uphill battle trying to streamline out the code I don't need and have to deal with the modified executable. Months ago I should have just cut all ties with that project and attempt to move my stuff to a clean eduke32 but I would have lost some of the AWOL features I liked. So I've foolishly limped along all this time.

Thanks for your help. I will still use what you gave me because it works somewhat. There are only 2 underwater areas on the map and while it would have upped the cool factor with the desired player Z consistantly, it will be good enough getting it half the time.


I too would have loved underwater moments in AWOL, but IIRC we were told not to design any since none of the character sprites had any animation tiles for swimming underwater.

This post has been edited by ck3D: 01 July 2023 - 02:55 PM

0

User is online   Danukem 

  • Duke Plus Developer

#3328

 ck3D, on 01 July 2023 - 02:53 PM, said:

I too would have loved underwater moments in AWOL, but IIRC we were told not to design any since none of the character sprites had any animation tiles for swimming underwater.


If there is no underwater gameplay in AWOL at all, then there is probably a slew of other issues. Most likely the physics and everything is just vanilla Duke which wouldn't have been to the standards of the mod. I'm guessing it's a case of the coder knowing it would be a lot of work to bring underwater up to standards and so it was decided resources are better spent elsewhere.
0

#3329

Can you force certain tiles to be loaded at map load to avoid 'Load tile' lag from actors using hightiles?
0

User is offline   VGames 

#3330

Is there a command to have a weapon lower itself down past the bottom of the screen without having to use a custom animation? Holster doesn’t seem to work properly unless u press the holster button manually.
0

Share this topic:


  • 119 Pages +
  • « First
  • 109
  • 110
  • 111
  • 112
  • 113
  • 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