What commands should I look into to the get the X and y positions of an enemy so that it can be used to display something on the screen in the position they’re located using rotatesprite?
EDuke32 Scripting "CON coding help"
#3541 Posted 31 October 2024 - 07:55 AM
#3542 Posted 31 October 2024 - 10:54 AM
If you are trying to make a radar display, it has been done.
#3543 Posted 31 October 2024 - 11:09 AM
in my radar code, I'm mainly using rotatepoint to do the heavy lifting, with some getincangle and basic var and array manipulation
#3544 Posted 31 October 2024 - 12:30 PM
Danukem, on 31 October 2024 - 11:09 AM, said:
in my radar code, I'm mainly using rotatepoint to do the heavy lifting, with some getincangle and basic var and array manipulation
I want a way to see enemy positions through walls. Like the railgun on Red Faction.
#3545 Posted 01 November 2024 - 02:12 PM
That's a big pain in the ass and involves math translating game coords to screen space coords. I do this exact thing in AWOL to display the AI Bot's stats over their heads while on screen. Take a look at awol_ui.con around the middle of the file, the "botui_xxx" statements handles it. In the "// AI Bot status display" section. There becomes a pretty big vertical desync the closer the actor is to the top or bottom of the player's screen or view, I'm pretty sure because of precision issues with the horiz property. As always, please credit Shotspark and/or AWOL if you pull any of the code wholesale.
#3546 Posted 01 November 2024 - 02:58 PM
Reaper_Man, on 01 November 2024 - 02:12 PM, said:
That's a big pain in the ass and involves math translating game coords to screen space coords. I do this exact thing in AWOL to display the AI Bot's stats over their heads while on screen. Take a look at awol_ui.con around the middle of the file, the "botui_xxx" statements handles it. In the "// AI Bot status display" section. There becomes a pretty big vertical desync the closer the actor is to the top or bottom of the player's screen or view, I'm pretty sure because of precision issues with the horiz property. As always, please credit Shotspark and/or AWOL if you pull any of the code wholesale.
Hey, thanks a lot for the heads up. I'll credit Shotspark and AWOL no matter what if this helps me. I'll check it out ASAP. How do you open the GRP for AWOL? Nothing I have opens it. I normally use GRPViewer.
This post has been edited by VGames: 01 November 2024 - 03:05 PM
#3548 Posted 03 November 2024 - 09:15 AM
What's a good way to wake enemies up when the player is within a certain range without having to go into every one of their individual sets of code and add the scripts to call on one of their AI statements specific to them? I considered giving them a little bit of damage to wake them up but if there was a better way to start their ai as if they actually saw the player, I'd like to use that instead.
This post has been edited by VGames: 03 November 2024 - 09:16 AM
#3549 Posted 03 November 2024 - 09:48 AM
Actors go asleep in 2 ways, changing their statnum and the .httimetosleep property. You can check their .picnum to see if it matches the enemy tile ID, and then check if their statnum is set to STAT_ZOMBIEACTOR and if so set them back to STAT_ACTOR. This will turn them back into regular actors running code. Actors turn into Zombies when their "sleep time" counter exceeds 32767 (and other conditions like being too far away). So you probably want to set the .httimetosleep back to 0 when you force them out of the Zombie state to prevent them from instantly falling asleep again.
#3550 Posted 03 November 2024 - 10:05 AM
Reaper_Man, on 03 November 2024 - 09:48 AM, said:
Actors go asleep in 2 ways, changing their statnum and the .httimetosleep property. You can check their .picnum to see if it matches the enemy tile ID, and then check if their statnum is set to STAT_ZOMBIEACTOR and if so set them back to STAT_ACTOR. This will turn them back into regular actors running code. Actors turn into Zombies when their "sleep time" counter exceeds 32767 (and other conditions like being too far away). So you probably want to set the .httimetosleep back to 0 when you force them out of the Zombie state to prevent them from instantly falling asleep again.
Cool man. That explains a lot.
By the way I ended up using the code from AWOL like you said to set up targeting reticles that pop up on enemies when they are on the other side of walls. It works pretty dang good thanks to you, so thanks for allowing me to use some code from AWOL. However, I noticed that when enemies are higher than me, such as a Liztroop flying, the targets are much higher than the actual enemy position on my screen. Were these health stats that appear above the bots in AWOL not setup to accommodate flying bots or bots that were higher than you because the bots in AWOL don't ever fly around or go up above you often? Can this be fixed? It's not a huge deal for me since you can only see enemies on the other side of a wall that you're somewhat close to and enemies aren't necessarily in the air or higher than you anyways while using this see through walls mechanic. I was just wanted to fix it if it was possible just in case.
#3551 Posted 03 November 2024 - 07:10 PM
Like I said, the vertical desync. If the problem is because of precision issues with .horiz, then I don't know if the problem can be solved. Otherwise it's an issue in the math calculating the Z-difference, I'd look at that code section first. I don't think it's a screen drawing precision issue but you could rule it out using the ROTATESPRITE_FULL16 flag (and changing the screen drawing values accordingly)
#3552 Posted 04 November 2024 - 06:27 AM
Reaper_Man, on 03 November 2024 - 07:10 PM, said:
Like I said, the vertical desync. If the problem is because of precision issues with .horiz, then I don't know if the problem can be solved. Otherwise it's an issue in the math calculating the Z-difference, I'd look at that code section first. I don't think it's a screen drawing precision issue but you could rule it out using the ROTATESPRITE_FULL16 flag (and changing the screen drawing values accordingly)
Ok I’ll check that out. Like I said it’s not a huge deal since the enemies that will be painted with these target icons will more than likely be on the floor and close by in the next room anyways. So no big deal. You’ve provided lots of help regardless. Thanks again.
This post has been edited by VGames: 04 November 2024 - 06:28 AM
#3553 Posted 13 November 2024 - 09:44 AM
I had a couple questions involving changing the chaingun cannon to something more akin to the plasma rifle from the LameDuke beta. Is it possible, through CON editing or something more advanced, to:
-Edit the muzzle flash of the chaingun? I see there's a sprite for the chaingun muzzle flash, but it seems to be rendered three times, roughly around where each of the chaingun's barrels are. I've seen some classic total conversions just blank out the sprites for this flash, but I would like to keep it, just color it blue and only have it shown once about where the plasma rifle's barrel is.
-Animate the chaingun ammo pickup? I'm trying to make a mod that doesn't interfere with anything already in place (so you could still play the original levels, just with the new player character and weapons). The default chaingun ammo sprite isn't animated, but the plasma rifle battery pickup is, so I basically wanted to put in a simple CON script that would have the battery pickup (the first frame of which would replace the original box of ammo) jump to the new ART tiles for a couple frames and then come back to the original one. That way the pickup would be animated but all the original chaingun ammo pickups in the original maps don't need new sprites set. I know there's a way to set animations in the ARTs themselves, but those assume the frames are all right next to each other.
-Edit the muzzle flash of the chaingun? I see there's a sprite for the chaingun muzzle flash, but it seems to be rendered three times, roughly around where each of the chaingun's barrels are. I've seen some classic total conversions just blank out the sprites for this flash, but I would like to keep it, just color it blue and only have it shown once about where the plasma rifle's barrel is.
-Animate the chaingun ammo pickup? I'm trying to make a mod that doesn't interfere with anything already in place (so you could still play the original levels, just with the new player character and weapons). The default chaingun ammo sprite isn't animated, but the plasma rifle battery pickup is, so I basically wanted to put in a simple CON script that would have the battery pickup (the first frame of which would replace the original box of ammo) jump to the new ART tiles for a couple frames and then come back to the original one. That way the pickup would be animated but all the original chaingun ammo pickups in the original maps don't need new sprites set. I know there's a way to set animations in the ARTs themselves, but those assume the frames are all right next to each other.
#3554 Posted 13 November 2024 - 02:44 PM
If you are making a mod with a new character and weapons, you'll need to learn a ton of stuff and it won't be easy, although there are many released mods that already do that and you can look at for examples of how to do things. My advice is just accept from the start that you will need to make your own chaingun with its own sprites, its own ammo actor, its own separate display code, etc. Trying to piggyback on the hardcoded chaingun will limit you severely and if your mod "doesn't interfere with anything already in place" then hacking the chaingun for your new weapon seems like a nonstarter anyway.
Certainly there are a lot of things that are impossible to do in EDuke32, but there's also a huge amount of possibilities. In general I don't think its very useful to ask whether something is possible, because then some smartass such as myself might simply say "yes" and that doesn't put you any farther forward. What you want to know is expert opinions on the best way to accomplish your goals.
Certainly there are a lot of things that are impossible to do in EDuke32, but there's also a huge amount of possibilities. In general I don't think its very useful to ask whether something is possible, because then some smartass such as myself might simply say "yes" and that doesn't put you any farther forward. What you want to know is expert opinions on the best way to accomplish your goals.
#3555 Posted Yesterday, 10:33 PM
I'm having trouble to create new interactive buttons. I tried looking some mods, tried to replicate the code, like Memories Mod, but with no results. I just want to create a new button with 2 new textures (off and on). I also tried keycard buttons and new keycards, but also without results.
#3556 Posted 36 minutes ago
Why do you need new buttons? You could just put your new textures on the existing button tile numbers.