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

Jump to content

  • 92 Pages +
  • « First
  • 90
  • 91
  • 92
  • You cannot start a new topic
  • You cannot reply to this topic

EDuke32 Scripting  "CON coding help"

User is offline   jimbob 

#2731

View PostDanukem, 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 online   Danukem 

  • Duke Plus Developer

#2732

View Postjimbob, 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.

View Postjimbob, 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 online   Danukem 

  • Duke Plus Developer

#2734

View PostRichardStorm, 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

View PostDanukem, 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 online   Danukem 

  • Duke Plus Developer

#2736

View Postjimbob, 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 online   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

View PostDanukem, 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 online   Danukem 

  • Duke Plus Developer

#2740

View PostRichardStorm, 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

View PostDanukem, 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

Share this topic:


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