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

Jump to content

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

#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 offline   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 offline   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 offline   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

User is offline   jimbob 

#2731

 Danukem, on 02 May 2021 - 10:32 AM, said:

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.
yes i did, but it seems it adds that flag through its hard code or something, changing the workslike would work i guess, but then it displays the wrong weapon art :o

Quote

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.

man, i forgot about offset, i tried messing with it once and didnt get the results i liked so i abandoned it, but with some trial and error i now have the projectile spawning on the right spot, now to adjust the height.

for whatever reason, using move to move something on event EGS does nothing :(

This post has been edited by jimbob: 02 May 2021 - 12:41 PM

0

User is offline   Danukem 

  • Duke Plus Developer

#2732

 jimbob, on 02 May 2021 - 12:26 PM, said:

yes i did, but it seems it adds that flag through its hard code or something, changing the workslike would work i guess, but then it displays the wrong weapon art :o


I just assumed you were using EVENT_DRAWWWEAPON or EVENT_DISPLAYWEAPON to cancel the hardcoded art and draw your own. If you are depending on the game displaying the tiles that are currently on the shrinker tiles, then yes that would be a problem. But you really should be drawing your own, otherwise you are limited to the number of tiles and the timing of them being the way it was in vanilla.

 jimbob, on 02 May 2021 - 12:26 PM, said:

for whatever reason, using move to move something on event EGS does nothing :(


No I mean you change the coords of the spawned sprite to move it instantly, like:

geta[].z z, sub z 2048, seta[].z z
0

#2733

I wonder if anyone has a list of the conditions that check if a TRIPOMB can be "shot" or not onto a wall, when you press fire.

I mean, i'm sure that something similar to ifawayfromwall and/or hitscan is involved, but there is also something that checks if that wall is part of a moving sector, and i don't know there is any mean to detect this via CON.
0

User is offline   Danukem 

  • Duke Plus Developer

#2734

 RichardStorm, on 03 May 2021 - 05:03 AM, said:

I wonder if anyone has a list of the conditions that check if a TRIPOMB can be "shot" or not onto a wall, when you press fire.

I mean, i'm sure that something similar to ifawayfromwall and/or hitscan is involved, but there is also something that checks if that wall is part of a moving sector, and i don't know there is any mean to detect this via CON.


First I would make my own thrown tripbomb actor with a regular move command on it. While moving through the air, you can check for whether it hits wall like this:

ifnotmoving
{
        setvarvar temp sprite[].htmovflag
	andvar temp 49152
	ifvare temp 32768
	{
		// hit a wall


Second here is the source code the game uses to determine if the wall is valid for placement. It places if PlaceMine gets set to 1

case HANDHOLDINGLASER__STATIC:
        {
            int const zOffset     = (playerNum >= 0) ? g_player[playerNum].ps->pyoff : 0;
            Zvel                  = (playerNum >= 0) ? fix16_to_int(F16(100) - pPlayer->q16horiz - pPlayer->q16horizoff) * 32 : 0;

            startPos.z -= zOffset;
            Proj_DoHitscan(spriteNum, 0, &startPos, Zvel, shootAng, &hitData);
            startPos.z += zOffset;

            int placeMine = 0;
            if (hitData.sprite >= 0)
                break;

            if (hitData.wall >= 0 && hitData.sect >= 0)
            {
                uint32_t xdiff_sq = (hitData.pos.x - startPos.x) * (hitData.pos.x - startPos.x);
                uint32_t ydiff_sq = (hitData.pos.y - startPos.y) * (hitData.pos.y - startPos.y);
                if (xdiff_sq + ydiff_sq < (290 * 290))
                {
                    // ST_2_UNDERWATER
                    if (wall[hitData.wall].nextsector >= 0)
                    {
                        if (sector[wall[hitData.wall].nextsector].lotag <= 2 && sector[hitData.sect].lotag <= 2)
                            placeMine = 1;
                    }
                    else if (sector[hitData.sect].lotag <= 2)
                        placeMine = 1;
                }

            }

1

User is offline   jimbob 

#2735

 Danukem, on 02 May 2021 - 01:39 PM, said:

I just assumed you were using EVENT_DRAWWWEAPON or EVENT_DISPLAYWEAPON to cancel the hardcoded art and draw your own. If you are depending on the game displaying the tiles that are currently on the shrinker tiles, then yes that would be a problem. But you really should be drawing your own, otherwise you are limited to the number of tiles and the timing of them being the way it was in vanilla.



No I mean you change the coords of the spawned sprite to move it instantly, like:

geta[].z z, sub z 2048, seta[].z z

i am using event_drawweapon,, wich is the odd thing. for both weapons actually, the shrinker and expander both have thier own new art located on different tilenums than the originals, but if i set weapon6_workslike 11 it displays the art for weapon 11

i'll try that method of moving the projectile in a minute
0

User is offline   Danukem 

  • Duke Plus Developer

#2736

 jimbob, on 04 May 2021 - 11:33 AM, said:

i am using event_drawweapon,, wich is the odd thing. for both weapons actually, the shrinker and expander both have thier own new art located on different tilenums than the originals, but if i set weapon6_workslike 11 it displays the art for weapon 11


Make sure your display code checks player[].curr_weapon and not currentweapon; the former is the actual weapon the player is holding while the latter is the weapon being displayed. If you change workslike it does change the hardcoded display to show a different weapon.
0

User is offline   jimbob 

#2737

i changed currentweapon to the other code, and that works, but the problem persists, even if i move it to another slot. by the looks of it, its not the glow flag, but it seems to be the combination of fully automatic, and projectile weapon, the weapon just turns dark ( and since im making a flamethrower this is the opposite of what i try to achieve ) it also seems to do this on enemy sprites firing the same projectile ( a fireball )

defineprojectile 3907 PROJ_WORKSLIKE 6210 
defineprojectile 3907 PROJ_VEL 700 // was 1000
defineprojectile 3907 PROJ_EXTRA 10
// defineprojectile 3907 PROJ_DROP -100 // was 150
defineprojectile 3907 PROJ_BOUNCES 0
defineprojectile 3907 PROJ_RANGE 20
defineprojectile 3907 PROJ_BSOUND 0
defineprojectile 3907 PROJ_SPAWNS FLAMESPAWNER
defineprojectile 3907 PROJ_SHADE 75
defineprojectile 3907 PROJ_XREPEAT 13 // was 15
defineprojectile 3907 PROJ_YREPEAT 10 // was 15
defineprojectile 3907 PROJ_FLASH_COLOR 33791
// defineprojectile 3907 PROJ_TRAIL FRAMEEFFECT1
// defineprojectile 3907 PROJ_CSTAT 2
defineprojectile 3907 PROJ_HITRADIUS 0
defineprojectile 3907 PROJ_OFFSET 200


This post has been edited by jimbob: 04 May 2021 - 01:34 PM

0

User is offline   Danukem 

  • Duke Plus Developer

#2738

Well, shade 75 is completely black and you have that set as the projectile shade, so that's weird unless you want the projectile to be black (but in that case why not use pal 4?). Maybe you want it black regardless of the sector pal.

Also it looks like the flash color would be purple based on that value of 33791, but I doubt that would matter. I can't really tell what's going on though without looking at your display code, which you have not shown yet.
0

#2739

 Danukem, on 03 May 2021 - 11:47 AM, said:

First I would make my own thrown tripbomb actor with a regular move command on it. While moving through the air, you can check for whether it hits wall like this:

ifnotmoving
{
        setvarvar temp sprite[].htmovflag
	andvar temp 49152
	ifvare temp 32768
	{
		// hit a wall


Second here is the source code the game uses to determine if the wall is valid for placement. It places if PlaceMine gets set to 1

case HANDHOLDINGLASER__STATIC:
        {
            int const zOffset     = (playerNum >= 0) ? g_player[playerNum].ps->pyoff : 0;
            Zvel                  = (playerNum >= 0) ? fix16_to_int(F16(100) - pPlayer->q16horiz - pPlayer->q16horizoff) * 32 : 0;

            startPos.z -= zOffset;
            Proj_DoHitscan(spriteNum, 0, &startPos, Zvel, shootAng, &hitData);
            startPos.z += zOffset;

            int placeMine = 0;
            if (hitData.sprite >= 0)
                break;

            if (hitData.wall >= 0 && hitData.sect >= 0)
            {
                uint32_t xdiff_sq = (hitData.pos.x - startPos.x) * (hitData.pos.x - startPos.x);
                uint32_t ydiff_sq = (hitData.pos.y - startPos.y) * (hitData.pos.y - startPos.y);
                if (xdiff_sq + ydiff_sq < (290 * 290))
                {
                    // ST_2_UNDERWATER
                    if (wall[hitData.wall].nextsector >= 0)
                    {
                        if (sector[wall[hitData.wall].nextsector].lotag <= 2 && sector[hitData.sect].lotag <= 2)
                            placeMine = 1;
                    }
                    else if (sector[hitData.sect].lotag <= 2)
                        placeMine = 1;
                }

            }



Oh pretty nice, thank you !

Also little trivia, it's evident from here that tripbombs cannot be placed in secret rooms XD (lotag 32767, and not-yet-discovered rooms actually, as when you step in lotag is reverted to 0)
0

User is offline   Danukem 

  • Duke Plus Developer

#2740

 RichardStorm, on 04 May 2021 - 07:31 PM, said:

Oh pretty nice, thank you !

Also little trivia, it's evident from here that tripbombs cannot be placed in secret rooms XD (lotag 32767, and not-yet-discovered rooms actually, as when you step in lotag is reverted to 0)


That wall detection code could be improved by getting the actual wall number out of htmovflag, and there are instructions for that here:

https://wiki.eduke32.../wiki/Htmovflag
0

#2741

Well yes, it can be improved in many ways, but I was actually searching for the essential part and i also got how sector and nextsector are handled when a wall is involved (that was an undiscovered chapter for me).
0

User is offline   jimbob 

#2742

 Danukem, on 04 May 2021 - 04:55 PM, said:

Well, shade 75 is completely black and you have that set as the projectile shade, so that's weird unless you want the projectile to be black (but in that case why not use pal 4?). Maybe you want it black regardless of the sector pal.

Also it looks like the flash color would be purple based on that value of 33791, but I doubt that would matter. I can't really tell what's going on though without looking at your display code, which you have not shown yet.

that might be it, i have set the shade to black ( should have been fullbright, probably forgot the - :facepalm: ) but also have spritenoshade/pal on that particular sprite, that seems to be the problem, the weapon aparently takes the shade of the projectile for a moment, it seems to work great now both on the weapon as on the enemy.
[edit] setting the Z value seems to work fine, i tried using the same line, on the y and x axis and see if i can get the shells to spawn slightly infront of the player, but it goes wonky if the player turns around, my shells spawn correctly and fly off to the side, but they dont show up in the players view, only in trace mode.

This post has been edited by jimbob: 05 May 2021 - 02:55 AM

0

User is offline   jimbob 

#2743

is there a way to get the distance a sound is played at? what i want to do is use event_sound to change certain sounds when you are far away, like explosions sounding more muffled. ifpdistg 10240 doesnt seem to work propperly.

onevent EVENT_SOUND
switch RETURN
case FTFIRE ifinwater set RETURN GENERIC_AMBIENCE4
case WAMBIANCE3 ifpdistg 10240 set RETURN WAMBIANCE7 break
endswitch
endevent



it works fine with other ifp commands like inwater.
0

User is offline   Danukem 

  • Duke Plus Developer

#2744

In that event, THISACTOR refers to the sprite from which the sound originates (if applicable). So I would try using dist DISTVAR THISACTOR player[].i to get the distance to player into DISTVAR and then decide whether to replace sound based on that.

You might want to add a game mode check to verify that gameplay is happening though, because in some contexts (e.g. menu before game starts) the player does not exist and that will cause an error.
0

User is offline   jimbob 

#2745

so something like this seems to work :)
gamevar DISTVAR 0 1

onevent EVENT_SOUND
ifactor BAZOOKAROCKET dist DISTVAR THISACTOR player[].i 
switch RETURN
case WAMBIANCE3 ifvarg DISTVAR 10240 set RETURN WAMBIANCE7 break

it seems to ignore the change in menus maybe because there is no distance to calculate. if i run into trouble i could add a ifp palive check, if your dead you probably wont notice distand sounds anyway anymore :P

yes, that completely gave the effect i was aiming for :) i might use the same for gunshots if i have time :D

This post has been edited by jimbob: 22 May 2021 - 11:59 AM

0

User is offline   Danukem 

  • Duke Plus Developer

#2746

With that code DISTVAR will be unchanged when "ifactor BAZOOKAROCKET" is false, so don't be surprised when RETURN changes "randomly"
0

User is offline   jimbob 

#2747

i added a few actor checks for other common sound 'generators' like my custom mortars, the bazookarocket and seenine, heavybomb and ill add others if i run into issues. its too bad you cant the sounds distance itself but have to rely on the actor that initiated the sound.
0

Share this topic:


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