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

Jump to content

  • 120 Pages +
  • « First
  • 28
  • 29
  • 30
  • 31
  • 32
  • 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

#871

View PostFox, on 26 July 2012 - 01:36 PM, said:

But that's kind of lame, since it only checks if the health is not the same.


I know it's lame, but he has good reason to not want to modify the enemy code. Once you start doing that, your code becomes much less portable.
1

User is online   Reaper_Man 

  • Once and Future King

#872

Precisely.
0

User is offline   Hendricks266 

  • Weaponized Autism

  #873

View PostTrooper Dan, on 26 July 2012 - 12:06 PM, said:

I think the problem is that EVENT_GAME code is executed after the actor's code is executed. Actors typically already have a check for ifhitweapon, which resets htextra. By the time your EVENT_GAME code is executed, the damage has already been processed.

That's a serious problem for mutators, and unfortunately I can't think of a simple solution. Perhaps a second EVENT_GAME should be added before the actor block executes, but that seems like overkill for a corner case like this.

Do you know of any other instances where there is something you cannot do in EVENT_GAME that you can effectively only do in actor code?
0

User is online   Reaper_Man 

  • Once and Future King

#874

Assuming that making a change so EVENT_GAME executes before instead of after is out of the question, I don't think having something like EVENT_PREGAME would be used exclusively for damage handling. Having both would (correct me if I'm wrong in my thinking here) allow you to set a variable in PREGAME, allow it to get modified during the actor's code, and then used/checked/whatever during GAME. But even if that's not the case, the more tools for modders the better, right?
0

User is online   Reaper_Man 

  • Once and Future King

#875

Another question: How should I properly access actors that are spawned via respawns? Neither EVENT_SPAWN nor EVENT_EGS seem to grab them.
0

User is offline   Danukem 

  • Duke Plus Developer

#876

View PostReaper_Man, on 27 July 2012 - 03:59 PM, said:

Another question: How should I properly access actors that are spawned via respawns? Neither EVENT_SPAWN nor EVENT_EGS seem to grab them.


onevent EVENT_EGS

ifspawnedby RESPAWN
{
// etc.


Works for me!
1

User is online   Reaper_Man 

  • Once and Future King

#877

Hmm you're right that works. Must be something else in my code that's treating map placed actors different than spawned actors. I'll dig deeper, thanks.

Okay you're partly right. The problem is that the picnum of the spawned sprite is the literal picnum, IE a spawned LIZTROOPJETPACK's picnum is 1725 and not 1680 as would be expected. Is this a bug, or do I need to add in every spawn variant of every enemy actor?

This post has been edited by Reaper_Man: 27 July 2012 - 05:05 PM

0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#878

Yes, you should add each instance.
0

User is online   Reaper_Man 

  • Once and Future King

#879

That sucks. =\
0

User is offline   Danukem 

  • Duke Plus Developer

#880

View PostReaper_Man, on 27 July 2012 - 04:41 PM, said:

Okay you're partly right. The problem is that the picnum of the spawned sprite is the literal picnum, IE a spawned LIZTROOPJETPACK's picnum is 1725 and not 1680 as would be expected.


It's not a bug; the behavior makes perfect sense. For example LIZTROOPJETPACK does not cactor into a regular LIZTROOP until it's actor code runs, but that can't happen until after EVENT_EGS.

It just takes a few moments to write code such as this:

		getactor[THISACTOR].picnum picnum
		switch picnum
		case LIZTROOP
		case LIZTROOPSTAYPUT
		case LIZTROOPSHOOT
		case LIZTROOPJETPACK
		case LIZTROOPRUNNING
		case LIZTROOPONTOILET
		case LIZTROOPJUSTSIT
		case LIZTROOPDUCKING
                // do whatever
                break
                case PIGCOP
                case PIGCOPDIVE
                case PIGCOPSTAYPUT
                // etc.

0

User is offline   Biturbo 

#881

Hello, can someone help me with this:

i need replace original crosshair by my own texture, but why is black color transparent?
For test i replaed original crosshair with black 64x64 bmp in .ART and in HRP with 64x64 black png.
But in game its transparent black, why? Is there any control of transparency of crosshair?

And how i can control if is crosshair off / on?
I know about event_displaycrosshair in HUD file, but how exactly it works?

This post has been edited by Biturbo: 04 August 2012 - 05:09 AM

0

User is offline   sedition 

#882

Is there a way to control the position of the main menu of the game. So I want to place it in the bottom left corner instead of having it in the middle of the screen.

I know, the problem would be the different screen resolutions, but can´t I just give it a %-value?
0

User is offline   Mblackwell 

  • Evil Overlord

#883

At the current time there's no ability to change the menus without editing the source code unfortunately.
0

User is offline   Biturbo 

#884

How i can simulate something like sector effector?

I placed my custom sprite in sector which i want do that effect of lighting. But there is problem, its working only for first sector, i need it for all sectors where is that sprite placed...
can someone help?

define LIGHTING_ICON 3589
gamevar timecounter 0 0
gamevar okay 0 1
gamevar sector_pos 0 0

onevent EVENT_DISPLAYROOMS

 ifrnd 0
 {
  ifrnd 64
  {
    soundonce THUNDER
    setvar okay 1
  }
 }

endevent

useractor notenemy LIGHTING_ICON
{
cstat 32768

getactor[THISACTOR].sectnum sector_pos

ifvare okay 1
{

setsector[sector_pos].floorshade 20
setsector[sector_pos].ceilingshade 20
addvar timecounter 1
setvar okay 1
}

ifvare timecounter 40
{
setsector[sector_pos].floorshade 30
setsector[sector_pos].ceilingshade 30
setvar timecounter 0
setvar okay 0
}

}
enda

0

User is offline   Jblade 

#885

You've made the gamevar sector_pos a global one - you'll need to change it to a per-actor variable by changing it's definition to this:
gamevar sector_pos 0 2

The wiki tells you different values you can set gamevars, but for the most part you'll be using 0 as a global var, 1 as a player var, and 2 as an actor var. You'll also want to change timecounter to a per actor var, judging by your code ;)

This post has been edited by James: 06 August 2012 - 06:39 AM

0

User is offline   Biturbo 

#886

View PostJames, on 06 August 2012 - 06:38 AM, said:

You've made the gamevar sector_pos a global one - you'll need to change it to a per-actor variable by changing it's definition to this:
gamevar sector_pos 0 2

The wiki tells you different values you can set gamevars, but for the most part you'll be using 0 as a global var, 1 as a player var, and 2 as an actor var. You'll also want to change timecounter to a per actor var, judging by your code ;)


Many Thanks i didnt know this (im just a new to .CON) but problem is it still doesnt work...

If i do this:

define LIGHTING_ICON 3589
gamevar timecounter 0 2
gamevar okay 0 0
gamevar sector_pos 0 2

onevent EVENT_DISPLAYROOMS

 ifrnd 0
 {
  ifrnd 64
  {
    soundonce THUNDER
    setvar okay 1
  }
 }

endevent

useractor notenemy LIGHTING_ICON
{
cstat 32768
getactor[THISACTOR].sectnum sector_pos

ifvare okay 1
{
setsector[sector_pos].floorshade 20
setsector[sector_pos].ceilingshade 20
addvar timecounter 1
}

ifvare timecounter 40
{
setsector[sector_pos].floorshade 30
setsector[sector_pos].ceilingshade 30
setvar timecounter 0
setvar okay 0
}

}
enda


Then it isnt working properly, first one sector goes dark and return back, later another one, but both never goes dark and return together.
I tried also this without that "setvar okay 0":

ifvare timecounter 40
{
setsector[sector_pos].floorshade 30
setsector[sector_pos].ceilingshade 30
setvar timecounter 0
}


and its really close to what i need, but still is there problem, when both sectors goes dark, they keep blinking...
So we are very close, just tell me someone what im doing bad ;) why they are blinking...
0

User is offline   Mblackwell 

  • Evil Overlord

#887

Your "okay" variable shouldn't be set by the effectors themselves. Since it's a global variable it's getting overridden each time. Set it to 1 or 0 in the APLAYER code.
0

User is offline   Biturbo 

#888

Ive tried but still its doesnt work ;)
cant you show me exactly i how can do it?
because ive tried many combinations of this + that aplayer code, but still it isnt working properly.
video is here: video
im trying to make own mod, something like slendergame.net with nice atmosphere, but first problem is these lighting, and another one is i dont know how control if is crosshair on or off.
I know maybe in some data or cfg file can be this information stored, but that isnt very useful because i need control it in .CON

I'd appreciate any help, thanks!

This post has been edited by Biturbo: 07 August 2012 - 05:34 AM

0

#889

For the crosshair http://wiki.eduke32.com/wiki/Crosshair Use this to disable it via CON. Once it is disabled, display a custom texture on the screen with a screen drawing command. http://wiki.eduke32.com/wiki/Scripting try and look at the bottom ;)
0

User is offline   Mblackwell 

  • Evil Overlord

#890

View PostBiturbo, on 07 August 2012 - 05:25 AM, said:

cant you show me exactly i how can do it?


gamevar thunder_count 0 0

gamevar runonce 0 2
gamevar default_cshade 0 2  // to store the original sector shade
gamevar default_fshade 0 2 // to store the original sector shade
gamevar new_cshade 0 2
gamevar new_fshade 0 2

useractor notenemy LIGHTING_ICON

    cstat 32768
    ifvare runonce 0 // we only want to store the shade at its default value
    {
        getsector[THISACTOR].floorshade default_fshade
        getsector[THISACTOR].ceilingshade default_cshade
        setvar runonce 1
    }


    ifvarg thunder_count 30 // if the counter is above a good value
    {
        setvarvar new_cshade default_cshade
        setvarvar new_fshade default_fshade
        
        subvar new_cshade 10 // subtract! lower numbers are brighter numbers
        subvar new_fshade 10
        ifvarg thunder_count 35 // I made two stages of brightness for the heck of it
        {
            subvar new_cshade 10
            subvar new_fshade 10
        }
        setsector[sector_pos].floorshade new_fshade
        setsector[sector_pos].ceilingshade new_cshade
    }
    else // otherwise just keep the default/original sector shade
    {
        setsector[THISACTOR].floorshade default_fshade
        setsector[THISACTOR].ceilingshade default_cshade
    }
    
enda

actor APLAYER

    ifvare thunder_count 0 ifrnd 16 // we only start counting sometimes
    {
        setvar thunder_count 1
    }
    else ifvarg thunder_count 0 // count as long as the var is more than 0
    {
        addvar thunder_count 1
        ifvarg thunder_count 40 // reset it when it goes over the max value we want
            setvar thunder_count 0
    }
    // rest of player code
    
enda


0

User is offline   Hendricks266 

  • Weaponized Autism

  #891

View Postrasmus thorup, on 07 August 2012 - 11:27 AM, said:

For the crosshair http://wiki.eduke32.com/wiki/Crosshair Use this to disable it via CON. Once it is disabled, display a custom texture on the screen with a screen drawing command. http://wiki.eduke32.com/wiki/Scripting try and look at the bottom ;)

That is circuitous. Use getuserdef[THISACTOR].crosshair only to see if the user has enabled or disabled the crosshair in their options. You should not change it because that would alter their preference.

Instead, utilize EVENT_DISPLAYCROSSHAIR. If you want to forcefully disable the crosshair, in that event, "setvar RETURN -1". If you only want to change the crosshair image, I added functionality so that all you have to do is set RETURN to the tilenum of the image you want to use. If you are doing anything more fancy than that, such as color palette or positioning changes, let me know and I will help you with that.
2

User is online   Reaper_Man 

  • Once and Future King

#892

View PostHendricks266, on 26 July 2012 - 06:21 PM, said:

That's a serious problem for mutators, and unfortunately I can't think of a simple solution. Perhaps a second EVENT_GAME should be added before the actor block executes, but that seems like overkill for a corner case like this.

Do you know of any other instances where there is something you cannot do in EVENT_GAME that you can effectively only do in actor code?

So hey, now that you've got your new computer, any chance of this happening soonish? I'm sort of bedridden post-surgery for the next couple of days, I'd love to be able to finish up that mutator I was working on. ;)
0

User is offline   Biturbo 

#893

Its possible to delete or disable some weapons or cheat codes?
or i need to edit eduke32.exe ?

This post has been edited by Biturbo: 02 September 2012 - 02:16 AM

0

User is online   Reaper_Man 

  • Once and Future King

#894

EVENT_PREGAME doesn't seem to cooperate with non-hitscan weapons. I used the following code:

onevent EVENT_PREGAME
{
	ifvarn sprite[THISACTOR].htextra -1
	{
		redefinequote 254 Actor (%d) Extra (%d) Htextra (%d) Owner (%d)
		qsprintf 254 254 THISACTOR sprite[THISACTOR].extra sprite[THISACTOR].htextra player[THISACTOR].i
		echo 254
	}
}
endevent


Shooting something with a hitscan weapon works fine:

Actor (448) Extra (24) Htextra (9) Owner (644)


But shooting them with anything else (freezer, RPG, etc.) only seems to output for spawned debris, gibs, and other effects. The original actor doesn't show up in the output.

Is this a bug, or am I doing things wrong?
0

#895

Just a quick question about stretching images on the screen. I made this code to display the background image of the menu in widescreen.

onevent EVENT_DISPLAYMENU
myospal 160 100 3281 0 1024 0
endevent


This works perfectly.

Now, I want to do this for the loadingscreen and the screen where Duke Nukem 3D pops up (#2493)
I already searched in the wiki for events but all I can find is EVENT_LOGO and EVENT_DISPLAYLOADINGSCREEN, but these are used to draw sprites on the background. So no luck with that.
Are there other events or are there some other tricks I can use.

Thanks in advance
0

User is offline   CruX 

#896

Tile 2493 is when the main menu is being displayed, so you're fine with that block of code. The other one you're looking for is GETLOADTILE.
*EDIT* My mistake about the first part. You're probably going to have to just replace that tile in the art files.

This post has been edited by EmericaSkater: 17 September 2012 - 08:00 AM

0

#897

View PostEmericaSkater, on 17 September 2012 - 07:50 AM, said:

Tile 2493 is when the main menu is being displayed, so you're fine with that block of code. The other one you're looking for is GETLOADTILE.
*EDIT* My mistake about the first part. You're probably going to have to just replace that tile in the art files.


Already replaced the tiles, even with widescreen ones. But he automaticly scales them to 4:3 size. I can't add the myospal or rotatesprite command to GETLOADTILE? Or am I wrong...
0

User is offline   Mblackwell 

  • Evil Overlord

#898

http://wiki.eduke32....ENT_GETLOADTILE is for the background tile itself.

http://wiki.eduke32....AYLOADINGSCREEN can be used to draw on top of everything else. You could make everything blank and then draw whatever you wanted.
0

#899

View PostMblackwell, on 17 September 2012 - 08:25 AM, said:

http://wiki.eduke32....ENT_GETLOADTILE is for the background tile itself.

http://wiki.eduke32....AYLOADINGSCREEN can be used to draw on top of everything else. You could make everything blank and then draw whatever you wanted.


Yeah, I knew that, but I have some idea's ;) Thanks for helping out!
0

#900

How to make a piercing projectile (rpg-workslike) like the cannon ball in DukePlus ?
0

Share this topic:


  • 120 Pages +
  • « First
  • 28
  • 29
  • 30
  • 31
  • 32
  • 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