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   lycanox 

#294

View PostIlovefoxes, on Sep 8 2009, 05:52 AM, said:

How do can I diff beetween the player and a Holoduke in EVENT_EGS? Even statnum doesn't work.

Both are essentially the same actor. (Which is probably how the game fools enemies to attack it. )

If you want the holoduke actor to actually do simple stuff. Ifpdistg 1000 or ifspawnedby APLAYER might have some effect.
(However do seem have side effects while teleporting or jet packing against a ridge.)

However, the best method I found is to spawn your own actor and quickly turn the holoduke off to get rid of the holoduke actor.

XThX2 said:

That Holoduke thing was discussed on 3D Realms Forums before. You can check there for replies. (I Think it was DeeperThought who answered, too)

I was the one that asked it back then. And came to the same conclusion.

This post has been edited by lycanox: 08 September 2009 - 04:11 AM

0

User is offline   Chip 

#295

I'm getting a lot of console errors relating to the dist command not working because its trying to get a distance to an invalid sprite.
I don't have access to my computer now so I can't give you my exact code (I'll try tomorrow) but here's the gist of it:

When my actor has a positive value from his htextra he'll then do the following (plus more but that's not relevent)

gamevar MYENEMY -1 2 // records who my actor will attack
gamevar DTEMP1 -1 2 // records the ID of what projectile (or attack) that hit the actor
gamevar DTEMP2 0 2 // used as a temp value
gamevar DTEMP3 -1 2 // records the ID of who shot the actor or inflicted damage if melee
gamevar RECORD1 -1 2 // used as a temp, in this case it'll record the distance obtained through the dist command
gamevar RECORD2 -1 2 // used as a temp, in this case it'll record the distance obtained through the dist command





ifvare DTEMP3 -1 // you were hit but this value was not set meaning it was a projectile that hit the actor
{
   getactor[THISACTOR].htowner DTEMP3 // know who's hit you
   getactor[THISACTOR].htpicnum DTEMP1 // know what's hitting you
}

ifvare MYENEMY -1 setvarvar MYENEMY DTEMP3 // if you have no enemy ID then treat who hit you as the enemy
else // you had an enemy ID but now you have 2!
{

 ifvarg MYENEMY -1 // you have an enemy ID
	 {
	  getactor[MYENEMY]statnum DTEMP2 
	 ifvarn DTEMP2 1024 dist [RECORD1] [THISACTOR] MYENEMY
	 }
 else setvar RECORD1 99999

 ifvarg DTEMP3 -1 // you have an ID of the projectile's owner
	   {
	   getactor[DTEMP3]statnum DTEMP2 
	   ifvarn DTEMP2 1024 dist [RECORD2] [THISACTOR] DTEMP3
	   }
 else setvar RECORD2 99999

 ifvarvarl RECORD2 RECORD1 setvarvar MYENEMY DTEMP3 // the new enemy is closer so record his ID!
}
setvar DTEMP1 -1 // erase the knowledge of who hit you - its no longer needed.
setvar RECORD1 -1
setvar RECORD2 -1


My errors bascally say something like that "error with dist - invalid sprite" meaning the actor does not exist but I made sure its being checked for with the statnum checking.....

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

0

User is offline   XThX2 

#296

Why are the variables in parantheses ? Also you forgot a "." with statnum of DTEMP2. Check if RECORD2 is -1 before initiating the dist command, too.
0

User is offline   Chip 

#297

View PostXThX2, on Sep 8 2009, 09:27 PM, said:

Why are the variables in parantheses ?


If you're refering to the [ ] on a gamevar in the dist command, that's because the game throws a fit if I don't put them on saying stuff like "RECORD1" is not a game array...


Quote

Also you forgot a "." with statnum of DTEMP2.

Ignore that, I've just written this out now so things like that which would cause the game to not load up don't exist in my real code.


Quote

Check if RECORD2 is -1 before initiating the dist command, too.


I'm going to have to but I didn't get time today but the fact is by rights the game shouldn't read those dist commands if my actor doesn't have an enemy ID or if so then not if it has a statnum of 1024.

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

0

User is offline   Danukem 

  • Duke Plus Developer

#298

I don't feel like wading through that code to find the errors, but in general you should never assume that a variable holds a valid sprite ID. Always check to make sure it is not -1. Even htowner can be -1 sometimes, I've seen it happen.
0

User is offline   Chip 

#299

View PostDeeperThought, on Sep 8 2009, 09:45 PM, said:

I don't feel like wading through that code to find the errors, but in general you should never assume that a variable holds a valid sprite ID.


Here's a quick run down where the error happens:

ifvarg DTEMP3 -1 // you have an ID of the projectile's owner
	   {
	   getactor[DTEMP3]statnum DTEMP2 
	   ifvarn DTEMP2 1024 dist [RECORD2] [THISACTOR] DTEMP3
	   }
else setvar RECORD2 99999



If the gamevar DTEMP3 holds a value of 0+ then check its existance with the statnum. If the statnum gamevar is not 1024 then check the distance between the actor and the enemy id that DTEMP3 holds.


I'm going to have to post my actual code tomorrow but I'm certain there's no difference between this and that...with the exception that the main code checks to make sure the actor THISACTOR actually exists incase it was somehow running this state from beond the void.
0

User is offline   Danukem 

  • Duke Plus Developer

#300

View PostXThX2, on Sep 8 2009, 01:27 PM, said:

Why are the variables in parantheses ? Also you forgot a "." with statnum of DTEMP2.


Right, but it's not his "actual code", so it's waste of our time to even look at it.
0

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

 Ilovefoxes, 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 offline   Danukem 

  • Duke Plus Developer

#304

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

 DeeperThought, 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 offline   Danukem 

  • Duke Plus Developer

#306

 Plagman, 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 offline   Danukem 

  • Duke Plus Developer

#308

 Ilovefoxes, 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 offline   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

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