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

Jump to content

  • 115 Pages +
  • « First
  • 73
  • 74
  • 75
  • 76
  • 77
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

User is offline   Sanek 

#2221

Is there some easy way (or at least already-documented one) to attach a single-hit death sequence to a brand new actor?
Suppose I use the code for that Bee enemy from Candymania as a starting point.
0

User is offline   Hendricks266 

  • Weaponized Autism

  #2222

Use ifhitweapon without ifstrength.
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#2223

View PostRPD Guy, on 12 February 2018 - 10:59 AM, said:

Someone knows?
For APLAYER we have "spritebridge" and "sbs" properties. The other actors don't have these.
How can I know if a actor is standing upon an "spritebridge"?

Try the htmovflag.
0

User is online   Danukem 

  • Duke Plus Developer

#2224

View PostFox, on 15 February 2018 - 09:37 AM, said:

Try the htmovflag.


I'm pretty sure I gave the correct answer on the last page. htmovflag detects collisions but not whether you are standing on something.
0

User is offline   Mere_Duke 

#2225

Does anyone know how to change damage of a hitscan-type default projectiles?
For FIRELASER, its
eshoot FIRELASER
seta[RETURN].extra %value%

But how to aplly this for the SHOTSPARK1 or SHOTGUN?

P.S. I know I can use
shoot SHOTGUN
shoot SHOTGUN
shoot SHOTGUN
...

but I want to avoid that, and, besides, I don't want to define new projectile.

This post has been edited by Mere_Duke: 17 February 2018 - 09:14 AM

0

User is online   Danukem 

  • Duke Plus Developer

#2226

View PostMere_Duke, on 17 February 2018 - 09:11 AM, said:

Does anyone know how to change damage of a hitscan-type default projectiles?
For FIRELASER, its
eshoot FIRELASER
seta[RETURN].extra %value%

But how to aplly this for the SHOTSPARK1 or SHOTGUN?


You don't. You could change the damage by editing the damage amounts in USER.CON, but that will change it for every time they are used.

View PostMere_Duke, on 17 February 2018 - 09:11 AM, said:

P.S. I know I can use
shoot SHOTGUN
shoot SHOTGUN
shoot SHOTGUN
...

but I want to avoid that, and, besides, I don't want to define new projectile.


Defining a projectile is very easy and it is the correct solution. For hitscan, you don't even need a tile with art on it to define it on.

There is a hackish solution, though, if you are really determined to make this more difficult than necessary. If you know the sprite ID of what you are shooting at, you can check its htowner and htextra right after shooting at it in the same block of code; if the owner is the actor who just fired and htextra is > 0, assume that's because you just shot it and increase htextra to the value you want.
0

User is offline   Mere_Duke 

#2227

Oh yeah, htextra is a good solution. Thx. It allows not only to change, say, bullet damage, but to add a random component to it, and a distance-based component too (for a shotgun-like weapons). And I've realised just now that I want to know how the default shotgun damage code works as well :dukecigar:
Also I can't find a word about how to translate *.con actor move velocity (move WALK 200 for example) into "build units per tic" value.
0

User is offline   Mere_Duke 

#2228

And thx for the "change actor's position" hack, it really helps, for example, to spawn debris or blood at the exact point of his body.
0

User is online   Danukem 

  • Duke Plus Developer

#2229

View PostMere_Duke, on 18 February 2018 - 08:28 AM, said:

And thx for the "change actor's position" hack, it really helps, for example, to spawn debris or blood at the exact point of his body.


Another very useful thing to know is how to use the SHOTSPARK1 actor. By reading its htg_t members, you can find out exactly what sprite or texture any hitscan projectile is hitting, and use that information to spawn appropriate effect sprites or take other actions right at the location and time of the impact.
0

User is offline   Mere_Duke 

#2230

Yes, htg_t is very useful array for projectiles, but why in wiki it is mentioned "usage discouraged" for actors? How it is possible to get the current frame offset of actor another way?
PS I need to execute a specific code on a specific action frame, I coded it with flags, but wonder if there is a better way.
"geta[].htg_t 3 TEMP" seems breaking code if combined with "ifcount - resetcount", actor starts to walk with negative velocity :dukecigar:

This post has been edited by Mere_Duke: 18 February 2018 - 05:16 PM

0

User is online   Danukem 

  • Duke Plus Developer

#2231

View PostMere_Duke, on 18 February 2018 - 04:39 PM, said:

Yes, htg_t is very useful array for projectiles, but why in wiki it is mentioned "usage discouraged" for actors? How it is possible to get the current frame offset of actor another way?
PS I need to execute a specific code on a specific action frame, I coded it with flags, but wonder if there is a better way.
"geta[].htg_t 3 TEMP" seems breaking code if combined with "ifcount - resetcount", actor starts to walk with negative velocity :dukecigar:


You should be able to track the frame of animation with the good old ifactioncount command.
0

User is offline   Mere_Duke 

#2232

Yep, I did it with flag to control that desired code will execute once because "ifcationcount %value%" duration depends on action speed value and almost always more than one tic; everything I put inside will be executed many times, so I need to have flag to restrict redundant state calls.
There is an easy solution if you need to do smth at every 3rd animation frame:
ifactioncount 3
{
	resetactioncount
	state dosomething
}

But in my case, there are 7 frames in the action, and I need to execute that state at the 3 and the 6 frames :dukecigar:

This code
ifcount 12
{
  resetcount
  geta[].htg_t 3 TEMP6
  ife TEMP6 3
    state stepsnd
  ife TEMP6 6
    state stepsnd
}

failed to work, and probably because it's "unreliable".
So there is only weird flag solution left, and works perfect.
But I always try to improve the code and make it more "universal".

This post has been edited by Mere_Duke: 18 February 2018 - 07:03 PM

0

User is offline   Mere_Duke 

#2233

Hmm, it works now like this, like I wanted it to be implemented, w/o flags and redundant checks:
  ifactioncount 1
  {
    resetactioncount
    geta[].htg_t 3 TEMP4
    ife TEMP4 3
      sound GARGAN_STEP
    ife TEMP4 6
      sound GARGAN_STEP
  }

But I still want to know why no one uses actors' "htg_t" (I haven't found "htg_t" usage for actors in AMCTC, Attrition and other mods files), and why wiki recommends to avoid "htg_t" of actors.

This post has been edited by Mere_Duke: 18 February 2018 - 07:29 PM

0

User is offline   Mere_Duke 

#2234

Another problem: When enemy actor is falling from a high distance, it makes a "squish" sound. How could I remove that sound, and why it is happening? I coded falling behavior, and when actor is falling to the water, it resets its action to a default one (not dying from water), but when it dies after from, say, a bullet, it plays "squish" sound anyways. Probably, the old falling data left anywhere, but idk where to search for.
I need either to completely reset actor data to a default state, if possible, or remove that annoying sound.
Ofc I can do a { spawn MYENEMY killit } to simulate a resetting, but it's not optimal way. And I can try and catch SQUISHED sound in EVENT_SOUND, but I think it's a bad idea too.
Thanks in advance!

This post has been edited by Mere_Duke: 21 February 2018 - 07:53 AM

0

User is offline   Mark 

#2235

I don't know if you tried this already or not. Its possible that if the actor never reaches "terminal velocity" it won't trigger the squish sound. If its only usable for the Aplayer actor, then never mind.
http://wiki.eduke32....r_falling_death

This post has been edited by Mark.: 21 February 2018 - 11:19 AM

0

User is online   Danukem 

  • Duke Plus Developer

#2236

Sounds fishy. I don't recall the hardcoded squish sound working that way. Are you saying that if not for your code, it would make the squish sound when falling on a tagged water sector?
0

User is offline   Mere_Duke 

#2237

@Mark
Yes, it's only for aplayer, but are you sure that the squish sound related to velocity, not to the height travelled by object?
I think it's possible to control the velocity of a sprite falling by using htcgg structure member.
@Trooper Dan
Nope, it works differenty. I'll try to explain in details. When the actor faces the situation when distance from the floor is more than 320, it starts falling and goes to the 1st frame of DYING animation. It continues to fall (dying anim constantly resets to its start frame), and when floordistance is less than 8, it checks with getzrange if the picnum below is a water. If not, then it "releases" DYING animation, and the actor is dying normally. If it is water below, it changes DYING anim to a "zero ai" or default STANDING action, and actor becomes alive, and behaves normally. Everything is ok except that in the case 2, if I kill that actor after he has fallen and was saved by water, he plays "squish" sound on death in addition to normal dying yell.
And I can't understand how "fall" works. I know of "htcgg", but sometimes actors fall faster or slower, in different situations. For example, my test actor is falling to the ground much slower, than to the water. (Probably smth related to the sectors? Idk)

This post has been edited by Mere_Duke: 21 February 2018 - 01:45 PM

0

User is online   Danukem 

  • Duke Plus Developer

#2238

View PostMere_Duke, on 21 February 2018 - 01:44 PM, said:

@Trooper Dan
Nope, it works differenty. I'll try to explain in details. When the actor faces the situation when distance from the floor is more than 320, it starts falling and goes to the 1st frame of DYING animation. It continues to fall (dying anim constantly resets to its start frame), and when floordistance is less than 8, it checks with getzrange if the picnum below is a water. If not, then it "releases" DYING animation, and the actor is dying normally. If it is water below, it changes DYING anim to a "zero ai" or default STANDING action, and actor becomes alive, and behaves normally. Everything is ok except that in the case 2, if I kill that actor after he has fallen and was saved by water, he plays "squish" sound on death in addition to normal dying yell.
And I can't understand how "fall" works. I know of "htcgg", but sometimes actors fall faster or slower, in different situations. For example, my test actor is falling to the ground much slower, than to the water. (Probably smth related to the sectors? Idk)


First, your sound bug: it is likely that the actor is falling on a water texture, but the sector was not actually lotag 1 (water sector). Thus, as far as the game is concerned, he fell on a regular floor and not water. I don't know where the falling death data is getting saved in the sprite structure, but clearly it is.

Second, your method is very complicated and will probably give you the wrong result in some situations. The easiest way to tell if an actor is falling is to simply check their zvel (positive means falling). I would try something like this:

gamevar falltime 0 2
define FALLDAMAGETIME 24 // number of tics of falling before landing will hurt
define FALLDAMAGEMULT 3

state fallaction

  // this is a placeholder state for changing the actor's action appropriately
  // you will want to change the action to the falling action when falltime >= FALLDAMAGETIME

ends

state checkfall

ifg sprite[].zvel 0
{
   add falltime 1
   state fallaction
}
else
{
  ifg falltime FALLDAMAGETIME
  {
    ifonwater
      nullop
    else
    ifinwater
      nullop
    else
    {
      sub falltime FALLDAMAGETIME
      mul falltime FALLDAMAGEMULT
      seta[].htextra falltime
      seta[].htpicnum KNEE
      seta[].htowner THISACTOR
      sound SQUISHED
      guts JIBS6 4 // or whatever you want
    }
  }
  set falltime 0
}

ends


The idea is that you want the actor to use the checkfall state whenever he's not already dead. It will determine whether he is falling, count how long he has been falling and apply damage depending on the length of the fall once he hits ground. It will not apply damage if he falls on a water sector.
1

User is offline   Mere_Duke 

#2239

Hmmm. This is, yes, the more convenient way to do this. I like it better than mine. But then I need to pass some actor-specific things into "state fallaction". While I can do this for sounds with "soundvar" (for example, to start playing actor-specific scream sound at some point), how do I change the action of a specific actor outside of that actor? (To change animation mid-air; I always hated walking-on-air enemies, and setting "move 0" negates any horizontal velocity it had before falling.) There is no "actionvar". But anyways, thanks for this, but! I've tried your code, and it has exactly the same behavior in cases mine had. Now I think it's just a map/sector issue. Sorry, I know zero about mapping and such. I recorded a video with that bug. You code is applied there.
The annoying SQUISH I couldn't catch is playing at 3rd enemy death. 2nd death is "wtf" as well :dukecigar:


This post has been edited by Mere_Duke: 21 February 2018 - 05:47 PM

0

User is offline   Mark 

#2240

How about using ifinwater and stopsound squish

Maybe you get lucky and stopsound will stop it fast enough so you don't hear it

This post has been edited by Mark.: 21 February 2018 - 06:14 PM

0

User is online   Danukem 

  • Duke Plus Developer

#2241

By code "outside the actor" are you referring to a generic state that will be executed by the actor, such as the state checkfall above? In that case, all you need to do is something like this:

ifactor MYCULTISTGUY
{
  // blah blah blah change the action
}
   else
ifactor LIZTROOP
{
 // blah blah blah change the action
}

// ... and so on


EDIT: on the squish sound, I don't really want to speculate about it because it could either be a hardcoded thing interacting with your code or there could be something else in your code causing it. Without looking at all of the relevant code, it's hard to say

This post has been edited by Trooper Dan: 21 February 2018 - 06:17 PM

0

User is offline   Mark 

#2242

I keep offering help in the hopes that eventually I'll get one right. I'm beginning to doubt it. :dukecigar:
0

User is online   Danukem 

  • Duke Plus Developer

#2243

View PostMark., on 21 February 2018 - 06:24 PM, said:

I keep offering help in the hopes that eventually I'll get one right. I'm beginning to doubt it. :dukecigar:


Your suggestion about stopping the sound when ifonwater would probably work, but I would first want to know what the root cause is and only do that as a last resort. Also, you would want to use "ifonwater ifactorsound THISACTOR SQUISHED stopactorsound THISACTOR SQUISHED". That's because the more general command "stopsound" will stop any instance of the sound, including instances legitimately started by another actor.
0

User is offline   Mere_Duke 

#2244

@Dan
Oh, I completely forgot that I can determine actors with "ifactor". Need to stop trying to do everything via gamevars.
Now I at least understand why in Attririon you collected all monster ai's and action's in one place.
The SQUISH bug is not code-related 100%. I tried another place and found no such issues. Let's just leave it at that.

@Mark
stopsound will stop all sounds of that kind in a map - bad solution.
stopactorsound THISACTOR SQUISHED will stop this exact squish sound but it will also stop a sound of exploding body
EVENT_SOUND is the best way to catch it I think, but anyway it's a "kludge". :dukecigar:

This post has been edited by Mere_Duke: 21 February 2018 - 06:48 PM

0

User is online   Danukem 

  • Duke Plus Developer

#2245

View PostMere_Duke, on 21 February 2018 - 06:47 PM, said:

stopactorsound THISACTOR SQUISHED will stop this exact squish sound but it will also stop a sound of exploding body


But you would also be checking ifonwater

Also, if you check this stuff before ifhitweapon, then that won't be an issue because in the exploding body case you use killit and then there is no actor to run the code which would stop sound on the next tic
0

User is offline   Mere_Duke 

#2246

View PostTrooper Dan, on 21 February 2018 - 07:08 PM, said:

But you would also be checking ifonwater


But if actor will walk out of the water, this won't stop the sound. But anyway it only happens for a single sector. The problem is not code-related, as I thought before. Both ways (mine & yours) work, but I prefer yours. Thx for that.
0

User is offline   Mere_Duke 

#2247

To determine spawned sprite, I use sprite[].picnum, what should I use to determine spawned projectile (say, RPG), and where should I catch them outside of an actor spawning them?
Is there any way to create a hitbox for a sprite? I have a tree sprite, and want bullets to pass through leaves but hit a trunk. So far I just spawn a tall&thin sprite with a cstat of 32768+257 in the center of that tree to simulate a trunk, and set a tree cstat to 0.
0

User is offline   Mere_Duke 

#2248

Another question is how to get the angle if I only have the arctangent? There is a "horis" member of player structure, and I don't know how to obtain the angle between player view vector and the flat surface he's standing on. (The (horiz-100)/128 is the actual arctg, but how to get the angle from it? I know about getangle, but dx/dy displacements are unknown in my case.)
0

User is online   Danukem 

  • Duke Plus Developer

#2249

View PostMere_Duke, on 24 February 2018 - 08:14 AM, said:

To determine spawned sprite, I use sprite[].picnum, what should I use to determine spawned projectile (say, RPG), and where should I catch them outside of an actor spawning them?


I don't understand what you are asking. A projectile is also a sprite, and it has a picnum just like any other sprite. It's not clear what you are trying to say. "catch them" sounds like a euphemism of some kind.

View PostMere_Duke, on 24 February 2018 - 08:14 AM, said:

Is there any way to create a hitbox for a sprite? I have a tree sprite, and want bullets to pass through leaves but hit a trunk. So far I just spawn a tall&thin sprite with a cstat of 32768+257 in the center of that tree to simulate a trunk, and set a tree cstat to 0.


I can only think of 2 methods off the top of my head. Method one is you define the actor with a sprite that has the actual hitbox you want, and then use an action to make it look different from its hitbox. Method 2 is what you describe -- make the actor nonhittable but make it spawn one or more proxy sprites with hitboxes that you want and make them transfer damage to the actor.

btw my internet is down at home and I can only be online for 5 minutes a day until it is fixed so that is all I can manage for now.
0

User is offline   Mblackwell 

  • Evil Overlord

#2250

You could also create a clipshape I believe, although it's a bit more complicated to set up.
0

Share this topic:


  • 115 Pages +
  • « First
  • 73
  • 74
  • 75
  • 76
  • 77
  • 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