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

Jump to content

  • 115 Pages +
  • « First
  • 83
  • 84
  • 85
  • 86
  • 87
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

User is offline   Danukem 

  • Duke Plus Developer

#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 offline   Mark 

#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   Danukem 

  • Duke Plus Developer

#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 offline   Mark 

#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. :)

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

0

User is offline   Mark 

#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   F!re-Fly 

#2526

View PostMark, 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 !!! :)
0

User is offline   Zaxtor 

#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

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

0

User is offline   Salvation 

#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   Danukem 

  • Duke Plus Developer

#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 

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

User is offline   Danukem 

  • Duke Plus Developer

#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 

#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
5

User is offline   Perro Seco 

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

User is offline   Mark 

#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   Danukem 

  • Duke Plus Developer

#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 offline   Mark 

#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   Danukem 

  • Duke Plus Developer

#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 offline   Mark 

#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

#2539

Hi,

I want to know if there is a code for Eduke32, for manual pistol reload?

If so what are the Eduke32 equivalents of these:

actor APLAYER
onevent EVENT_DOFIRE
onevent EVENT_TURNAROUND
onevent EVENT_RESETPLAYER
onevent EVENT_PRESSEDFIRE
onevent EVENT_DISPLAYREST


I got confused trying to make the code from "How to manually reload" tutorial work with Eduke32. It works in Duke 3D CON's
0

User is offline   Danukem 

  • Duke Plus Developer

#2540

View PostGordon Freeman, on 28 August 2019 - 11:51 AM, said:

I got confused trying to make the code from "How to manually reload" tutorial work with Eduke32. It works in Duke 3D CON's


The tutorial you refer to: https://wiki.eduke32...manually_reload

IS for EDuke32 already. You've got it backwards -- you can use it in EDuke32 CONs but not in regular Duke 3D CONs.
0

#2541

OK,

That's what happens when you are a total noob.
0

#2542

My apologies for the double post.

Can someone post a script example of how to add manual reload to the shotgun, as an example.

Its easier for me to learn by example.

I'm learning, but it is a very slow process...
0

User is offline   Danukem 

  • Duke Plus Developer

#2543

It's not exactly clear what you want. How many times do you want the shotgun to be able to fire before you have to reload it? Do you want the shotgun to stop working when it's empty until the player presses a different key to reload it? Should the reload start automatically when the shotgun is empty, and only be manual if it is partially depleted?

EDIT: Anyway, I coded a manual reload shotgun for DukePlus, and I think AMC TC has several like that. It will be hard for you to find the relevant code by searching through the CONs, but I don't have time to write new code.

This post has been edited by Trooper Dan: 30 August 2019 - 04:01 PM

0

#2544

View PostTrooper Dan, on 30 August 2019 - 03:52 PM, said:

It's not exactly clear what you want. How many times do you want the shotgun to be able to fire before you have to reload it? Do you want the shotgun to stop working when it's empty until the player presses a different key to reload it? Should the reload start automatically when the shotgun is empty, and only be manual if it is partially depleted?

EDIT: Anyway, I coded a manual reload shotgun for DukePlus, and I think AMC TC has several like that. It will be hard for you to find the relevant code by searching through the CONs, but I don't have time to write new code.


I want the shotgun to reload after firing 8 rounds. I want the shotgun to stop working after it empties all 8 rounds, until i press the reload key. You don't have to write a new code, I will find it in the AMC TC or DukePlus, and make it work, somehow. Thank you for telling me, and also for help and patience with me.
0

User is offline   Mark 

#2545

.

Attached thumbnail(s)

  • Attached Image: happycoder.jpg

1

User is offline   F!re-Fly 

#2546

I invented air bubbles that Duke can pick up underwater. I wish I could make sure that the counter of the airleft value was stopped for a short time, before health declined again. When Duke picks medkits out of the water without problems, I would like to do the same underwater.
0

User is offline   MC84 

#2547

Can anyone shed some light on how different blending modes are implemented in eduke32? For instance transparent lights and lens flares that have an 'additive' property instead of just a straight transparency? I can only find info on fogpals on the eduke wiki. Thanks
0

#2548

Hello!
Is there a way to determine which frame of the animation is currently playing? This is necessary, for example, to synchronize the sound of steps with character animation. Or to make sure that the animation has finished playing.
0

User is offline   Danukem 

  • Duke Plus Developer

#2549

View PostMr. Alias Nameless, on 19 January 2020 - 11:51 PM, said:

Hello!
Is there a way to determine which frame of the animation is currently playing? This is necessary, for example, to synchronize the sound of steps with character animation. Or to make sure that the animation has finished playing.


https://wiki.eduke32...iki/Actioncount

ifactioncount and resetactioncount can be used to do what you want.
0

User is offline   F!re-Fly 

#2550

For my part, I planned different kinds of armor with well defined values. I wish I could make sure that the armor that is picked up only affects Duke's health when it reaches 100%.

For example a golden armor of 200hp, will keep the health always at 100%, until the armor runs out.

Last thing, I would also like to make sure that Duke cannot pick up another armor, until the special armor is used up below 100%.

This post has been edited by Firefly Trooper: 20 January 2020 - 10:13 AM

0

Share this topic:


  • 115 Pages +
  • « First
  • 83
  • 84
  • 85
  • 86
  • 87
  • 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