Forum posts

Posted 1 year ago2023-01-11 20:47:45 UTC
in Coding issue: Monster infighting! Post #347228
What you should probably do is take a look at the code for barney getting mad when shot/attacked by the player, im pretty sure it uses monster conditions, so what you probably want to do is: define a new monster condition (or use an existing unused one), then make an exception in the code that checks which monster can attack which (the classify code) so that it can attack any monster as long as it has the condition bit set then set m_hEnemy to GetMonsterPointer(PushEnemy function) like Captain P said
Posted 2 years ago2022-04-19 06:34:23 UTC
in Barney doesnt die Post #346454
Are you using Spirit of Half-Life for the mod?
If so, you could try setting the barney's health with a keyvalue

If you're using a custom codebase you could add the code for
setting health as a keyvalue.

Or if you're using vanilla HL you could just try trapping the barney after spawning
in a func_wall_toggle (enabled by default), use a trigger_hurt to get its health really low,
and then disable the trigger_hurt, and the func_wall_toggle.
Posted 2 years ago2022-04-10 06:49:08 UTC
in Creating a basic bot Post #346419
@Solokiller Thanks
Posted 2 years ago2022-03-26 21:50:09 UTC
in Creating a basic bot Post #346369
@tschumann I already tried that, with not much success
Posted 2 years ago2022-03-18 23:54:54 UTC
in Creating a basic bot Post #346351
Hi, I need some help making a very basic bot, im asking for help, beacuse all of my attempts failed.
All I used as a base for the bot is Botman's code (pretty sure I cant achive what I want with that)
The bot needs to be able to do the following:
  • Activate triggers when standing in them
  • Attack aliens with long range weapons (autoaim + shooting, it doesnt need to turn at all)
  • Think like a player (By that I mean run think code, so physics and basic player stuff applies to it)
Help would be much appreciated.

Code I alredy wrote for the bot:
https://github.com/piper742/ya-ps2hl-dll-updated/blob/master/dlls/ps2hlu_fakeplayer_decay.cpp

Thanks for reading!
Posted 2 years ago2022-02-11 20:28:34 UTC
in Beam color not updating Post #346274
I need help with making an env_beam's beam update colors.
I've been trying to solve a weird problem for the past week.
When I find an env_beam with an env_render using the netname (custom stuff)
It finds it perfectly fine, changes the color, but when I try to do the same the second time
it doesn't do anything, tested it on custom maps, and stuff, haven't really been able to find
a solution to this.

Here is the code used for finding the target entities:

// CODE START
if (!FStringNull(pev->netname))
{
edict_t* pentTarget2 = NULL;
pentTarget2 = FIND_ENTITY_BY_STRING(NULL, "netname", STRING(pev->netname));
while ( pentTarget2 )
{
//pentTarget2 = FIND_ENTITY_BY_STRING(NULL, "netname", STRING(pev->netname));
if (FNullEnt(pentTarget2))
break;

entvars_t *pevNetname = VARS(pentTarget2);
if (!FBitSet(pev->spawnflags, SF_RENDER_MASKFX))
pevNetname->renderfx = pev->renderfx;
if (!FBitSet(pev->spawnflags, SF_RENDER_MASKAMT))
pevNetname->renderamt = pev->renderamt;
if (!FBitSet(pev->spawnflags, SF_RENDER_MASKMODE))
pevNetname->rendermode = pev->rendermode;
if (!FBitSet(pev->spawnflags, SF_RENDER_MASKCOLOR))
pevNetname->rendercolor = pev->rendercolor;

pentTarget2 = FIND_ENTITY_BY_STRING(pentTarget2, "netname", STRING(pev->netname));
}
}
// CODE END

Thanks for reading!

EDIT: Found a solution for the problem just after posting.
You need to individually set pev->rendercolor.x/y/z to make a beam's color change.
Changing the entire thing for some reason freezes the beam's rendercolor at the new value
Posted 2 years ago2021-12-21 11:50:40 UTC
in Swapping between players Post #346147
@tschumann
Swapping the "pev" of the 2 players doesnt work. The solution i used switched some things between players pev(s) (origin, angles, viewangles, etc), but not the entire thing. This solution has quite a few problems, the bot ignores triggers, floats in the air, and moves with a tram that it is not even standing on.
I think using SET_VIEW would be the best solution, but it doesnt work for some reason on players. (Makes the targeted players model invisible, but the players view is left unchanged)
Posted 2 years ago2021-12-11 22:39:11 UTC
in adding back the alpha 0.52 blood stream effect? Post #346114
I have never played the Half-Life 1 alpha, but this is the best quick implementation I managed to make:
Add this to a monsters TraceAttack function

if(m_bloodColor == BLOOD_COLOR_RED)
UTIL_BloodStream(ptr->vecEndPos, gpGlobals->v_forward * -35 + gpGlobals->v_up * 2.1, (unsigned short)73, 100);

(If the TraceAttack function doesnt exist then create one or you can just add this to combat.cpp if you want this to apply to all monsters)
Why are you even using visual c++ 2008 you need a Windows Vista machine to just run it properly (from my Experience)?
Install something newer like VS2019 or even VS2022 perview and use SoloKillers half-life updated sdk instead of the old 2008VS version
Posted 2 years ago2021-11-30 06:30:03 UTC
in Swapping between players Post #346086
I need help with this, beacuse I havent been able to figure this out on my own.
This is for a mod im working on (A decay port to PC source code can be found here)
So the set up Ive got so far is this:
Each player when spawning gets assigned a custom m_decayIndex value (from 1 to 2, if its not decay its 0)
I need to figure out how to change both players positions, angles, health, weapons, ammo, etc, with eachother
I alredy have a command that changes the index, but I need it to change players completely.

Help would be appreciated.
Posted 3 years ago2021-09-15 18:20:18 UTC
in [help] Rendering a model fullbright Post #345936
@Admer456
Thanks Admer, this helped alot, I think I might post the results
Posted 3 years ago2021-09-12 19:28:28 UTC
in [help] Rendering a model fullbright Post #345927
I need some help with making a specific entity's model always render fullbright, I
alredy tried poking around with that StudioModelRenderer.cpp, but im pretty sure
it needs OpenGL code to work, can someone please help me with this?

(Just to be clear, im not trying to implement a working fullbright flag, im just trying to
make a specific entity's model always render fullbright)

Thanks for reading!
Posted 3 years ago2021-06-13 09:27:39 UTC
in Specific PAK file loading Post #345697
Hello everyone!

I was wondering if it would be possible to only have 1 PAK
file loaded at a time (for example: vanilla hl models in pak0 and
modified models in pak1, and the correct pak file gets loaded based on the map)

The only thing is, that the correct assets need to be loaded/map (so pak1 shouldnt override pak0 on some maps)

I am aware that pak file reading is mostly in the engine, so I wont be able to modify
that, but maybe iirc the engine only checks for .pak files with the name pak0,1,2,3, etc

So could it be possible to use code found here to read custom named pak files?
And have it load the correct pakfile on a specific map?

So could this be possible?

Thanks for reading! :biggrin:
Posted 3 years ago2021-06-03 19:05:22 UTC
in Adding support for shadow volumes back into GoldSRC Post #345674
Supadupaplex's PS2HL has shadows implemented, you should look into that. (it has some Z-fighting going on)

link to the PS2HL github page: https://github.com/supadupaplex/ya-ps2hl-dll
Posted 3 years ago2021-05-26 05:07:11 UTC
in Creating a custom main menu Post #345665
Hello everyone!

I need some help creating a complete custom main menu for my Half-Life: Decay port (Based on Yet another PS2 Half-Life PC port).
Source code can be found here: https://github.com/piper742/ya-ps2hl-dll-updated (I am aware that the documentationa needs some updates)

I need a simular looking main menu as in the original ps2hl (PS2HL menu is mainly sprite based), so far I havent managed to come up with a solution,
so here is what I dont want to use (but will try if it really becomes necesarry):
  • Cry of fear method (using a custom hud element as a menu, bc it requires loading map)
  • Using Xash3d (that itself gives you a quite similar main menu)
It would be good to have the a solution that can:
1) run in goldsrc
2) doesnt require map loading (or to be loaded)
PS2 Half-Life main menuPS2 Half-Life main menu
I have no experience modifiing the main menu (besides changes in the resources folder).
I know this would require some big changes in the dll file or potentially some workaround, but I just want to get a good looking PS2HL menu.
If such thing is impossible in goldsrc (without loading a map), then feel free to call me stupid. Thanks in advance! (Sorry for bad english in some places)

EDIT: PS2HL menu is basically WON menu with a bit more customized buttons (forgot to mention this)
Posted 3 years ago2021-05-11 17:44:36 UTC
in Need some help with a keyvalue Post #345598
@Solokiller

yea, its supposed to check their netname, not their targetname. (checked the mapfile again to make sure)
Also thanks for mentioning that check, for some reason I had commented it out, so I fixed that (It was actually causing a crash)

Ive got the whole thing working now, and I will try using UTIL_FindEntityByString.

But now that that works (tested on a test map not ht11lasers) I have realised that multisource's are likely the main cause of the issue beacuse they have a custom spawnflag set, I'll have to look into that further. (the issue is on map ht11lasers that lasers dont register correctly, like Incorrect colors,
no sync-ing)

Thanks for the help! :biggrin:
Posted 3 years ago2021-05-09 17:48:02 UTC
in Need some help with a keyvalue Post #345595
So, Ive been working on a Half-Life: Decay port (Based on Yet another PS2 Half-Life PC port) and have somewhat recently (8 months ago)
ran into an issue when porting the mission lasers (ht11lasers). So here is the situation:

Whenever I press the buttons in the laser control room, the laser doesnt change color or become visible after being
completely turned off. First I thought that trigger_bit & trigger_bit_counter had some problems, but
I found out later that it was all caused beacuse env_render had a new keyvalue in PS2 Half-Life called
netname, it basically works somewhat like a multi manager, it finds all other entities on the map with the same netname (not targetname!)
and then applies the new rendermode, renderfx, color, etc...

I tried to make it work but all of my attempts have failed so far, so I came here to ask for help.

Here is the code:
//
// PS2DECAY
//

    if (!FStringNull(pev->netname))
    {
        edict_t* pentTarget    = NULL;
        //pentTarget = FIND_ENTITY_BY_STRING(pentTarget, "netname", STRING( pev->netname ));
        pentTarget = FIND_ENTITY_BY_STRING(NULL, "netname", STRING(pev->netname));
        while ( pentTarget )
        {
            //if (FNullEnt(pentTarget))
                //break;

            entvars_t *pevNetname = VARS( pentTarget );
            if ( !FBitSet( pev->spawnflags, SF_RENDER_MASKFX ) )
                pevNetname->renderfx = pev->renderfx;
            if ( !FBitSet( pev->spawnflags, SF_RENDER_MASKAMT ) )
                pevNetname->renderamt = pev->renderamt;
            if ( !FBitSet( pev->spawnflags, SF_RENDER_MASKMODE ) )
                pevNetname->rendermode = pev->rendermode;
            if ( !FBitSet( pev->spawnflags, SF_RENDER_MASKCOLOR ) )
                pevNetname->rendercolor = pev->rendercolor;

            pentTarget = FIND_ENTITY_BY_STRING(pentTarget, "netname", STRING( pev->netname ));
        }
    }
This is all located at the bottom of CRenderFxManager :: Use ( CBaseEntity *pActivator, CBaseEntity *pCaller, USE_TYPE useType, float value )

Can someone please help me with this?
Do you want your character to like move the weapon sideways when running like in hl2?
Is it some type of special animation like animated jiggle for a wepon part or some animation that you want the weapon to play when the player is walking?
There is an entity in SoHL that changes your sourrounding sound effects (eg. echo in a vent, echo in big spaces) its called trigger_sound (Brush-based DSP Sound).
I dont know if that is what you are looking for, but you might give it a try.
Or you might want to try movewith with the ambient generic like you said (movewith is in SoHL too), if the map is in your custom mod, you might want to implement Amder456's util_movewith which is found in his Advanced Development Mod, It really helped me out sometimes.
(attaching it to the player migth be a bit of a challange)
Posted 4 years ago2020-11-20 07:33:58 UTC
in Porting Goldsrc water to Unity Post #344898
OpenGL does the wavy water rendering. All water within goldsrc is divided into 64x64 units (wave effects repeat throught all units). How far I know the water rendering is defined within other dlls. But you might want to check XashXT for water rendering code.
Posted 4 years ago2020-11-13 21:54:41 UTC
in [HELP] Lens flares Post #344854
@Admer456 Thanks for your help, I really appreciate it, it helps me by alot. By the way good luck with your programming video tutorials.
Posted 4 years ago2020-11-12 13:02:44 UTC
in [HELP] Lens flares Post #344850
So im trying to make lens flares. I have made a pretty good concept,
but I just dont know how to do the math part of it.
Basicly I just want to copy the lens flares from the unofficial pc port
of Half-Life: Decay (flare effect on maps: dy_uplink, dy_dampen).
Basicly I just need some help with the math part of it, by that I mean
calculating which angle should the lensflare effect be facing, and how
to calculate the distance between sprites/flares. Ive done some testing
and I came to the conclusion that TRI-API is drawing the flares in decay.

Help with these lens flare effects would be much appreciated.
Posted 4 years ago2020-11-10 18:40:27 UTC
in Source to Goldsrc? Post #344847
I did it once for the map c2a5a to get the skybox from HL:S. You should just re-create it bc the max amount of allocblocks is much larger in source it will crash your game if u arent using software mode renderer or running the game on xash3D.
Posted 4 years ago2020-09-21 13:41:40 UTC
in [HELP] Extending the sentence limit Post #344734
There is no trigger_sequence entity in the code but there are some things releated to reading sequence files in eiface.h
Posted 4 years ago2020-09-10 19:59:49 UTC
in [HELP] Extending the sentence limit Post #344717
well, thats unfortunate, but is there an archive of the forum on the waybackmachine maybe?
Posted 4 years ago2020-09-10 19:02:14 UTC
in [HELP] Extending the sentence limit Post #344715
Hi,
I need some help with extending the sentence limit
beacuse changing the limit in util.h is going to lead me to an engine limit,
I need some sort of hacky method to make maps use custom sentence files (like in sven co-op)
or any other method of just extending the limit.
You can't change the directory in sound.cpp for the sentences file "sound/sentences.txt"
beacuse then everything just gets a random sound assigned to it, another engine limit i think.

Btw im using the 2008 VC++ sdk by Gary_McTaggart
So, I just realized that the errors that im getting (in-game) arent anywhere found in my source code its an engine limitation, The Xash3D SDK for some reason has these defined in a file thats not included in my SDK (Half-Life SDK v2.3 for Microsoft Visual Studio 2008 by Gary_McTaggart) that code is probably from some old version, I dont think I could just go and slap all of that code onto my SDK link stuff, and extend the limit, or maybe?
Ive alredy tried changing the limit of CVOXFILESENTENCEMAX, but then the game is just throwing errors at me, it launches, but im getting tons of errors from sound.cpp, I believe it is a failsafe thing to prevent crashes, playing mp3s not working might be caused by me running my mod on a much older version of half-life, like the build is from 2007, it supports Direct3D, (I run it on that older version bc the steam version crashes too often on it), and it plays mp3 files from the steam version of Half-Life fine, but opposing force it just gives the error, btw sentences.txt is a problem beacuse opposing force's new sentences for monsters, scientists, and vox is too much, I alredy deleted tons of unused sentences, but the problem still exists, also it has sentences from decay and bshift (my mod is a half life game pack)
Hello, just need some help with sentences in half life (im making a mod just to be clear), Ive alredy came up with 2 possible solutions: a) Increase the limit of maximum sentences (I believe its hard coded), b) make it read different files on different map prefixes (eg. of, c, ht, ba_), im making a mod about all of half life campaigns merged into one, but theres another problem: playing any opposig force tracks put into my media folder directly from the gearbox/media folder doesnt seem to work, it gives me the following error: warning: MP3_InitStream(3, media\Prospero01.mp3) failed

Regarding the first issue Ive alredy tried just simply changing the file name (sentences.txt) that the game is meant to read in sounds.cpp and it just starts assigning random sounds found in my mods sounds folder to sentences, regarding the other issue, ive alredy implemented fmod into my game (I could only get my hands on a newer release, not the one that every tutorial mentions, and its just giving me an error in-game), that didnt solve the problem, so I implemented a patch that was sadly for Xash3d (Im trying everything at this point, it didnt work).

(btw english isnt my first language, so sorry for spelling mistakes)
Help with these issues would be much appreciated.
Posted 4 years ago2020-06-12 18:10:50 UTC
in Need help with broken buttons in mod Post #344399
Admer456, I replaced the use code with soHLs use code, it fixed the issue, thx for help, finally this issue is fixed.
Posted 4 years ago2020-06-12 12:17:39 UTC
in Need help with broken buttons in mod Post #344397
sorry, I didnt mention its based on SoHL, i just usally add entities to my mod, and not complete features, like my mod doesnt have movewith, the only major modification I made to my mod was just adding the env_sky and the things needed for it to work in view.cpp, I think I based the buttons.cpp code modifications on the sohl 1.2 version, I made a reddit post about this 15 days ago, I have a vid there about the glitch, the link is here
Posted 4 years ago2020-06-11 19:16:32 UTC
in Need help with broken buttons in mod Post #344395
I reverted the buttons code to the original as I said, but there are a few minor changes, here are all the lines added to the original buttons code:
#define SF_BUTTON_ONLYDIRECT    16 // LRC

int        CBaseButton::ObjectCaps()
{
    return (CBaseToggle::ObjectCaps() & ~FCAP_ACROSS_TRANSITION) |
        (pev->takedamage ? 0 : FCAP_IMPULSE_USE) |
        (pev->spawnflags & SF_BUTTON_ONLYDIRECT ? FCAP_ONLYDIRECT_USE : 0);
}

    if (IsLockedByMaster()) return;
I did not remove ANY lines from the original code

btw I clean the solution, and recompile after adding new weapons
Posted 4 years ago2020-06-11 11:19:07 UTC
in Need help with broken buttons in mod Post #344391
I have no idea whats causing this issue, I looked throught my code and compared it to the original using winmerge, but I didnt find anything that could be causing this, I tried reverting the entire buttons.cpp to the original, but nothing seems to help. And by broken buttons I dont only mean broken func_buttons, I think CBaseToggle might be broken beacuse buttons and npcs are broken too. Btw by broken I mean they can only be interacted with only one side.