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

Jump to content

  • 124 Pages +
  • « First
  • 12
  • 13
  • 14
  • 15
  • 16
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

User is offline   lycanox 

#391

Is there a way to kill actors when they are asleep.
I am trying to create a remote controlled missile. But it is unable to kill most monsters unless the player wakes them first.

It also seems that monsters behave differently when asleep. So is it possible to blow up Liz troopers when asleep.
But not possible to blow up Liz mans.
0

#392

View PostDeeperThought, on Oct 23 2009, 12:46 AM, said:

I've made a few player force fields that deflect projectiles. Just change the angle of the projectile, it's zvel and owner. You don't need to fire a new one. You can spawn an animation sprite at the point where it deflects and play a sound. Maybe the real problem is you don't know how to make the projectile deflect without it dying. You can have the projectile detect distance to the force field and hitscan for it, then turn it around before it actually hits anything. Another method is to allow it to hit, but use EVENT_KILLIT to cancel its death and then turn it around from there.


I should let you guys know I have gotten most of this all working now with deflecting stuff. It's not the exact method above, but I do have EVENT_KILLIT involved with a lot of it, and I still let the original projectile die and spawn a new one[but I can destroy the originals instantly too]. The only minor snafu with it is that when it deflect's a COOLEXPLOSION1, I try to get it's count and actorcount just before it's deleted through htg_t 0 & 2, but they always come back as 0 so when the new projectile is spawned, it spawns at it's default animation frames instead of part-way into the animation already.

Because of this I've been considering remaking a "COOLEXPLOSION2" or something as a replacement so deflected mindblasts actually hurt non-players and such, but I'm trying to get an idea of the animation speed and fuse/lifetime of the original COOLEXPLOSION1 is in exact values. Does anyone know that information on this topic? It would be a big help for me. :o
0

User is offline   XThX2 

#393

If nothing else works, you can always set an actorvar for it to point the actioncount by "ifactioncount 1 setactorvar[THISACTOR].frame 1" but I'm sure htg_t would work fine. Where are you using htg_t 0 and 2 ? You can try EVENT_GAME just to see if it works.
0

User is offline   Danukem 

  • Duke Plus Developer

#394

View PostLord Misfit, on Oct 24 2009, 10:30 AM, said:

I should let you guys know I have gotten most of this all working now with deflecting stuff. It's not the exact method above, but I do have EVENT_KILLIT involved with a lot of it, and I still let the original projectile die and spawn a new one[but I can destroy the originals instantly too]. The only minor snafu with it is that when it deflect's a COOLEXPLOSION1, I try to get it's count and actorcount just before it's deleted through htg_t 0 & 2, but they always come back as 0 so when the new projectile is spawned, it spawns at it's default animation frames instead of part-way into the animation already.

Because of this I've been considering remaking a "COOLEXPLOSION2" or something as a replacement so deflected mindblasts actually hurt non-players and such, but I'm trying to get an idea of the animation speed and fuse/lifetime of the original COOLEXPLOSION1 is in exact values. Does anyone know that information on this topic? It would be a big help for me. :o


Why shouldn't the animation reset, and why would anyone care ? I appreciate attention to detail, but this crosses the line into being a weird fetish. You are spending time and adding code to deal with "problems" that no one cares about (and I'm not saying that based only on this feature).
0

User is offline   Hendricks266 

  • Weaponized Autism

  #395

		case COOLEXPLOSION1__STATIC:
			t->shade = -127;
			t->cstat |= 8192;
			t->picnum += (s->shade>>1);
			break;


				if (s->picnum == COOLEXPLOSION1)
				{
					s->shade++;
					if (s->shade >= 40) KILLIT(i);
				}


Does that help?
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#396

How can I draw something at event DISPLAYROOMS and so that it will be draw BEHIND the transparent water ror sectors? Because whenever I draw something there using roratesprite, it appers in front of the ror sectors.
0

User is offline   CruX 

#397

Getting arrows to stick in a wall (if they actually 'hit' a wall) is something I've been trying to hammer out since I started working on the bow for my mod, and I still haven't managed to get it working. I thought at first I could do it with the htg_t struct, but that only appears to work for bullet-type projectiles (come to think of it, I've only managed to get it to do anything for shotgun, SHOTSPARK1 and chaingun projectiles). Now I'm starting to think it has something to do with the hitscan command, but if returning what's under the crosshair is it's only function, then I'm having some trouble imagining how that could pull the desired effect either. Can anyone help me figure this out?
0

User is offline   XThX2 

#398

You could possibly check for the velocity of the arrow, and make it hitscan the time it is spawned (once) to get the wall it hitscanned's x/y/z values. When the velocity is set to 0, you can make the arrow spawn another arrow (this time, no projectile code; possibly with different art) at the coordinates it left off. (That's the first thing that comes to my mind now)
0

User is offline   CruX 

#399

View PostXThX2, on Nov 4 2009, 10:56 AM, said:

You could possibly check for the velocity of the arrow, and make it hitscan the time it is spawned (once) to get the wall it hitscanned's x/y/z values. When the velocity is set to 0, you can make the arrow spawn another arrow (this time, no projectile code; possibly with different art) at the coordinates it left off. (That's the first thing that comes to my mind now)


Hmmm.. I did try something earlier where I coded the arrow to spawn a SHOTSPARK1 on impact, then coded the SHOTSPARK1 to use htg_t if it was spawned by an arrow. This way it'd know whether or not it was hitting a wall, and if it did I had it change it's picnum to the arrow (a different set, like you suggested). It's gotten me a bit closer to what I wanted, but now for some reason the arrow ends up spinning around in place when it spawns (even though I know I gave it the correct frames). Strange stuff...
0

User is offline   XThX2 

#400

As far as my tests resulted, ifspawnedby when used by shotspark1 does not have any effect. Instead, I do this;

	  findnearsprite IONPARTICLEBOOM 500 returnvar1
	  ifvarn returnvar1 -1
	  {
		  getactor[returnvar1].htg_t 2 temp
		  ifvare temp 0
			  killit
		}


Where IONPARTICLEBOOM is a bullet based projectile that spawns an explosion when it hits a wall. Try it this way and see if it works. Of course, you would get the necessary information from it before killing it.

This post has been edited by XThX2: 04 November 2009 - 11:55 AM

0

User is offline   CruX 

#401

View PostXThX2, on Nov 4 2009, 11:53 AM, said:

As far as my tests resulted, ifspawnedby when used by shotspark1 does not have any effect. Instead, I do this;

	  findnearsprite IONPARTICLEBOOM 500 returnvar1
	  ifvarn returnvar1 -1
	  {
		  getactor[returnvar1].htg_t 2 temp
		  ifvare temp 0
			  killit
		}


Where IONPARTICLEBOOM is a bullet based projectile that spawns an explosion when it hits a wall. Try it this way and see if it works. Of course, you would get the necessary information from it before killing it.


Well, I changed the code from changing picnums to just having it spawn the stuck arrow actor and that got rid of the crazy rotating problem. Last hurdle is trying to figure out how to get it closer to the wall to actually create the illusion that it's really stuck in the wall (right now it spawns a few inches away so, it's just sort of hanging in mid-air). Just to see what would happen, I coded the arrow to move further inwards towards the wall once it spawns then stop after a few tics, but it vanishes if it goes too far, and just hangs in the middle of the wall if it's actually 'within' it. Is this something that only a model can fix?
0

User is offline   XThX2 

#402

Is that arrow rendered as vertically flat ? I would probably suggest you change the y-repeat of the arrow and cstat of it to make it vertically flat. That way, it would look like it's actually in the wall. (It can possibly make the arrow look longer than it actually is though :))
0

User is offline   CruX 

#403

View PostXThX2, on Nov 5 2009, 11:37 AM, said:

Is that arrow rendered as vertically flat ? I would probably suggest you change the y-repeat of the arrow and cstat of it to make it vertically flat. That way, it would look like it's actually in the wall. (It can possibly make the arrow look longer than it actually is though :))


At this point I should really know what vertically flat means, but if it's aligned with the floor, then no it's not. Also I found another way to do it that's pretty simple (so simple, i can't believe I didn't think of it beforehand ). I just made a bullet-type projectile that had no graphic or extra value, and spawned a custom decal. I then coded the arrow to spawn another invisible custom actor on impact that would shoot said projectile that would leave behind this decal and that decal, once being spawned, would spawn the arrow in the wall. Sort of has a jerry-rigged feel to it, but it works pretty nicely.
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#404

Whenever I use startlevel command in multiplayer, it seems like to be resulting in a votation beetween players... but I wanted it to go right through levels. How can I do it?

This post has been edited by Ilovefoxes: 06 November 2009 - 06:11 AM

0

User is offline   XThX2 

#405

View PostEmericaSkater, on Nov 5 2009, 12:22 PM, said:

At this point I should really know what vertically flat means, but if it's aligned with the floor, then no it's not. Also I found another way to do it that's pretty simple (so simple, i can't believe I didn't think of it beforehand ). I just made a bullet-type projectile that had no graphic or extra value, and spawned a custom decal. I then coded the arrow to spawn another invisible custom actor on impact that would shoot said projectile that would leave behind this decal and that decal, once being spawned, would spawn the arrow in the wall. Sort of has a jerry-rigged feel to it, but it works pretty nicely.


Vertically flat means well, open mapster32, put a sprite and press R, the first time you do it; what you see is vertically flat. (Aligned with wall)

Can they be picked up, by the way ?
0

User is offline   CruX 

#406

View PostXThX2, on Nov 6 2009, 07:38 AM, said:

Vertically flat means well, open mapster32, put a sprite and press R, the first time you do it; what you see is vertically flat. (Aligned with wall)

Can they be picked up, by the way ?


Picked up AND climbed on. You'll get to see when I nail down a few more changes and post some more videos. (I got the full version of FRAPS just for you :) )
0

User is offline   Danukem 

  • Duke Plus Developer

#407

View PostIlovefoxes, on Nov 6 2009, 06:10 AM, said:

Whenever I use startlevel command in multiplayer, it seems like to be resulting in a votation beetween players... but I wanted it to go right through levels. How can I do it?


It's not supposed to stop for voting, that sounds like a bug.
0

User is offline   XThX2 

#408

I have an interesting question. How can I remove the "spinningnukeicons" without removing their art ? (I need it so the one on the right can disappear) It seems like a tricky task, as event game doesn't function on menu.
0

User is offline   Danukem 

  • Duke Plus Developer

#409

View PostXThX2, on Nov 9 2009, 10:38 AM, said:

I have an interesting question. How can I remove the "spinningnukeicons" without removing their art ? (I need it so the one on the right can disappear) It seems like a tricky task, as event game doesn't function on menu.


I don't know of any way to do that. Maybe you could remove their art (or replace it with something invisible), and then draw your own on the left side in the the appropriate event. That would require having access to where the player is in the menu, though, and I'm not sure if that's available.
0

User is offline   XThX2 

#410

I've asked about it to Hunter_Rus way back, when he helped with the special actions of menu. I asked if I could access to the commands of the player in there to display my own icon. He said he could think of doing it... that's probably the last time I've ever heard of him ! D: I for myself would be more than happy to replace that icon with something more appropriate, or even play around with it's properties. (I've been using displaymenurest for menu actions)

This post has been edited by XThX2: 09 November 2009 - 10:56 AM

0

User is offline   XThX2 

#411

[EDIT] : Sorry, nevermind.

This post has been edited by XThX2: 14 November 2009 - 03:00 AM

0

User is offline   CruX 

#412

...Is there any conventional way to keep the player's sprite from going semi-transparent when you go into third-person mode? It seems like there should be, but I didn't see anything about it in the player struct on the wiki and just using cstat commands beneath the APLAYER line didn't do anything...
0

User is offline   Danukem 

  • Duke Plus Developer

#413

 EmericaSkater, on Nov 20 2009, 08:20 AM, said:

using cstat commands beneath the APLAYER line didn't do anything...


That's because the sprite you see in F7 mode is not the player sprite. It's a member of the tsprite array which is used only for display purposes. To access that array, use EVENT_ANIMATESPRITES. Only sprites with the 16 bit set in their mdflags member will be processed in that event, so do that first:

actor APLAYER MAXPLAYERHEALTH PSTAND 0 0

getactor[THISACTOR].mdflags temp
orvar temp 16
setactor[THISACTOR].mdflags temp


Then, since only player tsprites will be processed and you want them to have cstat 0, do this:

onevent EVENT_ANIMATESPRITES
settspr[THISACTOR].tsprcstat 0
endevent

0

User is offline   CruX 

#414

 DeeperThought, on Nov 20 2009, 09:34 AM, said:

That's because the sprite you see in F7 mode is not the player sprite. It's a member of the tsprite array which is used only for display purposes. To access that array, use EVENT_ANIMATESPRITES. Only sprites with the 16 bit set in their mdflags member will be processed in that event, so do that first:

actor APLAYER MAXPLAYERHEALTH PSTAND 0 0

getactor[THISACTOR].mdflags temp
orvar temp 16
setactor[THISACTOR].mdflags temp


Then, since only player tsprites will be processed and you want them to have cstat 0, do this:

onevent EVENT_ANIMATESPRITES
settspr[THISACTOR].tsprcstat 0
endevent


Works great. I had the feeling the sprite in 3rd person wasn't actually a player sprite since it would never show up without turning over_shoulder_on to 1 (no matter where I had the camera positioned). Tsprites were probably the one thing I never looked that much into . Thanks abunch, DT
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#415

It is the player sprite itself, only the cstat is special set-up.

They use that because otherwise other player would see a transparent player, which they shoudln't.

It's the same as a sprite standing in a colored sector, it has another tspr palette in a normal sprite.

Note: take care to not change the cstat of player shadow using tspr.
0

User is offline   m210® 

#416

Help me with cansee command!
	setvar spriteid 0
	setvar minimum 16777216
	setvar minid -1
	whilevarn spriteid 16384
	{
		getactor[spriteid].picnum picnum
		switch picnum
		case LIZTROOP
		{
			getactor[spriteid].x mx
			getactor[spriteid].y my
			getactor[spriteid].z mz
			getactor[spriteid].extra extra
			getactor[THISACTOR].x x
			getactor[THISACTOR].y y
			getactor[THISACTOR].z z
			subvarvar mx x
			subvarvar my y
			getangle mang mx my
					getactor[THISACTOR].ang ang
			getincangle mang mang ang
			ifvarg extra 0
			ifvarg mang -256 ifvarl mang 256
			{
				dist tmp THISACTOR spriteid
				ifvarvarl tmp minimum { setvarvar minimum tmp }
				ifvarvare tmp minimum ifvarvarn spriteid THISACTOR setvarvar minid spriteid
			}
		}
		break
		endswitch
		addvar spriteid 1
	}
	
	ifvarn minid -1
	{	
		getactor[minid].x mx
		getactor[minid].y my
		getactor[minid].z mz
		getactor[minid].sectnum sect2

		cansee camerax cameray cameraz camerasect mx my mz sect2 see
		addlogvar see
			}



In case at picture see variable equal is 0, why?
canseespr isn't works correctly and have more cases when see variable = 0

Help me to fix this problem! please :)

Attached File(s)


0

User is offline   Danukem 

  • Duke Plus Developer

#417

View PostM210, on Dec 5 2009, 07:36 AM, said:

In case at picture see variable equal is 0, why?


Canseespr wasn't working because you didn't raise the sprites up before checking. This is a very common problem and there should be something in the wiki about it (I'll add it to canseespr if it isn't there yet). canseespr determines visibility from the base of the sprites (the bottom of their feet) which is a poor position to see from. You made the same mistake with cansee. Try using subvar mz 8192 right before the cansee command.
0

User is offline   m210® 

#418

Thanks, but it hasn't helped :)
Screenshot, see = 0 :)

Attached File(s)


0

User is offline   Danukem 

  • Duke Plus Developer

#419

View PostM210, on Dec 5 2009, 09:35 AM, said:

Thanks, but it hasn't helped :)
Screenshot, see = 0 :)


The change I suggested is necessary, so if it didn't help it's because some other part of your code is not working (probably that getincangle part). You should test the different components of your code separately. Make sure each component is working correctly before you put them together.

EDIT: I just ready throgh your code for the first time, and it's really weird. Who is THISACTOR? Is that the player? You have some sprite looping through all the sprites in the game, and when it gets to a LIZTROOP it checks whether it is facing it. But if the sprite running the code isn't the player, then there's no reason to believe there should be visibility in the screenshot. But if it is the player, then there is no reason to check ifvarvarn spriteid THISACTOR (since we already know the player isn't a LIZTROOP).

This post has been edited by DeeperThought: 05 December 2009 - 10:21 AM

0

User is offline   m210® 

#420

Other part of my code works true, because I tried to use ifcansee command and it worked, but this command gave variable = 1 even if actor was behind a wall.

Well, I try to delete getincangle part but it will not helped :)
0

Share this topic:


  • 124 Pages +
  • « First
  • 12
  • 13
  • 14
  • 15
  • 16
  • 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