Action/Use Button
Moderator: InsideQC Admins
3 posts
• Page 1 of 1
Action/Use Button
I had a similar post a long time ago, but I've actually made some progress on my own. I made an action/use button, and it only seems to work on enemies. (I tested to see if it even worked by making a knight have th_use = knight_die;) And i click use on the knights and they die.
Ok, wait, i did a little more testing before submitting this post and i found out if i made the button a shootable button (obviously giving it health) it works, so which makes me believe that is it linked to the:
portion of my code, so my new question, what do i need to replace takedamage with for it to be able to work on pickups and buttons and doors etc, without giving them health?
EDIT:
Here is my whole action/use code if you need it.
Ok, wait, i did a little more testing before submitting this post and i found out if i made the button a shootable button (obviously giving it health) it works, so which makes me believe that is it linked to the:
- Code: Select all
if (trace_ent.takedamage)
{
use_ent();
}
portion of my code, so my new question, what do i need to replace takedamage with for it to be able to work on pickups and buttons and doors etc, without giving them health?
EDIT:
Here is my whole action/use code if you need it.
- 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.takedamage)
{
use_ent();
}
};
- Ghost_Fang
- Posts: 336
- Joined: Thu Nov 12, 2009 4:37 am
yea, i ended up find that on my own messing with it, but i waited for comments to see if there is a better way, thanks though 
- Ghost_Fang
- Posts: 336
- Joined: Thu Nov 12, 2009 4:37 am
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest