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

Jump to content

  • 118 Pages +
  • « First
  • 107
  • 108
  • 109
  • 110
  • 111
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

User is online   VGames 

#3241

So I have destructible gibs in my mod and of course they have their cstats set up to take hitscan damage and block. It all works great but is there any way to keep the player from bobbing up and down when walking over gibs? It’s not a huge issue but it can be annoying in certain situations due to the player kind of sliding down and off the gibs when on top of them. Could I maybe set their clip dist to something to keep this from happening without removing their ability to be destroyed by bullets?
0

User is offline   Danukem 

  • Duke Plus Developer

#3242

 VGames, on 01 March 2023 - 06:57 AM, said:

So I have destructible gibs in my mod and of course they have their cstats set up to take hitscan damage and block. It all works great but is there any way to keep the player from bobbing up and down when walking over gibs? It’s not a huge issue but it can be annoying in certain situations due to the player kind of sliding down and off the gibs when on top of them. Could I maybe set their clip dist to something to keep this from happening without removing their ability to be destroyed by bullets?


Hey VGames, this isn't an answer to your question but I feel I need to say something about the Savior Of Babes mod that you released recently. I downloaded it today and took a look. It has a lot of material, both art and code that have been taken from other projects. I think the amount of stuff taken from other EDuke32 projects is excessive and that the credits are grossly inadequate given how much you have taken. For example in my case there are whole scripts files for enemies that I wrote (some still have my name on them; I guess I should see that as a positive) and other code for very tricky things such as the lightsaber animation display. Also, there is lots of art for enemies made by sebabdukeboss20. That is not an exhaustive list, just some things I noticed.

I graciously helped you with your code questions, for example in this thread: https://forums.duke4...babes-dev-help/ but if I had known this was your plan I honestly would not have helped, and now this makes me less likely to help others. That's why I think it's relevant to mention it in this thread.

I don't think that you are being malicious. In fact I'm pretty sure that you are just having a good time making your mod and that you do appreciate all the help and resources at your disposal. I imagine that you are an eager young person who just wants to make a fun mod and had no intention of ruffling feathers. But I don't think you understand how it feels if you have been slaving away on projects for many years and then someone comes along and uses your stuff without permission and then gets credit for it from youtubers and other people who just think it is a cool mod without realizing how much of it was made by other people who didn't consent.

In your readme you do have a thanks section where you list various mods that you have learned/taken stuff from. What I'm saying is that it is grossly inadequate to just list a mod and say thanks for "sprites and coding features" if you have largely copied and pasted significant amounts of someone else's work without their permission. Now as a modder I do understand that we "borrow" a lot of stuff! But there are rules we try should follow. The most important one to me is that if we are using significant amounts of content from another in mod our own community that we discuss it with those mod authors first and get their permission to include it. In some cases we have a working relationship with each other -- for example, between AMC TC and Alien Armageddon, but that is because we share team members and the traffic goes both ways.
7

User is online   VGames 

#3243

My apologies I didn’t think it would be a big deal since credit was given for everything I borrowed. I never claimed to make everything on my own and I do intend to elaborate a lot more on the read me which includes the thank you section. This is just a pre 1.0 release and there is still much more to do. But I will definitely clarify a lot more in the thank you section for the next release. I hope I didn’t upset you. I won’t be adding content from other mods from here on out. I have a good base to work with now.
I’m not young by any means. I’ve been modding for a long time across many games and I’ve borrowed from other’s mods the entire way. And I’ve given thanks exactly like this with every mod. So I didn’t see an issue with how I went about it since I’ve been doing it like this since my very first release of a mod without anybody saying anything. People have already come to me asking about some of the resources I got because they were interested in playing the mods that I borrowed from, I’m referring to newcomers of course. I have a decent following and people know my capabilities by now so they know I didn’t make this stuff all by myself. And I am the first person to put in a good word for the mods that I took resources from. Plus I seriously doubt the vast majority who play my mod haven’t played any of your work. No way would they not know where some of the resources in my mod came from. Your work is legendary

This post has been edited by VGames: 01 March 2023 - 01:04 PM

-2

User is offline   Danukem 

  • Duke Plus Developer

#3244

 VGames, on 01 March 2023 - 06:57 AM, said:

So I have destructible gibs in my mod and of course they have their cstats set up to take hitscan damage and block. It all works great but is there any way to keep the player from bobbing up and down when walking over gibs? It’s not a huge issue but it can be annoying in certain situations due to the player kind of sliding down and off the gibs when on top of them. Could I maybe set their clip dist to something to keep this from happening without removing their ability to be destroyed by bullets?


I don't see why you would want to make them blocking at all though. Hittable, yes, but why blocking?

EDIT: And in case anyone was wondering -- there is not going to be an ongoing beef about the credits thing as far as I am concerned as long as it is handled in the way we talked about over DMs, so that's now over in this thread.

This post has been edited by Danukem: 02 March 2023 - 04:58 PM

0

User is online   VGames 

#3245

Agreed on the credits issue.

Back to my question. How do I make them destructible with bullets and explosions without making them blocking? I thought this was the only way.

EDIT
ok I get it. Only cstat 256 is needed. I feel stupid now. Carry on people.

This post has been edited by VGames: 02 March 2023 - 05:19 PM

0

User is offline   Danukem 

  • Duke Plus Developer

#3246

 VGames, on 02 March 2023 - 05:14 PM, said:

Agreed on the credits issue.

Back to my question. How do I make them destructible with bullets and explosions without making them blocking? I thought this was the only way.

EDIT
ok I get it. Only cstat 256 is needed. I feel stupid now. Carry on people.


It's as simple as not setting the blocking bit in their cstat. The blocking bit is the first bit. So literally any even numbered cstat value will be non-blocking (0, 4, 8, etc) Add the 256 to that for hittable
0

User is online   VGames 

#3247

Ok so I was putting together a new episode with custom slaughter maps. For some reason I can't get the second map to start after the first map is completed. It just plays the first map again. But if I play through the first map the second time it's loaded up it will continue on to the second map like it should have done the first time. Has anybody had this issue? I know I have everything set up properly in the USER.CON file. I have named the maps E5L1, E5L2, E5L3, etc. This also happens when I skip to the first map of the new episode. What could be causing this?
0

#3248

Does your client have 5 episodes by default? Could be something with how you're adding one
0

User is online   VGames 

#3249

I figured it out. The map in question was using the MP version of the nuke button because it’s palette was set to 1.
0

#3250

I don't understand how/why this is causing the kicking action and ifpdistl {} to loop forever. From the duke_grunt it sounds like the actioncount is hitting 2 and then resetting which makes me think the move is resetting it but the change to action (AJAGES) is being ignored.

action AJAGEKICK 41 2 1 1 12 //stuck on this action

state jagekick
  ifaction AJAGEKICK  //this should have become false after 2 frames
  {
    ifactioncount 2
    {
      ifpdistl 1152  //duke_grunt,pal, hp loss is spammed during the loop
      {
        sound DUKE_GRUNT
        palfrom 8 32
        addphealth -8
        getactor[THISACTOR].ang queens
        cos queenx queens
        sin queeny queens
        findnearactor APLAYER 1152 queenz
        movesprite queenz queenx queeny 0 CLIPMASK0 queens
      }
      move JAGESTOPPED faceplayerslow
      action AJAGES  //this line is not taking effect; ai should remain AIJAGEKICK with action AJAGES for use in svolley state
    }
  }
  else
  state svolley
ends



state jageseekstate
  ifcansee
  {
    ifaction AJAGEC
    {
      ifcount 24
        state cvolley
      break
    }
    else
    ifaction AJAGECFLASH
    {
      state cvolley
      break
    }
    ifpdistl 1280
      ifrnd 160
      {
        sound JGKICK
        ai AIJAGEKICK //Only call for kicking ai in the actor
        break
      }
//(truncated)
ends

...
    ifai AIJAGESEEKENEMY
      state jageseekstate
    else
    ifai AIJAGEKICK
      state jagekick
...

0

User is offline   Danukem 

  • Duke Plus Developer

#3251

 lllllllllllllll, on 14 March 2023 - 05:55 PM, said:

the change to action (AJAGES) is being ignored.


How have you verified that? If it was me I would have it log a variable or spawn an explosion or something when it reached the line, so that I would know for sure if it wasn't reaching it. Otherwise, it's possible that it is getting set for 1 or 2 tics and then some other part of your code you aren't showing is resetting the AI back to the AJAGEKICK action.
0

#3252

It is as you said. Spawning an enemy on the next line was popping out squads
0

User is offline   Danukem 

  • Duke Plus Developer

#3253

 lllllllllllllll, on 14 March 2023 - 09:11 PM, said:

It is as you said. Spawning an enemy on the next line was popping out squads


Did you actually look at your log when this is happening and verify there are no errors? I think there is an error:

findnearactor APLAYER 1152 queenz
movesprite queenz queenx queeny 0 CLIPMASK0 queens

The APLAYER sprite is not an actor (actor is defined as statnum 1). The player has a special statnum and will not be found by that command. This means that your queenz var is being set to -1. On the next line, you are using movesprite on sprite -1. This will cause an error, aborting code execution of that state, making it not reach the action set.

Instead of using those two lines, use this one line:

movesprite player[].i queenz queeny 0 CLIPMASK0 queens
0

#3254

The log for what I was using was filled with invalid move spam ><

To check I had put a spawn below the action AJAGES at the bottom so it's strange that was working but neither the action nor the state following it ever did.
Using player[]i stopped the loop but the movement only works on duke's corpse.
0

User is offline   Danukem 

  • Duke Plus Developer

#3255

 lllllllllllllll, on 15 March 2023 - 12:34 AM, said:

The log for what I was using was filled with invalid move spam ><

To check I had put a spawn below the action AJAGES at the bottom so it's strange that was working but neither the action nor the state following it ever did.
Using player[]i stopped the loop but the movement only works on duke's corpse.


I correctly diagnosed your problem. But no, movesprite will not move a live player. You would need to directly set the player's posxv and posyv, or alternatively fvel and svel in the input struct.
0

User is online   VGames 

#3256

Is the way map objects like cardboard boxes, tires, or palm trees catch on fire when damaged by weapons hardcoded? Is there any way to manipulate the way they react to certain damage types so that they don’t always just catch on fire?
0

User is offline   Danukem 

  • Duke Plus Developer

#3257

Yes and probably.
0

#3258

The actor shrinks and spawns a growing fire, so for the fire you should be able to catch it at event_spawn with an ifactor - ifspawnedby entry, and for the main actor maybe sizeto or sizeat can negate the shrinking or by changing to a dupe actor which should also avoid the killit.
0

User is online   VGames 

#3259

Great idea. Thanks.
0

User is online   VGames 

#3260

How do u make the player taller? Like make the position of their view higher? I thought simply increasing their size would do the trick kind of like how making them smaller shrinks their camera view down to the floor when shrunk. But it doesnt
0

User is offline   Danukem 

  • Duke Plus Developer

#3261

Replace the steroids item with growth hormone.
0

User is offline   MC84 

#3262

I am attempting to make a simple NPC/civilian that's stationary and one-sided, and simply cycles through different actions etc. I have followed Dan's tutorial from 2018 and setup the actions and have checked that they all work etc. The first thing I'm trying to do is just setup a basic idling routine, where the NPC alternates between a few different actions. So far this (sort of) works, however I want to specify the actioncount for some actions so that they don't quit mid-animation, which is currently what's happening.

Basically I want CIV1FLICK to only ever play 8 frames, and CIV1SMOKE 16 frames.


action CIV1IDLE 1 11 1 1 16
action CIV1FLICK 12 8 1 1 16
action CIV1SMOKE 20 16 1 1 16

useractor notenemy CIV1 NPCSTRENGTH
{

 fall
  
      ifcount 64 ifrnd 6
      {
        ifrnd 128
          action CIV1IDLE
        else
        {
          ifrnd 128
            action CIV1FLICK
          else
            ifrnd 128
            action CIV1SMOKE
        }
        resetcount
		
	ifaction CIV1FLICK ifactioncount 8 break
		
	ifaction CIV1SMOKE ifactioncount 16 break
		
      }

}
enda


0

User is offline   Danukem 

  • Duke Plus Developer

#3263

action CIV1IDLE 1 11 1 1 16
action CIV1FLICK 12 8 1 1 16
action CIV1SMOKE 20 16 1 1 16

useractor notenemy CIV1 NPCSTRENGTH CIV1IDLE

 fall
  
       ifaction CIV1IDLE ifactioncount 11
      {
        resetactioncount
        ifrnd 128
        {
          ifrnd 128
            action CIV1FLICK
          else
            action CIV1SMOKE
        }
      }
                
   ifaction CIV1FLICK ifactioncount 8 action CIV1IDLE
                
   ifaction CIV1SMOKE ifactioncount 16  action CIV1IDLE
                
enda

2

User is offline   MC84 

#3264

thanks Dan - I swear I had tried that command at some point... and thanks for improving some of the other code as well. I Appreciate it! Also is it best practice to include the death/hurt/interact branches of if statements first, and then have the default routine last? From looking at other code this seems to be a common approach.

This post has been edited by MC84: 24 March 2023 - 03:44 PM

1

User is offline   Danukem 

  • Duke Plus Developer

#3265

View PostMC84, on 24 March 2023 - 03:41 PM, said:

Also is it best practice to include the death/hurt/interact branches of if statements first, and then have the default routine last? From looking at other code this seems to be a common approach.


I do it that way but it's not necessary as long as you are careful and make sure that dead actors aren't running code they aren't supposed to.
1

User is offline   Reaper_Man 

  • Once and Future King

#3266

As CON is executed from top to bottom, you can place the bail out conditions for dead actors sooner and prevent unnecessary later code from running, saving CPU time. It's why you generally always see character state machine built like:

ifaction SOMEACTION
	state actorstate
else
ifaction OTHERACTION
	state actorotherstate
else
[. . .]


The use of "else" here prevents different status states from running in a single tic. Without the elses, if the animation begins as SOMEACTION and the animation changes to OTHERACTION from within state actorstate, you would have both states run in a given tic, which is most likely not planned or expected behavior.

As far as freeing up CPU cycles, something else you can do to free it up is force it to stop being an actor by changing it's statnum - assuming you want it to run absolutely zero code, including "blow up corpses" type code. If so then you can do:

seta .statnum STAT_DEFAULT


And that turns it into a non-actor, static sprite.
2

User is offline   MC84 

#3267

I want to try to attempt a custom enemy that's based off the pigcop (ie basically the same behaviour). I'm still animating/rendering my actions however I have had a look at the GAME.CON code and while I can kinda follow most of it, I was hoping someone could shed some light on how the following if construction works?

state pigshootenemystate
//  ifcansee
  {
    ifcount 12 nullop
    else
      ifcount 11
    {
      ifcanshoottarget
      {
        sound PIG_ATTACK
        shoot SHOTGUN etc.
      }
      else
        ai AIPIGSEEKENEMY
    }
    ifcount 25 nullop
    else
      ifcount 24
      {
        action APIGCOCK
        sound SHOTGUN_COCK
      }
    ifcount 48 nullop
    etc. etc.


I thought that 'ifcount' was just based off the in-game tic counter, so how does this construction work when presumably all of the values will eventually be true? Clearly I'm missing something here, but take the first ifcount; won't the tic counter always reach 11? hence making the 12 null and void? And then how can the counter then advance to the higher values (25,24,48,etc)?
0

User is offline   Danukem 

  • Duke Plus Developer

#3268

The expression "ifcount 12" can be read as "if the count is AT LEAST 12"

So in quasi-English, what that part is saying is: "If the counter is 12 or higher do nothing, otherwise if the counter is at least 11 execute what is in the following braces". This can be simplified to "If the counter is exactly 11, execute what is in the following braces."

The count commands in old CON don't have an equals operator, so it has to be written out in the more complex way using the nullop command.

There's no denying the code is needlessly difficult to read and could be simplified using eduke syntax. In my code, if a behavior is tied to an animation, I try to stick to actioncount when determining what behavior to switch to. One advantage of this is that if the animations are sped up (either through redefining the actions or by hacking the hgt_t members) the actor will still behave correctly.
2

#3269

You'll notice there is no 'else' between ifcount 12/11 - ifcount 25/24 - ifcount 48, so they will not prevent the other from running.
ifactioncount is sometimes used in the same manner but needs more care because the delay used on the action changes the amount of ticks inbetween single actions. For example:

  action FAST 0 1 1 1 1
  action SLOW 0 1 1 1 16

  //
  ifaction FAST
  {
    ifactioncount 3 nullop
    else
    ifactioncount 2
      shoot SHOTGUN
  }
  ifaction SLOW
  {
    ifactioncount 3 nullop
    else
    ifactioncount 2
      shoot SHOTGUN
  }
//


the FAST action will have its actioncount at 2 for one tic (I think) and fire once
the SLOW action will have its actioncount at 2 for 4 tics (I think) and fire 4 times in what will seem like an instant since it is happening once per tic
2

User is offline   Reaper_Man 

  • Once and Future King

#3270

It's also worth noting that to get the expected behavior, you have to setup your ifcount / ifactioncount with the higher value checked first. That's why they go in order of 12 and then 11, so that the 12 block takes precedence. If you reversed those (or got rid of the nullop blocks altogether), instead of basically "pausing" for the time in between shooting and cocking, after 11 gametics it would shoot every gametic for 13 more gametics (24 - 11), then play the cocking sound every gametic for 23 gametics (47 - 24), and so on.

This is also while you'll often see this setup:

ifcount 13
    resetcount
else
ifcount 12
    state dosomething


This resets the counter if it ever exceeds 12 (the desired target count), because otherwise if the counter is never reset, then because an actor's count is always incrementing, when your code steps into the branch where it's checking "ifcount 12", it will instantly execute because the count will be at 500 or something.
2

Share this topic:


  • 118 Pages +
  • « First
  • 107
  • 108
  • 109
  • 110
  • 111
  • 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