A few door questions.
Moderator: InsideQC Admins
2 posts
• Page 1 of 1
A few door questions.
1. I'm having an issue with making doors only open with my universal action/use command. I thought it would be as simple as changing self.touch = door_use to th_use = door_use. But no avail. I thought it was because my use command uses trace_ent, so i made it trace_ent || trace_ent.takedamge just to be sure. Still, nothing. Here is my use code.
2. Another thing i want to add to doors is have monsters attack it if if stands between them and the player and be able to be destroyed, so basically if they are enraged from seeing a player they will attack the door but the door is a lower priority. Is this simple to do? I am terrible at AI so please help haha.
3. Would giving the door health and usable conflict?
- Code: Select all
void() use_ent =
{
local entity oldself;
if (trace_ent.th_use)
{
oldself = self;
other = self;
self = trace_ent;
self.th_use();
self = oldself;
}
};
void() use_cmd =
{
local vector source;
local vector org;
makevectors (self.v_angle);
source = self.origin + '0 0 16';
traceline (source, source + v_forward*64, FALSE, self);
if (trace_fraction == 1.0)
return;
org = trace_endpos - v_forward*4;
if (trace_ent || trace_ent.takedamage)
{
if (trace_ent.classname == "player" && trace_ent.capenabled == 0)
return;
if (trace_ent.capenabled == 1)
HelpOther();
use_ent();
}
};
2. Another thing i want to add to doors is have monsters attack it if if stands between them and the player and be able to be destroyed, so basically if they are enraged from seeing a player they will attack the door but the door is a lower priority. Is this simple to do? I am terrible at AI so please help haha.
3. Would giving the door health and usable conflict?
- Ghost_Fang
- Posts: 336
- Joined: Thu Nov 12, 2009 4:37 am
1. I can't say off hand what the problem might be, but I do have a suggestion. Put an eprint(trace_ent) somewhere after your traceline and see what you're getting for results. Are the doors even being found?
2. It's doable, but it's a bit more complex than the usual AI. One simple way would be to change the monster targeting code to look for doors if it can't find a player. This would make them dumb as they would just attack whatever doors they see. Smarter stuff would involve only attacking doors if they could see a player before, but can't now, with some sort of timeout.
The way to really do this would be with real navigation support, so that the monster knows that to get from point A to point B, it should smash down door C on the way. For info on that sort of thing (or any advanced AI code) the bot tutorials are your best bet. (The enhancing tutor bot series, I forget the link, is really good.)
Edit: found it: http://www.quaddicted.com/webarchive/minion.planetquake.gamespy.com/tutorial/main.htm
3. There's nothing in having doors be +use able and having health that would inherently conflict. However, to do what you want would require modifying the basic door code. If I recall correctly, doors with heath open when they are "killed", so having them destructible would require changes. Furthermore, having health may (I forget exactly) have effects on other door functions, like how they respond to being triggered and what not, so you'd need to look into that.
2. It's doable, but it's a bit more complex than the usual AI. One simple way would be to change the monster targeting code to look for doors if it can't find a player. This would make them dumb as they would just attack whatever doors they see. Smarter stuff would involve only attacking doors if they could see a player before, but can't now, with some sort of timeout.
The way to really do this would be with real navigation support, so that the monster knows that to get from point A to point B, it should smash down door C on the way. For info on that sort of thing (or any advanced AI code) the bot tutorials are your best bet. (The enhancing tutor bot series, I forget the link, is really good.)
Edit: found it: http://www.quaddicted.com/webarchive/minion.planetquake.gamespy.com/tutorial/main.htm
3. There's nothing in having doors be +use able and having health that would inherently conflict. However, to do what you want would require modifying the basic door code. If I recall correctly, doors with heath open when they are "killed", so having them destructible would require changes. Furthermore, having health may (I forget exactly) have effects on other door functions, like how they respond to being triggered and what not, so you'd need to look into that.
- Karatorian
- Posts: 31
- Joined: Tue Aug 17, 2010 4:26 am
- Location: Rindge, NH, USA
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest