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

Jump to content

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

EDuke32 Scripting  "CON coding help"

User is offline   Danukem 

  • Duke Plus Developer

#324

What TerminX said. Also, I don't understand why you are changing the y coordinate of the projectile.

This post has been edited by DeeperThought: 16 September 2009 - 04:22 PM

0

User is offline   XThX2 

#325

I worked that one out. I have a harder issue now that I can't seem to solve. I've been messing around with this for 4 days.

  ifai AIHTROTELEPORT
  {
	  ifvarand status 4 nullop else { ifvare temprand 0 setvar temprand -1 addvar status 4 }
	  
	  whilevarn spritenum 16384
	  {
		  getactor[spritenum].picnum picnum
		  ifvare picnum EFFECTSPRITE
		  {
			  getactor[spritenum].lotag lotag2	
			  getactor[spritenum].hitag hitag2
			  whilevarn arrayholder 128
			  {
				  setarray container[arrayholder] lotag2
				  setvarvar arraycheck container[arrayholder]
				  setarray container[arrayholder] hitag2
				  setvarvar arraycheck2 container[arrayholder]
				  
				  ifvarvarn temprand randomvar5 ifvarvare randomvar5 arraycheck ifvarvare arraycheck2 yvel2
				  {
					  getactor[THISACTOR].x mx
					  getactor[THISACTOR].y my
					  getactor[THISACTOR].z mz
					  getactor[spritenum].x x2
					  getactor[spritenum].y y2
					  getactor[spritenum].z z2
					  getactor[spritenum].sectnum mysector
					  sound TELEPORTER
					  espawn TRANSPORTERBEAM
					  setactor[RETURN].x mx
					  setactor[RETURN].y my	  
					  setactor[THISACTOR].x x2
					  setactor[THISACTOR].y y2
					  ifvarn mysector -1 setactor[THISACTOR].sectnum mysector
					  subvar z2 1024
					  setactor[THISACTOR].z z2
					  sound TELEPORTER
					  espawn TRANSPORTERBEAM
					  setactor[RETURN].x x2
					  setactor[RETURN].y y2
					  setvarvar temprand randomvar5
					  ai AIHTROSHOOT1
				  }
				  addvar arrayholder 1
			  }
		  }
		  addvar spritenum 1
	  }
  }


I wanted my guy to teleport to one of the "hitag" amount of teleporters which it's yvel also checks. I place hitag amounts of these "dummy actors" to where I Want this guy to teleport, and give them lotags starting from 0 to hitag. This guy randomly picks one of them, and teleports to the corresponding lotag of the randomed number. The problem is, it only teleports to a fixed place, which is only 1.

I thought of the general issue first, and thought that it was the tags of effectors not being set, and only the last one. So, I decided to use arrays and increase each array by 1, so that it would check it; in a secondary while loop. I'm not sure if I'm overcomplicating things, or missing something so little again; but this is basically the first time I touched arrays :/ (The idea is like in Heretic's D'sparil fight, the wizard randomly teleports to one of the 4 fixed places)

This post has been edited by XThX2: 19 September 2009 - 04:23 PM

0

User is offline   Danukem 

  • Duke Plus Developer

#326

Ok, I've only read the first few lines, but already I see that you did not set spritenum to 0 before starting the loop. Or if you did set it, you didn't show that part of the code.
0

User is offline   XThX2 

#327

Oh yeah I forgot that part, but it is set before that AI is initiated along with some other variables. Here's that line.

ifspritepal 0 { ifrnd 72 { ai AIHTROPAIN sound HTRO_PAIN } } else { ifrnd 64 { ai AIHTROPAIN sound HTRO_PAIN } else { setvar randomvar5 0 setvar arrayholder 0 setvar arrayholder2 0 randvarvar randomvar5 yvel2 setvar spritenum 0 ai AIHTROTELEPORT } }

0

User is offline   Danukem 

  • Duke Plus Developer

#328

Ok, I've read a few more lines of the code now.

The normal procedure when dealing with sprites that aren't SEs or the other hardcoded effect actors, is to get their lotags and hitags into variables at map load time using the eventloadactor command. Then you set their lotag and hitag struct members to 0 to prevent nasty hardcoded effects and refer only to the variables from that point forward. In your code you are checking the struct members, not the variables. Are you sure that isn't a problem?
0

User is offline   NF64 

  • Touched by the Banhammer

#329

If I wanted to change the camera angle would that be found in the game.con or hard coded? Because I couldnt find it in the game.con.
0

User is offline   Danukem 

  • Duke Plus Developer

#330

View PostNfelli64, on Sep 19 2009, 07:06 PM, said:

If I wanted to change the camera angle would that be found in the game.con or hard coded? Because I couldnt find it in the game.con.


Look at this and read the note at the top that I just edited:

http://wiki.eduke32.com/wiki/Confaq42

To reposition the camera, you will need to change the values of the camera variables (e.g. cameraang) in a display event. You will have to learn a lot of stuff before you can do that competently.
0

User is offline   NF64 

  • Touched by the Banhammer

#331

Quote

To reposition the camera, you will need to change the values of the camera variables (e.g. cameraang) in a display event. You will have to learn a lot of stuff before you can do that competently.

simple enough.

This post has been edited by Nfelli64: 19 September 2009 - 07:55 PM

0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#332

I am trying to create beetween levels animations, intermission screens, etc. Although whenever I play a sound it is affected by game environment, this is, being underwater or after defeating a boss (command endofgame 52) which stop the sound from playing.

Any idea?
0

User is offline   Danukem 

  • Duke Plus Developer

#333

You could make a little sector somewhere and teleport the player to it.
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#334

Setting sector lotag to 0 and timebeforeexit to 0 does the work perfectly.
0

User is offline   XThX2 

#335

I'm sure I've asked this in the past but I ask it again hoping I'll have a clue this time. I have been trying to code the "bullets going thru if dead" for shotgun/supershotgun for my mod and I have a rather crappy way of doing it; which is by small delays. (Shooting 6 pellets per frame of the weapon up to 4 frames which makes 24 pellets) and... well it works the way it is supposed to be, however it is not really satisfying. First, you can spread the pellets wider by looking left/right/up/down. Also, there will only be 6 pellets going through if it happens.

I was playing the game and found out that some actors have this property such as CHAIR1, CHAIR2, vases, and even the slimer. When you shoot them, the pellets go through them when one hits them. I checked the source code for such things but couldn't find; so what I'm asking is if anyone can provide me information about how this can be done, or is done in the game ? (I'm hoping that it's not hard-coded for the first pellet hitting the object, then the rest going through)
0

User is offline   Danukem 

  • Duke Plus Developer

#336

View PostXThX2, on Sep 26 2009, 02:06 PM, said:

(I'm hoping that it's not hard-coded for the first pellet hitting the object, then the rest going through)


Well of course it is hardcoded. Otherwise it would be possible to add to any actor using 1.5 CON commands.
0

User is offline   XThX2 

#337

I meant, coded to act that way. If so, it would be really useless to add on enemies.
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#338

Yeah, it would be good if there was an spriteflag or something for that.
0

User is offline   Mblackwell 

  • Evil Overlord

#339

Why not just have the actor that was hit calculate the angle the bullet that hit it was shooting from and shoot a second bullet?
0

User is offline   Danukem 

  • Duke Plus Developer

#340

View PostMblackwell, on Sep 26 2009, 08:08 PM, said:

Why not just have the actor that was hit calculate the angle the bullet that hit it was shooting from and shoot a second bullet?


That's better than nothing, but it's not great.

The second bullet will have a random component to its angle, because there is still no way to modify ANGRANGE when fired from a non-player. Also, it would be hard to recover the vertical angle accurately. And what if the actor got hit by more than one bullet at the same time? There's no way to know that just from checking the actor. Plus, you don't even know where the bullet hit, and when the actor fires the new bullet it will shoot from its mid-section regardless.

A better source of information is the SHOTSPARK1 actor itself, when it spawns. You get the exact location that it hit, the angle it is facing, and by comparing its location relative to the player you can recover the vertical angle as well. Plus there is one such actor for each bullet, so there's no problem in knowing how many hit. But deciding whether the SHOTSPARK1 should fire a new bullet, and then doing so with the right results presents its own problems.
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#341

Is it possible to get in a gamevar what is the width and height in pixels of an specific tile number? For example, for making a background.

I suppose it is possible, as it seems to affect gameplay (for example a blocking wall sprite, etc).
0

User is offline   XThX2 

#342

View PostDeeperThought, on Sep 26 2009, 11:47 PM, said:

That's better than nothing, but it's not great.

The second bullet will have a random component to its angle, because there is still no way to modify ANGRANGE when fired from a non-player. Also, it would be hard to recover the vertical angle accurately. And what if the actor got hit by more than one bullet at the same time? There's no way to know that just from checking the actor. Plus, you don't even know where the bullet hit, and when the actor fires the new bullet it will shoot from its mid-section regardless.

A better source of information is the SHOTSPARK1 actor itself, when it spawns. You get the exact location that it hit, the angle it is facing, and by comparing its location relative to the player you can recover the vertical angle as well. Plus there is one such actor for each bullet, so there's no problem in knowing how many hit. But deciding whether the SHOTSPARK1 should fire a new bullet, and then doing so with the right results presents its own problems.


I thought it would be a lot of work to do as well, which would have bugs. Right now, there's nothing I can do but to find the way to provide the smallest delay of all. For one thing, I've tried ifvarn and it's not really fast. I also tried the htg_t of the actor, still not enough. I tried whilevarn at some point but it was too fast that they were being fired at the same time.

So, what can I do to provide an almost unnoticable delay between all 24 shots ? (Or per 4 shots for 6 tries, 3 for 8 and such)
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#343

You can't. A tick is 1/26 of a second. That nothing fast.


I am not sure how you could do it, but I have discovered something close to that.

Posted Image

There you can see the shots are at different angles. During EVENT_EGS I use SHOTSPARK1 to change the player angle. And the delay equal to zero.

===//===//===

What is the best way to simulate a multiplayer game? I heard you can do it through the console command, but I don't know how. =/

This post has been edited by Ilovefoxes: 27 September 2009 - 05:35 AM

0

User is offline   Mblackwell 

  • Evil Overlord

#344

Code executed in actor loops occurs each tic, code executed in EVENT_EGS I believe occurs each tic for each actor (EG: 1K actors = 1K times per tic), code executed in a Display event (EVENT_DISPLAYREST, etc) occurs once per frame rather than per tic.
0

User is offline   Danukem 

  • Duke Plus Developer

#345

View PostMblackwell, on Sep 27 2009, 08:23 AM, said:

Code executed in actor loops occurs each tic, code executed in EVENT_EGS I believe occurs each tic for each actor (EG: 1K actors = 1K times per tic), code executed in a Display event (EVENT_DISPLAYREST, etc) occurs once per frame rather than per tic.


EVENT_EGS code is executed immediately when something is spawned and then never again for that sprite. For example, in "espawn PIGCOP setactor[RETURN].pal 17" the EGS code runs right after the spawn and before the pal is set. Maybe you were thinking of EVENT_GAME?
0

User is offline   Mblackwell 

  • Evil Overlord

#346

View PostDeeperThought, on Sep 27 2009, 11:06 AM, said:

EVENT_EGS code is executed immediately when something is spawned and then never again for that sprite. For example, in "espawn PIGCOP setactor[RETURN].pal 17" the EGS code runs right after the spawn and before the pal is set. Maybe you were thinking of EVENT_GAME?


Yes.
0

User is offline   Chip 

#347

Right then, how would I go about making an actor of mine become (or make) a light source?
In the old Polymer thread started by DT, he said that he had actors spawn SECTOREFFECTORS and the actors controlled them.
I've just tried that but the very instant a SECTOREFFECTOR is spawned (or espawned) the game crashes with -found lonely sectoreffector at x y ..... So I had it spawn a dummy actor first, set its values then change its picnum to a SECTOREFFECTOR but then the game would er.. no crash but not work either. The game would "pause" all map present actors of all types except the player allowing me to wounder around a map in a photo like mode - taking screen shots of current scenes and events from different angles!
However any newly spawned actors would work as normal

It was interesting but not what I wanted.
Basically how would I have my own non hard coded light sources in game? I intend to have things like flame throwers, weapons and such which need to spawn a light source so I can't just hide them off map and move them into place.
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#348

I have no idea.

But first, about you changing an actor to SE, do you tryed to change te tags in EVENT_EGS?

For what I know, SEs have an special cstat assigned to them. Debug an map and check it.

This post has been edited by Ilovefoxes: 29 September 2009 - 06:53 AM

0

User is offline   Chip 

#349

Quote

But first, about you changing an actor to SE, do you tryed to change te tags in EVENT_EGS?


No I did not! I'll try that.
0

User is offline   Danukem 

  • Duke Plus Developer

#350

View PostChip, on Sep 29 2009, 07:30 AM, said:

So I had it spawn a dummy actor first, set its values then change its picnum to a SECTOREFFECTOR but then the game would er.. no crash but not work either.


That's the method I use. But you have to change the statnum to 3.

EDIT: And no, you do not have to use EVENT_EGS.

This post has been edited by DeeperThought: 29 September 2009 - 07:01 AM

0

User is offline   Chip 

#351

I didn't know about the statnum 3 on SE's.
Anyway I did it through event_EGS (Which still to this day I keep thinking is only for weapons! - I've got to get out of that habbit) and so I can bypass dummyactors and just have event_GAME move the SE to where the spawner was.
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#352

I am not sure why this error occur. It seems like to be whenever I use the hitscan command while the screen is not at 100% of it's size (status bar scale lower).

Quote

323422016
32156: 31337 {
32157: 1778 getactor 253 19 331 230 331 14
32164: 1780 divvarvar 331
32166: 4 guniqhudid 253 17
32169: 1781 cos 380
32171: 4 guniqhudid 253 15
32174: 1782 sin 381
32176: 4 guniqhudid 253 15
32179: 1783 hitscan
32180: 4 guniqhudid 253 0
32183: 4 guniqhudid 253 1
32186: 4 guniqhudid 253 2
32189: 4 guniqhudid 253 13 380 381 331current actor: 524 (2605)
g_errorLineNum: 0, g_tw: 381

0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#353

What is the most effective method to freeze the player?

Statnum only affects the APLAYER actor, not the player itself.

Constantly setting actor[].extra to zero works for single player, but not multiplayer as I cannot "ressurect" the player later.

Commands such as lockplayer only stop looking or moving around, isn't effective for making an intermission screen or something else.

This post has been edited by Ilovefoxes: 03 October 2009 - 12:52 PM

0

Share this topic:


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