Lord Markaine Posted July 16, 2005 Share Posted July 16, 2005 When I use force pull/push it affects everthing in my view. I increased the forcepush/pull radius, so that I can use it from a far away distance. int radius = 1024;<---------- //since it's view-based now. //350; Increased I also changed: if (push_list[x]->client && VectorLength(pushDir) <= 256)<---------- Increased I even added: vec3_t trFrom; VectorCopy(self->client->ps.origin, trFrom); trFrom[2] += self->client->ps.viewheight; AngleVectors( self->client->ps.viewangles, forward, NULL, NULL ); VectorNormalize( forward ); VectorMA( trFrom, radius, forward, end ); trap_Trace( &tr, trFrom, vec3_origin, vec3_origin, end, self->s.number, MASK_SHOT ); if ( tr.entityNum != push_list[x]->s.number || tr.fraction == 1.0 || tr.allsolid || tr.startsolid ) {//must be pointing right at it continue; } in different places, and that didn't work. But I worked for: Buttons, glass, breakables, or any activatable ents. I just want targeted things to be pulled or push. I think this is it but, if (powerLevel == FORCE_LEVEL_1) { //can only push/pull targeted things at level 1 VectorCopy(self->client->ps.origin, tfrom); tfrom[2] += self->client->ps.viewheight; AngleVectors(self->client->ps.viewangles, fwd, NULL, NULL); tto[0] = tfrom[0] + fwd[0]*radius/2; tto[1] = tfrom[1] + fwd[1]*radius/2; tto[2] = tfrom[2] + fwd[2]*radius/2; My problem might be, if (ent->client && !InFieldOfVision(self->client->ps.viewangles, visionArc, a) && ForcePowerUsableOn(self, ent, powerUse)) { //only bother with arc rules if the victim is a client "only bother with arc rules if the victim is a client"<---is this it? Link to comment Share on other sites More sharing options...
ensiform Posted July 16, 2005 Share Posted July 16, 2005 wtf ? ur not making sense. where is this code located ... u got a bug here or are u posting a fix / your code ? Link to comment Share on other sites More sharing options...
Lord Markaine Posted July 16, 2005 Author Share Posted July 16, 2005 w_force.c under forcethrow. on a dif computer I'll post my code soon. Link to comment Share on other sites More sharing options...
ensiform Posted July 16, 2005 Share Posted July 16, 2005 i take it ur trying to get item pulling working? has anyone gotten it to work that would be willing to share some code ? Link to comment Share on other sites More sharing options...
Lord Markaine Posted July 16, 2005 Author Share Posted July 16, 2005 No, do or do not there is no try... I'm already able to use force push and pull to: pull/push items, weapons, etc. break glass break breakables activate buttons, touch plates, switches,etc. What I'm having problems with is, when I press force pull, I pull everthing (items,weapons...) in my sight. I only want to pull targeted things. So, since I used push_list[x]->s.pos.trType = TR_LINEAR; the items will have no gravity, really nasty when I pull something I don't need and they go floating all over the level. I'll be fixing the think and thinktime to change them back to TR_GRAVITY by adding some .trTime =duration stuff. Link to comment Share on other sites More sharing options...
razorace Posted July 17, 2005 Share Posted July 17, 2005 Oh well, you have two options if you want to just push/pull the objects that you're looking at: 1. Use the Level 1 Push/Pull method of onlying affecting the object that you hit with a directed trace. 2. filter out all the objects outside the player's view using one of the many InFOV functions. Since the player's viewangles is set by the crosshairs, the tighter you make the FOV input, the close the object is to the crosshairs. Link to comment Share on other sites More sharing options...
Lord Markaine Posted July 22, 2005 Author Share Posted July 22, 2005 It doesn't matter if I have force level 1, It doesn't use the arc rules I guess. It pulls whatever's in my fov. So, could you explain what is, and how these work in the forcethrow code: radius = a sphere around me? or a circle at the end of the visionarc? visionarc \ / visionarc = from my eyes, like: \/ me Link to comment Share on other sites More sharing options...
razorace Posted July 22, 2005 Share Posted July 22, 2005 I think your problem is that you need to filter your push_list with the fovs I mentioned before. There should be a preexisting FOV check somewhere in the push/pull code for force levels 2 and above. I'd look for that and see what you can learn from that. Link to comment Share on other sites More sharing options...
Lord Markaine Posted July 25, 2005 Author Share Posted July 25, 2005 Thanks Razor, I got it workin now. Visionarc was my problem also. Now my code allows me to: pull/push items, weapons, etc. break glass break breakables activate buttons, touch plates, switches, etc but I need to clean it up now because I just tested and found out that I can pull/push swoops... Or just make the swoop stop on a dime and eject the rider forward, that'll be funny Finally I get back to my fatalities. Link to comment Share on other sites More sharing options...
razorace Posted July 25, 2005 Share Posted July 25, 2005 sounds cool. How complicated is the code? Would you mind submitting it to OJP? Link to comment Share on other sites More sharing options...
Lord Markaine Posted July 26, 2005 Author Share Posted July 26, 2005 Not complicated at all. I still don't know much about C. But I've been playing with code since Outcast, you probably don't remember, but I was Markaine and now Lord Markaine, same guy. I've been kinda bug testing, so as soon as I'm finish I'll post something. Besides, I owe you for always pointing me in the right direction to figure stuff out on my own... It always leads me to other ideas. Link to comment Share on other sites More sharing options...
razorace Posted July 26, 2005 Share Posted July 26, 2005 Well, I remember the icon. Is that yours? And you're welcome. Link to comment Share on other sites More sharing options...
Lord Markaine Posted July 26, 2005 Author Share Posted July 26, 2005 No, the icon isn't mine. Long ago in my super noob days: http://www.lucasforums.com/showthread.php?s=&threadid=90841 Link to comment Share on other sites More sharing options...
razorace Posted July 26, 2005 Share Posted July 26, 2005 Woah, now you're making me feel old. Link to comment Share on other sites More sharing options...
Lord Markaine Posted July 27, 2005 Author Share Posted July 27, 2005 Yeah, running into problems again with my code so, here's a little something... In w_force.c under forcethrow, look for: ------------------------------------------------------------------------------ if ( Q_stricmp( "lightsaber", ent->classname ) != 0 ) {//not a lightsaber ------------------------------------------------------------------------------ All I did was add some more to it like: if ( Q_stricmp( "func_plat", ent->classname ) != 0 ) { if ( Q_stricmp( "func_breakable", ent->classname ) != 0 ) { if ( Q_stricmp( "func_glass", ent->classname ) != 0 ) { ------------------------------------------------------------------------------ Now for the rest, after the func_door code, or right above: //attempt to break any leftover grips ------------------------------------------------------------------------------- else if ( Q_stricmp( "func_plat", push_list[x]->classname ) == 0 ) {//push/pull the door vec3_t trFrom; VectorCopy(self->client->ps.origin, trFrom); trFrom[2] += self->client->ps.viewheight; AngleVectors( self->client->ps.viewangles, forward, NULL, NULL ); VectorNormalize( forward ); VectorMA( trFrom, radius, forward, end ); trap_Trace( &tr, trFrom, vec3_origin, vec3_origin, end, self->s.number, MASK_SHOT ); if ( tr.entityNum != push_list[x]->s.number || tr.fraction == 1.0 || tr.allsolid || tr.startsolid ) {//must be pointing right at it continue; } Touch_Button( push_list[x], self, NULL ); GEntity_UseFunc( push_list[x], self, self ); G_UseTargets (push_list[x], self); continue; } else if ( Q_stricmp( "func_breakable", push_list[x]->classname ) == 0 ) {//push/pull the door vec3_t trFrom; VectorCopy(self->client->ps.origin, trFrom); trFrom[2] += self->client->ps.viewheight; AngleVectors( self->client->ps.viewangles, forward, NULL, NULL ); VectorNormalize( forward ); VectorMA( trFrom, radius, forward, end ); trap_Trace( &tr, trFrom, vec3_origin, vec3_origin, end, self->s.number, MASK_SHOT ); if ( tr.entityNum != push_list[x]->s.number || tr.fraction == 1.0 || tr.allsolid || tr.startsolid ) {//must be pointing right at it continue; } G_ActivateBehavior( push_list[x], BSET_USE ); Touch_Button( push_list[x], self, NULL ); GEntity_UseFunc( push_list[x], self, self ); G_UseTargets (push_list[x], self); continue; } else if ( Q_stricmp( "func_glass", push_list[x]->classname ) == 0 ) {//push/pull the door vec3_t trFrom; VectorCopy(self->client->ps.origin, trFrom); trFrom[2] += self->client->ps.viewheight; AngleVectors( self->client->ps.viewangles, forward, NULL, NULL ); VectorNormalize( forward ); VectorMA( trFrom, radius, forward, end ); trap_Trace( &tr, trFrom, vec3_origin, vec3_origin, end, self->s.number, MASK_SHOT ); if ( tr.entityNum != push_list[x]->s.number || tr.fraction == 1.0 || tr.allsolid || tr.startsolid ) {//must be pointing right at it continue; } Touch_Button( push_list[x], self, NULL ); GEntity_UseFunc( push_list[x], self, self ); G_UseTargets (push_list[x], self); continue; } -------------------------------------------------------------------------------- As the the use of all three: Touch_Button( push_list[x], self, NULL ); GEntity_UseFunc( push_list[x], self, self ); G_UseTargets (push_list[x], self); Still testing on different maps, so some work and some don't work the right way yet. For example, Sith J Cull's Palpatine's Rescue map has some breakable stuff, but you can't use the force to break it. If you've played this map, you probably wanted to use the force to collapse the walkway on someone like Dooku did to Obiwan. Well, with this you can. I still have alot of testing to do with the other stuff I didn't post, like activation switches. But there's the basics. Link to comment Share on other sites More sharing options...
razorace Posted July 28, 2005 Share Posted July 28, 2005 So, what's the problem? Just from looking casually it looks like you don't want cascading if statments with your Q_stricmp stuff. You could probably do the same thing with a single if statment with everything anded. Link to comment Share on other sites More sharing options...
Wudan Posted July 28, 2005 Share Posted July 28, 2005 Wow, that's ... Ok, you should work on simplifying that code up - I'd say ... each time you do an 'if this is the item that is getting hit' make a function for the actions within and call that function if the condition is met. It'll be prettier, and you may save yourself some headaches. Hmmmm, could be a bracket problem, just by looking at it. Making the logic complicated to read can be problematic, especially if there appears to be a problem in your logic. Post the entire function, do code tags work on this forum? Com_Printf( "Whaassssssup!?\n" ); Yes they do. Link to comment Share on other sites More sharing options...
Lord Markaine Posted July 29, 2005 Author Share Posted July 29, 2005 Well actually it works, Its just a matter of checking if I truly need all three of these: Touch_Button( push_list[x], self, NULL ); GEntity_UseFunc( push_list[x], self, self ); G_UseTargets (push_list[x], self); In the case of func_glass, if I only use say, Touch_Button(.....); the glass may just disappear, no sound effects, etc. kingda the same with my func_button, func_useable, etc., except I got alot more than three functions... I said I'd post something...So run and play with it if I take too long. Thanks again guys. Because of you guys, I finally get to play the way I've been wanting. Link to comment Share on other sites More sharing options...
razorace Posted July 29, 2005 Share Posted July 29, 2005 why not put some if statements in there to differiencate between which functions are called for a particular class of object. Link to comment Share on other sites More sharing options...
GangsterAngel Posted August 3, 2005 Share Posted August 3, 2005 Well actually it works, Its just a matter of checking if I truly need all three of these: Touch_Button( push_list[x], self, NULL ); GEntity_UseFunc( push_list[x], self, self ); G_UseTargets (push_list[x], self); I did it this way... Under if ( Q_stricmp( "limb", ent->classname ) ) {//not a limb Add: int ModCanPush; if(Q_stricmp( "func_glass", ent->classname ) == 0/* && G_ClientTarget(self)==ent*/)ModCanPush=1; if(ModCanPush!=1)continue; I Decided not to use the G_ClientTarget function. and to use the Trace Enum in the PushList Trace. but ive included the function in this post incase it can help anyone. Above else if ( !Q_stricmp( "func_static", push_list[x]->classname ) ) {//force-usable func_static Add: else if ( Q_stricmp( "func_glass", push_list[x]->classname ) == 0 ) { if(tr.entityNum == push_list[x]->s.number) { GEntity_UseFunc( push_list[x], self, self ); G_Damage(push_list[x],self,self,forward,push_list[x]->s.origin,120,NULL,MOD_FORCE_DARK,NULL,NULL); } } That works fine, Glass Shards,, Sounds. perfect Heres that user target function that some of u might find usefull: ( G_cmds.c) int G_ClientTarget (gentity_t *User) { trace_t tr; vec3_t tfrom, tto, fwd; int isreal; gentity_t *kEnt; tfrom[2] += User->client->ps.viewheight; VectorCopy(User->client->ps.origin, tfrom); tfrom[2] += User->client->ps.viewheight; AngleVectors(User->client->ps.viewangles, fwd, NULL, NULL); tto[0] = tfrom[0] + fwd[0]*1200; tto[1] = tfrom[1] + fwd[1]*1200; tto[2] = tfrom[2] + fwd[2]*1200; trap_Trace(&tr, tfrom, NULL, NULL, tto, User->s.number, MASK_SOLID); kEnt=&g_entities[tr.entityNum]; if (kEnt && kEnt!=NULL) return &g_entities[tr.entityNum]; else { // trap_SendServerCommand( User-g_entities , va( "print \"^1Could not detect your target \n\"")); return NULL; } } Link to comment Share on other sites More sharing options...
GangsterAngel Posted August 3, 2005 Share Posted August 3, 2005 if the mapper has linked a entity to be triggerd when the glass breaks though, it would not tirgger it i dont think. unless its in G_Combat.c if is glass trigger trigger .,,, bla bla bla .. but incase its not . i would add if(G_PickTarget(push_list[x]->target)!=NULL)G_UseTargets (push_list[x], self); above the G_Damage line Heres a screenie: http://img48.imageshack.us/img48/5166/glass6ql.jpg Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.