![]() |
Sensing grenades in-flight
How can I get my bot to "sense" grenades (i.e. how can I get the edict of the grenade) that are thrown into its vicinity? FindEntityInSphere doesn't seem to detect them, or perhaps I'm just not using it correctly. Any tips?
-JB |
Re: Sensing grenades in-flight
Grenade entities are class-named "grenade", simply that :)
There are several ways to detect them, but this one will work: Code:
edict_t *pGrenade = NULL; |
Re: Sensing grenades in-flight
Thanks so much Pierre-Marie- you're great! Now another question...
How do grenades indicate that they've detonated? I need to be able to detect this so my bots don't think they last forever. Thanks! -JB |
Re: Sensing grenades in-flight
Well i identify grenades like this, i don't even care about detonated or not right now.
Code:
edict_t *pent = NULL; Code:
////////////////////////////////// |
Re: Sensing grenades in-flight
Think about it two_masks: if you make your bot care for grenades each frame and react accordingly, when the grenade has detonated the bot won't be able to detect it anymore since it doesn't exist anymore right ? Hence the bot won't react to it anymore...
I think you're trying to solve an unexistent problem perhaps :) |
Re: Sensing grenades in-flight
Uhm... could be me but shouldn't it check if its unequal to zero instead?
if (strcmp ("grenade", STRING (pGrenade->v.classname)) != 0) |
Re: Sensing grenades in-flight
strcmp returns zero if the strings are equal. so
Code:
if (strcmp (model_name, "models/w_hegrenade.mdl") == 0) |
Re: Sensing grenades in-flight
I was refering to PMB's post...And i find == 0 more clear then ! sometimes, dunno why 9_9
Oh and it seems that Im not the only one who had some problems the the text between the code tags... |
Re: Sensing grenades in-flight
This is because Aspirin copy and pasted the code, and when you copy-paste coloured code the formatting tags are copied as well ; plus if you enclose them between code tags, the formatting tags are disabled and then they show up...
it's a bit of a PITA I concede. Someone's gotta have a look in the PHP files again... |
Re: Sensing grenades in-flight
ok, marked the text and clicked on those 2 'A's ... so more a user fault, maybe we should just add some notes about this on the reply page ?!
|
Re: Sensing grenades in-flight
or an option like in word2k , edit-> insert content->unformated text, to paste from the clipboard (i just wanted to say even word 200 is too f**** up to allow "normal" copy&paste anymore, i hate that)
C U friday noon |
Re: Sensing grenades in-flight
When i copy stuff and i want to be sure it is not formatted or messed up in any way. I copy it, paste it into notepad. Then copy it from that to any document i want. It works great for me.
|
Re: Sensing grenades in-flight
I guess notepad is a simple edit field, therefore limited to 65kb on win9x machines ( old 16 bit stuff ). those wordpad or however called stuff is based on rtf windows, thus allowing to copy formatted text. when you paste your text to the notepad, only the text information data is requested from the clipboard, no rtf stuff
|
Re: Sensing grenades in-flight
yes asp, notepad is that simple edit field :) I once tried VB (yuk) and i created my own notepad with it. :)
Anyway, i do not use wordpad, because it still does not erase the text format. As you said, notepad only requires text, therefor it works good for me. |
Re: Sensing grenades in-flight
To those who are still running the sock notepad:
replace it, guys. Replace it. I mean it. There are tons of free replacements for NotePad, full of kickass features. FYI I'm using an old version of EditPad. It has a multiple document interface, a powerful search/replace facility that can operate on all the open documents at once (that which no other editor I know are able to), unlimited text buffer, DOS/ANSI/UNIX/Mac text conversion. Lots of stuff. I can't live without it. The newer versions of EditPad also do syntax highlighting and other stuff but I find them bloated. The version I use is the 3.2.1 Fr. I don't know if it's still available anywhere. |
Re: Sensing grenades in-flight
Yeah, EditPad RULEZ! It loads up more quickly than any other text editor I've ever see (even quicker than Notepad). It minimizes itself to the system tray so that you can pop it up again instantly. It can be used as a hexadecimal editor of files. You can even do super-elite ROT-13 "encryption" to hide your source code from prying eyes! :)
botman |
All times are GMT +2. The time now is 22:07. |
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.