
EDuke32 Scripting "CON coding help"
#2543 Posted 30 August 2019 - 03:52 PM
EDIT: Anyway, I coded a manual reload shotgun for DukePlus, and I think AMC TC has several like that. It will be hard for you to find the relevant code by searching through the CONs, but I don't have time to write new code.
This post has been edited by Trooper Dan: 30 August 2019 - 04:01 PM
#2544 Posted 31 August 2019 - 07:39 AM
Trooper Dan, on 30 August 2019 - 03:52 PM, said:
EDIT: Anyway, I coded a manual reload shotgun for DukePlus, and I think AMC TC has several like that. It will be hard for you to find the relevant code by searching through the CONs, but I don't have time to write new code.
I want the shotgun to reload after firing 8 rounds. I want the shotgun to stop working after it empties all 8 rounds, until i press the reload key. You don't have to write a new code, I will find it in the AMC TC or DukePlus, and make it work, somehow. Thank you for telling me, and also for help and patience with me.
#2546 Posted 23 November 2019 - 03:16 PM
#2547 Posted 08 January 2020 - 02:26 AM
#2548 Posted 19 January 2020 - 11:51 PM
Is there a way to determine which frame of the animation is currently playing? This is necessary, for example, to synchronize the sound of steps with character animation. Or to make sure that the animation has finished playing.
#2549 Posted 20 January 2020 - 03:28 AM
Mr. Alias Nameless, on 19 January 2020 - 11:51 PM, said:
Is there a way to determine which frame of the animation is currently playing? This is necessary, for example, to synchronize the sound of steps with character animation. Or to make sure that the animation has finished playing.
https://wiki.eduke32...iki/Actioncount
ifactioncount and resetactioncount can be used to do what you want.
#2550 Posted 20 January 2020 - 10:04 AM
For example a golden armor of 200hp, will keep the health always at 100%, until the armor runs out.
Last thing, I would also like to make sure that Duke cannot pick up another armor, until the special armor is used up below 100%.
This post has been edited by Firefly Trooper: 20 January 2020 - 10:13 AM
#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.