![](https://forums.duke4.net/public/style_images/cgs/_custom/switch.png)
EDuke32 Scripting "CON coding help"
#2971 Posted 21 August 2022 - 01:59 PM
In cases where the coder doesn't know what is going on or causing the issue, I kind of have to discount what they are saying about it since what they are saying could include false assumptions. So I can't go by your descriptions, only the actual code, and you didn't include the main part of your code. I don't have time anyway though.
#2972 Posted 21 August 2022 - 02:48 PM
Danukem, on 21 August 2022 - 01:59 PM, said:
In cases where the coder doesn't know what is going on or causing the issue, I kind of have to discount what they are saying about it since what they are saying could include false assumptions. So I can't go by your descriptions, only the actual code, and you didn't include the main part of your code. I don't have time anyway though.
I didn't think I should post all the code here. I'll post a link for the file itself if anybody is interested.
https://www.mediafir...EAPONS.con/file
#2973 Posted 25 August 2022 - 05:59 PM
----------------------------------------------------------------------------- Summary : Combat arena management and spawning. Arena Managers act like Touchplates, activating when a player enters their sector. Arena Spawn Points act like Respawns, except they can spawn multiple times. Once activated, a Manager will attempt to trigger their paired Spawn Points in waves on a repeating cycle. Each wave, a Spawn Point will only trigger if its spawned child is dead, otherwise it will be skipped. Spawn Points will continue spawning until their "tickets" run out. For example, if an arena has 5 Spawn Points but 2 enemies are left alive, the next wave will only spawn 3 enemies, but only if each of those 3 Spawn Points have remaining tickets. For Arena Managers: * Set the sprite's HITAG to the spawn wave frequency, in game tics (min 90) For Arena Spawn Points: * Set the sprite's HITAG to the tile ID to spawn * Set the sprite's LOTAG to the number of spawn "tickets" (min 1) Use the palette to pair a Manager with Spawn Points to create a complete system. A Manager can have any number of associated Spawn Points, and there can be as many Manager systems as there are palette numbers. Note: Spawn Points will not spawn if a player has line-of-sight with them, so place them in non-visible locations, and try not to place other Spawn Points within line-of-sight of each other to prevent the system from dead locking! -----------------------------------------------------------------------------
This manager largely works by abusing EVENT_WORLD and custom statnums to reduce overhead. I am pretty proud of this effect and its elegance, and unfortunately it didn't get used as much in AWOL as I had hoped, so hopefully it gains more life in someone else's project.
This code won't run as-is, you'll need to setup gamevars and remove or fix some AWOL-specific code/vars outside the scope of this file. No support will be provided for this code.
Attached File(s)
-
enemy_arena.con (6.38K)
Number of downloads: 201
#2975 Posted 03 September 2022 - 01:25 PM
#2976 Posted 03 September 2022 - 01:42 PM
VGames, on 03 September 2022 - 01:25 PM, said:
https://wiki.eduke32...iki/Spriteflags
Make sure to apply the NOSHADE flag to the sprite before applying shade.
#2977 Posted 03 September 2022 - 05:10 PM
Danukem, on 03 September 2022 - 01:42 PM, said:
Make sure to apply the NOSHADE flag to the sprite before applying shade.
Oh ok. Thanks. I misunderstood the use of this flag.
#2978 Posted 10 September 2022 - 10:01 AM
Sangman, on 10 February 2020 - 06:44 AM, said:
I'm working on a few performance related things and just want to corroborate this behavior, and I'm not sure if this is a bug in the implementation of EVENT_RESETGOTPICS or if this event is explicitly meant to function only with mirrors. Based on the description and comments in the source code, I assumed it would fire every frame after EVENT_DISPLAYROOMS, but it only seems to be fired when mirror rendering logic is happening. So if you want to reset the gotpic array independent of mirror logic, it seems to be safest to do in a DISPLAYROOMS event after all other DISPLAYROOMS events have been executed, or in any other event that runs after DISPLAYROOMS.
Danukem, on 10 February 2020 - 09:44 AM, said:
Based on a quick test using the above info, sprites are rendered (or at least, inserted into the gotpic array) even if they are not explicitly on screen, based on A.) if the sprite's sector is being rendered AND B.) if the sprite is within the player's field of vision. Using the example image below, if the player were in the top left of each U, the sprite on the left room would always be rendered no matter where the player is located, as long as the player is facing in its direction, even though the walls block it from being seen. But the sprite in the right room would never be rendered until the player gets in the bottom left corner sector, at which point the sprite's sector begins to be rendered and it begins to follow those rules.
![Attached Image: capt0007.png](https://forums.duke4.net/uploads/monthly_09_2022/post-843-0-91791500-1662832330_thumb.png)
Basically, if you understand how sector rendering is performed, any sprite in a rendered sector will always be drawn if the sprite's location is within the player's field of vision, even if walls block it from being seen. One-way mask walls would presumably prevent this as they function as white walls during rendering, although I didn't test this here.
#2979 Posted 10 September 2022 - 10:55 AM
I just tried using the htflags 2048 on the missiles when they're within a certain range of the player to make them clip through him but that didn't work either.
This post has been edited by VGames: 10 September 2022 - 11:07 AM
#2980 Posted 10 September 2022 - 11:01 AM
#2981 Posted 10 September 2022 - 12:31 PM
VGames, on 10 September 2022 - 10:55 AM, said:
I just tried using the htflags 2048 on the missiles when they're within a certain range of the player to make them clip through him but that didn't work either.
This is one of those situations where offsets just don't cut it. You have to intervene at the instant the rockets spawn in EVENT_EGS and manually reposition the x and y coordinates. I find the rotatepoint command useful for calculating the new coordinates in these situations.
#2982 Posted 10 September 2022 - 12:40 PM
jimbob, on 10 September 2022 - 11:01 AM, said:
Typically when an enemy uses that state, it is facing towards the player and the back of the enemy is facing towards the wall that get bloodied. So maybe those hardcoded wall splat projectiles have a big angle offset and come out the backside of the sprite shooting them. Therefore, I would try making your projectile turn 1024 build degrees right before shooting those blood splats and deleting itself.
#2983 Posted 10 September 2022 - 01:38 PM
Danukem, on 10 September 2022 - 12:31 PM, said:
Will do. Thanks a lot
#2984 Posted 11 September 2022 - 10:24 AM
Danukem, on 10 September 2022 - 12:40 PM, said:
i already tried that, including some other angles ( 512 and others ) making the sprite spin seems to work so there is definatly a offset involved but finding the right angle seems to be rather difficult. i could always try to make increments in angle offset of about 32 units untill i hit the sweet spot.
[edit] trying to rotate the sprite didnt seem to work, there is probably something else going on in the code. so i hacked it by making a move command and using faceplayer. its a hack but it seems to work
![:P](https://forums.duke4.net/public/style_emoticons/default/tongue.gif)
This post has been edited by jimbob: 11 September 2022 - 10:53 AM
#2985 Posted 11 September 2022 - 10:33 AM
ifactor ID_ALT1 { rotatepoint player[].posx player[].posy 100 player[].posy player[].ang temp tempb setsprite THISACTOR temp player[].posy player[].posz }
No matter what I set that 100 to the missile simply does not show up. Even if I set it to 0. What am I doing wrong? This is in the EGS event.
#2987 Posted 14 September 2022 - 05:44 AM
#2988 Posted 14 September 2022 - 11:06 AM
VGames, on 14 September 2022 - 05:44 AM, said:
It is very hardcoded
#2989 Posted 15 September 2022 - 05:44 PM
#2990 Posted 15 September 2022 - 09:07 PM
#2991 Posted 16 September 2022 - 04:25 AM
Danukem, on 16 June 2009 - 11:01 AM, said:
That would be fine if that’s the best that can be achieved. My work around so far was to have the drops disappear if the player got within a certain distance of them. This is ok but I’d really like the drops to fall right in front of the players face sometimes and with this method I have to set the distance to 2000 or more to keep them from landing on his head. So it looks weird sometimes when they simply disappear mid air. But if they simply disappeared when contacting the player that would be even better. How would I go about doing this?
This post has been edited by VGames: 16 September 2022 - 04:27 AM
#2992 Posted 16 September 2022 - 12:06 PM
VGames, on 16 September 2022 - 04:25 AM, said:
This is more difficult than it should be. There is no direct way to tell if a sprite is falling onto the player. The getzrange command can be used for this, though. I have had success with it.
https://wiki.eduke32.../wiki/Getzrange
You'll have to examine the floorhit return value to see if the player is being hit, and then compare the floorz return value to the height of the falling sprite and have it delete itself if the z distance is short enough.
#2993 Posted 16 September 2022 - 12:18 PM
#2994 Posted 16 September 2022 - 02:40 PM
#2995 Posted 16 September 2022 - 07:55 PM
MC84, on 16 September 2022 - 02:40 PM, said:
Sure, as long as you know what you are doing it should be fine. If you are worried about it, just make a copy of the tile to a different tile number and use one of them as the actor and the other as the non-actor.
#2996 Posted 23 September 2022 - 03:56 PM
action BLOODDRIP_FRAMES 0 1 1 1 1 actor REDBLOODDRIP 0 BLOODDRIP_FRAMES setactor[THISACTOR].xrepeat 20 setactor[THISACTOR].yrepeat 20 seta[].htflags 2048 fall state thisactor_getzrange // <---------- THIS IS WHERE I'M CALLING TO THE STATE DEFINED IN THE GETZRANGE.CON FILE iffloordistl 2 { ifge tagz_florhit 16384 { sub tagz_florhit 16384 ifrnd 128 { setactor[THISACTOR].picnum REDSPLAT1 cstat 4 sound BLOODSPLAT1SFX } else { setactor[THISACTOR].picnum REDSPLAT2 sound BLOODSPLAT2SFX } setactor[THISACTOR].xrepeat 6 setactor[THISACTOR].yrepeat 6 cstat 32 insertspriteq fall } } enda
No matter what I try the splats either appear on the player's head or an actor or they don't appear at all on the floor. Please tell me what I'm doing wrong. I think I'm completely lost. I need the blood drops to only splat on floors and not any other actor.
GETZRANGE.CON code:
// In gamevar tagz_z 0 0 // Temp gamevar tagz_cstat 0 0 // Out gamevar tagz_ceilz 0 0 gamevar tagz_ceilhit 0 0 gamevar tagz_florz 0 0 gamevar tagz_florhit 0 0 // ZOFFSET in the EDuke32 source. define TAGZ_ZOFFSET 256 // In the EDuke32 source, the <walldist> passed to VM_GetZRange(). define TAGZ_WALLDIST 127 gamevar check_count 0 2 // Updates the current actor's actor[].floorz and actor[].ceilngz members in // the same way A_GetZRange() does. defstate thisactor_getzrange ifl check_count 1 { set tagz_z sprite[].z, sub tagz_z TAGZ_ZOFFSET // Back up and clear cstat. set tagz_cstat sprite[].cstat seta[].cstat 0 getzrange sprite[].x sprite[].y tagz_z sprite[].sectnum /*out:*/ tagz_ceilz tagz_ceilhit tagz_florz tagz_florhit /*in:*/ TAGZ_WALLDIST CLIPMASK0 // Restore cstat. seta[].cstat tagz_cstat // Set actor[] members for the current actor. seta[].htceilingz tagz_ceilz seta[].htfloorz tagz_florz set check_count 5 } else sub check_count 1 ends
This post has been edited by VGames: 23 September 2022 - 03:58 PM
#2997 Posted 23 September 2022 - 05:41 PM
#2998 Posted 23 September 2022 - 10:02 PM
Reaper_Man, on 23 September 2022 - 05:41 PM, said:
Yes, but movesprite moves the sprite. I assume he wants his sprite to move only using the fall command. Otherwise, yeah, if he wants to make the sprite fall by putting a positive value on the z velocity parameter in the movesprite command, then he could use that. He would still need to decode the hit sprite in the same way he needs to for getzrange though, so I don't think it is any easier.
Anyway, here is code that should work for getzrange:
gamevar tempvar 0 0 gamevar floorz 0 0 gamevar floorhit 0 0
getzrange sprite[].x sprite[].y sprite[].z sprite[].sectnum tempvar tempvar floorz floorhit 256 CLIPMASK0 sub floorz sprite[].z ifl floorz 12288 ifge floorhit 49152 { sub floorhit 49152 ife floorhit player[].i killit }
I think that's all there is to it. You can use the same var to receive most of the data because the only ones you actually care about are <floorz> and <floorhit> returns. What that code does is check what the sprite would hit below it in a 256 build unit radius. If that thing is the player sprite and the base of the player sprite is < 12288 z units below the sprite doing the check, the sprite deletes itself.
#2999 Posted 24 September 2022 - 09:33 AM
Danukem, on 23 September 2022 - 10:02 PM, said:
Anyway, here is code that should work for getzrange:
gamevar tempvar 0 0 gamevar floorz 0 0 gamevar floorhit 0 0
getzrange sprite[].x sprite[].y sprite[].z sprite[].sectnum tempvar tempvar floorz floorhit 256 CLIPMASK0 sub floorz sprite[].z ifl floorz 12288 ifge floorhit 49152 { sub floorhit 49152 ife floorhit player[].i killit }
I think that's all there is to it. You can use the same var to receive most of the data because the only ones you actually care about are <floorz> and <floorhit> returns. What that code does is check what the sprite would hit below it in a 256 build unit radius. If that thing is the player sprite and the base of the player sprite is < 12288 z units below the sprite doing the check, the sprite deletes itself.
Wow thanks a lot. I’ll put this to use and see what I can do with it.
#3000 Posted 24 September 2022 - 10:27 AM
This post has been edited by VGames: 24 September 2022 - 10:41 AM