EDuke32 Scripting "CON coding help"
#3241 Posted 01 March 2023 - 06:57 AM
#3242 Posted 01 March 2023 - 11:20 AM
VGames, on 01 March 2023 - 06:57 AM, said:
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.
#3243 Posted 01 March 2023 - 12:39 PM
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
#3244 Posted 02 March 2023 - 04:56 PM
VGames, on 01 March 2023 - 06:57 AM, said:
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
#3245 Posted 02 March 2023 - 05:14 PM
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
#3246 Posted 02 March 2023 - 05:20 PM
VGames, on 02 March 2023 - 05:14 PM, said:
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
#3247 Posted 06 March 2023 - 08:36 AM
#3248 Posted 07 March 2023 - 02:50 PM
#3249 Posted 07 March 2023 - 06:04 PM
#3250 Posted 14 March 2023 - 05:55 PM
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 ...
#3251 Posted 14 March 2023 - 07:58 PM
lllllllllllllll, on 14 March 2023 - 05:55 PM, said:
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.
#3252 Posted 14 March 2023 - 09:11 PM
#3253 Posted 14 March 2023 - 09:57 PM
lllllllllllllll, on 14 March 2023 - 09:11 PM, said:
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
#3254 Posted 15 March 2023 - 12:34 AM
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.
#3255 Posted 15 March 2023 - 02:21 AM
lllllllllllllll, on 15 March 2023 - 12:34 AM, said:
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.
#3256 Posted 19 March 2023 - 02:54 PM
#3258 Posted 20 March 2023 - 04:22 PM
#3260 Posted 22 March 2023 - 08:27 AM
#3262 Posted 24 March 2023 - 12:53 PM
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
#3263 Posted 24 March 2023 - 01:23 PM
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
#3264 Posted 24 March 2023 - 03:41 PM
This post has been edited by MC84: 24 March 2023 - 03:44 PM
#3265 Posted 24 March 2023 - 07:57 PM
MC84, on 24 March 2023 - 03:41 PM, said:
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.
#3266 Posted 25 March 2023 - 09:12 AM
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.
#3267 Posted 30 March 2023 - 01:43 AM
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)?
#3268 Posted 30 March 2023 - 02:36 AM
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.
#3269 Posted 30 March 2023 - 07:33 AM
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
#3270 Posted 30 March 2023 - 12:58 PM
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.