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

Jump to content

  • 115 Pages +
  • « First
  • 89
  • 90
  • 91
  • 92
  • 93
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

User is offline   jimbob 

#2701

View PostDanukem, on 05 March 2021 - 11:35 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.

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

0

User is offline   jimbob 

#2702

aparently it really is as simple as definesound *.ogg works like a charm :)
0

User is offline   jimbob 

#2703

i have this weird bug, i added some new enemy art files, and since these are a higher resolution i used EVENT_EGS to scale enemies to thier new respective sizes ( about 10 X and Y ) but now the enemies that are only seen on higher difficulties show up in game, but dont do anything. they are "there" but not quite. is there a fix to this? what i nean is, that if an enemy is flagged for say damn im good, he will show up at any difficulty but the AI does nothing. its really confusing for the player.

This post has been edited by jimbob: 16 March 2021 - 05:19 PM

0

User is online   Danukem 

  • Duke Plus Developer

#2704

Are you sure you are using EVENT_EGS to resize them and not EVENT_SPAWN? The issue you are describing happens when the game has deleted a higher difficulty enemy by setting its size to 0 by 0, and then your code goes ahead and makes it bigger anyway. Since the game already tried to delete it, it becomes a dead sprite and just stands there.
0

User is offline   jimbob 

#2705

View PostDanukem, on 16 March 2021 - 05:47 PM, said:

Are you sure you are using EVENT_EGS to resize them and not EVENT_SPAWN? The issue you are describing happens when the game has deleted a higher difficulty enemy by setting its size to 0 by 0, and then your code goes ahead and makes it bigger anyway. Since the game already tried to delete it, it becomes a dead sprite and just stands there.

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

0

User is online   Danukem 

  • Duke Plus Developer

#2706

EVENT_SPAWN is the correct place for the code

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

User is offline   jimbob 

#2707

View PostDanukem, on 17 March 2021 - 01:18 AM, said:

EVENT_SPAWN is the correct place for the code

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

User is offline   jimbob 

#2708

probably a stupid question, but i cant seem to resize the healt and ammobox sprite ( the ones that are drawn on the HUD if you use a larger screensize. there is a displaysbar event, messing with that seems to mess up the screen somewhat so i decided to use EVENT_DISPLAYREST

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

User is online   Danukem 

  • Duke Plus Developer

#2709

I think tsprite commands only work in EVENT_ANIMATESPRITES, so not in the hud at all.

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

User is offline   jimbob 

#2710

what im trying to do is replace the original background boxes with my own ( the ones that say HEALTH and AMMO ) and then scale them down half size, they are tile 30 31 and 33 and 20, in what event would rotatesprite for hud tiles have to be used? i did manage to place some "huud"sprites onscreen with EVENT_DISPLAYROOMSEND, i used it to draw 'blood' on the screen when low on health. the numbers themselves are good enough for the time being, might replace the font with a more apropriate one later

[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 :P

Attached thumbnail(s)

  • Attached Image: duke0000.png


This post has been edited by jimbob: 21 March 2021 - 12:49 PM

0

User is online   Danukem 

  • Duke Plus Developer

#2711

I had never even heard of that event until you mentioned it. The normal procedure would be to use EVENT_DISPLAYREST, set RETURN to -1 to cancel the hardcoded Duke display, then draw your own hud however you want using screen drawing commands and logic.
0

User is offline   jimbob 

#2712

View PostDanukem, on 21 March 2021 - 02:52 PM, said:

I had never even heard of that event until you mentioned it. The normal procedure would be to use EVENT_DISPLAYREST, set RETURN to -1 to cancel the hardcoded Duke display, then draw your own hud however you want using screen drawing commands and logic.

i'll look into it today, thanks :)
0

User is offline   jimbob 

#2713

Quick and probably stupid question, but i was messing with event_damagewall today and made certain walls spawn debris when hit, u want to do the same with floors but using floor[RETURN].picnum xxx doesnt seem to work in event_damagefloors
0

User is offline   oasiz 

  • Dr. Effector

#2714

Tried using sets[RETURN].floorpicnum ?
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.
0

User is offline   jimbob 

#2715

I'll try that tomorow
0

User is offline   jimbob 

#2716

View Postoasiz, on 29 March 2021 - 12:45 PM, said:

Tried using sets[RETURN].floorpicnum ?
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.
0

User is offline   jimbob 

#2717

Well it didnt quite work, must have been a fluke. It did change a seemingly random texture,probably due to the set command
0

User is online   Danukem 

  • Duke Plus Developer

#2718

For a different approach, you can spawn the debris from the projectile itself at the time of impact. A bullet (SHOTSPARK1) can check whether it is hitting the floor and the floorpicnum so you spawn the right kind of debris, and of course that also means it is spawning at the correct coordinates. I usually don't bother with texture specific debris on other projectiles such as rockets because the explosion, smoke and metal scrap is enough.
0

User is offline   jimbob 

#2719

i'll look into that, that would also fix the exclusion of certain projectiles that now interact with damagewalls, like the knee weapon and shells, wich is kinda silly, having a shell hit a wall and making a bullet impact sound and shoot chunks of concrete around

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

0

User is online   Danukem 

  • Duke Plus Developer

#2720

Yes that sounds right. By the way, don't ever assume that htg_t 7 has an actual sector because it could be -1 if the bullet hit a sprite or a wall. Do not proceed to expressions such as gets[hitsector] or geta[hitsprite] until you have determined the value is valid and not -1. Because if it is -1, you will get an error and Eduke32 will abort code execution for the actor entirely. I'm harping on that because it is very easy to assume you have a valid object when you don't.
0

User is offline   jimbob 

#2721

sounds like it needs a ifn hitsector -1
0

User is offline   Jblade 

#2722

how does one access the picnum/shade of the bottom half of a wall with BOTTOM_SWAP enabled on it? (cstat 2) that's the flag that lets the bottom half of the wall under the adjacent sector have its own shade, picnum .etc .etc

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

-1

User is offline   jimbob 

#2723

so how does one replace the ending sequence from episode 1, with a custom animation? even_cutscene on the wiki page is empty and no help unfortunatly. i have managed to start a cutscene when starting episode 1
0

User is offline   Mark 

#2724

Its been a few years but I seem to remember the animation plays automatically at level end if you create it in .ivf format and name it cineov2.ivf and I placed it in the root folder in my project. If you want sound, the file needs to be triggered at the same time. This info is online somewhere because thats where I got it from. I'm assuming the original .anm format still works too.

edit:
https://wiki.eduke32...%3ASearch&go=Go

This post has been edited by Mark: 14 April 2021 - 03:25 PM

0

User is offline   jimbob 

#2725

The problem.is that episode 1 doesnt use an anm file but hardcoded tiles, so i cant just replace the anm/ifv file unfortunatly.

This post has been edited by jimbob: 15 April 2021 - 01:12 AM

0

User is offline   Mark 

#2726

Ah, maybe I defined my level to episode 2 so I could use cineov2.ivf

I just checked. Thats what I did.

This post has been edited by Mark: 15 April 2021 - 04:53 AM

0

User is online   Danukem 

  • Duke Plus Developer

#2727

If this is a major sticking point, you could make episode 1 a tutorial level or a credits level, then make episode 2 your actual episode. :lol:
0

User is offline   jimbob 

#2728

that seems like the easy way to do it, i'll probably do that :D
0

User is offline   jimbob 

#2729

meh, how do i remove the nasty glow effect from the shrinker, it seems persistent no matter how i configure the weapon6_flags :( i get it working without the glow when i remove automatic weapon functions like flag 8 and 16, but i need those.
the expander does not seem to do this.
on a related question, i have a custom projectile, but it seems to originate from the players bottom center, the RPG seems to originate from the weapons actual position, how do i get my custom projectile to originate from the actual weapon position? or, if atleast spawn somewhat infront of the player

This post has been edited by jimbob: 02 May 2021 - 04:11 AM

0

User is online   Danukem 

  • Duke Plus Developer

#2730

Are you sure you removed flag 2, because that's the one that makes it glow according to the wiki:

https://wiki.eduke32...i/WEAPONx_FLAGS

If it still glows with flag 2 off, then I would try changing the workslike to a different weapon.

For the other problem, have you tried changing the projectile's offset? https://wiki.eduke32...efineprojectile It's horribly unintuitive and you pretty much have to guess at what value to use, but you can make a projectile spawn anywhere to the left or right with the correct offset. If it is spawning too low, raise it up in EVENT_EGS.
0

Share this topic:


  • 115 Pages +
  • « First
  • 89
  • 90
  • 91
  • 92
  • 93
  • 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