AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   attach_view error (https://forums.alliedmods.net/showthread.php?t=27092)

Des12 04-14-2006 17:32

attach_view error
 
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.

Des12 04-16-2006 02:14

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.

p3tsin 04-16-2006 08:29

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) :wink:

T(+)rget 04-16-2006 10:45

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.

Twilight Suzuka 04-16-2006 13:05

Target: After dispatching key values, you must dispatch a spawn, or else the engine won't know what the new keyvalues are.

T(+)rget 04-16-2006 20:20

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 :shock:

NightWish 04-17-2006 10:55

note to twilight :
never challenge Targie boy in code :\
he's impossible to beat :( :( :(

Twilight Suzuka 04-17-2006 20:27

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 :shock:

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.

Wolle 04-17-2006 20:38

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? :wink:

Twilight Suzuka 04-17-2006 21:05

There is a global stopsound put forth on putinserver to prevent sounds from carrying between servers. You'll need to reset the sound.


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

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