.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   HPB_bot (http://forums.bots-united.com/forumdisplay.php?f=35)
-   -   Resurrected bots (http://forums.bots-united.com/showthread.php?t=1649)

ukfreethinker 12-05-2004 12:23

Resurrected bots
 
I want my bots to have a lower health when they enter the world. If I put

pBot->pEdict->v.health = 8;

into the BotSpawnInit() function they are very easy to kill in their first incarnation. But when they respawn they have full health. I tried putting the same line into BotThink() where the bot clicks "Fire" to respawn but somewhere this is getting overridden. Can anyone suggest where this initialisation code should go?

Thanks very much

Paul

botman 12-05-2004 14:50

Re: Resurrected bots
 
Just check to see if the bot's health is greater than the max amount you want them to have at the top of the BotThink() function. If it's 100 (or higher), set it to the value you want it to be.

botman

Pierre-Marie Baty 12-05-2004 15:18

Re: Resurrected bots
 
This is yet another example of how unsafe it is to write arbitrary stuff in the entvars when the engine doesn't expect it. 8)

By setting this, you are overwriting what the engine already writes at the same location. The question is whether you write it before the engine passed here or after it.

And there's also a problem with the clients. All your clients' DLL (including your listen server client) are programmed to know that when a player respawns, his health starts at 100. You change this by the engine side. But then, all the clients' predictions get out of sync. If you make a change to a player's health arbitrarily, send an update network message to all your clients.

ukfreethinker 12-05-2004 15:52

Re: Resurrected bots
 
Seems like BotSpawnInit is only called once when a bot is first added. The health is reset by CBasePlayer::Spawn in the game DLL when a dead bot comes back to life. For what I am doing I don't mind changing the game DLL as well but it would be neater to do it in the Bot DLL. Is there anything which is called after CBasePlayer::Spawn in the Bot DLL where I can do it?

I want the bots to start with a health of 50 and then be more motivated to increase their health as well as suffer damage during fighting.

Paul

PS. Respect to botman for reverse engineering all this stuff! Must have been a big effort.

Pierre-Marie Baty 12-05-2004 16:03

Re: Resurrected bots
 
Which MOD is this for ?

If this is HLDM, all a bot needs to do to respawn is to press the FIRE key. Pressing this key to respawn will also make the bot trigger a call in CBasePlayer::Spawn in the game DLL. Hence if you want the bots to reset their structure AFTER pressing the fire key and not BEFORE it, call BotSpawnInit() one frame after the bot has set his pEdict->v.button to IN_ATTACK.

The code that makes the bot press IN_ATTACK when dead is in BotThink(), if I remember well.


All times are GMT +2. The time now is 07:36.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.