EDuke32 Scripting "CON coding help"
#3441 Posted 28 March 2024 - 06:40 PM
#3442 Posted 28 March 2024 - 07:29 PM
To avoid messing with the to-be-deleted recons, check their size before you do anything to them. A sprite waiting to be deleted is going to be tiny. By making sure they are larger than 4x or 4y you can size just the relevant recons. But a RESPAWN'd sprite is going to start tiny too.
event_egs affects recons spawned by RESPAWN
event_loadactor affects recons placed on the map
event_spawn affects both recons placed on the map and spawned by RESPAWN
So you just need to check loadactor sizes and then apply the change there, and respawns in egs do not need to be checked before you modify them.
If you set the check in event_spawn it will process RESPAWNs but won't do anything to them since they are smaller than 4x 4y.
Just one or the other xrepeat or yrepeat needs to be checked.
Sometimes you'll find sprites that spawn tiny no matter what and you can use
ifle sprite[].lotag userdef[].player_skill
to check the skill setting directly
Or you can combine the two in event_spawn with something like
ifactor RECON
{
ifspawnedby RESPAWN
sizeat 56 48
else
ifle sprite[].lotag userdef[].player_skill
sizeat 56 48
}
mashed enter
This post has been edited by lllllllllllllll: 28 March 2024 - 07:36 PM
#3443 Posted 29 March 2024 - 02:34 AM
lllllllllllllll, on 28 March 2024 - 07:29 PM, said:
To avoid messing with the to-be-deleted recons, check their size before you do anything to them. A sprite waiting to be deleted is going to be tiny. By making sure they are larger than 4x or 4y you can size just the relevant recons. But a RESPAWN'd sprite is going to start tiny too.
event_egs affects recons spawned by RESPAWN
event_loadactor affects recons placed on the map
event_spawn affects both recons placed on the map and spawned by RESPAWN
So you just need to check loadactor sizes and then apply the change there, and respawns in egs do not need to be checked before you modify them.
If you set the check in event_spawn it will process RESPAWNs but won't do anything to them since they are smaller than 4x 4y.
Just one or the other xrepeat or yrepeat needs to be checked.
Sometimes you'll find sprites that spawn tiny no matter what and you can use
ifle sprite[].lotag userdef[].player_skill
to check the skill setting directly
Or you can combine the two in event_spawn with something like
ifactor RECON
{
ifspawnedby RESPAWN
sizeat 56 48
else
ifle sprite[].lotag userdef[].player_skill
sizeat 56 48
}
mashed enter
Holy shit, wasn't expecting so many details on how to do it... Thank you so much!
EDIT: I ended up doing this, and it seems to work well
// Fixed RECON actor size
onevent EVENT_LOADACTOR
switch sprite[].picnum
case RECON
sizeat 48 48
break
endswitch
endeventOne more thing... there is a bug that is getting me crazy and I want to fix it. Sometimes, the Sentry version of the bosses just don't die, they get in a kind of stuck state, facing the same direction and shooting at me, and they don't die. What is causing this?
This post has been edited by NukeDukem89: 29 March 2024 - 03:26 AM
#3444 Posted 29 March 2024 - 06:23 AM
The former usually happens when a useractor has its strength set to 0 with "strength 0". I guess if you have custom actions it could happen with the regular enemies. You can fix that by using "strength 1" instead.
The latter can happen when you have your "ifhitweapon" or its death states split from the shoot state in a manner where they will never be used. For example the flinch action is always in front of the other behavior states and joined with "else" so that only one or the other gets used, but ifhitweapon is still separate.
#3445 Posted 29 March 2024 - 06:58 AM
lllllllllllllll, on 29 March 2024 - 06:23 AM, said:
The former usually happens when a useractor has its strength set to 0 with "strength 0". I guess if you have custom actions it could happen with the regular enemies. You can fix that by using "strength 1" instead.
The latter can happen when you have your "ifhitweapon" or its death states split from the shoot state in a manner where they will never be used. For example the flinch action is always in front of the other behavior states and joined with "else" so that only one or the other gets used, but ifhitweapon is still separate.
They are stuck in a random direction, stand still but like walking, and also shooting in the same direction. It's the World Tour code, nothing touched.
This post has been edited by NukeDukem89: 29 March 2024 - 06:59 AM
#3446 Posted 29 March 2024 - 09:49 AM
I don't use world tour though. Does it happen with a clean con?
#3447 Posted 29 March 2024 - 05:53 PM
lllllllllllllll, on 29 March 2024 - 09:49 AM, said:
I don't use world tour though. Does it happen with a clean con?
I've tried to reproduce it without success... Weird taking into account that I came across this bug 3 or 4 times the other day...
I have more questions though. What exactly the spriteflag 8192 does? Smooth anims? If I put these spriteflags on TANK and NEWBEAST, they wake up as soon as the map is loaded. I don't understand. Is this spriteflag in any of the other enemies?
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?
This post has been edited by NukeDukem89: 29 March 2024 - 05:56 PM
#3448 Posted 29 March 2024 - 06:15 PM
NukeDukem89, on 29 March 2024 - 05:53 PM, said:
I have more questions though. What exactly the spriteflag 8192 does? Smooth anims? If I put these spriteflags on TANK and NEWBEAST, they wake up as soon as the map is loaded. I don't understand. Is this spriteflag in any of the other enemies?
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?
They are declared as "useractor" which makes them wake up on map load. That behavior should not be related to spriteflags 8192. That flag causes sprites to use movement interpolation which will make their movement (not animation) appear smooth when the framerate is higher than 30. However, I believe that flag is already on by default in recent EDuke32, so be careful if you set that, since you might be reversing it and turning it off by mistake.
#3449 Posted 30 March 2024 - 02:09 AM
Danukem, on 29 March 2024 - 06:15 PM, said:
I swear this lines
// Added smooth movement flag to TANK, DRONE and NEWBEAST //spriteflags DRONE 8192 //spriteflags NEWBEAST 8192 //spriteflags TANK 8192
are causing these monsters to wake up on map load. I commented them and they don't wake up. I got them from your Essentials CON file btw, thanks again.
Maybe is causing the monsters to wake up because in fact it is already on by thefault on EDuke32 (https://voidpoint.io...4de595959a33c5b)?
#3450 Posted 30 March 2024 - 03:00 AM
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
#3451 Posted 30 March 2024 - 06:04 AM
Danukem, on 30 March 2024 - 03:00 AM, said:
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.
#3452 Posted 31 March 2024 - 03:24 PM
lllllllllllllll, on 29 March 2024 - 09:49 AM, said:
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
endsAnd 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.
#3453 Posted 31 March 2024 - 06:13 PM
#3454 Posted 01 April 2024 - 01:31 PM
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?
#3455 Posted 01 April 2024 - 02:14 PM
NukeDukem89, on 29 March 2024 - 05:53 PM, said:
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
#3456 Posted 01 April 2024 - 03:39 PM
ck3D, on 01 April 2024 - 02:14 PM, said:
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.
#3457 Posted 01 April 2024 - 05:45 PM
This post has been edited by ck3D: 01 April 2024 - 05:48 PM
#3458 Posted 01 April 2024 - 06:09 PM
NightFright, on 01 April 2024 - 01:31 PM, said:
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.
#3459 Posted 01 April 2024 - 08:13 PM
#3460 Posted 01 April 2024 - 09:47 PM
#3461 Posted 02 April 2024 - 03:44 PM
#3462 Posted 02 April 2024 - 04:31 PM
#3463 Posted 02 April 2024 - 09:19 PM
NukeDukem89, on 02 April 2024 - 03:44 PM, said:
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).
#3464 Posted 03 April 2024 - 01:17 PM
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"?
#3465 Posted 03 April 2024 - 02:35 PM
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
#3466 Posted 03 April 2024 - 09:44 PM
geta[].extra HEALTHto
getp[].last_extra HEALTHand the issue disappears. No additional checks necessary. Thanks a lot!

Help
Duke4.net
DNF #1
Duke 3D #1


