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

Jump to content

  • 120 Pages +
  • « First
  • 116
  • 117
  • 118
  • 119
  • 120
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

User is offline   Reaper_Man 

  • Once and Future King

#3511

This setup will break down the more a mod changes the vanilla code, particularly the APLAYER code. A mod that totally does away with things like PFROZEN and PSHRINKING will throw CON errors. Or a mod that uses a different define name for the timer than THAWTIME won't ever display properly.

I am pretty sure that stepping into a blue light sector wouldn't trigger "if sprite[].pal" type checks, since technically the actor's tsprite is having its palette changed and not the actual sprite itself. (Without going super in-depth, the tsprite is a virtual sprite for every sprite/actor in a map and handles the visual component independent of the actual actor, for example enemies turning PAL 6 with nightvision don't actually change palettes, but their tsprite does.) Anyway, it should be easy to test that real quick.

Looking at the vanilla behavior for freezer-ing, aside from starting action PFROZEN, the only other characteristic you could check against would be the palette.
0

User is offline   NightFright 

  • The Truth is in here

#3512

That's what I thought. I was looking through the entire wiki and couldn't find another method. At first I hoped I could use sprite[].htg_t 4 PFROZEN, but I'd need a variable instead of an action here.

Before I am looking for a map with fitting conditions it'd probably be faster to create a super simple map with a mirror and pal 1 lighting. In any case, it'd be a very specific case, especially since it's rather unlikely to get frozen in singleplayer (only with mods, basically) and even then, you'd have to die while frozen in blue light.
0

User is offline   ck3D 

#3513

You wouldn't even need a mirror in your test map, the freezer projectiles bounce off all wall types. (edit - didn't notice the post was over a week old before I replied, so you've probably remembered or found out since)

This post has been edited by ck3D: 15 May 2024 - 07:39 AM

0

#3514

Is it ok to use the same var or even RETURN as a throwaway for unwanted return vars?

For example hitscan has 6 return vars
<hit sector return var> <hit wall return var> <hit sprite return var> <hit x return var> <hit y return var> <hit z return var>
when only wanting a sprite id
TEMP1 TEMP1 TEMP2 TEMP1 TEMP1 TEMP1


It did not cause any apparent crashes, lag, errors, or otherwise
0

User is offline   Reaper_Man 

  • Once and Future King

#3515

Yes.

Well, probably not RETURN as that's a pre-defined gamevar and may have strange or unintended results overriding its value. But using a user gamevar like TEMP1 like this is just fine. Strictly speaking, the value will result in the value of "hit z return var" as it's assigned last.
0

#3516

Why is "ife" for the current picnum breaking loops?

//loop ends after 1 sprite
//
        whilen SECTORVAR NUMSECTORS
        {
          headspritesect PICNUMVAR SECTORVAR
          set PICNUMCOPY PICNUMVAR
          whilen PICNUMVAR -1
          {
            ife PICNUMVAR RESPAWN //<
              ife sprite[].hitag sprite[PICNUMVAR].lotag
                setav[PICNUMVAR].TEMP1 1
            nextspritesect PICNUMVAR PICNUMVAR
            ife PICNUMVAR PICNUMCOPY
              set PICNUMVAR -1
          }
          add SECTORVAR 1
        }
//


//loop ends after all sprites
//
        whilen SECTORVAR NUMSECTORS
        {
          headspritesect PICNUMVAR SECTORVAR
          set PICNUMCOPY PICNUMVAR
          whilen PICNUMVAR -1
          {
	    switch sprite[PICNUMVAR].picnum //<
	     case RESPAWN  //<
              ife sprite[].hitag sprite[PICNUMVAR].lotag
                setav[PICNUMVAR].TEMP1 1
	      break
	    endswitch
            nextspritesect PICNUMVAR PICNUMVAR
            ife PICNUMVAR PICNUMCOPY
              set PICNUMVAR -1
          }
          add SECTORVAR 1
        }
//

0

User is online   Danukem 

  • Duke Plus Developer

#3517

View Postlllllllllllllll, on 08 June 2024 - 05:53 AM, said:

Why is "ife" for the current picnum breaking loops?

//loop ends after 1 sprite
//
        whilen SECTORVAR NUMSECTORS
        {
          headspritesect PICNUMVAR SECTORVAR
          set PICNUMCOPY PICNUMVAR
          whilen PICNUMVAR -1
          {
            ife PICNUMVAR RESPAWN //<
              ife sprite[].hitag sprite[PICNUMVAR].lotag
                setav[PICNUMVAR].TEMP1 1
            nextspritesect PICNUMVAR PICNUMVAR
            ife PICNUMVAR PICNUMCOPY
              set PICNUMVAR -1
          }
          add SECTORVAR 1
        }
//


//loop ends after all sprites
//
        whilen SECTORVAR NUMSECTORS
        {
          headspritesect PICNUMVAR SECTORVAR
          set PICNUMCOPY PICNUMVAR
          whilen PICNUMVAR -1
          {
	    switch sprite[PICNUMVAR].picnum //<
	     case RESPAWN  //<
              ife sprite[].hitag sprite[PICNUMVAR].lotag
                setav[PICNUMVAR].TEMP1 1
	      break
	    endswitch
            nextspritesect PICNUMVAR PICNUMVAR
            ife PICNUMVAR PICNUMCOPY
              set PICNUMVAR -1
          }
          add SECTORVAR 1
        }
//



PICNUMVAR is a sprite number and is NOT the picnum of the sprite. In the second loop, you do a switch statement on the picnum, but in the first loop you just compare the sprite number directly with RESPAWN, so if the sprite number happens to be 9 that will be true. That doesn't necessarily explain why the loop ends early, but it seems like it invalidates the first version regardless. Beyond that mistake, I have couple of criticisms. First, your variable names are obscuring what is going on rather than helping you. I think when you gave it the name PICNUMVAR you convinced yourself that it holds a picnum --- but of course you can put any value at all in it and in this case it's not a picnum. It's better to refer directly to the struct members whenever possible rather than putting values in variables. Secondly, you could have figured out what is going on by logging values, rather than looking at the problem like it was test question. You are eventually going to come across bugs that you won't be able to figure out unless you can log what is going on at specific points in the code.
1

#3518

Thank you, I did something retarded again
0

User is offline   VGames 

#3519

Is the animation code for the fist that hits the nuke button at the end of a map available anywhere? I'm referring to the one that plays when EVENT DISPLAYFIST is triggered. I noticed it was not in the samples file that has all of the weapon and view animations like the cracking knuckles animation.
0

User is offline   quakis 

#3520

I'm looking into coding a 3D Skybox much in the same style as the one seen in Ion Fury, something with a camera/anchor point that's able to render 1:1 and align with the mapping terrain. I've looked through the code in IF but not certain I've caught all the details how it works, the code from AWOL also gave me some additional insight but I think it functions a little different compared to IF's?

What kind of full checklist am I looking at to meet all the required steps to get something like this at least in a working state to later expand from?

This is how I think the checklist would look based on my understanding:

  • a camera origin actor, get and store its xyz etc coords
  • an anchor point actor, get and store its xyz etc coords
  • link camera origin with anchor point to keep position tied together (not yet certain how to just yet)
  • skybox ceiling / wall picnum replaced with an empty picnum (replaced with HOM/NULL) so stuff can be rendered behind it?
  • initialise all the above via EVENT_ENTERLEVEL
  • get the camera viewpoint (via showviewunbiased / showviewq16unbiased?)
  • draw camera viewpoint where HOM / NULL is (via EVENT_DISPLAYROOMS?)
  • ???

I honestly might be way over my head for this one right now with my current knowledge, but feel it's an important part of the design for my current project. I could use a TROR layer as a backup option but that's not really suitable for my needs here.

I'd rather go into this knowing what I might need for the whole thing. Using the above process and keeping it simple one step at a time, I looked into just replacing the defined skybox picnum with null. Already hit a roadblock when Eduke fails to enter any map (regardless if skybox picnum used or not) after it finishes loading and then quits out. I'm definitely missing some prior steps or still need to add more parts first to avoid that.

Which is why I thought its better to ask about the possible checklist involved before digging myself into a hole and learn nothing from it all.

Cheers for your time.

This post has been edited by quakis: 22 June 2024 - 12:55 PM

1

User is online   Danukem 

  • Duke Plus Developer

#3521

This is one of the few effects I haven't done yet in one of my mods, although I've coded similar things (most notably the flying ship effect in Demon Throne where everything you see around the ship is projected from a moving camera).


My advice would be to get the most basic version of the effect working first without worrying about anchor points at all. Make a map with a HOM area where the sky would be, make a big separate room in it with the scene you want to show for the sky, then use showview in EVENT_DISPLAYROOMS to show that in place of the HOM sky. It will look weird as you are walking around without the anchor point code but the simple version will be much easier to set up and will teach you how the effect works.
2

User is offline   quakis 

#3522

Thanks Dan, guess I'm overcomplicating things for myself at this stage. I'll start with your advice and see how I get on, at least I know the anchor points won't be necessary just yet to play around with this effect. Cheers!
0

User is offline   ck3D 

#3523

As far as how it's done in A.W.O.L. it's mainly Reaper_Man you should ask. The Dubai map I made uses a switchable camera system. The skybox is built on an exact 1:32 scale so that it aligns with the other two (playable) layers of the city (that actually was the hardest part, getting the map/skybox/back to map transitions seamless), where both rooftop and street level are connected through the skybox with traditional silent teleporters; the miniature has two skybox viewpoints/cameras, one at street level, another one at sky; each sector in which a transition can happen (usually the transport elevators found inside the buildings) has a special effector in it that triggers a change of camera that most of the time is invisible as the player is indoors, or falling when it happens. The switchable camera as a feature was introduced specifically for that level and is additional to the more traditional skybox system so that the skybox can be 'sandwiched' in the middle of the map's z axis in addition to surrounding it.

This post has been edited by ck3D: 23 June 2024 - 01:49 AM

2

User is offline   Reaper_Man 

  • Once and Future King

#3524

View Postquakis, on 22 June 2024 - 12:52 PM, said:

Using the above process and keeping it simple one step at a time, I looked into just replacing the defined skybox picnum with null. Already hit a roadblock when Eduke fails to enter any map (regardless if skybox picnum used or not) after it finishes loading and then quits out.

Can you post your error log? That seems like something is really wrong.

Conceptually I think you understand how it's done. The effect works by abusing the hall-of-mirrors "error" and rendering a "sky camera" to the screen prior to all other rendering. This way any visible HOM textures render the camera's perspective. The "skybox" effect is then built by moving and rotating the sky camera's position relative to the player. In AWOL, the "sky camera" is placed in the centerpoint of the 3D skybox area, and is used as the relative reference point to the actual game world's origin (0, 0) position.

In your checklist, the "camera origin actor" is just the player, or whatever is the current active game view. The math to "link" the player view to the skybox camera is just a matter of 1.) dividing the player's absolute position by your skybox scale, and then 2.) applying that position as an offset from the sky camera's position. So if your sky camera scale is 1/10, and the player is currently at XY coords 150,250, and your sky camera is located at 1000,1000, then the result camera rendering position is 1015,1025. This is performed in EVENT_DISPLAYROOMS in the file "awol_env.con", along with the actual rendering. You want to use the "q16" versions of things because you get greater integer precision, which removes jitter in the camera view, even if you are using a scale of 1:1
2

User is offline   VGames 

#3525

I saw this old thread about the precache command and was wondering if I should be using it to help people with lower end PC's play my mod better since it uses upscaled sprites and textures for everything?

https://forums.duke4...__1#entry142771

I saw in another thread that weapon related sprites should always be precached. Is this something I should be looking into?
0

User is online   Danukem 

  • Duke Plus Developer

#3526

I have one of those old PCs myself and it's very frustrating when you get killed by an enemy because the screen freezes for a second while the tiles for the enemy load in (since it's an enemy that hasn't been encountered yet in the session) but gameplay continues during that second. So yeah it's a serious issue in mods that use lots of high definition tiles.
1

User is offline   VGames 

#3527

View PostDanukem, on 29 June 2024 - 05:46 PM, said:

I have one of those old PCs myself and it's very frustrating when you get killed by an enemy because the screen freezes for a second while the tiles for the enemy load in (since it's an enemy that hasn't been encountered yet in the session) but gameplay continues during that second. So yeah it's a serious issue in mods that use lots of high definition tiles.


Ok that makes sense.

Since a lot of the new enemies are randomly spawned in after the map has loaded to take the place of enemies that are already placed in maps, would it be wise to set them up to always precache like the weapon view sprites? Because I figured if you set them up to precache only when they're in maps that would mean they need to be manually placed in maps via mapster for it to work correctly. This is not the case for the new enemies and how they're added to the game in my mod.

This post has been edited by VGames: 29 June 2024 - 05:52 PM

0

User is online   Danukem 

  • Duke Plus Developer

#3528

View PostVGames, on 29 June 2024 - 05:51 PM, said:

Ok that makes sense.

Since a lot of the new enemies are randomly spawned in after the map has loaded to take the place of enemies that are already placed in maps, would it be wise to set them up to always precache like the weapon view sprites? Because I figured if you set them up to precache only when they're in maps that would mean they need to be manually placed in maps via mapster for it to work correctly. This is not the case for the new enemies and how they're added to the game in my mod.


I struggle with the same thing myself. In the case of Alien Armageddon we have such a large number of enemies (60+ now, each with detailed tiles) that precaching them all would be too much. Yet in some game modes almost any of them could appear in a map as a replacement for one of the other actors. So I opt not to precache them all because it would increase load time too much. I just precache the most common ones.
0

User is offline   VGames 

#3529

Ok thanks that makes sense too. I’ll just need to decide on how much I want to spend on initial loading times.
0

User is offline   VGames 

#3530

One more thing. Does the precache whole map option in the options menu make commands like “precache 1234 2376 0” obsolete since setting this option to on does the same thing as the command without any set up? So pretty much there’s no reason to use a precache command with a 0 parameter if this option is enabled?
0

#3531

Adding lines for precache 0 did remove lag from sprites placed in the map even though it was caching the map before play
1

User is offline   VGames 

#3532

View Postlllllllllllllll, on 01 July 2024 - 09:56 AM, said:

Adding lines for precache 0 did remove lag from sprites placed in the map even though it was caching the map before play


Ok I'll go ahead and keep the commands then. I don't think it hurts anything either way.
0

User is offline   VGames 

#3533

I noticed that when the player is shrunk useractor enemies do not track the player's position like the other original enemy actors do. Is there a way to get useractor enemies to track the player's position like the originals? I'm trying to get small spider actors to track the player position when they are shrunk but they seem to ignore the player altogether.
0

User is online   Danukem 

  • Duke Plus Developer

#3534

View PostVGames, on 05 August 2024 - 03:23 PM, said:

I noticed that when the player is shrunk useractor enemies do not track the player's position like the other original enemy actors do. Is there a way to get useractor enemies to track the player's position like the originals? I'm trying to get small spider actors to track the player position when they are shrunk but they seem to ignore the player altogether.


One thing to be aware of is that ifp palive returns false when the player shrunk. So if your enemies check for whether the player is alive before following, that might explain it.


It's instructive to look at the code for NEWBEAST, which is a useractor. Notice that it explicitly will enter its seeking state when the player is shrunk. Once in that state, it does check for whether ifp pdead is true, but only when deciding whether to shoot or scratch. It will not leave the seeking state just because the player is "dead".
1

User is offline   VGames 

#3535

Oh ok that helps a lot. I have been using ifpalive so that must be the issue. Thanks for the clarification.
0

User is offline   VGames 

#3536

How do you check for the height of the ceiling in the current sector that you are in? I thought there was a real easy way to do it but ceilingz isn't exactly what I'm looking for. I'm trying to get the height of the ceiling that you see in mapster when you're pointing at it in 3D mode.
0

User is online   Danukem 

  • Duke Plus Developer

#3537

View PostVGames, on 30 August 2024 - 04:56 PM, said:

How do you check for the height of the ceiling in the current sector that you are in? I thought there was a real easy way to do it but ceilingz isn't exactly what I'm looking for. I'm trying to get the height of the ceiling that you see in mapster when you're pointing at it in 3D mode.


https://wiki.eduke32...Getceilzofslope

You want that one ^ it gives you the celing z at specific x y coordinates
1

User is offline   VGames 

#3538

Doesn't this still return ceilingz? That's not the height of the ceiling, is it? That's more like the z coordinate of the ceiling which could be anything depending on the location of the map. Or am I using it wrong? Maybe I should explain what I'm trying to do. I want to check if the player is in one of those tiny tunnels that you go through when shrunk. How do I check what the height of that ceiling is so that I can make something happen when in those tiny tunnels?
0

User is online   Danukem 

  • Duke Plus Developer

#3539

sounds like what you actually want is how much distance there is between the floor and the ceiling, which means you get both values and subtract
0

User is offline   VGames 

#3540

Oh ok I understand now. Get the floorz and the ceilingz and subtract them to get a number that shows the distance between them. I’ll do that. Thanks for the tip
0

Share this topic:


  • 120 Pages +
  • « First
  • 116
  • 117
  • 118
  • 119
  • 120
  • 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