
EDuke32 Scripting "CON coding help"
#1583 Posted 30 January 2015 - 02:27 AM
You might need to run clipmove on your sprite and detect if the ceiling it hits calculate if the sprite's Z coordinate is the highest it will go in the sector considering clipping (by looking at the function for it in the source code), detect if the ceiling in question is a TROR surface, and if so warp the sprite yourself.
#1584 Posted 30 January 2015 - 03:13 AM
Alright, I sort of suspected that it would have to be forced. It does seem like something that should be built into TROR since it means the default Duke enemies can't move through them out of the box, but it doesn't sound too hard to work around for a mod. Thanks for clarifying!
#1585 Posted 07 February 2015 - 09:23 AM
Jblade, on 26 January 2015 - 01:03 AM, said:
How do I get an enemy to move through a TROR layer? He flies right up to the top of the sector and then just flails about randomly.
That was implemented in r3666. Can you provide a failing test case?
I checked trueror1.map with
- a liztroop,
- a LIZMANJUMP that jumps higher than normal (by editing the source), and
- the COMMANDER.
All three work fine here.
#1586 Posted 07 February 2015 - 11:13 AM
I tested using 4575 in my Graveyard mod, which was installed to check out something else for you, and my newbeast replacement which can jump quite high would not break through the TROR barrier. My Drone replacement would not break through until the player submerged into the lower sector and then went back up to the upper sector. Then the Drone followed me up.
So if you could, test it with the Drone and Newbeast to see if they work properly in your test map.
So if you could, test it with the Drone and Newbeast to see if they work properly in your test map.
#1587 Posted 07 February 2015 - 01:35 PM
Helixhorned, on 07 February 2015 - 09:23 AM, said:
That was implemented in r3666. Can you provide a failing test case?
I checked trueror1.map with
- a liztroop,
- a LIZMANJUMP that jumps higher than normal (by editing the source), and
- the COMMANDER.
All three work fine here.
I checked trueror1.map with
- a liztroop,
- a LIZMANJUMP that jumps higher than normal (by editing the source), and
- the COMMANDER.
All three work fine here.
I just uploaded a map called htest.map to the AMC repository - I spawned a liztroop in and it indeed moved no problem but my enemy just raises up and then struggles to move out of the sector. It's possible it may be related to it being a useractor enemy and the liztroop is just a standard actor? I'm using the same kind of checks the liztroop does to move upwards as well.
This post has been edited by Jblade: 07 February 2015 - 01:35 PM
#1588 Posted 20 February 2015 - 03:00 PM
Jblade, on 07 February 2015 - 01:35 PM, said:
I just uploaded a map called htest.map to the AMC repository - I spawned a liztroop in and it indeed moved no problem but my enemy just raises up and then struggles to move out of the sector.
The reason the enemy didn't take into account TROR boundaries is that it never issues fall. Unfortunately, this is pretty much the only place that updates actor[].ceilingz and actor[].floorz in a proper fashion for a given sprite. These members are intended as cached versions of the upper and lower bounds for vertical movement. If you search for these members in the EDuke32 source code, you'll find a lot of places where they are set to the sector's ceiling or floor z -- without regard to slope, and now, TROR. My earlier fix (r3666) modified the updating of these members for the COMMANDER and DRONE to consider movement through TROR bunches as well.[1] However, carrying out the same kind of tweak for all other enemies (when moving vertically) in r4975 entailed unwanted behavior: enemies would start moving through blocking sprite constructions (reported by Micky C on IRC, reached me via TX in a PM).
[1]And for upward-moving enemies, but without storing actor[].ceilingz. Actually, that's kind of weird now I think about it. This idea behind that was probably to allow Enforcers jump across bunches. But it seems that the actor's sector number may fail to be updated, then. Needs to be reviewed.
The reason is the above-mentioned proper actor[] .ceilingz and .floorz update, namely using the engine function getzrange. For actors, this is pretty much only called via fall.
The solution I have settled at is to have CON coders issue getzrange themselves whenevery they see fit. In r5016, I added a CON file thisactor_getzrange.con that reimplements EDuke32's hardcoded way of doing that: the initial z position is the actor's one minus 256, and the actor's cstat is temporarily cleared to 0 (to prevent hitting itself). This is only one part of the source's A_GetZLimits(); the other part disables fake floor shadows on hitting a certain class of face sprite below and effects the "sliding" above enemies (regardless of how far away the sprite is above it, actually!). That part was not reproduced.
So, thisactor_getzrange.con is intended to be copied into your mod, includeing it once somewhere and calling "state thisactor_getzrange" where you would issue fall for a falling actor. Note that getzrange() needs to check all sprites in the collected set of sectors for collision -- watch out for quadratic run time. You may also want to call it less frequently than every game tic as a microoptimization, for example every fourth one and only when the actor moves vertically.
#1589 Posted 21 February 2015 - 02:38 AM
great, just tested it and the code works fine - I also added in a little bit of code so it only checks every 4 tics as suggested as well. Thanks a lot for taking the time to write up the code, I appreciate it.
#1590 Posted 21 February 2015 - 04:22 AM
Could we please have that extra snippet of code Jblade? Thanks.
#1591 Posted 21 February 2015 - 06:00 AM
Mark., on 21 February 2015 - 04:22 AM, said:
Could we please have that extra snippet of code Jblade? Thanks.
Well I don't actually know if it's more efficient this way, it's just a case of checking to see if a variable is equal to 0, if it is than run the check and set that variable then to something like 5 and take away 1 from it if it doesn't equal 0 to create a basic counter. I think that will do what helix described as only checking every few tics but it might be not as efficient as it could be. I doubt you really need to worry about that anyways unless you're using lots and lots of enemies and lots of sprites in the same sector.
#1593 Posted 24 February 2015 - 02:34 PM
Yo, I'm new around here and I have no Idea where to start with CON scripting. Can anyone point me in the direction of an easy to understand tutorial? I have been modding GZDoom for about a year, but I'm guessing that that will not help.
#1594 Posted 24 February 2015 - 02:40 PM
There is a tutorial on the beginning of GAME.CON. But in the future CON language will be replaced with Luna.
#1596 Posted 24 February 2015 - 03:07 PM
Fox, on 24 February 2015 - 02:40 PM, said:
There is a tutorial on the beginning of GAME.CON. But in the future CON language will be replaced with Luna.
It's lua, not luna. CON won't be replaced, it'll always be around. But it does seem like lua will ultimately be the more powerful and flexible language (I mean they wouldn't have bothered implementing it if it didn't have significant advantages). So it would be worth learning lua straight up. There's a probably a guide floating around the forum somewhere.
It'd be worth looking up the wiki though, since familiarizing yourself with various aspects of the coding system will give you a leg up when it comes to learning lua for eduke. http://wiki.eduke32.com/wiki/Scripting
#1597 Posted 24 February 2015 - 03:15 PM
Welcome! CON scripting is easier than Decorate from what I've seen but there's less hand holding in certain places - I'd recommend first taking a look at the basic game's CON files (which you can open with any old text editor) and getting a feel for it. Than grab an Eduke32 mod and take a look at the code there - it gets complex fast but the upside is you have a huge amount of control over pretty much every single thing in the game. Look at WGR2, DNF2013, or AMC TC for some examples of what's possible

#1598 Posted 24 February 2015 - 03:21 PM
Do you guys use plain notepad or some code program with colors and shit?
#1600 Posted 24 February 2015 - 03:45 PM
DavoX, on 24 February 2015 - 03:21 PM, said:
some code program with colors and shit?
I lol'd...
The colours and shit are there for a reason...
But yes, notepad++ is what most programmers use.
You would have to be a idiot to try edit with notepad/word.
It removes all the formatting and indentation.
Also, if you want to learn LUA, the best place to start would be to look around the Garry's Mod community.
It's the main coding language used for all the mods/addons.
The structure *should* be identical to how it's used in EDuke32.
This post has been edited by Commander Cody: 24 February 2015 - 03:48 PM
#1601 Posted 24 February 2015 - 04:27 PM
Umm... wow this is way more complicated than DECORATE. Is there a way to have a sprites name not be a tile number?
#1602 Posted 24 February 2015 - 04:32 PM
Yeah, you need to define it first though - so for instance if your sprite is called ROBOTDUDE you would have this code:
and then you can simply use ROBOTDUDE if you want to refer to that actor in other code.
define ROBOTDUDE *tilenumber*
and then you can simply use ROBOTDUDE if you want to refer to that actor in other code.
#1603 Posted 10 March 2015 - 05:16 PM
I'm trying to import the beachbabe from vacation and so far all I have is just the model walking in place in game. I went through the Def,Game and User cons and added all the coding for the beachbabe via copy past and defined her tile num where my custom content/model is, still nothings happening. I'm sticking the game code on the very bottom of the document. What am I doing wrong for it not to work?
move BEACHBABEWALKSPEED 70 move BEACHBABERUNSPEED 140 move BEACHBABESHRUNKSPEED 40 move BEACHBABESTOP action BEACHBABEWALK 0 3 5 1 20 action BEACHBABERUN 0 3 5 1 13 action BEACHBABEFROZE 0 1 5 ai AIBEACHBABEROAM BEACHBABEWALK BEACHBABEWALKSPEED randomangle geth getv ai AIBEACHBABEWANTDUKE BEACHBABEWALK BEACHBABEWALKSPEED faceplayerslow geth getv ai AIBEACHBABERUNAWAY BEACHBABERUN BEACHBABERUNSPEED randomangle geth getv ai AIBEACHBABESHRUNK BEACHBABEWALK BEACHBABESHRUNKSPEED randomangle geth getv ai AIBEACHBABEGROW BEACHBABEWALK BEACHBABESTOP faceplayerslow ai AIBEACHBABEFROZEN BEACHBABEFROZE BEACHBABESTOP ai AIBEACHBABEPOSE BEACHBABEFROZE BEACHBABESTOP ai AIBEACHBABEFLEE BEACHBABEWALK BEACHBABEWALKSPEED fleeenemy geth getv state BABEREMARK ifactioncount 1 { ifrnd 254 nullop else { resetactioncount ifrnd 1 sound BABECOMM1 else ifrnd 1 sound BABECOMM2 else ifrnd 1 sound BABECOMM3 else ifrnd 1 sound BABECOMM4 else ifrnd 1 sound BABECOMM5 } } ends state BABEHURTREMARK ends state BEACHBABEFLEESTATE state BABEREMARK ifcount 5 { ifpdistl 2000 { ai AIBEACHBABEFLEE resetcount break } ai AIBEACHBABEWANTDUKE } ends state BEACHBABEROAMSTATE ifrnd 16 ai AIBEACHBABEROAM ifcansee ifpdistl 10000 ifrnd 32 ai AIBEACHBABEWANTDUKE ends state BEACHBABEWANTDUKESTATE ifpdistl 2000 ai AIBEACHBABEFLEE ifpdistg 10000 ifrnd 32 { ai AIBEACHBABEROAM break } state BABEREMARK ends state BEACHBABERUNAWAYSTATE ifactioncount 1 { resetactioncount ifrnd 2 sound BABESCREAM1 else ifrnd 2 sound BABESCREAM2 else ifrnd 2 sound BABESCREAM3 else ifrnd 2 sound BABESCREAM4 } ifrnd 16 ai AIBEACHBABERUNAWAY ends state BEACHBABESTATE fall cstator 257 state babechecksquished ifai 0 { ifrnd 64 sound BABECOMM1 else ifrnd 85 sound BABECOMM2 else ifrnd 128 sound BABECOMM3 else sound BABECOMM4 ai AIBEACHBABEROAM } ifvare vaca_pose 1 { ai AIBEACHBABEPOSE break } ifai AIBEACHBABEPOSE ai AIBEACHBABEROAM ifai AIBEACHBABESHRUNK { ifcount SHRUNKDONECOUNT { ai AIBEACHBABERUNAWAY cstat 257 } else { ifcount SHRUNKCOUNT sizeto 40 40 else state genericshrunkcode } } else ifai AIBEACHBABEGROW { ifcount 32 { state stopbeachbabebathersounds respawnhitag guts JIBS4 20 guts JIBS6 20 // guts JIBS4 20 // guts JIBS6 20 spawn EXPLOSION2 sound PIPEBOMB_EXPLODE // spritepal 6 soundonce BABESCREAM4 // debris SCRAP3 4 sound SQUISHED killit } else { sizeto MAXXSTRETCH MAXYSTRETCH break } } ifai AIBEACHBABEFROZEN { ifhitweapon { ifwasweapon FREEZEBLAST { strength 0 break } lotsofglass 30 sound GLASS_BREAKING respawnhitag ifrnd 84 spawn BLOODPOOL killit } else { ifp pfacing ifpdistl FROZENQUICKKICKDIST pkick } ifcount THAWTIME { getlastpal ai AIBEACHBABERUNAWAY } else ifcount FROZENDRIPTIME ifactioncount 26 { spawn WATERDRIP resetactioncount } } ifhitweapon { sound SQUISHED ai AIBEACHBABERUNAWAY ifdead { ifwasweapon GROWSPARK { cstat 0 move 0 sound ACTOR_GROWING ai AIBEACHBABEGROW break } else ifwasweapon FREEZEBLAST { ai AIBEACHBABEFROZEN move 0 spritepal 1 strength 0 sound SOMETHINGFROZE break } state stopbeachbabebathersounds ifrnd 128 sound DUKE_HIT_STRIPPER1 else sound DUKE_HIT_STRIPPER2 respawnhitag // state standard_bjibs state standard_bjibs state random_wall_jibs spawn BLOODPOOL // spritepal 6 soundonce BABESCREAM4 killit } else { ifwasweapon SHRINKSPARK { sound ACTOR_SHRINKING move 0 ai AIBEACHBABESHRUNK cstat 0 break } else { guts JIBS6 1 } // else ifwasweapon GROWSPARK sound EXPANDERHIT } } /* ifdead { state standard_bjibs sound SQUISHED killit } */ ifai AIBEACHBABEROAM state BEACHBABEROAMSTATE else ifai AIBEACHBABEWANTDUKE state BEACHBABEWANTDUKESTATE else ifai AIBEACHBABERUNAWAY state BEACHBABERUNAWAYSTATE else ifai AIBEACHBABEFLEE state BEACHBABEFLEESTATE ends useractor notenemy BEACHBABE1 BEACHBABESTRENGTH BEACHBABEWALK state BEACHBABESTATE enda
#1604 Posted 11 March 2015 - 12:28 AM
ifvare vaca_pose 1 { ai AIBEACHBABEPOSE break }
What is this? Vars are an eduke thing; the original Vacation did not have them.
If vaca_pose is set to 1, that will cause the sprite to do that ai and break, so that would make it freeze (since the ai in question doesn't move).
#1605 Posted 11 March 2015 - 01:33 PM
That code was from the Vacation hrp SVN DL. Figured it was the same. I got the one from the vanilla vacation and just threw the con in instead of just putting the code in the game.con
BEACHBAB.CON:
Edukelog:
BEACHBAB.CON:
Spoiler
Edukelog:
Spoiler
#1606 Posted 11 March 2015 - 02:03 PM
1. Use the attach function instead of pasting files in the body of your post.
2. You are on the right track by using the Vaca+ con instead of the original one, because the original used nasty hacks to support v1.3D, which I removed in Vaca+ in the name of modularity. In addition, Vaca+ supported Duke Plus for a time until it added the Super Trooper in a non-modular fashion, so you have a better chance of it working right off the bat.
3. Remove the block Trooper Dan posted from your code; you won't need it. I added it to assist in taking screenshots: "vaca_pose" is a gamevar that is never changed during normal gameplay; I would set it from the console.
4. Be sure you defined all the sounds the beach babe uses. These come in two parts: a "define" for the label, which assigns the sound an ID number, and a "definesound", which gives the sound a file name and a few properties.
5. Be sure all the states that the code calls are included in the cons. For example, I don't see where you included "state stopbeachbabebathersounds".
2. You are on the right track by using the Vaca+ con instead of the original one, because the original used nasty hacks to support v1.3D, which I removed in Vaca+ in the name of modularity. In addition, Vaca+ supported Duke Plus for a time until it added the Super Trooper in a non-modular fashion, so you have a better chance of it working right off the bat.
3. Remove the block Trooper Dan posted from your code; you won't need it. I added it to assist in taking screenshots: "vaca_pose" is a gamevar that is never changed during normal gameplay; I would set it from the console.
4. Be sure you defined all the sounds the beach babe uses. These come in two parts: a "define" for the label, which assigns the sound an ID number, and a "definesound", which gives the sound a file name and a few properties.
5. Be sure all the states that the code calls are included in the cons. For example, I don't see where you included "state stopbeachbabebathersounds".
#1607 Posted 12 March 2015 - 05:29 PM
I added the defs to the def.con,user and my own custom con for my custom content. After defining the sounds and reverting back to the beachgirl you wrote and removed that bit of code. It's still throwing the 'Error on line BEACHBAB.CON:48: expecting '{' ..ect codes. Beachbather has her own con file. I'm not adding her con files till I'm done modeling her. I didn't write any of the beachbab.con. I just grabbed it straight from your svn filesource.
Attached File(s)
-
eduke32.log (22.36K)
Number of downloads: 656 -
BEACHBAB.CON (6.14K)
Number of downloads: 614
#1608 Posted 12 March 2015 - 11:46 PM
Also for following the wiki in making new breakable objects. I'm not getting anywhere. I wanted to start on adding the girls but for some reason it's not working. I already defined the girls in the def.con but still it cries about those stupid brackets when they are there. Something so simple and still it doesn't work. For the sake of compatibility issues I made a new folder to test the beacbbitch in and my new Girls.con and still it doesn't work. Didn't add the log file here this time with beachbitch cause she's still throwing the same tears over brackets.
Attached File(s)
-
eduke32.log (4.12K)
Number of downloads: 618 -
GIRLS.CON (209bytes)
Number of downloads: 594
#1609 Posted 20 March 2015 - 06:46 PM
Am I seriously thee only one who has tried to implement the wiki con examples and they not work???
#1610 Posted 20 March 2015 - 11:57 PM
Maybe I'm just really rusty with my CON coding, but I don't understand why it says it is expecting '{'
Usually when those errors happen it is the RIGHT bracket that is missing, not the left. The code you have attached looks like it should work. It could be a compiler bug, but, in my experience the cause is usually something that is not being shown. There's a lot of stuff being loaded that you aren't showing us, including your custom def file.
You might want to try typing the girl code into a new CON file, just in case there are hidden characters in your file that are messing with the compiler. I have actually had that issue (long, long ago). While you are at it, replace the defined labels with constants.
Usually when those errors happen it is the RIGHT bracket that is missing, not the left. The code you have attached looks like it should work. It could be a compiler bug, but, in my experience the cause is usually something that is not being shown. There's a lot of stuff being loaded that you aren't showing us, including your custom def file.
You might want to try typing the girl code into a new CON file, just in case there are hidden characters in your file that are messing with the compiler. I have actually had that issue (long, long ago). While you are at it, replace the defined labels with constants.
#1611 Posted 21 March 2015 - 06:31 PM
Whats a constant??? I'm far from being a CON coder myself.
I deleted the girls con and made a new one to see if that would help and it's still crying over the brackets when they are clearly there. I even deleted all the duke files and did a fresh install of everything and it still bitches.
I deleted the girls con and made a new one to see if that would help and it's still crying over the brackets when they are clearly there. I even deleted all the duke files and did a fresh install of everything and it still bitches.
#1612 Posted 21 March 2015 - 06:43 PM
1337DirtAlliance, on 21 March 2015 - 06:31 PM, said:
Whats a constant??? I'm far from being a CON coder myself.
Use just 5225 instead of BEACHBABE1.