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

Jump to content

  • 124 Pages +
  • « First
  • 52
  • 53
  • 54
  • 55
  • 56
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

User is offline   Helixhorned 

  • EDuke32 Developer

#1585

View PostJblade, 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.
0

User is offline   Mark 

#1586

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.
0

User is offline   Jblade 

#1587

View PostHelixhorned, 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 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

0

User is offline   Helixhorned 

  • EDuke32 Developer

#1588

View PostJblade, 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.
2

User is offline   Jblade 

#1589

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.
0

User is offline   Mark 

#1590

Could we please have that extra snippet of code Jblade? Thanks.
0

User is offline   Jblade 

#1591

View PostMark., 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.
0

User is offline   Mark 

#1592

Okey Dokey.
0

User is offline   xenoxols 

#1593

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.
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1594

There is a tutorial on the beginning of GAME.CON. But in the future CON language will be replaced with Luna.
0

User is offline   xenoxols 

#1595

So should I wait for luna? Or will that be a while?
0

User is offline   Micky C 

  • Honored Donor

#1596

View PostFox, 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
0

User is offline   Jblade 

#1597

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 :)
0

User is offline   DavoX 

  • Honored Donor

#1598

Do you guys use plain notepad or some code program with colors and shit?
0

User is offline   Mark 

#1599

Notepad++ is a popular one.
0

User is offline   The Commander 

  • I used to be a Brown Fuzzy Fruit, but I've changed bro...

#1600

View PostDavoX, 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

1

User is offline   xenoxols 

#1601

Umm... wow this is way more complicated than DECORATE. Is there a way to have a sprites name not be a tile number?
0

User is offline   Jblade 

#1602

Yeah, you need to define it first though - so for instance if your sprite is called ROBOTDUDE you would have this code:
define ROBOTDUDE *tilenumber*

and then you can simply use ROBOTDUDE if you want to refer to that actor in other code.
0

#1603

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



0

User is online   Danukem 

  • Duke Plus Developer

#1604

  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).
0

#1605

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:

Spoiler


Edukelog:

Spoiler

0

User is offline   Hendricks266 

  • Weaponized Autism

  #1606

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".
0

#1607

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)


0

#1608

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)


0

#1609

Am I seriously thee only one who has tried to implement the wiki con examples and they not work???
0

User is online   Danukem 

  • Duke Plus Developer

#1610

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.
1

#1611

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.
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1612

View Post1337DirtAlliance, 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.
0

#1613

Tried that for both the beach and my custom girl and still nothing. Same { errors
0

User is online   Danukem 

  • Duke Plus Developer

#1614

View Post1337DirtAlliance, on 21 March 2015 - 11:13 PM, said:

Tried that for both the beach and my custom girl and still nothing. Same { errors


Have you tried using a debug build to see if it gives you more information in the log file when it fails?
0

Share this topic:


  • 124 Pages +
  • « First
  • 52
  • 53
  • 54
  • 55
  • 56
  • 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