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

Jump to content

  • 119 Pages +
  • « First
  • 48
  • 49
  • 50
  • 51
  • 52
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

User is offline   Hendricks266 

  • Weaponized Autism

  #1471

http://wiki.eduke32....iki/Definesound

Then you need to add them to MUSICANDSFX sprites in the locations you want each individual sound.
1

User is offline   OpenMaw 

  • Judge Mental

#1472

Having an issue.

NEVERMIND! Fixed dat business. Used the other form of flashlight code by Darkus which avoids this issue.

Woo.

This post has been edited by Commando Nukem: 21 May 2014 - 12:27 PM

0

User is offline   OpenMaw 

  • Judge Mental

#1473

How does one get the player's name?

I want to display the player's name on screen as part of a new HUD i'm working on. So, whatever the name is for multiplayer, will be displayed on the screen. I can't find anything in the Wiki about this. "Name" was the closest I could find, it and it doesn't do anything.

This is what my code looks like right now:





gamevar NAME 0 1

definequote 254 PLAYERNAME  // Just standin definition.

onevent EVENT_DISPLAYREST
{
getplayer[THISACTOR].Name NAME                                       // Name
redefinequote 254 %d                                                                // Changes quote to display whatever we tell it.
qsprintf 254 254 NAME                                                              // Print does it's mapping voodoo.
gametext STARTALPHANUM 320 10 254 0 0 0 0 0 xdim ydim
}
endevent



I tried using Idplayers too, and it didn't work either. Is there just no way to do this?
0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1474

getpname
1

User is offline   OpenMaw 

  • Judge Mental

#1475

View PostFox, on 21 May 2014 - 05:06 PM, said:

getpname


You rock.
0

User is offline   Hendricks266 

  • Weaponized Autism

  #1476

If you have def files, you might as well use tilefromtexture instead of messing with EDITART.

Animated gifs don't automatically become animations in ART. You have to define the tiles separately and set the ART animation value (from defs, the animtilerange command).

The CON files are a scripting language containing elements from C and assembly, so there is no simple solution to what you ask. You just need to program it, and if you don't know programming, learning is the only way.
0

User is offline   OpenMaw 

  • Judge Mental

#1477

So i'm working on testing out an idea. I've got other things working more or less the way I want them, but there's something i'm building up to a piece at a time.

Right here, I want to project onto the screen the POV of another object. In this instance a pigcop with a palette of 200. I'm sure this will come off as a bit amusing to some of you, but i'm honestly stumped. Posted Image




gamevar ptemp 0 2
gamevar ptemp2 0 2

//  ('squadmate') Camera

onevent EVENT_DISPLAYREST
{
	getactor[THISACTOR].picnum ptemp
		ifvare ptemp PIGCOP
			getactor[THISACTOR].pal ptemp2
				ifvare ptemp2 200
				getactor[THISACTOR].x x
				getactor[THISACTOR].y y
				getactor[THISACTOR].z z
				getactor[THISACTOR].ang ang
				// getactor[THISACTOR].horiz horiz
				// getactor[THISACTOR].horizoff temp
				// addvarvar horiz temp
				updatesectorz x y z sect
showviewunbiased x y z ang horiz sect 16 41 56 69
}
endevent


Obviously, this is not working. Oh, It does project a view onto the screen, but it's behind the player.

I'm almost certain I need to call the pig stuff in an EVENT_LOADACTOR and then reference it into the EVENT_DISPLAYREST stuff. I was trying that before and it either wasn't showing up, or was just showing a view from the player's feet.

Note, I commented out a few lines that weren't working (for obvious reasons, they reference a camera setup for a player position.)


So, can someone point me in the right direction?

This post has been edited by Commando Nukem: 23 May 2014 - 01:48 PM

0

User is offline   Mblackwell 

  • Evil Overlord

#1478

View PostCommando Nukem, on 23 May 2014 - 01:47 PM, said:

So i'm working on testing out an idea. I've got other things working more or less the way I want them, but there's something i'm building up to a piece at a time.

Right here, I want to project onto the screen the POV of another object. In this instance a pigcop with a palette of 200. I'm sure this will come off as a bit amusing to some of you, but i'm honestly stumped. Posted Image




gamevar ptemp 0 2
gamevar ptemp2 0 2

//  ('squadmate') Camera

onevent EVENT_DISPLAYREST
{
	getactor[THISACTOR].picnum ptemp
		ifvare ptemp PIGCOP
			getactor[THISACTOR].pal ptemp2
				ifvare ptemp2 200
				getactor[THISACTOR].x x
				getactor[THISACTOR].y y
				getactor[THISACTOR].z z
				getactor[THISACTOR].ang ang
				// getactor[THISACTOR].horiz horiz
				// getactor[THISACTOR].horizoff temp
				// addvarvar horiz temp
				updatesectorz x y z sect
showviewunbiased x y z ang horiz sect 16 41 56 69
}
endevent


Obviously, this is not working. Oh, It does project a view onto the screen, but it's behind the player.

I'm almost certain I need to call the pig stuff in an EVENT_LOADACTOR and then reference it into the EVENT_DISPLAYREST stuff. I was trying that before and it either wasn't showing up, or was just showing a view from the player's feet.

Note, I commented out a few lines that weren't working (for obvious reasons, they reference a camera setup for a player position.)


So, can someone point me in the right direction?


DISPLAYREST is always called from the player, so it will never be true.

What you want is this

gamevar temp 0 2
gamevar camera_exist -1 1
gamevar camera_x 0 1
gamevar camera_y 0 1
gamevar camera_z 0 1
gamevar camera_horiz 0 1
gamevar camera_sect 0 1

onevent EVENT_DISPLAYREST

    ifvarn camera_exist -1        // we shouldn't display if there's no existing camera actor
        showviewunbiased camera_x camera_y camera_z camera_ang camera_horiz camera_sect 16 41 56 69

endevent

onevent EVENT_GAME
    getactor[THISACTOR].picnum temp
    ifvare temp PIGCOP
    {        
        getactor[THISACTOR].pal temp
        ifvarvare camera_exist THISACTOR ifvarn temp 200 // if the pal is altered somehow we can remove it as the camera
            setvar camera_exist -1
        else ifvare temp 200
        {
            getactor[THISACTOR].x camera_x
            getactor[THISACTOR].y camera_y
            getactor[THISACTOR].z camera_z
            subvar camera_z 8192 // offset until you get to eye level
            getactor[THISACTOR].ang camera_ang
            getactor[THISACTOR].sectnum camera_sect
            setvar camera_horiz 100
            setvarvar camera_exist THISACTOR
        }
    }
endevent

1

User is offline   OpenMaw 

  • Judge Mental

#1479

Ohhh! Thank you. Works like a dream.


Thank you for commenting it too. I'm honestly trying to find my way through and learn CON, as much as lack the natural talent for coding. Posted Image
0

User is offline   OpenMaw 

  • Judge Mental

#1480

View Post1337DirtAlliance, on 24 May 2014 - 08:25 AM, said:

Mapster error log below

Error on line 8bit.def:11: expecting symbol, got "0}"
Error on line 8bit.def:13: expecting symbol, got "0}"


Def Code below

// Stripper00 (3504)
tilefromtexture 3504 { file "CustomT/8bit/3504.png" xoffset -2 }
tilefromtexture 3505 { file "CustomT/8bit/3505.png" xoffset -2 }
tilefromtexture 3506 { file "CustomT/8bit/3506.png" xoffset -2 }
tilefromtexture 3507 { file "CustomT/8bit/3507.png" xoffset -2 }
tilefromtexture 3508 { file "CustomT/8bit/3508.png" xoffset -2 }   	<<-- Line 11
animtilerange 3404 3508 2 2
                                                                                                <<-- Line 13
tilefromtexture 3509 { file "CustomT/8bit/3509.png" xoffset 0} 		// For some reason if I don't define the X they don't appear in the tiles listing.
tilefromtexture 3510 { file "CustomT/8bit/3510.png" xoffset -1 }
tilefromtexture 3511 { file "CustomT/8bit/3511.gif" xoffset 0}            


Tiles appear in mapster. But she doesn't move.


In the second group, you need a space between the 0 and }'s. :)

This post has been edited by Commando Nukem: 24 May 2014 - 09:07 AM

0

User is offline   Micky C 

  • Honored Donor

#1481

Yet another attempt to stick my head into the world of eduke scripting.

So as someone who has only ever messed around with structured coding (specifically, fortran and VBA). What are the main differences between that type of programming, and how it's implemented in eduke32? I take it it's more of an object-oriented situation?

While in fortran you can write a block of code like a subroutine, and call it anywhere you want and have it run under certain conditions and a certain number of times, I remember reading somewhere that all the con code runs all the time during the game? Seems a bit different.
Also how sensitive is the code to where its placed in a file?
0

User is offline   Jblade 

#1482

I think the best idea is to crack open the default GAME.CON and take a look around - apart from a bunch of values that need to be defined you could strip the majority of stuff out and the game would work fine. I don't code otherwise so I can't really compare it to any other languages I'm afraid, but I doubt you'll have any trouble coding (especially if you already know other languages)

I remember a conversation a while ago about disabling saving...anybody remember that or could shed some light on it? There's a particular level I want to disable saving on.
0

User is offline   Mblackwell 

  • Evil Overlord

#1483

It's like C and Java meet Visual Basic.


Also there is an http://wiki.eduke32..../EVENT_SAVEGAME but I'm not sure if setting it to RETURN -1 would disable it.
0

User is offline   Hendricks266 

  • Weaponized Autism

  #1484

There are comparisons to be made with assembly too--the strictly imperative style and the requirement for global-scope variables.
0

User is offline   Anvil 

#1485

Hello,
I need a code that will cause every level in an episode to start with only 48 bullets of pistol and 100 health.
0

User is offline   Chip 

#1486

 Anvil, on 23 July 2014 - 09:44 AM, said:

Hello,
I need a code that will cause every level in an episode to start with only 48 bullets of pistol and 100 health.


This should work:

onevent EVENT_RESETPLAYER
setplayer[THISACTOR].ammo_amount PISTOL_WEAPON 48
setplayer[THISACTOR].ammo_amount SHOTGUN_WEAPON 0
setplayer[THISACTOR].ammo_amount CHAINGUN_WEAPON 0
setplayer[THISACTOR].ammo_amount RPG_WEAPON 0
setplayer[THISACTOR].ammo_amount HANDBOMB_WEAPON 0
setplayer[THISACTOR].ammo_amount SHRINKER_WEAPON 0
setplayer[THISACTOR].ammo_amount GROW_WEAPON 0
setplayer[THISACTOR].ammo_amount DEVISTATOR_WEAPON 0
setplayer[THISACTOR].ammo_amount TRIPBOMB_WEAPON 0
setplayer[THISACTOR].ammo_amount FREEZE_WEAPON 0

setplayer[THISACTOR].gotweapon SHOTGUN_WEAPON 0
setplayer[THISACTOR].gotweapon CHAINGUN_WEAPON 0
setplayer[THISACTOR].gotweapon RPG_WEAPON 0
setplayer[THISACTOR].gotweapon HANDBOMB_WEAPON 0
setplayer[THISACTOR].gotweapon SHRINKER_WEAPON 0
setplayer[THISACTOR].gotweapon GROW_WEAPON 0
setplayer[THISACTOR].gotweapon DEVISTATOR_WEAPON 0
setplayer[THISACTOR].gotweapon TRIPBOMB_WEAPON 0
setplayer[THISACTOR].gotweapon FREEZE_WEAPON 0

setplayer[THISACTOR].last_extra 100
endevent

0

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1487

I suppose the armor and inventory should also be reset.
0

User is online   Danukem 

  • Duke Plus Developer

#1488

I don't think that setting last_extra on the player will work. I'm pretty sure you need to set extra on the player sprite.
1

User is offline   Anvil 

#1489

I've found the code I've been looking for:

 Hendricks420, on 17 June 2013 - 11:15 PM, said:

gamevar temp 0 0

onevent EVENT_ENTERLEVEL
getplayer[THISACTOR].i temp
setactor[temp].extra MAXPLAYERHEALTH
setplayer[THISACTOR].shield_amount 0
setplayer[THISACTOR].gotweapon PISTOL_WEAPON 1
setplayer[THISACTOR].gotweapon SHOTGUN_WEAPON 0
setplayer[THISACTOR].gotweapon CHAINGUN_WEAPON 0
setplayer[THISACTOR].gotweapon RPG_WEAPON 0
setplayer[THISACTOR].gotweapon HANDBOMB_WEAPON 0
setplayer[THISACTOR].gotweapon SHRINKER_WEAPON 0
setplayer[THISACTOR].gotweapon DEVISTATOR_WEAPON 0
setplayer[THISACTOR].gotweapon TRIPBOMB_WEAPON 0
setplayer[THISACTOR].gotweapon FREEZE_WEAPON 0
setplayer[THISACTOR].gotweapon GROW_WEAPON 0
setplayer[THISACTOR].ammo_amount PISTOL_WEAPON 48
setplayer[THISACTOR].ammo_amount SHOTGUN_WEAPON 0
setplayer[THISACTOR].ammo_amount CHAINGUN_WEAPON 0
setplayer[THISACTOR].ammo_amount RPG_WEAPON 0
setplayer[THISACTOR].ammo_amount HANDBOMB_WEAPON 0
setplayer[THISACTOR].ammo_amount SHRINKER_WEAPON 0
setplayer[THISACTOR].ammo_amount DEVISTATOR_WEAPON 0
setplayer[THISACTOR].ammo_amount TRIPBOMB_WEAPON 0
setplayer[THISACTOR].ammo_amount FREEZE_WEAPON 0
setplayer[THISACTOR].ammo_amount GROW_WEAPON 0
setplayer[THISACTOR].boot_amount 0
setplayer[THISACTOR].firstaid_amount 0
setplayer[THISACTOR].heat_amount 0
setplayer[THISACTOR].holoduke_amount 0
setplayer[THISACTOR].jetpack_amount 0
setplayer[THISACTOR].scuba_amount 0
setplayer[THISACTOR].steroids_amount 0
endevent


1

User is offline   Fox 

  • Fraka kaka kaka kaka-kow!

#1490

I would recommend to use EVENT_RESETPLAYER instead since it's syncronized.
0

User is offline   The Commander 

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

#1491

What is the correct way to display models on screen.
I was trying to use rotatesprite in DISPLAYREST but it just displays the dummy tile.

This post has been edited by The Angry Kiwi: 27 August 2014 - 05:13 AM

0

User is offline   Mblackwell 

  • Evil Overlord

#1492

http://wiki.eduke32...._Language#model

Look under hud.
0

User is offline   The Commander 

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

#1493

Thank you kind sir.
0

User is offline   Mblackwell 

  • Evil Overlord

#1494

You are quite welcome!
0

User is offline   The Commander 

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

#1495

Now to work out how to set the addang to some sort of var so that I can rotate it constantly.
... Why can't we use CON variables in Def...

This post has been edited by The Angry Kiwi: 27 August 2014 - 06:59 PM

0

User is offline   Hendricks266 

  • Weaponized Autism

  #1496

 The Angry Kiwi, on 27 August 2014 - 06:58 PM, said:

... Why can't we use CON variables in Def...

It's a content definition markup language, not a scripting language.
0

User is offline   Mark 

#1497

As usual, without an example to look at in the Wiki I can't figure out how to do the following...

I need to stop sound numbers 494 and 496 when the player enters sector number 162. I have multiple maps that have sector number 162 but the 2 sounds to stop will only be playing in 1 of the maps so I don't have to worry about that part. I see the stopsound command in the Wiki but I don't know how to use the getsector command or whatever else will be needed for sector detection and pass it along to the stopsound command.
0

User is online   Danukem 

  • Duke Plus Developer

#1498

 Mark., on 14 September 2014 - 08:33 AM, said:

As usual, without an example to look at in the Wiki I can't figure out how to do the following...

I need to stop sound numbers 494 and 496 when the player enters sector number 162. I have multiple maps that have sector number 162 but the 2 sounds to stop will only be playing in 1 of the maps so I don't have to worry about that part. I see the stopsound command in the Wiki but I don't know how to use the getsector command or whatever else will be needed for sector detection and pass it along to the stopsound command.


I don't think it's a good idea to have specific sector numbers in your code. The number could change (e.g. if you deleted the sector and then re-created it because of a problem with the map) and then the code wouldn't work.

There are several different ways of doing what you want. You could place a sprite in the sector which is coded to stop the sounds, for example. Something like this:

useractor notenemy SOUNDSTOPPER 0

ifvarvare sprite[THISACTOR].sectnum player[THISACTOR].cursectnum
{
  stopsound 494 
  stopsound 496
}
enda


Obviously you have to define "SOUNDSTOPPER" as some tile number and then place the tile in the sector. You might also want to make it invisible (either in mapster or using code). And if you want the sounds to be able to play while the player is in that sector but after he arrives, then you would need a little more code to make that distinction. There might be a problem with the actor not waking up fast enough and the sounds starting to play -- make sure that the actor is in line of sight to the player before he enters the sector.
1

User is offline   Mark 

#1499

Sounds like it should work. I'll give it a try when I'm done snacking on my delicious cheese and crackers. :)
0

User is offline   Mark 

#1500

It works fine. It would be great if the sounds faded instead of shutting off abruptly, but it gets the job done and made the affected area much easier to hear the other softer backround sounds.

It was a problem at first until I realised I gave you 494 and 496 instead of the actual 394 and 396 :)

edit: If there is an easy addition to the previous code to put a delay of a few seonds before shutting down the sounds I could time it to the autoclosing of the doors to that area. Otherwise maybe its possible through the use of a touchplate and masterswitch with delay to spawn the new soundstopper sprite? No, there would be a chance the player moves out of that sector before the actor spawns.

This post has been edited by Mark.: 14 September 2014 - 10:26 AM

0

Share this topic:


  • 119 Pages +
  • « First
  • 48
  • 49
  • 50
  • 51
  • 52
  • 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