Raised This Month: $ Target: $400
 0% 

Ent flying x units over player


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
osk522
BANNED
Join Date: Dec 2006
Location: Slöinge, Falkenberg, Hal
Old 01-20-2007 , 08:05   Ent flying x units over player
Reply With Quote #1

Hi there!
Iv'e been searching the forums for over 2 hours now (yes, I said hours), but can find how to make an ent(camera) follow another ent (player), x units over the ent(player).
And don't post some crap about topdown view.

BTW the ent(camera) wont have any function, except that the player will attach its view to it (attach_view(id,cameraent[id])).

Last edited by osk522; 01-22-2007 at 11:35.
osk522 is offline
Send a message via MSN to osk522
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 01-20-2007 , 17:02   Re: Ent flying x units over player
Reply With Quote #2

Code:
new myCamera[33]; public plugin_init() {      register_forward(FM_PlayerPostThink,"fw_postthink"); } public make_a_camera(id) {      myCamera[id] = create_entity("info_target"); } public fw_postthink(id) {      if(pev_valid(myCamera[id]))      {           new Float:origin[3];           pev(id,pev_origin,origin);           origin[2] += 128.0; // or however many units           set_pev(myCamera[id],pev_origin,origin);      } }

After updating your position, it finds the space 128 units above you, and sets your camera's origin to that. If you want to make sure it doesn't go through the roof, you'll want to do a trace line upwards and see if it hits anything before 128 units.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
osk522
BANNED
Join Date: Dec 2006
Location: Slöinge, Falkenberg, Hal
Old 01-20-2007 , 18:45   Re: Ent flying x units over player
Reply With Quote #3

Quote:
Originally Posted by XxAvalanchexX View Post
After updating your position, it finds the space 128 units above you, and sets your camera's origin to that. If you want to make sure it doesn't go through the roof, you'll want to do a trace line upwards and see if it hits anything before 128 units.
Haven't tested it, but it looks so simple it just got to work .
+karma.
osk522 is offline
Send a message via MSN to osk522
osk522
BANNED
Join Date: Dec 2006
Location: Slöinge, Falkenberg, Hal
Old 01-20-2007 , 21:10   Re: Ent flying x units over player
Reply With Quote #4

Tested it, although I dont know if it works.
When I do attach_view(id,cameraent[id]) the display fucks up.
When I shoot, I can hear the sounds of the gun.
I think it's becouse the ent doesn't have any angles, how do I fix it?
osk522 is offline
Send a message via MSN to osk522
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 01-20-2007 , 22:03   Re: Ent flying x units over player
Reply With Quote #5

I've never actually been able to get attach_view to work. I don't know why. It always sets my view to the origin of 0,0,0.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
osk522
BANNED
Join Date: Dec 2006
Location: Slöinge, Falkenberg, Hal
Old 01-21-2007 , 09:28   Re: Ent flying x units over player
Reply With Quote #6

Quote:
Originally Posted by XxAvalanchexX View Post
I've never actually been able to get attach_view to work. I don't know why. It always sets my view to the origin of 0,0,0.
Iv'e got it to work.
I can post a copy if you want.
osk522 is offline
Send a message via MSN to osk522
GoD-Tony
Veteran Member
Join Date: Jul 2005
Old 01-21-2007 , 11:01   Re: Ent flying x units over player
Reply With Quote #7

I'm also trying to do something similar, please post it if you have it working. Thanks.
GoD-Tony is offline
Zenith77
Veteran Member
Join Date: Aug 2005
Old 01-21-2007 , 20:21   Re: Ent flying x units over player
Reply With Quote #8

attach_view() only works with entities that have a model set. Don't ask me why, HL is just weird. If in the case you don't want your entity to have a model, you can just set the correct rendering on it.
__________________
Quote:
Originally Posted by phorelyph View Post
your retatred
Zenith77 is offline
osk522
BANNED
Join Date: Dec 2006
Location: Slöinge, Falkenberg, Hal
Old 01-22-2007 , 11:39   Re: Ent flying x units over player
Reply With Quote #9

Quote:
Originally Posted by Zenith77 View Post
attach_view() only works with entities that have a model set. Don't ask me why, HL is just weird. If in the case you don't want your entity to have a model, you can just set the correct rendering on it.
That answears alot.
+karma
osk522 is offline
Send a message via MSN to osk522
dutchmeat
Senior Member
Join Date: Sep 2006
Old 01-22-2007 , 05:15   Re: Ent flying x units over player
Reply With Quote #10

this will work:
http://forums.alliedmods.net/showthread.php?t=29637
the only thin you have to do is change the coordinates.

But, if you are going to use this as a check to see if the player has a wallhack, it won't work.
A wallhack is a hook to the client's video memory, so it won't change the halflife view. If you want to create a 'wallhack check' you will have to make a clientside program, that makes a 'windows' screenshot, and send it via socket.
__________________
before you criticize someone, you should walk a mile in their shoes. that way, when you criticize them, you're a mile away and you have their shoes.

Last edited by dutchmeat; 01-22-2007 at 05:46.
dutchmeat is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 22:22.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode