
EDuke32 Scripting "CON coding help"
#2694 Posted 02 March 2021 - 09:03 AM
#2695 Posted 03 March 2021 - 01:47 PM
anyway, unrelated question, is it possible to have an actor play a music file ( .ogg or midi ) i need this for purposes

#2696 Posted 03 March 2021 - 02:05 PM
jimbob, on 03 March 2021 - 01:47 PM, said:

If you want it to be specifically defined as music and not a sound, then use one of these commands:
https://wiki.eduke32...wiki/Starttrack
#2697 Posted 04 March 2021 - 08:06 AM
i would prefer if it could be used as a sound, what im trying to do is make a functional record player that plays back X amount of musical tracks depending on how often you use it, i could use short samples liek say 30 seconds but even that in half decent audio in WAV requires a lot of space, so if i could play a midi file of .ogg file from that actor as a sound comming from a 'recordplayer' that would be pretty neat.
#2698 Posted 04 March 2021 - 07:36 PM
jimbob, on 04 March 2021 - 08:06 AM, said:
i would prefer if it could be used as a sound, what im trying to do is make a functional record player that plays back X amount of musical tracks depending on how often you use it, i could use short samples liek say 30 seconds but even that in half decent audio in WAV requires a lot of space, so if i could play a midi file of .ogg file from that actor as a sound comming from a 'recordplayer' that would be pretty neat.
Alien Armageddon has a bunch of ogg samples loaded via `definesound` in attcons/ATTDEFS.CON
#2699 Posted 05 March 2021 - 04:15 AM
#2700 Posted 05 March 2021 - 11:35 AM
jimbob, on 05 March 2021 - 04:15 AM, said:
There's not much to look at in AA that would help you make a record player, he was just pointing out that you can use .ogg as a sound format.
A really simple way to do what you want would be to make a separate actor for each individual record and have them spread across a table with the record player in the middle. The player would walk up to the record they want to play, then the record would be an actor with code something like:
useractor notenemy RECORD1 0 ife RECORD1UNLOCK YES { cstat 32 ifp palive ifp pfacing ifpdistl 1280 ifhitspace ifcansee { stopsound REC2SOUND stopsound REC3SOUND soundonce REC1SOUND } enda
You would make the record sprites start as invisible in mapster, and define the sounds with a large radius so that they seemed to emanate from the entire room. You would declare a global var for each variable (RECORD1UNLOCK, RECORD1UNLOCK, etc) and set them to NO (NO = 0, YES = 0). Then all you have to do code some things in the game to make them turn to YES.
#2701 Posted 05 March 2021 - 12:51 PM
Danukem, on 05 March 2021 - 11:35 AM, said:
A really simple way to do what you want would be to make a separate actor for each individual record and have them spread across a table with the record player in the middle. The player would walk up to the record they want to play, then the record would be an actor with code something like:
useractor notenemy RECORD1 0 ife RECORD1UNLOCK YES { cstat 32 ifp palive ifp pfacing ifpdistl 1280 ifhitspace ifcansee { stopsound REC2SOUND stopsound REC3SOUND soundonce REC1SOUND } enda
You would make the record sprites start as invisible in mapster, and define the sounds with a large radius so that they seemed to emanate from the entire room. You would declare a global var for each variable (RECORD1UNLOCK, RECORD1UNLOCK, etc) and set them to NO (NO = 0, YES = 0). Then all you have to do code some things in the game to make them turn to YES.
right now i have one record on the gramophone player, the actor has a few tracks you can go to by pressing space, i have it set up like this.
action RECORDTRACK1 0 1 1 1 8 action RECORDTRACK2 0 1 1 1 8 action RECORDTRACK3 0 1 1 1 8 action RECORDTRACK4 0 1 1 1 8 action RECORDSTOPPED 0 1 1 1 8 move RECORDSPINNING 0 0 move RECORDSTOPSPINNING 0 0 useractor notenemy RECORDS 0 RECORDTRACK1 ifaction RECORDTRACK1 { soundonce BONUSMUSIC move RECORDSPINNING spin // ifactioncount 8 action RECORDTRACK1 ifpdistl 2048 ifp palive ifcansee ifhitspace { ifactioncount 4 action RECORDSTOPPED } } else ifaction RECORDSTOPPED { move RECORDSTOPPED stopsound BONUSMUSIC ifpdistl 2048 ifp palive ifcansee ifhitspace { ifactioncount 4 action RECORDTRACK1 } } enda
this way i can just make new actions for each track it has to play, and eventually either stop, like i have now, or loop back to track 1
note, the actor is set relative to the floor, so it is flat and spins right round like a record baby.
This post has been edited by jimbob: 05 March 2021 - 12:52 PM
#2702 Posted 07 March 2021 - 03:45 PM

#2703 Posted 16 March 2021 - 05:18 PM
This post has been edited by jimbob: 16 March 2021 - 05:19 PM
#2704 Posted 16 March 2021 - 05:47 PM
#2705 Posted 17 March 2021 - 12:03 AM
Danukem, on 16 March 2021 - 05:47 PM, said:
you are right, i used event_spawn and not EGS :doh:
using event EGS doesnt actually resize the items and enemies

[edit]
placed the whole shebang under event_game and that works flawelessly.
This post has been edited by jimbob: 17 March 2021 - 12:12 AM
#2706 Posted 17 March 2021 - 01:18 AM
You just have to make sure that the actor isn't size 0 0 before you apply your own size to it. For example, instead of using "sizeat 24 24" you would use"ifg sprite[].xrepeat 4 sizeat 24 24"
EVENT_GAME works but the sprite is running that code every single tic, which is not efficient. It may never matter in your project, but enough inefficient code will eventually bog the game down. Also, if you want the actor to be resizable, your EVENT_GAME code has to be written to allow that, because if you are just constantly setting the size in that event it will override whatever size you set in the actor code.
#2707 Posted 17 March 2021 - 04:35 AM
Danukem, on 17 March 2021 - 01:18 AM, said:
You just have to make sure that the actor isn't size 0 0 before you apply your own size to it. For example, instead of using "sizeat 24 24" you would use"ifg sprite[].xrepeat 4 sizeat 24 24"
EVENT_GAME works but the sprite is running that code every single tic, which is not efficient. It may never matter in your project, but enough inefficient code will eventually bog the game down. Also, if you want the actor to be resizable, your EVENT_GAME code has to be written to allow that, because if you are just constantly setting the size in that event it will override whatever size you set in the actor code.
ill put it back in event_spawn with the added fix, i plan on using a ton of enemies, and have them resizing too.
#2708 Posted 21 March 2021 - 08:25 AM
onevent EVENT_DISPLAYREST // rezise ammo health and inventory box. switch sprite[spriteid].picnum case HEALTHBOX gettspr[].tsprxrepeat x div x 2 gettspr[].tsprxrepeat y div y 2 settspr[].tsprxrepeat x settspr[].tspryrepeat y break endswitch // resize hud icons endevent
but no matter where i place it, it doesnt scale the art down half to compensate the larger res art.
#2709 Posted 21 March 2021 - 11:43 AM
For the hud you need to draw your own using rotatesprite and similar command, then you can size and place things however you want. Its a huge pain in the ass to get all the numbers right, though.
#2710 Posted 21 March 2021 - 12:40 PM
[edit] i suppose an easy but dirty fix would be to delete the original art tiles and use rotatesprite to draw a new one scaled to size on the originals position using EVENT_DISPLAYROOMSEND.
heres an image of what i try to do, the bottom ones are the originals, the top what i want, but on the bottom

This post has been edited by jimbob: 21 March 2021 - 12:49 PM
#2711 Posted 21 March 2021 - 02:52 PM
#2712 Posted 21 March 2021 - 11:23 PM
Danukem, on 21 March 2021 - 02:52 PM, said:
i'll look into it today, thanks

#2713 Posted 29 March 2021 - 12:13 PM
#2714 Posted 29 March 2021 - 12:45 PM
Getting seems to work without sets/setw but changing values not so.
Also with sectors you have sector[].floor/ceilingpicnum -- Floors/ceilings do not have their own structs.
#2716 Posted 30 March 2021 - 04:34 AM
oasiz, on 29 March 2021 - 12:45 PM, said:
Getting seems to work without sets/setw but changing values not so.
Also with sectors you have sector[].floor/ceilingpicnum -- Floors/ceilings do not have their own structs.
that seems to work, though i did just a quick test, im going to use this to spawn dirt kicking up when hitting sandy floors etc, much like when shooting water surfaces.
#2717 Posted 31 March 2021 - 04:29 AM
#2718 Posted 31 March 2021 - 11:11 AM
#2719 Posted 31 March 2021 - 01:26 PM
im making an educated guess that geta[].htg_t 7 hitsector and gets[hitsector].floorpicnum picnum
are what im looking for?
This post has been edited by jimbob: 31 March 2021 - 02:18 PM
#2720 Posted 31 March 2021 - 08:17 PM
#2722 Posted 05 April 2021 - 04:35 AM
EDIT: lol, immediately figured it out as soon as I hit post. the reverse side of that wall has the settings applied (so basically check if CSTAT 2 is set on your wall and then check the nextwall id)
This post has been edited by Jblade: 05 April 2021 - 04:37 AM