
EDuke32 Scripting "CON coding help"
#2724 Posted 14 April 2021 - 03:17 PM
edit:
https://wiki.eduke32...%3ASearch&go=Go
This post has been edited by Mark: 14 April 2021 - 03:25 PM
#2725 Posted 15 April 2021 - 01:10 AM
This post has been edited by jimbob: 15 April 2021 - 01:12 AM
#2726 Posted 15 April 2021 - 04:51 AM
I just checked. Thats what I did.
This post has been edited by Mark: 15 April 2021 - 04:53 AM
#2727 Posted 15 April 2021 - 10:17 AM

#2729 Posted 02 May 2021 - 04:08 AM

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
#2730 Posted 02 May 2021 - 10:32 AM
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.
#2731 Posted 02 May 2021 - 12:26 PM
Danukem, on 02 May 2021 - 10:32 AM, said:
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.

Quote
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
#2732 Posted 02 May 2021 - 01:39 PM
jimbob, on 02 May 2021 - 12:26 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.
jimbob, on 02 May 2021 - 12:26 PM, said:

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
#2733 Posted 03 May 2021 - 05:03 AM
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.
#2734 Posted 03 May 2021 - 11:47 AM
RichardStorm, on 03 May 2021 - 05:03 AM, said:
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; } }
#2735 Posted 04 May 2021 - 11:33 AM
Danukem, on 02 May 2021 - 01:39 PM, said:
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
#2736 Posted 04 May 2021 - 12:09 PM
jimbob, on 04 May 2021 - 11:33 AM, said:
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.
#2737 Posted 04 May 2021 - 01:33 PM
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
#2738 Posted 04 May 2021 - 04:55 PM
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.
#2739 Posted 04 May 2021 - 07:31 PM
Danukem, on 03 May 2021 - 11:47 AM, said:
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)
#2740 Posted 04 May 2021 - 08:57 PM
RichardStorm, on 04 May 2021 - 07:31 PM, said:
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
#2741 Posted 04 May 2021 - 09:13 PM
#2742 Posted 04 May 2021 - 11:55 PM
Danukem, on 04 May 2021 - 04:55 PM, said:
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
#2743 Posted 22 May 2021 - 04:58 AM
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.
#2744 Posted 22 May 2021 - 10:02 AM
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.
#2745 Posted 22 May 2021 - 11:51 AM

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

yes, that completely gave the effect i was aiming for


This post has been edited by jimbob: 22 May 2021 - 11:59 AM
#2746 Posted 22 May 2021 - 11:59 AM
#2747 Posted 22 May 2021 - 12:21 PM
#2748 Posted 19 June 2021 - 12:07 PM
case SECTOREFFECTOR ifspawnedby FIREBARREL { seta[].lotag 4 geta[].sectnum mysectortemp gets[mysectortemp].floorshade shadetemp sub shadetemp 2 seta[].shade shadetemp } break
#2749 Posted 19 June 2021 - 01:45 PM
#2750 Posted 19 June 2021 - 11:29 PM
#2751 Posted 16 August 2021 - 11:20 AM
state navigate // navigate to the waypoint. findnearactor WAYPOINT 20480 TEMP // piece of code straight from the eduke32 wiki. modified for a rudimentary waypoint system. ifvarvare MHITAG COUNT // make sure the waypoint he is going to is the next sequential one, so he doesnt backtrack. ifvarn TEMP -1 { getactor[TEMP].x MX getactor[TEMP].y MY getactor[THISACTOR].x x getactor[THISACTOR].y y subvarvar MX x subvarvar MY y getangle ANGVAR MX MY setactor[THISACTOR].ang ANGVAR } // here starts my own changes to make the system do what i need. // if the actor is within the accepted distance from the waypoint, make him aim for the next one by adding one to the count. findnearactor WAYPOINT 512 TEMP ifvarn TEMP -1 { addvar COUNT 1 } endsthe actor runs state navigate every once in a while during his seek state where he tries to find the player, the waypoint or an enemy. it needs a lot of work though. just asking of im on the right track with this. it needs a lot of work to make it somewhat more sophisticated but right now its just used to make soldiers move in a general direction instead of rather randomly around the map, or follow the player a round like a line of lemmings.
#2752 Posted 16 August 2021 - 11:34 AM
As for whether you are on the right track, you are kind of on the way to making looping waypoints like the pigcop recon cars. Make sure you read the tag off of the waypoint so that you can compare it to the enemy's counter.
#2753 Posted 16 August 2021 - 11:49 AM
Danukem, on 16 August 2021 - 11:34 AM, said:
As for whether you are on the right track, you are kind of on the way to making looping waypoints like the pigcop recon cars. Make sure you read the tag off of the waypoint so that you can compare it to the enemy's counter.
i will make a simple useractor that will move towards the waypoint at all times to check if it works. and you're right. i should really try to get one thing working before adding too much at the same time.