Duke4.net Forums: EDuke32 Scripting - Duke4.net Forums

Jump to content

  • 124 Pages +
  • « First
  • 4
  • 5
  • 6
  • 7
  • 8
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

User is offline   MIKE SIMS 

#141

any tips for making a "health bar" HUD rather than the numeric health? or how to get the ammo on screen like I've seen in some mods (the shells)
0

User is offline   XThX2 

#142

Well I used a hud like that. In my case, I had small gemstones lined up for both health and armor, and a pointer above the first gemstone.

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)
0

#143

View PostMIKE SIMS, on Jul 31 2009, 10:47 PM, said:

any tips for making a "health bar" HUD rather than the numeric health? or how to get the ammo on screen like I've seen in some mods (the shells)

How to make a health bar

This post has been edited by Dr. Kylstein: 01 August 2009 - 08:37 AM

0

User is offline   Danukem 

  • Duke Plus Developer

#144

View PostDr. Kylstein, on Aug 1 2009, 08:59 AM, said:

Assuming HEALTHBAR is the name of a 2x16 tile:
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)
0

User is offline   MIKE SIMS 

#145

View PostDr. Kylstein, on Aug 1 2009, 08:59 AM, said:


i love you (no homo) :blink: So I'm assuming a um.. Kill Counter would essentially work the same?
0

#146

View PostMIKE SIMS, on Aug 2 2009, 07:09 PM, said:

i love you (no homo) :blink: So I'm assuming a um.. Kill Counter would essentially work the same?

Any number you want. Just replace "getactor[THISACTOR].extra temp" and adjust BARSCALE as needed.
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#147

I am trying to make an projectile (RPG) hitscan what object it will hit. Although I am unable to discovery which value I should put as vertical angle.

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

0

User is offline   Danukem 

  • Duke Plus Developer

#148

View PostIlovefoxes, on Aug 4 2009, 10:42 AM, said:

I am trying to make an projectile (RPG) hitscan what object it will hit. Although I am unable to discovery which value I should put as vertical angle.

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.
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#149

Hah, thanks! It's quite easy, I see... =P And I was trying to understand how to make an arctan2.

This post has been edited by Ilovefoxes: 04 August 2009 - 07:08 PM

0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#150

I am trying to make an heat-seeking weapon... although every time I shoot two times and the first shot kill the enemy, the sprites is deleted and them the second shot has an invalid sprite ID. How does can I check if an ID actually exists as specific sprite?
0

#151

View PostIlovefoxes, on Aug 5 2009, 10:38 AM, said:

I am trying to make an heat-seeking weapon... although every time I shoot two times and the first shot kill the enemy, the sprites is deleted and them the second shot has an invalid sprite ID. How does can I check if an ID actually exists as specific sprite?

Nonexistent sprites have a statnum of 1024, or so I heard.
0

User is offline   Danukem 

  • Duke Plus Developer

#152

View PostDr. Kylstein, on Aug 5 2009, 08:35 AM, said:

Nonexistent sprites have a statnum of 1024, or so I heard.


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.
0

User is offline   m210® 

#153

Is possible to make a non-projectile actor which will be reflected off walls as projectiles? ( PROJECTILE_FLAG_BOUNCESOFFWALLS 4 )
Somebody can help me with code?
0

User is offline   Danukem 

  • Duke Plus Developer

#154

View PostM210, on Aug 5 2009, 11:24 AM, said:

Is possible to make a non-projectile actor which will be reflected off walls as projectiles? ( PROJECTILE_FLAG_BOUNCESOFFWALLS 4 )
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.
0

User is offline   Jimmy 

  • Let's go Brandon!

#155

I noticed in my mod that the kick_hit sound will sometimes not play. I've searched through my code and there are absolutely no "stopsound kick_hit" commands anywhere. I'm puzzled as to what could cause this. Anyone have any ideas?

This post has been edited by Captain Awesome: 05 August 2009 - 11:11 AM

0

User is offline   m210® 

#156

View PostDeeperThought, on Aug 5 2009, 10:56 PM, said:

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.

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]


Posted Image
Can you help?

This post has been edited by M210: 05 August 2009 - 11:33 AM

0

User is offline   Danukem 

  • Duke Plus Developer

#157

View PostM210, on Aug 5 2009, 12:29 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]


Posted Image
Can you help?



What you need to do is translate this function into CON code. Good luck!

Quote

static void A_DoProjectileBounce(int32_t i)
{
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);
}

0

User is offline   XThX2 

#158

I almost understood what the code there does, but a few questions about the commands.

What exactly do,

*mulscale
*divscale
*ksqrt
*&
*wallptr

these do? I understood the math part, just the commands are bugging me.
0

User is offline   Hendricks266 

  • Weaponized Autism

  #159

@Ilovefoxes:
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

0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#160

LA, BIGORBIT and MOONSKY use an multiple images compound when the games runs. I am trying to change the sky pic in-game... although I can't get rid of this even if I change the .ceiningpicnum... any idea? I tryied dynamicremap already and didn't worked.

This post has been edited by Ilovefoxes: 06 August 2009 - 10:25 AM

0

User is offline   lycanox 

#161

I don't know if this is a bug in Eduke or just bad coding.

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?
0

User is offline   Jimmy 

  • Let's go Brandon!

#162

View PostHendricks266, on Aug 5 2009, 10:53 PM, said:

@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.


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.
0

User is offline   Hendricks266 

  • Weaponized Autism

  #163

@Captain Awesome
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)



This post has been edited by Hendricks266: 06 August 2009 - 02:29 PM

0

User is offline   XThX2 

#164

OH, and I thought it was a bug in my code... Thanks!
0

#165

Oh geeze, I feel like a utter n00b to ask this, seeing as it was probably asked somewhere in the distant past, but...

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

0

User is offline   XThX2 

#166

		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

0

#167

View PostXThX2, 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. :blink:

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
0

User is offline   XThX2 

#168

I was messing with updatesectorz and changespritesect but they didn't do anything (IF sector -1 and such) because the thing was that projectiles were exploding at another available sector, which was annoying. However, I'm sure the solution involves updatesectorz and it's neighbors.
0

User is offline   lycanox 

#169

View PostHendricks266, on Aug 6 2009, 10:15 PM, said:

@Captain Awesome
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.
0

User is offline   Jimmy 

  • Let's go Brandon!

#170

It goes through walls? That's very interesting, I didn't know if that could be achieved, could be very useful for a Red Faction/Eraser style Railgun.
0

Share this topic:


  • 124 Pages +
  • « First
  • 4
  • 5
  • 6
  • 7
  • 8
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic


All copyrights and trademarks not owned by Voidpoint, LLC are the sole property of their respective owners. Play Ion Fury! ;) © Voidpoint, LLC

Enter your sign in name and password


Sign in options