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

Jump to content

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

EDuke32 Scripting  "CON coding help"

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#301

Is it just with me or ifvarand sector[THISACTOR].ceilingstat 1 doens't work?
0

User is offline   Chip 

#302

I solved my problem - I got suspicious when "ifvarn DTEMP1 1024 addlogvar DTEMP1" and DTEMP1 was reporting 1024, it was a typo.

This post has been edited by Chip: 09 September 2009 - 02:26 AM

0

User is offline   Plagman 

  • Former VP of Media Operations

#303

View PostIlovefoxes, on Sep 9 2009, 10:58 AM, said:

Is it just with me or ifvarand sector[THISACTOR].ceilingstat 1 doens't work?


You'll have to do better than sector[THISACTOR]. Get the sectnum from thisactor to a gamevar and then use sector[] on that.
0

User is online   Danukem 

  • Duke Plus Developer

#304

View PostPlagman, on Sep 9 2009, 04:10 AM, said:

You'll have to do better than sector[THISACTOR]. Get the sectnum from thisactor to a gamevar and then use sector[] on that.


I thought those were supposed to be equivalent.
0

User is offline   Plagman 

  • Former VP of Media Operations

#305

View PostDeeperThought, on Sep 9 2009, 04:35 PM, said:

I thought those were supposed to be equivalent.


Ah, then THISACTOR is smarter than I thought; anyway, it should be getsector[] and not sector[]. Is it allowed to use it directly as a gamevar or do you have to assign ceilingstat to an actual gamevar first?
0

User is online   Danukem 

  • Duke Plus Developer

#306

View PostPlagman, on Sep 9 2009, 07:55 AM, said:

Ah, then THISACTOR is smarter than I thought; anyway, it should be getsector[] and not sector[]. Is it allowed to use it directly as a gamevar or do you have to assign ceilingstat to an actual gamevar first?


A while back, TerminX added the ability to refer to struct members as variables for the purpose of comparing values. For example, ifvare sprite[THISACTOR].pal 10 is equivalent to ifspritepal 10. What Ilovefoxes posted conforms to the new syntax and should work. We still have to put members into variables in order to set things, though. For example, this does not work: setactor[THISACTOR].z player[THISACTOR].posz

EDIT: That's wrong. What I should have is that struct members cannot be the targets of gamevar writes. For example, setvarvar player[THISACTOR].posz Z is not valid. On the other hand, setactor[THISACTOR].z player[THISACTOR].posz should work.

This post has been edited by DeeperThought: 10 September 2009 - 03:37 PM

0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#307

I just started to use that syntax (structure member as variable) now. And don't know much, but it seems I can only use with actors or player, not userdef, input, tsprite, and etc. I don't know,

Heh, I would also like to use getplayer[sprite[sprite[THISACTOR].owner].yvel].extra, but this seems overpower. =P

This post has been edited by Ilovefoxes: 09 September 2009 - 07:24 PM

0

User is online   Danukem 

  • Duke Plus Developer

#308

View PostIlovefoxes, on Sep 9 2009, 07:40 PM, said:

Heh, I would also like to use getplayer[sprite[sprite[THISACTOR].owner].yvel].extra, but this seems overpower. =P


That doesn't make sense. Extra is not even a member of the player struct. Also, it kind of defeats the purpose if you make your code hard to read.
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#309

okay, I wrote wrong that extra value.

But I mean to replace this:

Quote

getactor[THISACTOR].owner OWNER
getactor[OWNER].x X
For this:

Quote

getactor[sprite[THISACTOR].owner].x X


This post has been edited by Ilovefoxes: 09 September 2009 - 09:44 PM

0

User is offline   XThX2 

#310

So, I've had some errors about "ifsound" being outside of a local event, and it's in APLAYER actor. Would it cause desync or something ? Would it do the same if I had put it in a state and then put it in APLAYER ? I'm doing it because I've changed the menu sounds, and some of them affect the game world. I stopped them from playing in APLAYER actor. (It was in EVENT_GAME before, and both methods work) My concern here is about multiplayer which I can't test for some time :/
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#311

Depending,

if you are using something like:

Quote

ifsound KICK_HIT
sound PISTOL_RICOCHET
There should be no problem.

But this:

Quote

ifsound KICK_HIT
addphealth 10
Surely will not work.

You must understand that the sound is not part of the game, and may or may not be here depending of the player option (sound on/off, maximum number of sounds, especially the lenght of the user sound file, etc).

This post has been edited by Ilovefoxes: 10 September 2009 - 09:16 AM

0

User is offline   Chip 

#312

How would I reset or otherwise adjust an actor's "ifwasweapon" tag? I've recently noticed my actors taking on the effects caused by previous projectile weapons when they have had damage inflicted on them from a non projectile source.

Example: actor suffers a single freeze blast hit - he then takes damage from a melee hit (set directly through an actor) - actor now dies.....but plays the "freeze" effect which is the end effect of dying to a freezeblast hit.



..unless ifwasweapon <NAME OF ACTOR INFLICTING DAMAGE!> works in over riding the last weapon? Pure assumption based on the fact that actors will hard codedly know who set damage on them (as I found out when my actor started attacking himself after suffering fall damage - my actors record the owner of the weapon as their enemy and since the fall damage was set by himself he then recorded his own ID as his enemy!)

This post has been edited by Chip: 10 September 2009 - 12:12 PM

0

User is offline   XThX2 

#313

What are you doing to deal melee damage to the actor in question ? It is probably something about it, not setting the htpicnum of the victim. (The last htpicnum was set to FREEZEWEAPON, and was left at that when being clawed to death; is what I have in mind)
0

User is offline   lycanox 

#314

Try to place the following code in front of the code that inflicts the damage to your actor in a way it does not run constantly.
It sets ifwasweapon to tilenumber -1. Which is not defined as a projectile in the game and thus makes the game run the standard hit and dead code.

setactor[THISACTOR].htpicnum -1

This post has been edited by lycanox: 10 September 2009 - 02:00 PM

0

User is offline   Chip 

#315

View Postlycanox, on Sep 10 2009, 10:27 PM, said:

Try to place the following code in front of the code that inflicts the damage to your actor
setactor[THISACTOR].htpicnum -1


And that was my problem! Because this was infront of the actor taking damage it gets overwritten as soon as the htextra becomes a positive value. Simply adding the set picnum thing after htextra was set works.

In addition to that


Quote

..unless ifwasweapon <NAME OF ACTOR INFLICTING DAMAGE!> works in over riding the last weapon?


Well that certainly works as far as my tests went!
I had it play a quote if "ifwasweapon CHARMELEON" (name of actor) turned true and it certainly did when ever the actor CHARMELEON sets damage to the actor through setactor[MYENEMY].htextra.
0

User is offline   XThX2 

#316

I have a question that I wonder. Why are the enemies facing to where they got hit when they get hit ? I tried this with normal duke monsters too. (I've changed their moves' speeds to 0, disabled their firing AI and changed their AI's extra commands. "seekplayer, faceplayer" and such.) They indeed, face where they got hit, or the player which I'm not really sure.

The question is, how can I go about disabling this ? I think this is hardcoded in enemy type actors.

This post has been edited by XThX2: 11 September 2009 - 03:12 PM

0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#317

They face the actor or projectile that hit them, not the player. I am not really sure how to get rid of it, try setting htlastvx htlastvy.
0

User is online   Danukem 

  • Duke Plus Developer

#318

You could try this approach:

getactor[THISACTOR].ang angvar

ifhitweapon
{
	setactor[THISACTOR].ang angvar


But that won't work unless the angle changes when ifhitweapon is checked. A foolproof method is to have the actor save their angle each tic at the end of their code, then restore to the saved angle when ifhitweapon is true

This post has been edited by DeeperThought: 11 September 2009 - 04:31 PM

0

User is offline   XThX2 

#319

Yes, thanks for that ! They indeed change their angle when ifhitweapon is true. The foolproof method you suggested works perfectly.
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#320

I can only see an model if I am facing the basic actor. How can I make sure I will always see it no mather where I am?
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#321

I am trying to add an continuous black screen from when an gameend (startlevel command) and it starts. But there is an delay in displayrest which it for an instant it doesn't show anything.

Any idea so that I can make it has no blank spot?

This post has been edited by Ilovefoxes: 15 September 2009 - 05:07 AM

0

User is offline   XThX2 

#322

		  getactor[THISACTOR].z z2
		  getplayer[THISACTOR].i ID
		  getactor[ID].z posz
		  subvar z2 8192
		  subvarvar z2 posz
		  ldist xyvalue2 THISACTOR ID
		  mulvarvar z2 z2 mulvarvar xyvalue2 xyvalue2
		  addvarvar z2 xyvalue2
		  sqrt z2 z2
			ezshoot z2 YELLOWROCKET
/*			getactor[THISACTOR].x x
			getactor[THISACTOR].y y
			getactor[THISACTOR].ang TEMP
			setvarvar y2 y
			addvar y2 128
			rotatepoint x y x y2 TEMP x3 y3
			setactor[RETURN].y y3 */


I was trying to make an actor shoot another from some distance with accurate vertical aim. The enemy targets player, and has rocket launcher mounted on his back, so he fires from a bit higher than the actor's Z. I thought of the case, draw some simple sketches and found out that phythagoras would just work fine. Difference between Z's form the height, their distance forms the base, and finally, the result forms the zvel it must come from. So, where have I been mistaken with this idea ? D:

[EDIT] : Forgot to say what doesn't work. The actor shoots at his feet if player is too far, and even behind himself which can actually go really far. If player is really close, then the rocket goes where it is supposed to, but most of the time, missed the player.

This post has been edited by XThX2: 16 September 2009 - 04:18 PM

0

User is offline   TerminX 

  • el fundador

  #323

Z coordinates aren't the same scale as X/Y coordinates...
0

User is online   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 online   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 online   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 online   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

Share this topic:


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