
EDuke32 Scripting "CON coding help"
#2551 Posted 28 January 2020 - 01:16 AM
This could be very useful for creating an inventory interface, for example.
#2552 Posted 10 February 2020 - 06:44 AM
Still, we have some functions like ifcansee that work against actors. I probably need that but for textures.
edit:
Apparently this is exposed via the gotpic array in CON.
ife gotpic[tilenum] 1 => means that tilenum is currently visible
The array doesn't reset on its own (there is an EVENT_RESETGOTPICS but from what I can tell from the source code, this only gets called when handling mirrors), but you can do so manually inside your code bock:
setarray gotpic[tilenum] 0
So far performance seems ok
Credit to Mblackwell for letting me know
This post has been edited by Sangman: 10 February 2020 - 09:29 AM
#2553 Posted 10 February 2020 - 09:44 AM
Sangman, on 10 February 2020 - 06:44 AM, said:
ife gotpic[tilenum] 1 => means that tilenum is currently visible
The array doesn't reset on its own (there is an EVENT_RESETGOTPICS but from what I can tell from the source code, this only gets called when handling mirrors), but you can do so manually inside your code bock:
setarray gotpic[tilenum] 0
Interesting. So what exactly causes the elements to get set? For example, if a certain enemy dies in a place where no players are around, is its dead body tile "in view"? Or does it require that the tile is actually rendered on a screen?
#2555 Posted 19 February 2020 - 12:45 PM
This post has been edited by Firefly Trooper: 19 February 2020 - 12:48 PM
#2556 Posted 19 February 2020 - 03:56 PM
Trooper Dan, on 10 February 2020 - 09:44 AM, said:
It requires the tile to be rendered.
This was added so the skybox in Ion Fury would only be drawn if the skybox texture (which is a blank tile) was visible.
Note that it's only set after it's rendered (meaning that in the Ion Fury example there's a 1 frame delay).
#2557 Posted 19 February 2020 - 04:15 PM
Fox, on 19 February 2020 - 03:56 PM, said:
This was added so the skybox in Ion Fury would only be drawn if the skybox texture (which is a blank tile) was visible.
Note that it's only set after it's rendered (meaning that in the Ion Fury example there's a 1 frame delay).
I miss-clicked and downvoted you by accident (that was supposed to be an upvote).
Anyway, that's a good feature for saving resources with an expensive command like showview
#2558 Posted 21 March 2020 - 08:49 AM
#2559 Posted 22 March 2020 - 03:24 PM
getplayer[THISACTOR].posx temp1 getplayer[THISACTOR].posy temp2 setplayer[THISACTOR].posx XPOS setplayer[THISACTOR].posy YPOS ldist DISTDIFF THISACTOR player[THISACTOR].i setplayer[THISACTOR].posx temp1 setplayer[THISACTOR].posy temp2
I'm trying to make monsters shoot at the direction of the player's movements (if you played Unreal games, you know what I mean).
#2560 Posted 22 March 2020 - 03:49 PM
EDIT: Here, if the vars "hitx" and "hity" are the distant coordinates, and assuming the other vars have been declared, then this will do the job
set xydist sprite[].x sub xydist hitx mul xydist xydist set y2 sprite[].y sub y2 hity mul y2 y2 add xydist y2 sqrt xydist xydist
This post has been edited by Trooper Dan: 22 March 2020 - 03:56 PM
#2561 Posted 23 March 2020 - 09:45 AM
Example, dodging left:

Also made a variant that take account of height. This time dodging left and jetpack on, going up:

#2562 Posted 23 March 2020 - 10:42 AM
#2563 Posted 23 March 2020 - 01:08 PM

#2564 Posted 24 May 2020 - 11:31 PM
#2565 Posted 25 May 2020 - 11:20 AM
#2566 Posted 25 May 2020 - 11:37 AM
spacekebab, on 25 May 2020 - 11:20 AM, said:
Not sure what you mean. At first I thought you meant prevent them from hanging off of ledges, but now I doubt that.
#2567 Posted 25 May 2020 - 07:15 PM
Trooper Dan, on 25 May 2020 - 11:37 AM, said:
That's exactly what I meant, sorry - didn't know how to word it.
This post has been edited by spacekebab: 25 May 2020 - 07:16 PM
#2568 Posted 25 May 2020 - 11:26 PM
spacekebab, on 25 May 2020 - 07:15 PM, said:
There is hardcoding in the base game which prevents the standard BLOODPOOL from hanging over ledges. So one solution is to spawn BLOODPOOL, then in a game event (EVENT_WORLD may be your best choice) cactor BLOODPOOL into your own actor, and change size and pal if needed. Since BLOODPOOL is already in a verified good location, that should be fine (although it won't be if your sprite is much bigger).
If you want to use your own code then I would suggest a loop where you test out some nearby coordinates (nothing fancy, just add and subtract values to your sprites's x and y) and check to see if the floor height is the same if the tested coords are in a different sector. Also you can check for slopes. If checks indicate a bad situation, you can resize or delete your sprite as appropriate.
#2569 Posted 29 August 2020 - 01:30 PM
Maybe set PROJ_FLASH_COLOR to all 0's? Or is there a global command?
This post has been edited by Mark: 29 August 2020 - 01:47 PM
#2570 Posted 29 August 2020 - 03:23 PM
#2571 Posted 29 August 2020 - 03:33 PM
This post has been edited by Mark: 29 August 2020 - 03:37 PM
#2572 Posted 29 August 2020 - 03:52 PM
The flash color thing might work if they are polymer lights.
#2573 Posted 29 August 2020 - 04:03 PM
edit: Because of how large an area weapons light up in the map I thought it might be the usual sector based flashing. But switching to Polymost stopped any weapon flashing. So even though the mod is ancient, eduke32 is supplying the flash thru Polymer. Can I just set the PROJ_FLASH with a gamevar or is it an event thing? In all my years of coding I have never messed with weapons. I'm a noob once more.

This post has been edited by Mark: 29 August 2020 - 04:13 PM
#2574 Posted 29 August 2020 - 05:12 PM
Find where there are "defineprojectile" for the projectiles in question. There should be a block of lines for each one of the projectiles. You want to add/replace with "defineprojectile PROJECTILENAME PROJ_FLASH_COLOR 0"
It might not work.
#2575 Posted 29 August 2020 - 07:28 PM
// Shotgun
gamevar WEAPON2_WORKSLIKE 2 2
gamevar WEAPON2_CLIP 0 2
gamevar WEAPON2_RELOAD 13 2
gamevar WEAPON2_FIREDELAY 4 2
etc...
I guess I'll search around in other projects to see if I can find a chunk of defineprojectile code to learn from. But if its a whole lot of effort to make a projectile from scratch, I'll just live with the flash. Actually, I wouldn't mind keeping the flash but reduce it's size by at least 50-60 percent.
This post has been edited by Mark: 29 August 2020 - 07:35 PM
#2576 Posted 29 August 2020 - 07:40 PM
You said they were "custom coded" so I assumed that meant they were custom projectiles. If the actors are using the regular hardcoded shots ("shoot SHOTGUN", "shoot CHAINGUN", "shoot SHOTSPARK1") then I don't know if there is any way to disable the lights they spawn in polymer. You could replace them with your own projectiles that don't emit light, though.
#2577 Posted 29 August 2020 - 07:49 PM
This post has been edited by Mark: 29 August 2020 - 07:51 PM
#2578 Posted 29 August 2020 - 08:27 PM
Mark, on 29 August 2020 - 07:49 PM, said:
No, for hitscan they are incredibly simple. Pick an unused tile number (can be a blank one it doesn't matter), define it as hitscan and set damage, decal size and a few other things and you are good to go. No math, no fuss.
#2579 Posted 29 August 2020 - 08:44 PM
This post has been edited by Mark: 29 August 2020 - 08:46 PM
#2580 Posted 30 August 2020 - 06:42 AM
Now I'm wondering if its possible/feasible to define and spawn my own SE light of a much smaller radius than the default flash was.