EDuke32 Scripting "CON coding help"
#1471 Posted 21 May 2014 - 05:37 AM
Then you need to add them to MUSICANDSFX sprites in the locations you want each individual sound.
#1472 Posted 21 May 2014 - 11:42 AM
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
#1473 Posted 21 May 2014 - 04:51 PM
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?
#1476 Posted 22 May 2014 - 12:55 PM
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.
#1477 Posted 23 May 2014 - 01:47 PM
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.
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
#1478 Posted 23 May 2014 - 06:56 PM
Commando Nukem, on 23 May 2014 - 01:47 PM, said:
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.
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
#1479 Posted 24 May 2014 - 05:57 AM
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.
#1480 Posted 24 May 2014 - 09:06 AM
1337DirtAlliance, on 24 May 2014 - 08:25 AM, said:
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
#1481 Posted 07 July 2014 - 06:18 PM
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?
#1482 Posted 07 July 2014 - 11:45 PM
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.
#1483 Posted 08 July 2014 - 06:07 PM
Also there is an http://wiki.eduke32..../EVENT_SAVEGAME but I'm not sure if setting it to RETURN -1 would disable it.
#1484 Posted 08 July 2014 - 06:14 PM
#1485 Posted 23 July 2014 - 09:44 AM
I need a code that will cause every level in an episode to start with only 48 bullets of pistol and 100 health.
#1486 Posted 26 July 2014 - 04:29 AM
Anvil, on 23 July 2014 - 09:44 AM, said:
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
#1488 Posted 26 July 2014 - 08:37 AM
#1489 Posted 07 August 2014 - 06:51 AM
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
#1490 Posted 07 August 2014 - 07:31 AM
#1491 Posted 27 August 2014 - 05:13 AM
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
#1495 Posted 27 August 2014 - 06:58 PM
... Why can't we use CON variables in Def...
This post has been edited by The Angry Kiwi: 27 August 2014 - 06:59 PM
#1496 Posted 27 August 2014 - 08:16 PM
The Angry Kiwi, on 27 August 2014 - 06:58 PM, said:
It's a content definition markup language, not a scripting language.
#1497 Posted 14 September 2014 - 08:33 AM
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.
#1498 Posted 14 September 2014 - 09:12 AM
Mark., on 14 September 2014 - 08:33 AM, said:
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.
#1499 Posted 14 September 2014 - 09:17 AM
#1500 Posted 14 September 2014 - 10:10 AM
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