View previous topic :: View next topic |
Author |
Message |
Ghost_Fang
Joined: 12 Nov 2009 Posts: 162
|
Posted: Wed Jul 21, 2010 3:21 am Post subject: 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:
Code: | 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: | 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();
}
}; |
|
|
Back to top |
|
 |
Sajt
Joined: 16 Oct 2004 Posts: 1026
|
Posted: Wed Jul 21, 2010 5:28 am Post subject: |
|
|
You can just get rid of the takedamage if entirely, since use_ent is checking for trace_ent.th_use. _________________ F. A. Špork, an enlightened nobleman and a great patron of art, had a stately Baroque spa complex built on the banks of the River Labe. |
|
Back to top |
|
 |
Ghost_Fang
Joined: 12 Nov 2009 Posts: 162
|
Posted: Wed Jul 21, 2010 5:36 am Post subject: |
|
|
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  |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2004 phpBB Group
|