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

Jump to content

Hide message Show message
Welcome to the Duke4.net Forums!

Register an account now to get access to all board features. After you've registered and logged in, you'll be able to create topics, post replies, send and receive private messages, disable the viewing of ads and more!

  • 85 Pages +
  • « First
  • 83
  • 84
  • 85
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

User is offline   Trooper Dan 

  • Duke Plus Developer
  • 3,950

#2521

It sounds like you pasted the code into the middle of a state or event or something. See what happens if you remove the actor, then paste it in at the absolute bottom of the SUBURBS.CON file.
0

User is online   Mark 

  • Honored Donor
  • 2,942

#2522

Thats where it is now. After the enda of the previous actor. I triple checked to make sure there wasn't an extra enda somewhere in the middle of the dog code. There wasn't. And this dog code works fine in Graveyard. There has to be a simple explanation of something I did wrong elsewhere to cause this seemingly impossible problem.

This post has been edited by Mark: 08 February 2019 - 01:50 PM

0

User is offline   Trooper Dan 

  • Duke Plus Developer
  • 3,950

#2523

Try putting an extra carriage return at the end of the file. Maybe what the error is saying is that it could not find the "enda" for the actor, and maybe it's not reading the last line for some reason.
0

User is online   Mark 

  • Honored Donor
  • 2,942

#2524

I just found the problem. The only thing I did when transferring the code to Suburbs was comment out an attack sound that isn't in the assets folder yet. The damn sound line had a brace after the sound command. Silly me. :wallbash:

This post has been edited by Mark: 08 February 2019 - 01:58 PM

0

User is online   Mark 

  • Honored Donor
  • 2,942

#2525

I had a laugh when I uncommented that sound in the dog code. Instead of a dog bite sound the dog was saying "eat lead", one of the lines from the thugs in the game when they shoot.
0

User is offline   Firefly_Trooper 

  • 47

#2526

 Mark, on 09 February 2019 - 10:24 AM, said:

I had a laugh when I uncommented that sound in the dog code. Instead of a dog bite sound the dog was saying "eat lead", one of the lines from the thugs in the game when they shoot.


Eat lead ? OUAF OUAF !!! :lol:
0

User is offline   Zaxtor 

  • 1,761

#2527

Is there a code to reduce a little bit how how far the player can look up or down.?

Like changing the limit a bit (depending how you set it)

Default is

299 is looking all the way up and -99 way down.

But making example a new limit in the horiz thing

Trequonia TC's Status:
Levels : 100% done - Textures : 100% done - Sounds : 100% done - Musics :100% done
Mod is finished, going to test it.
Trequonia's Official website

This post has been edited by Zaxtor: 17 April 2019 - 11:42 PM

0

User is offline   Salvation 

  • 3

#2528

I'm having a problem with getting reload -button work with Chaingun. By using eduke32 wiki i was able to code succesfully manual reload for the pistol. However my next plan was to code manual reload for chaingun cannon (weapon nr. 3).

It wont work: Each time i select weapon 3 it starts automatically shooting, making impossible to switch weapon or do anything... it just shoots until there is no ammunition left. The everything related to M4 is actually chaingun cannon on the code that i pasted down there. The pistol and its manual reload function works properly, however, chaingun doesn't.


Here is the code for M4

gamevars:

// M4 RELOAD
gamevar M4AMMO 0 1
gamevar KICKBACK 0 1
gamevar M4WEAPON 0 1
gamevar M4MAGAZINE 0 1
gamevar PERPLAYER2 0 1

gamevar WEAPON3_CLIP 0 GAMEVAR_PERPLAYER



Here is for the GAME.CON:

actor APLAYER MAXPLAYERHEALTH PSTAND 0 0

getplayer[THISACTOR].ammo_amount PWEAPON M4AMMO // the player's pistol ammo

ifvare PWEAPON 3 // if the player has the pistol selected...
  {
    ifvarl M4MAGAZINE 1 // and his magazine count is at zero...
    {
      getplayer[THISACTOR].weapon_pos PERPLAYER2
      
      ifvarn PERPLAYER2 0
        break // if he has a weapon that's lowering off screen, break
      else ifvarl M4AMMO 1
        break
      else // otherwise, if he has ammo for the pistol, start the reloading anim
      {
        setplayer[THISACTOR].reloading 1
        setplayer[THISACTOR].kickback_pic 4
      }
    }
      
    ifvare KICKBACK 5 // if the reloading animation is on its second frame...
    {
      ifvarg M4AMMO 29 // if the player has at least twelve pistol rounds left,
        setvar M4MAGAZINE 30 // then set his magazine counter to a full magazine
      else
        setvarvar M4MAGAZINE M4AMMO // otherwise set the magazine counter equal to his remaining ammo
    }
  }


onevent EVENT_LOOKLEFT 

  setvar RETURN -1 // disable the event
  ifvare PWEAPON 3 // if the player has the pistol armed
  {
    ifvare M4MAGAZINE 30 // and his magazine is full, break
      break
    else ifvarvare M4MAGAZINE M4AMMO // if his magazine is equal to his pistol ammo, break
      break
    else // otherwise, start the reloading sequence
    {
      setplayer[THISACTOR].reloading 1
      setplayer[THISACTOR].kickback_pic 4
    }
  }

endevent

onevent EVENT_PRESSEDFIRE // when the player presses the fire button...

  ifvare PWEAPON 3 // and he has the pistol armed...
    ifvarl M4MAGAZINE 1
      setvar RETURN -1 // if his magazine is at zero, disable the firing key

endevent

onevent EVENT_DISPLAYREST
ifvare player[THISACTOR].curr_weapon 3
{
 digitalnumberz 2930 280 175 M4MAGAZINE 0 0 0 0 0 xdim ydim 50000 // display the magazine count at a slightly smaller size (50000) next to the ammo
}
endevent

onevent EVENT_DOFIRE 

  ifvare PWEAPON 3 // if the player has the pistol selected when he fires a projectile...
    ifvarg M4MAGAZINE 0
      subvar M4MAGAZINE 1 // subtract 1 from the magazine count, unless it's already at zero

endevent



Should i also paste the pistol manual reload -code?
0

User is offline   Trooper Dan 

  • Duke Plus Developer
  • 3,950

#2529

Quote

ifvarl M4MAGAZINE 1 // and his magazine count is at zero...
{
getplayer[THISACTOR].weapon_pos PERPLAYER2

ifvarn PERPLAYER2 0
break // if he has a weapon that's lowering off screen, break
else ifvarl M4AMMO 1
break
else // otherwise, if he has ammo for the pistol, start the reloading anim

{
setplayer[THISACTOR].reloading 1
setplayer[THISACTOR].kickback_pic 4
}

}



Looking at the block I highlighted above: It doesn't do anything to change the conditions leading up to it, so won't it just keep setting kickback_pic to 4 every tic? You probably need to make your own variable to count out your reload sequence, or at least check whether reloading is already non zero before telling it to start a reload.
0

User is offline   Perro Seco 

  • 263

#2530

I managed to create an actor that attacks another thanks to this tutorial, but I have a question: how can I check if one is in sight of the other? I mean, check if there's a wall between them, for example.

Posted Image
0

User is offline   Trooper Dan 

  • Duke Plus Developer
  • 3,950

#2531

For visibility checks, you can use canseespr


The downside is that visibility doesn't always mean accessibility -- for example, if one actor sees another through an unbreakable window. So I use hitscan with an appropriate clipmask instead (although that is much harder to set up).
1

User is offline   Perro Seco 

  • 263

#2532

Thanks a lot! Fortunately, there are no unbreakable windows in the areas these actors are.

I'm using all Tekwar civilians to bring some life to the urban levels of my TC. One of them includes a shooting animation, so I used it to make her defend against any player attacks, and if you change the sprite palette to 3, she will also attack other civilians randomly. Ideal behaviour for chaotic city levels. :D

Posted Image

Posted Image
5

User is offline   Perro Seco 

  • 263

#2533

View PostTrooper Dan, on 19 November 2018 - 06:22 PM, said:

You could always use startlevel after the bonus screen, right as the game is about to load the next regular level.

Late as always, but I managed to create my own secret level button. This is what I got right now inside its code:

ifpdistl 1024 ifhitspace ifp palive ifp pfacing ifcansee ifvare SECLV 0
{
  lockplayer 12 setplayer[THISACTOR].timebeforeexit 8
  ifvare VOLUME 0 setvar SECLV 5 else ifvare VOLUME 1 setvar SECLV 6 else setvar SECLV 7
}


And inside EVENT_DISPLAYBONUSSCREEN I placed this line:

ifvarn SECLV 0 { setuserdef[THISACTOR].level_number SECLV setvar SECLV 0 }


SECLV is a gamevar that holds the secret level's number. I tried with startlevel after the bonus screen as you suggested, but it didn't work; the level name was correctly shown in the loading screen, but then the loaded level was another different.

Posted Image
1

User is online   Mark 

  • Honored Donor
  • 2,942

#2534

When you press the escape key to exit a map and bring up the menu, a different sound plays each time. How would I define it to only one sound of my choosing? Also, what sound is being used when you scroll thru menu selections? I want to sub a new one for that too.

This post has been edited by Mark: 12 July 2019 - 03:35 PM

0

User is offline   Trooper Dan 

  • Duke Plus Developer
  • 3,950

#2535

It's hardcoded to randomly play one of certain sound numbers. You can either code a hack which will involve intervening in EVENT_SOUND when one of the escape sounds starts to play and that particular menu is up, OR you can simply replace all of the sound numbers that can play during escape with the one sound you want. Then re-assign any "lost" sounds to other sound numbers.
1

User is online   Mark 

  • Honored Donor
  • 2,942

#2536

I found 2 little snippets of code in my "con tricks" folder. One or both should get me what I need. One is detecting if a certain menu is open and the other is an example of how to use event_sound. Sometimes I forget I have that folder. Your post steered me in the right direction. Thanks.
0

User is offline   Trooper Dan 

  • Duke Plus Developer
  • 3,950

#2537

I don't know if the sound starts to play before or after the menu number is set -- if it's before, then the menu won't be up in EVENT_SOUND and you'll need to use stopsound in the player actor or in a menu event.
0

User is online   Mark 

  • Honored Donor
  • 2,942

#2538

It plays after the menu starts. I've got it working. The hardest part of the whole process was determining which sound files were playing during menus.
1

Share this topic:


  • 85 Pages +
  • « First
  • 83
  • 84
  • 85
  • You cannot start a new topic
  • You cannot reply to this topic


All copyrights and trademarks are property of their respective owners. Instead of reading this text, you could be playing Ion Fury! ;) © 2019 Voidpoint, LLC

Enter your sign in name and password


Sign in options