View Full Version : Remedy help - Throwing grenade at target
Melt 284
11-30-2003, 05:41 PM
Here is the code for the custom event the enemy receives:
this->AI_SetPerceiving(false);
this->AI_SetTactic(CoverCombat);
this->AI_AddCommand(STAND, THROWGRENADE, "");
The target the enemy has (as specified in its Startup section) is about 5 meters in front of him.
When the enemy receives the custom event he throws the grenade... at the wall directly behind him.
No matter what way the enemy is facing on startup he still does this and I have tried as many different variations of AI Perceiving modes and PushCommand and Timers and all else I could think of but still... no way to simply make the enemy throw a grenade at a target.
Please help.
Melt 284
12-02-2003, 09:39 PM
Bump. Anyone please help.
Aknott
12-03-2003, 03:07 AM
Did you try the Idle tactic?
mysteryperfecta
12-03-2003, 08:53 AM
Remedy must be particularly busy at the moment. I haven't seen them answer a question in a couple weeks. I just want to add that I'm having a very similar problem with AI and grenades, and would greatly appreciate an answer.
Melt 284
12-03-2003, 03:50 PM
Arknott, thanks for the reply. Yes I have tried every AI tactic mode there is.
Melt 284
12-07-2003, 12:49 PM
Bump.
Dsilence
12-08-2003, 04:33 AM
what about ai_settarget???
make the target character a custom group
then set target to that group or sumthing?
Melt 284
12-08-2003, 06:29 PM
Dsilence, yeah I use ai_settarget in his startup with the following line:
this->AI_SetTarget( ::LabHigh::GrenadeTarget );
And when watching him ingame with F7-mode on it can be seen that "Grenadetarget" (a mesh) is his active target the entire time like it should be.
Thanks for the reply though. It is really good to have people try to help on this as it has been annoying me for over a month now.
Has anyone ever gotten an enemy to throw a grenade at a target successfully?
Melt 284
12-08-2003, 07:58 PM
Here's some more information:
It does not matter what you set the AI Target to be, he still throws it the exact same way behind him.
It does not matter what skin the NPC has because I've tried lots.
smellyirishman
12-08-2003, 08:17 PM
k iv just read this thread now fsr and have been experimenting.
hum he faces one way and hurls the grenades the other!!!!!!!! great fun to watch but not at 2:20 in t morning when ya tryin to solve somthin http://forums.3drealms.com/ubbthreads/images/graemlins/grin.gif
ok now i tried changing the side that t target was on but he didnt change the way he faced http://forums.3drealms.com/ubbthreads/images/graemlins/confused.gif
dammbit i was ment to sleep an hour ago http://forums.3drealms.com/ubbthreads/images/graemlins/redface.gif
k now nothing works and im definitly goin to bed http://forums.3drealms.com/ubbthreads/images/graemlins/grin.gif
Ghast
12-11-2003, 02:32 AM
I can't even get the grenade thrown, is grenade a weapon, ammo, what? Is there a special animation? Only ceertain enemy types? Is it because of the mesh?
Can you post your startup too? Guess I am learning what doesn't work pretty good *LOL*
scorpianuk
12-11-2003, 03:25 AM
what a pickle this is cant you just have him throw a bomb
i can get him to do that and get him to throw grenade at me if i hide but at a target no way!!
mysteryperfecta
12-11-2003, 08:18 AM
I don't even know if this would work, but could you create an NPC in a unique enemy group, place him where you would like the grenade to go, hide him, and make him the enemy of the grenade thrower? I don't know if the enemy will attack a hidden character. Maybe you could unhide the npc for .1 seconds. Or I wonder if there is a way to give an NPC an invisible skin. If you took all of the enemies weapons away except grenades, he'd have to use them.
Just grasping at straws, but this problem may only get solved with creative thinking (unless Remedy swoops down and addresses it).
Melt 284
12-11-2003, 09:00 AM
what a pickle this is cant you just have him throw a bomb
What do you mean throw a bomb? There is no bomb weapon...
but could you create an NPC in a unique enemy group, place him where you would like the grenade to go, hide him, and make him the enemy of the grenade thrower?
Tried that. It does not matter who or what the target is he still throws the grenade at the wall behind him. The target can be a mesh beside him or an enemy 200 meters away, makes no difference.
If you took all of the enemies weapons away except grenades, he'd have to use them.
Nope, you can take all his weapons away and give him hundreds of grenades but he will just point his hand at you without a weapon in it unless you specifically tell him to throw the grenade.
mysteryperfecta
12-11-2003, 12:40 PM
I don't know if I was clear. I was talking about abandoning the THROWGRENADE command altogether, and relying on the npc to attack it's enemy group using the hardcoded AI, and not an AICommand.
Are you saying that if you set an enemy's target as "player", set his tactic as "combat", take away his weapons and give him grenades, he will not use the grenades to attack the player? I have enemies my map that throw grenades, because they have them, not because I've told them to. My problem (and yours) comes in when we try to command the enemy to throw a grenade.
The frustrating thing is, there's probably a simple solution, but Remedy has let your question and others wither on the vine. I can understand being busy with the console ports (and maybe vacations), but someone needed to be assigned to check the forums at least once a week and answer some questions. This is how the MP1 community fell off.
Ghast
12-11-2003, 01:13 PM
I have enemies my map that throw grenades, because they have them, not because I've told them to. My problem (and yours) comes in when we try to command the enemy to throw a grenade.
Thanks, I'll try that!
yeppers, there's a whole slew of numbered animations, and just trying to set up test situations to see what they do is work enough without having Moves Acts and Parameters that only fail when you try to load the LDB2 when one could hope the editor would be more robust about disallowing illegal combos?
About the community, RTCW had a whole slew of unexplained game engine problems, it made the community stronger! MP1 IMHO suffered from a lack of working demo .LVLs from the modding community.
Kipsta's tuts are a godsend, but I would be equally happy if people just posted .LV2s more often of problems solved (built with the default texture?) so we all aren't reinventing the wheel?
scorpianuk
12-11-2003, 01:31 PM
there is a bomb
Melt 284
12-14-2003, 12:30 AM
I was talking about abandoning the THROWGRENADE command altogether, and relying on the npc to attack it's enemy group using the hardcoded AI, and not an AICommand.
This is unfortunatly the path I may have to choose. It does however complicate my implementation of it as the AI does not throw reliably and I have a hole (about 2m wide, 1m high) that the enemy must throw the grenade through.
The AI does not throw unless it cannot see the target and when it does throw it likes to bounce the grenade of walls and such, never going through the hole.
mysteryperfecta
12-14-2003, 12:19 PM
The AI does not throw unless it cannot see the target and when it does throw it likes to bounce the grenade of walls and such, never going through the hole.
Ya, enemies only throw a grenade under certain circumstances. I didn't realize your needed the enemy to throw it into a hole.
It's too bad your enemy actually throws a grenade behind him. If he just did the motion, you could do a CreateProjectile from a mesh, timed and positioned to coordinate with the enemy's arm movement. That is, if the enemy in the same place to throw the grenade. And that's getting pretty desperate. http://forums.3drealms.com/ubbthreads/images/graemlins/smile.gif
matt_dickinson
12-14-2003, 12:27 PM
wait hes throwing into a hole? hm seems complex have u tried just 2 empty rooms and making him throw grenades at the player? it happens alot in the game id be suprised if it was so hard to do.
Melt 284
12-14-2003, 05:36 PM
it happens alot in the game id be suprised if it was so hard to do
Yes, it is that hard to do. Unless someone from Remedy drops by and explains why their "THROWGRENADE" command does not work or someone else figures it out.
I do not want to spend hours animating a fake grenade throw where a grenade appears at the enemy's hand. Not only would this not look as aesthetically pleasing, it is probably unnecessary since what I want to happen DOES happen in the game. Remedy just won't explain it.
I will attempt to keep this thread on the front page for a few months or so until Remedy recognises it or one of the elite like Arknott figure it out http://forums.3drealms.com/ubbthreads/images/graemlins/mryuck.gif
matt_dickinson
12-14-2003, 05:58 PM
being hard to do and taking u months to find a solution arent the same tho. i suspect it will be either a small detail or a completely different method to what uve tried. im sur eit will be sorted eventualy tho http://forums.3drealms.com/ubbthreads/images/graemlins/smile.gif
Melt 284
12-19-2003, 02:53 PM
Bump...
Ghast
12-19-2003, 05:07 PM
What about the vlad throwing grenade command? You could use the animation with a cutscene and pan to a grenade sliding into the hole then trigger explosion?
Melt 284
12-29-2003, 07:43 PM
Bump. I am still searching for a solution to make a character throw a grenade at something. (Not just animating it and trying to make a grenade appear to fly from his hand).
Melt 284
01-03-2004, 08:29 PM
Ok... until Remedy tells us whats wrong with the THROWGRENADE command I've decided to try animating a grenade throw instead of actually having it happen. I couldn't use the unreliable AI_SetTactics because sometimes they take a long time, sometimes they won't throw at all, and sometimes they do it right... just too unpredictable.
So... how should I go about doing this? Do I have to make a dynamic mesh that looks like a grenade or can I use a Level Item or what? And how would I explode it? Use a pressure wave or an actual grenade somehow..?
Melt 284
01-10-2004, 12:24 AM
Bump
Melt 284
01-15-2004, 06:48 PM
Bump..
theHunted
01-15-2004, 07:36 PM
try to add this->AI_RevealTarget();
to the players startup tab or wherever you want it.
Melt 284
01-16-2004, 12:02 AM
try to add this->AI_RevealTarget();
to the players startup tab or wherever you want it.
Doesn't change anything, but thanks anyway.
kemical
01-16-2004, 02:54 AM
just wanted to say that I've tried doing it too, I get the same results with the grenade flying behind, or sideways, I'm using p_createprojectileatbone and creating a grenade that way... maybe i just need to find the correct bone though.
theHunted
01-16-2004, 05:36 AM
you can still always do
enemy->C_Removeallweapons(the weapon he ought to have);
enemy->C_Pickupweapon(grenade);
enemy->C_Pickupammo(grenade, 1);
and let the enemy handle it in tactics mode
enemy->AI_Settactic(combat);
combined with a timer that immediately after he throws the grenade sets him back to scripting mode again it should work. makes you lose control about what the ai actually does though, as it might just run around and hide and then throw it, or the likes.
FatherSeraphin
01-16-2004, 08:07 AM
The Hunted, he already said it didnt work. He needs to get the grenade into a hole.
Here is two VERY stupid ideas/things to try out:
- I dont know if it is possible. But have the NPC non-moving, and have him face the opposite direction of the hole. Then trigger the grenade throw...
- Rely on the premade AI. Give the NPC grenade. Have a small, small mesh be the target, and make it get out of the hole, so the NPC see it, then emmediatly get the mesh inside. So the NPC will try to get the grenade bouncing off a wall and into the hole. Experiment with different wall/NPC/hole positioning, until you are sure the grenade lands in the hole.
Kozak
01-16-2004, 12:53 PM
Well what you can do is make the enemie animate throwing the grenade and then place a little fsm near his hands so when he ends animating the fsm spawns a grenade projectile in the appropriate direction.
Melt 284
01-16-2004, 04:15 PM
I'm using p_createprojectileatbone and creating a grenade that way...
I am currently experimenting with this option. Its probably the best route.
I dont know if it is possible. But have the NPC non-moving, and have him face the opposite direction of the hole. Then trigger the grenade throw...
The direction the character faces does not change the direction the grenade goes.
Experiment with different wall/NPC/hole positioning, until you are sure the grenade lands in the hole.
I've tried this (relying on the AI). The AI won't always do the same thing. It can be lined up perfectly and he will still miss half the time or just decide not to throw at all sometimes.
then place a little fsm near his hands so when he ends animating the fsm spawns a grenade projectile
This is a possibility much like CreateProjectileToBone() and I will try it if I cannot get CreateProjectileToBone() working within the next few hours.
Thanks for all of the suggestions, it's not so frustrating when others help out.
Melt 284
01-16-2004, 06:46 PM
I'm using p_createprojectileatbone and creating a grenade that way... maybe i just need to find the correct bone though.
I have used this method and it is too unreliable. I have managed to make the character animate a grenade throw at 2.88 seconds into the animation and then throw the grenade from the the "R Gun" bone (R Hand is even less reliable).
Everywhere between about 2.87 and 2.9 seconds into the animation will cause the character to throw somewhat forward.
The problem: Using this method works about once out of every 5 throws. Not good enough.
BTW, I have tried "real time" and "game time" timer modes. Both are inaccurate.
BAH.
GreenCRUSH
01-16-2004, 07:14 PM
dude i think I got an idea:
on the enemies startup only give him grenades and set his tactic to attack the player. Create a timer that after a given ammount of time it changes the tactic and the weapons that he has. Also, you could create a trigger that starts this event. Or, you could create a waypoint, turn him in a certian direction when he is spawned, etc.
Melt 284
01-16-2004, 08:04 PM
dude i think I got an idea:
on the enemies startup only give him grenades and set his tactic to attack the player. Create a timer that after a given ammount of time it changes the tactic and the weapons that he has. Also, you could create a trigger that starts this event. Or, you could create a waypoint, turn him in a certian direction when he is spawned, etc.
I have already tried everything you have mentioned here. The AI is NOT reliable.
Melt 284
01-16-2004, 08:05 PM
I have a solution that now works 9/10 times! Its the solution I posted a couple hours ago which only worked about 1/5 times. I just moved the character closer to the hole and off to the right a couple meters and used a relatively straight throw. I guess what I have is good enough to use.
Thanks to everyone for the suggestions.
Kakistocracy
01-17-2004, 06:58 PM
How did you get 39 replies on one page? http://forums.3drealms.com/ubbthreads/images/graemlins/eek.gif
Melt 284
01-17-2004, 11:02 PM
How did you get 39 replies on one page?
By default there are 50 posts shown per page. To change the amount click "My Home" and the click "Edit" beside the part that says "Display preferences, number of shown threads, languages, colors...".
vBulletin® v3.8.7, Copyright ©2000-2012, vBulletin Solutions, Inc.