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

Jump to content

  • 120 Pages +
  • « First
  • 114
  • 115
  • 116
  • 117
  • 118
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

#3451

View PostDanukem, on 30 March 2024 - 03:00 AM, said:

spriteflags 8192 is smoothmove, it is not supposed to make anything wake up

https://wiki.eduke32.com/wiki/Htflags

That change you linked in the source is only supposed to affect vertical movement, whereas smoothmove affects all movement. Nevertheless I do remember that enemies have smoothmove by default now. In fact it caused a problem for me in AA because I was applying the flag and enemies became stuttery after a certain revision. I figured out I was xoring the flag on them (https://wiki.eduke32...iki/Spriteflags)

But if the enemies are awake on start when the flag is set but not otherwise, that's pretty strange

I've just removed the flags and discarded the TANK and NEWBEAST attributes fix since I didn't saw any oversized instance of these actors.
0

#3452

View Postlllllllllllllll, on 29 March 2024 - 09:49 AM, said:

Sounds like "move 0".
I don't use world tour though. Does it happen with a clean con?

Finally found what was causing this bug.

This:
state boss1palshrunkstate
  ifcount SHRUNKDONECOUNT
    ai AITROOPSEEKENEMY <--------------------
  else
    ifcount SHRUNKCOUNT
      sizeto 40 40
  else
    state genericshrunkcode
ends


And this:
state boss1code

  ifaction ABOSS1FROZEN
  {
    ifcount THAWTIME
    {
      ai AIBOSS1SEEKENEMY
      spritepal 21 <----------------------------------------
    }
    else
      ifcount FROZENDRIPTIME
    {
      ifactioncount 26
      {
        spawn WATERDRIP
        resetactioncount
      }
    }


Changed it to "AIBOSS#SEEKENEMY" (applies to boss 1, 2 and 3) and "getlastpal" respectively.
0

User is online   Danukem 

  • Duke Plus Developer

#3453

That's why when you start a new project, use a modified version of GAME.CON that already has the old bugs like that fixed. There's one like that from Darkus, and I have released stuff like that. There's a lot of stuff that you're gonna want in pretty much any project, including common bug fixes.
0

User is offline   NightFright 

  • The Truth is in here

#3454

What's the smartest and most efficient way to realize a blinking sprite? (Like the health numbers in the EDuke32 HUD if player health is low.)

Currently I'm realizing it by getting player_par, doing a mod 30 division of it and letting the sprite only show if the result is 15 or less (for blinking 1x per second/30 game tics). Is that a reasonable approach?
0

User is offline   ck3D 

#3455

View PostNukeDukem89, on 29 March 2024 - 05:53 PM, said:

Talking about TANK and NEWBEAST, I'm seeing a attributes fix in many mods. It seems that these actors get oversized when loaded, but I haven't saw it in my playthroughs. Is there any exact place wheare I can see this?


Off memory, NEWBEAST size gets checked but not some other variants such as NEWBEASTJUMP and a couple more, most likely all listed on the Infosuite. You can easily play with that in user maps, I think I've seen large (64x64/not resized) instances of those NEWBEAST variants in some of William Gee's levels, I also used the 'feature' for the grinch drones in Poison Heart. The normal NEWBEAST and TANK actors only get resized upon sight of the player, IIRC, when they become active. When spawned via RESPAWN, the problematic NEWBEAST variants will size at microscopic (barely visible) size (and hitbox) all the while remaining fully functional behavior-wise, and retain those dimensions until dead since you can't shrink that enemy so that it would ever run another size check.

Fun fact but the NEWBEAST does something really hacky in order to bleed green; it swaps pal (IIRC to 6, maybe to 8) to technically turn green for just as long as it takes to spawn the blood sprites, then instantly reverts back to pal 0 before the switch can be displayed.

This post has been edited by ck3D: 01 April 2024 - 02:18 PM

0

User is offline   Reaper_Man 

  • Once and Future King

#3456

View Postck3D, on 01 April 2024 - 02:14 PM, said:

Fun fact but the NEWBEAST does something really hacky in order to bleed green; it swaps pal (IIRC to 6, maybe to 8) to technically turn green for just as long as it takes to spawn the blood sprites, then instantly reverts back to pal 0 before the switch can be displayed.

This trick and others like it is used all over the place internally in the source code. For example, the stained glass maskwalls cycle through a few different pals as it spawns different glass amounts, since the spawned glass takes on its owner's palette.
1

User is offline   ck3D 

#3457

Honestly I think that's kind of cool, threw me off guard when I realized they also applied it to enemies though (IIRC, BOSS4/Queen does the same since its code is based on NEWBEAST's), since enemy pal swaps are common even in the base game (and are literally encouraged practice in the 1.4+ user.cons). The base code is such that the enemy (NEWBEAST variant or BOSS4) automatically will revert back to pal 0 instead of getlastpal, so as a newbie can be a bit of a headscratcher the first time figuring out why the usual pal swap hacks for enemy variants seem to break on them. It's basically the same issue as every boss being set to thaw back to pal 0 (instead of getlastpal), or 21 for Sentries, after they were frozen, regardless of their original attributes that were set in-map by the level designer. That also applies to 1.4+ and BOSS4.

This post has been edited by ck3D: 01 April 2024 - 05:48 PM

0

User is offline   Reaper_Man 

  • Once and Future King

#3458

View PostNightFright, on 01 April 2024 - 01:31 PM, said:

What's the smartest and most efficient way to realize a blinking sprite? (Like the health numbers in the EDuke32 HUD if player health is low.)

Currently I'm realizing it by getting player_par, doing a mod 30 division of it and letting the sprite only show if the result is 15 or less (for blinking 1x per second/30 game tics). Is that a reasonable approach?

That method seems fine. totalclock is probably better than player_par, but off the top of my head I don't know what the difference is practically. You might also use getticks instead, as that's independent of the player being loaded into a level and seems more clean to use as a static timer.
0

User is online   Danukem 

  • Duke Plus Developer

#3459

totalclock would be especially good if you want the sprite/text to fade in and out rather than simply blink on or off, since it would give you more precision
0

User is offline   NightFright 

  • The Truth is in here

#3460

Well, in this case a rather direct/abrupt blinking is desired, so it doesn't have to be anything fancy. Good to know such a method exists, though. Thanks for the confirmation, guys!
0

#3461

Is there a way to change total killcount on a level? If I remove "addkill 1" from an enemy in GAME.CON, the total killcount is still the same.
0

User is offline   Reaper_Man 

  • Once and Future King

#3462

The player max_actors_killed member. It's a little weird though, it's auto incremented whenever an enemy - specifically a tile with the SFLAG_BADGUY or SFLAG_BADGUYSTAYPUT spriteflags - is spawned. This is how there's an inconsistent number of "max kills" in maps, where if you don't even trigger a Respawn that spawns an enemy, it doesn't get added to the max kills.
0

User is online   Danukem 

  • Duke Plus Developer

#3463

View PostNukeDukem89, on 02 April 2024 - 03:44 PM, said:

Is there a way to change total killcount on a level? If I remove "addkill 1" from an enemy in GAME.CON, the total killcount is still the same.


You can subtract one from max_actors_killed as Reaper_Man suggested, but if the actor is not supposed to be counted as an enemy in the first place, you might want to redefine it as useractor notenemy (although that can have unwanted side effects).
0

User is offline   NightFright 

  • The Truth is in here

#3464

Is there a way to prevent health values from becoming negative when using digitalnum?

I'm using

geta[].extra HEALTH
digitalnumber DIGITALNUM 20 183 HEALTH 0 0 272 0 0 xdim-1 ydim-1


With this, I briefly see the Steroids icon in the health display when intentionally damaging myself on the "Hollywood Holocaust" rooftops before dropping to my death (i.e. health becomes negative). I want to avoid using the "minus hack" suggested earlier, also since an unmodded statusbar doesn't have this glitch.

Maybe simply put an "ifge HEALTH 0" check in front of the digitalnum line? Or possibly "ifphealthl 0 nullop else"?
0

User is offline   Reaper_Man 

  • Once and Future King

#3465

Have you tried using EVENT_INCURDAMAGE? This allows you to process incoming damage to the Player. Specifically using this to set their health to 0 if it's below zero. The problem with handling this fix in the APLAYER code, or in an actor code in general, is that you are processing the damage after it has already taken effect, so you get 1 frame of the "wrong" negative value.

Alternatively, you can just do something like:

geta .extra HEALTH
ifl HEALTH 0
    set HEALTH 0

digitalnumber [blah blah blah]


That would floor HEALTH to 0 without having to mess with INCURDAMAGE.

EDIT - I looked in the source code and it looks like all the statusbar stuff is checking the player's last_extra, so maybe try using that instead of the APLAYER extra?

This post has been edited by Reaper_Man: 03 April 2024 - 03:01 PM

1

User is offline   NightFright 

  • The Truth is in here

#3466

Indeed, switching to last_extra apparently did the trick. Merely a change from
geta[].extra HEALTH
to
getp[].last_extra HEALTH
and the issue disappears. No additional checks necessary. Thanks a lot!
0

#3467

Somehow using the recon tiles with tilefromtexture from 9321 thru 9334 with texhitscan has fixed the recon's hitbox. I was going to test these with a different actor, forgot, and noticed the hitscan of the hardcoded version is now exactly as it appears. I don't understand how or why because there is nothing connecting them at all. There is not even an actor for those slots.
0

User is offline   VGames 

#3468

Is it possible to keep sector effectors with a lotag of 33 from spawning debris when the player uses the quake command via scripts?
0

User is offline   Reaper_Man 

  • Once and Future King

#3469

... Why? That is literally all SE 33 does. If you don't want debris, just don't place it?
0

User is offline   VGames 

#3470

I don’t mind when the map calls for it. I don’t want it to happen when the player uses the quake command. Seems like it can’t but I figured I’d ask.
0

#3471

Probably one of those cases where you'd fare better just writing a new effect from scratch, as it'd probably take more time and effort to try and modify the existing one. So much hardcoded weirdness with the stock stuff.

Suppose in brief, if it were me, the roadmap would be like;

> Write new quake effector that's nearly identical to the old one.
> Maybe add a means to make it longer (Hitag = number of quakes? Multiply a timer by that amount?)
> Add a flag to say if debris spawns or not when it's active
> Write new debris effector that's nearly identical to the old one, but works conditionally to the above (Use a copy of that timer var to set the duration of debris?)
> Run into a few problems and things that don't do the goddamn thing they're supposed to, because that's how it always goes - swear profusely at it

I'm not sure what you're doing or what this is for, though.
0

User is offline   VGames 

#3472

LOL I’ll give it a shot. Thanks for the feedback and tips.
0

User is offline   NightFright 

  • The Truth is in here

#3473

Is it normal that mini Battlelords can't be attacked and don't do anything after returning from shrunk state? If it's a bug in con code: Is there a way to fix it?
0

User is online   Danukem 

  • Duke Plus Developer

#3474

 NukeDukem89, on 31 March 2024 - 03:24 PM, said:

Finally found what was causing this bug.

This:
state boss1palshrunkstate
  ifcount SHRUNKDONECOUNT
    ai AITROOPSEEKENEMY <--------------------
  else
    ifcount SHRUNKCOUNT
      sizeto 40 40
  else
    state genericshrunkcode
ends


And this:
state boss1code

  ifaction ABOSS1FROZEN
  {
    ifcount THAWTIME
    {
      ai AIBOSS1SEEKENEMY
      spritepal 21 <----------------------------------------
    }
    else
      ifcount FROZENDRIPTIME
    {
      ifactioncount 26
      {
        spawn WATERDRIP
        resetactioncount
      }
    }


Changed it to "AIBOSS#SEEKENEMY" (applies to boss 1, 2 and 3) and "getlastpal" respectively.


That old bug was talked about in this thread less than 2 weeks ago and the fix was posted.
0

User is offline   NightFright 

  • The Truth is in here

#3475

Geez, I literally must have tomatoes on my eyes. It's even on the same page. Never entered my mind it could be right in front of me. Thanks!

PS: If I want to use this fix as a mutator, it's not enough to just provide the edited state, right? I need to include the actor as well.
0

#3476

 Danukem, on 12 April 2024 - 01:42 AM, said:

That old bug was talked about in this thread less than 2 weeks ago and the fix was posted.

Also happens with Incinerator. It's easy fix though.

I'm doing a World Tour mod version with a bunch of basic fixes and additions, this is one of these fixes. I've also polished Firefly and Cycloid Incinerator, nothing crazy, but better nonetheless. Shame I probably can't share it here...
0

User is offline   NightFright 

  • The Truth is in here

#3477

If it's mostly a con mod, I don't see how this could be an issue. You can also include corrections of art tiles, for example. As long as one cannot run the entire game/bonus episode with it...
0

User is offline   NightFright 

  • The Truth is in here

#3478

Something else:
When using this code from Darkus' game.con fixes, NEWBEAST actors would freeze ingame.

appendevent EVENT_SPAWN
    ifn MONSTERS_OFF 1
    {
        switch sprite[].picnum
            case TANK
                cstat 257
                sizeat 60 60
                clipdist 100
                spriteflags 8192
            break
            case NEWBEAST
            case NEWBEASTSTAYPUT
            case NEWBEASTHANG
            case NEWBEASTHANGDEAD
            case NEWBEASTJUMP
                cstator 257
                sizeat 40 40
                clipdist 64
            break
         endswitch
    }
endevent


When changing "sizeat" to "sizeto", they would function again (which wouldn't be the point of that particular fix, though). Any idea why? (The tank fix above it works fine, btw.)
0

User is online   Danukem 

  • Duke Plus Developer

#3479

I don't think you mean all NEWBEAST become frozen, I think you mean that ones with lotags above the current difficulty (i.e. the ones that are supposed to be deleted because they are for a higher difficulty).

The reason they get frozen is the game tried to delete them by setting their size to 0 0 and changing their statnum, but then this code comes along afterwards and just sets them to 40 40 regardless, rendering them lifeless zombies.

Sizeto is only going to happen once because the spawn event happens once, so my guess is it would increase the formerly frozen ones from 0 0 to 1 1 in size. Perhaps that's not big enough to be very visible or stop the deleting from happening? Therefore you wouldn't see frozen ones around. There might be little tiny frozen ones if you look closely.
2

User is offline   NightFright 

  • The Truth is in here

#3480

I see. So what you are saying is those "frozen" (inactive) sprites are those which shouldn't be there due to the selected difficulty, but this code forces them to be shown, anyway.
In that case, I guess the fix would be to include a check for selected skill, like this:

appendevent EVENT_SPAWN
    ifn MONSTERS_OFF 1
        ifle sprite[].lotag userdef[].player_skill
        {
            switch sprite[].picnum
                case TANK
                    ...
                break
                case NEWBEAST
                case NEWBEASTSTAYPUT
                case NEWBEASTHANG
                case NEWBEASTHANGDEAD
                case NEWBEASTJUMP
                    ...
                break
         endswitch
    }
endevent

0

Share this topic:


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