Raised This Month: $ Target: $400
 0% 

attach_view error


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Des12
Senior Member
Join Date: Jan 2005
Old 04-14-2006 , 17:32   attach_view error
Reply With Quote #1

The problem is, the camera always spawns at 0,0,0. I have looked at many different threads where people have had this problem, but no solution was ever found. So I hope this might be different:

Code:
       get_user_aiming(id, entid, entbody, 9999);     if(!is_user_alive(entid)) {         return PLUGIN_HANDLED;     }         g_victim[id] = entid;         new camera = create_entity("info_target")     new Float:origin[3]         entity_get_vector(entid, EV_VEC_origin, origin);         entity_set_origin(camera, origin)     new Float:maxs[3] = {0.0,0.0,0.0}     new Float:mins[3] = {0.0,0.0,0.0}         entity_set_size(camera,mins,maxs)     entity_set_int(camera, EV_INT_movetype, MOVETYPE_FOLLOW)         entity_set_int(camera, EV_INT_solid, SOLID_NOT)         entity_set_edict(camera, EV_ENT_aiment, entid)         entity_set_string(camera, EV_SZ_classname, "camera" )         DispatchSpawn(camera)           g_pcamera[id] = camera;     attach_view(id, g_pcamera[id])     set_task(0.1,"angles",id);     return PLUGIN_HANDLED; } public angles(id) {     if(g_victim[id] == 0) return PLUGIN_HANDLED;     new Float:angles[3];     entity_get_vector(g_victim[id], EV_VEC_angles, angles)     entity_set_vector(g_pcamera[id], EV_VEC_angles, angles)     set_task(0.1,"angles",id);     return PLUGIN_HANDLED; }

I make the camera, set it on the target's origin, set it to follow the target, make the player see through the camera, then cosntantly update the camera's angels to match the targets.

Neither the origin setting nor angle update works, but the player can see through the camera at 0,0,0.
__________________
-Dest Romano

www.JustRP.com
A TSRP Server

Quote:
Originally Posted by Brad
Don't you go be bringing reality into this.
Des12 is offline
Des12
Senior Member
Join Date: Jan 2005
Old 04-16-2006 , 02:14  
Reply With Quote #2

I was mistaken, the camera spawns in seemingly random places each time the function runs. I'll try messing with the origin, seeing if different methods of getting it will work.
__________________
-Dest Romano

www.JustRP.com
A TSRP Server

Quote:
Originally Posted by Brad
Don't you go be bringing reality into this.
Des12 is offline
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 04-16-2006 , 08:29  
Reply With Quote #3

im having the exact same problem (trying to make a camera too)
could u reply here if u get on with it? (will do the same if i find anything)
__________________
plop
p3tsin is offline
T(+)rget
Senior Member
Join Date: Mar 2004
Old 04-16-2006 , 10:45  
Reply With Quote #4

You shouldn't be using this native:
DispatchSpawn(camera)

^ the camera is created and spawned so why are you using this? Besides its mainly for normal HL entities, not customised ones.

You shouldn't need to update the angles, since movetype FOLLOW is as is, in which it should track your aiment.
T(+)rget is offline
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 04-16-2006 , 13:05  
Reply With Quote #5

Target: After dispatching key values, you must dispatch a spawn, or else the engine won't know what the new keyvalues are.
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
T(+)rget
Senior Member
Join Date: Mar 2004
Old 04-16-2006 , 20:20  
Reply With Quote #6

Perhaps I'm blind Twilight Suzuka but I don't see the use of a DispatchKeyValue in the above code, which is when DispatchSpawn is mean't to be called!

Do you, or are you on drugs
T(+)rget is offline
NightWish
Junior Member
Join Date: Apr 2006
Location: Denmark
Old 04-17-2006 , 10:55  
Reply With Quote #7

note to twilight :
never challenge Targie boy in code :\
he's impossible to beat
NightWish is offline
Send a message via MSN to NightWish
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 04-17-2006 , 20:27  
Reply With Quote #8

Quote:
Originally Posted by T(+)rget
Perhaps I'm blind Twilight Suzuka but I don't see the use of a DispatchKeyValue in the above code, which is when DispatchSpawn is mean't to be called!

Do you, or are you on drugs
What the hell are you talking about? of course there is a DispatchKeyValue!

Its not as if I didn't not read the actual script, then assume that the person who made this thread wasn't a complete total idiot, who would never dream of doing something as stupid as randomly throwing in a DispatchSpawn!

Oh wait. Turns out, that situation is completely correct. Then again, my information still stands. After a DispatchKeyValue, you should use a DispatchSpawn.
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
Wolle
Member
Join Date: Jun 2005
Location: Berlin / Germany
Old 04-17-2006 , 20:38  
Reply With Quote #9

Quote:
Originally Posted by NightWish
...never challenge Targie boy in code :\
he's impossible to beat
Really?
Hmm, that's awesome.
So maybe he can tell me why music played through client_connect( id )
is stopped when you're put into the server and how to prevent that?
__________________
Become part of games development!
http://www.games-academy.de
Wolle is offline
Send a message via AIM to Wolle
Twilight Suzuka
bad
Join Date: Jul 2004
Location: CS lab
Old 04-17-2006 , 21:05  
Reply With Quote #10

There is a global stopsound put forth on putinserver to prevent sounds from carrying between servers. You'll need to reset the sound.
__________________
Twilight Suzuka is offline
Send a message via AIM to Twilight Suzuka Send a message via MSN to Twilight Suzuka
Reply



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 05:12.


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