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

Jump to content

  • 123 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"

#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

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

 Hendricks266, 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

User is offline   Danukem 

  • Duke Plus Developer

#171

 Captain Awesome, on Aug 7 2009, 11:35 AM, said:

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.


Not really, because the projectile isn't going through walls, what's happening is that he is spawning it at a point past the wall (by making it spawn some distance in front of the player). Once it gets moving, it will be stopped by a wall just like any other projectile.
0

User is offline   Jimmy 

  • Let's go Brandon!

#172

Oh. =( It'd be very cool if a bit could be implemented that allowed a projectile to go through walls.
0

User is offline   Jimmy 

  • Let's go Brandon!

#173

Sorry to double post, but I was wondering how one would go about coding a spawner that would spawn a certain amount of something by a defined var. I know you could do the "ifvare 1, ifvare 2, etc etc" route, but that seems like a waste. Is there a simpler way?
0

User is offline   Danukem 

  • Duke Plus Developer

#174

 Captain Awesome, on Aug 7 2009, 08:04 PM, said:

Sorry to double post, but I was wondering how one would go about coding a spawner that would spawn a certain amount of something by a defined var. I know you could do the "ifvare 1, ifvare 2, etc etc" route, but that seems like a waste. Is there a simpler way?


[code]

whilevarn NUMSPAWNS 0
{
espawnvar SPAWNPICNUM
subvar NUMSPAWNS 1
}
0

User is offline   Jimmy 

  • Let's go Brandon!

#175

Doh, I have never used this command before. Thanks.
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#176

Is there a way so that I can check if a user map in running without confusing with volume 0 level 7?
0

User is offline   XThX2 

#177

What do you mean with "confusion" ? Is it about the music ?

This post has been edited by XThX2: 08 August 2009 - 12:18 PM

0

User is offline   Chip 

#178

 Captain Awesome, on Aug 7 2009, 08:08 PM, said:

Oh. =( It'd be very cool if a bit could be implemented that allowed a projectile to go through walls.


Its still possible to emulate such a thing with the commands we already have. It wont be perfect but It will still work. :blink: Just have the projectile spawn a pathfind sprite that syncs its possition with the weapon but also ahead slightly. Then have that work out whether its gone through a wall or not then make it adjust the projectile accordingly so it misses the wall and travels through the void.....assuming that we can repossition a live projectile and that it doesn't pop once its out of a sector, if not then have the pathfinder travel through the wall till it reaches a sector then shoot out a new projectile.
0

User is offline   XThX2 

#179

Uhm, I believe hitscan checks and movesprite in EVENT_GAME would work better. (Or simply making it an actor based projectile)
0

User is offline   Chip 

#180

Either way its clearly possible.
0

Share this topic:


  • 123 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