
EDuke32 Scripting "CON coding help"
#141 Posted 31 July 2009 - 06:47 PM
#142 Posted 01 August 2009 - 02:24 AM
Basically, I checked players health and placed them according to it, they won't display if their condition is false. You can, say put a health block per 5 health the player has. (Use DISPLAYREST event)
#143 Posted 01 August 2009 - 07:59 AM
MIKE SIMS, on Jul 31 2009, 10:47 PM, said:
How to make a health bar
This post has been edited by Dr. Kylstein: 01 August 2009 - 08:37 AM
#144 Posted 01 August 2009 - 08:10 AM
Dr. Kylstein, on Aug 1 2009, 08:59 AM, said:
gamevar temp 0 2 gamevar xvar 0 2 onevent EVENT_DISPLAYREST { setvar xvar 0 // set starting x coordinate getactor[THISACTOR].extra temp // get the player's health whilevarn temp 0 { // loop for each hitpoint rotatesprite xvar 184 65536 0 HEALTHBAR 0 0 16 0 0 xdim ydim // draws HEALTHBAR at (xvar,184) addvar xvar 2 // move to the right subvar temp 1 // next hitpoint } } endevent
Edit: this would be a rather large bar, however. You could "divvar temp <number>" before starting the loop to make each bar worth more points.
I might add a more thought-out version to the wiki later.
Yep, that's pretty much what I've been doing for bars in my mods (like the air left bar in DP that appears when you go under water without scuba gear, etc)
#145 Posted 02 August 2009 - 03:09 PM
Dr. Kylstein, on Aug 1 2009, 08:59 AM, said:
i love you (no homo)

#146 Posted 02 August 2009 - 06:29 PM
MIKE SIMS, on Aug 2 2009, 07:09 PM, said:

Any number you want. Just replace "getactor[THISACTOR].extra temp" and adjust BARSCALE as needed.
#147 Posted 04 August 2009 - 09:42 AM
As I could figure, to make an RPG have the same horizontal and vertical speed (an angle of 45º) the .zvel should be 16x the xvel. But this is as far as I could get... any help, please?
This post has been edited by Ilovefoxes: 04 August 2009 - 09:49 AM
#148 Posted 04 August 2009 - 12:34 PM
Ilovefoxes, on Aug 4 2009, 10:42 AM, said:
As I could figure, to make an RPG have the same horizontal and vertical speed (an angle of 45º) the .zvel should be 16x the xvel. But this is as far as I could get... any help, please?
Take the projectile's zvel and shift it 14 to the left for the hitscan parameter. I discovered that a few years ago and it seems to work fine.
#149 Posted 04 August 2009 - 06:36 PM
This post has been edited by Ilovefoxes: 04 August 2009 - 07:08 PM
#150 Posted 05 August 2009 - 06:38 AM
#151 Posted 05 August 2009 - 07:35 AM
Ilovefoxes, on Aug 5 2009, 10:38 AM, said:
Nonexistent sprites have a statnum of 1024, or so I heard.
#152 Posted 05 August 2009 - 08:15 AM
Dr. Kylstein, on Aug 5 2009, 08:35 AM, said:
Yup. It's also good to check for whether the target changed picnum, because sometimes one sprite will get deleted and then another one spawns with the same ID.
#153 Posted 05 August 2009 - 10:24 AM
Somebody can help me with code?
#154 Posted 05 August 2009 - 10:56 AM
M210, on Aug 5 2009, 11:24 AM, said:
Somebody can help me with code?
It's possible, but I don't know the math for making it bounce correctly and I'm too lazy to look it up. If it were me I would just make it a projectile and add code to it in EVENT_GAME to make it do whatever it needs to do.
#155 Posted 05 August 2009 - 11:11 AM
This post has been edited by Captain Awesome: 05 August 2009 - 11:11 AM
#156 Posted 05 August 2009 - 11:29 AM
DeeperThought, on Aug 5 2009, 10:56 PM, said:
I think is necessary to find ID of wall and a difference of angles between the actor and a wall(delta_fi). Before reflection to develop the actor on a angle equal
reflang=actor_ang + 2[delta fi]

Can you help?
This post has been edited by M210: 05 August 2009 - 11:33 AM
#157 Posted 05 August 2009 - 12:38 PM
M210, on Aug 5 2009, 12:29 PM, said:
What you need to do is translate this function into CON code. Good luck!
Quote
{
int32_t dax, day, daz = 4096;
spritetype *s = &sprite[i];
int32_t hitsect = s->sectnum;
int32_t k = sector[hitsect].wallptr;
int32_t l = wall[k].point2;
int32_t xvect = mulscale10(s->xvel,sintable[(s->ang+512)&2047]);
int32_t yvect = mulscale10(s->xvel,sintable[s->ang&2047]);
int32_t zvect = s->zvel;
int32_t daang = getangle(wall[l].x-wall[k].x,wall[l].y-wall[k].y);
if (s->z < (ActorExtra[i].floorz+ActorExtra[i].ceilingz)>>1)
k = sector[hitsect].ceilingheinum;
else
k = sector[hitsect].floorheinum;
dax = mulscale14(k,sintable[(daang)&2047]);
day = mulscale14(k,sintable[(daang+1536)&2047]);
k = xvect*dax+yvect*day+zvect*daz;
l = dax*dax+day*day+daz*daz;
if ((klabs(k)>>14) < l)
{
k = divscale17(k,l);
xvect -= mulscale16(dax,k);
yvect -= mulscale16(day,k);
zvect -= mulscale16(daz,k);
}
s->zvel = zvect;
s->xvel = ksqrt(dmulscale8(xvect,xvect,yvect,yvect));
s->ang = getangle(xvect,yvect);
}
#158 Posted 05 August 2009 - 03:15 PM
What exactly do,
*mulscale
*divscale
*ksqrt
*&
*wallptr
these do? I understood the math part, just the commands are bugging me.
#159 Posted 05 August 2009 - 06:53 PM
arctan2 = getangle
@Captain Awesome:
Check the sound's priority, the third number in the definesound declaration.
definesound KICK_HIT kickhit.voc 0 0 4 0 0
By default it is set 4, really low. The maximum is 255. You may also want to increase the maximum number of voices in the sound setup. I believe TX recently upped it from 32 to 96.
@XThX2:
Check the wiki, my friend.
mulscale
divscale - There's no divscale command in the CONs; see mulscale.
ksqrt - Remember that in the source code, you can directly feed commands to other commands. So for ksqrt, it's just taking the square root of the mulscale command.
& - The only &'s in that code are "&sprite[i]" and "&2047". The first one I have no clue about, but it probably doesn't matter. The second one is only used with angles, probably because the only legal values for ang are between 0 and 2047, for 2048° of rotation.
wallptr - The first wall of a sector is where a wall hinges for slopes, and it also is used to check the statuses of all the walls in a sector.
This post has been edited by Hendricks266: 05 August 2009 - 06:54 PM
#160 Posted 06 August 2009 - 10:24 AM
This post has been edited by Ilovefoxes: 06 August 2009 - 10:25 AM
#161 Posted 06 August 2009 - 11:33 AM
But when I want to display a negative value on screen. It displays the steroids HUD instead of the - symbol.
Is there any way to fix this through coding?
#162 Posted 06 August 2009 - 11:53 AM
Hendricks266, on Aug 5 2009, 10:53 PM, said:
Check the sound's priority, the third number in the definesound declaration.
definesound KICK_HIT kickhit.voc 0 0 4 0 0
By default it is set 4, really low. The maximum is 255. You may also want to increase the maximum number of voices in the sound setup. I believe TX recently upped it from 32 to 96.
I've already tried that, but for the sake of it I upped my setting to 96, gave it a priority of 255, played in a map that wasn't playing any sounds, and still it did the same deal. It's really nerve racking because I really don't understand it.
#163 Posted 06 August 2009 - 12:15 PM
I dunno then. Try messing with WEAPON0_FIRESOUND.
@lycanox:
There is no minus digital symbol, but I have encountered this before and fixed it.
EDukeWiki: How to display negative numbers with the digital font
Attached File(s)
-
digital_minus.zip (1.67K)
Number of downloads: 913
This post has been edited by Hendricks266: 06 August 2009 - 02:29 PM
#165 Posted 06 August 2009 - 11:13 PM
Well, how in the world to you force a projectile spawned by an actor/player to spawn at a fixed distance in front of them, and WITHOUT using "WEAPONx_SHOOTS" or those other properties. I'm talking about from the eshoot/ezshoot commands. I need to know this because for some reason if my player is moving too fast when firing a specfic projectile this way, the attack gets caught behind them or something and hits the player instead of traveling forward and hitting what's in front of them, because shots spawned from eshoot/ezshoot seem to spawn directly in the same x/y area as the player while "WEAPONx_SHOOTS" will spawn them a fixed enough distanced ahead of the player this problem doesn't happen [I just tested it].
The only things I can think of that are part of this is that the solution would require posx/posy and the ang of the player/actor. However from there on, I'm stumped. Rotatepoint doesn't seem to help [which I tried], and setting various projectile flags momentarily doesn't stop the projectile from hitting the shooting player when they're spawned, so I really need help, and the sad part is that's it's probably some really easy method I'll be headdesking over later in shame when I read it. X_X;
On that note, it's been near-forever since I posted on a Coding-Help topic. I hope I'm not too rusty.
This post has been edited by Lord Misfit: 06 August 2009 - 11:14 PM
#166 Posted 07 August 2009 - 12:29 AM
eshoot GRAYROCKET getactor[THISACTOR].x x getactor[THISACTOR].y y getplayer[THISACTOR].ang TEMP setvarvar x2 x addvar x2 384 setvarvar y2 y subvar y2 128 rotatepoint x y x2 y2 TEMP x3 y3 setactor[RETURN].x x3 setactor[RETURN].y y3 eshoot GRAYROCKET addvar y2 256 rotatepoint x y x2 y2 TEMP x3 y3 setactor[RETURN].x x3 setactor[RETURN].y y3
Here's some code I use for making what you asked. (I asked what you are asking now in the past, DeeperThought helped me with that and I used it for this problem) In here however, there are two rockets spawned with fixed distance between them, spawned at a certain kickbackpic of weapon. The only issue with this is that the rockets can go through walls, which I seem to be unable to find a solution.
This post has been edited by XThX2: 07 August 2009 - 12:30 AM
#167 Posted 07 August 2009 - 01:27 AM
XThX2, on Aug 7 2009, 04:29 AM, said:
eshoot GRAYROCKET getactor[THISACTOR].x x getactor[THISACTOR].y y getplayer[THISACTOR].ang TEMP setvarvar x2 x addvar x2 384 setvarvar y2 y subvar y2 128 rotatepoint x y x2 y2 TEMP x3 y3 setactor[RETURN].x x3 setactor[RETURN].y y3 eshoot GRAYROCKET addvar y2 256 rotatepoint x y x2 y2 TEMP x3 y3 setactor[RETURN].x x3 setactor[RETURN].y y3
Here's some code I use for making what you asked. (I asked what you are asking now in the past, DeeperThought helped me with that and I used it for this problem) In here however, there are two rockets spawned with fixed distance between them, spawned at a certain kickbackpic of weapon. The only issue with this is that the rockets can go through walls, which I seem to be unable to find a solution.
O_o; Woah... to be honest, I'll admit I had previously used what I thought was a near-identical method to the above which did not appear to work, and thus I had been extremely skeptical that you had understood my exact problem when I saw the code, but apparently you did something different in your version that actually works. I guess that "x2" var is the key to the actual problem I was trying to fix [I was apparently setting x2/y2 to the same difference and that had an effect I wasn't expecting]. I wouldn't have expected changing just one of the vars would be enough to do the effect before I tried your code. I thank you man.

BTW, for the projectile I used, I basically put it under EVENT_GAME and have it increment a timer and kill the projectile automatically after 2.5-5 seconds to clear up space in that situation about the projectiles going through walls. Now I too am hoping someone has a solution to that part of the code. o.o
#168 Posted 07 August 2009 - 03:47 AM
#169 Posted 07 August 2009 - 10:08 AM
Hendricks266, on Aug 6 2009, 10:15 PM, said:
I dunno then. Try messing with WEAPON0_FIRESOUND.
@lycanox:
There is no minus digital symbol, but I have encountered this before and fixed it.
EDukeWiki: How to display negative numbers with the digital font
Thanks.