lfnetwork.com mark read register faq members calendar

Thread: I'm force pulling too many items/weapons
Thread Tools Display Modes
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Old 07-16-2005, 01:18 AM   #1
Lord Markaine
 
Lord Markaine's Avatar
 
Join Date: Apr 2002
Posts: 17
I'm force pulling too many items/weapons

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?
Lord Markaine is offline   you may: quote & reply,
Old 07-16-2005, 02:13 AM   #2
ensiform
The Stig
 
ensiform's Avatar
 
Join Date: Nov 2004
Location: Sawtooth Cauldron
Posts: 1,241
Current Game: Borderlands 2
wtf ?

ur not making sense. where is this code located ... u got a bug here or are u posting a fix / your code ?


iojamp project lead / coder
ensiform is offline   you may: quote & reply,
Old 07-16-2005, 03:46 AM   #3
Lord Markaine
 
Lord Markaine's Avatar
 
Join Date: Apr 2002
Posts: 17
w_force.c
under forcethrow.

on a dif computer I'll post my code soon.
Lord Markaine is offline   you may: quote & reply,
Old 07-16-2005, 11:30 AM   #4
ensiform
The Stig
 
ensiform's Avatar
 
Join Date: Nov 2004
Location: Sawtooth Cauldron
Posts: 1,241
Current Game: Borderlands 2
i take it ur trying to get item pulling working?


has anyone gotten it to work that would be willing to share some code ?


iojamp project lead / coder
ensiform is offline   you may: quote & reply,
Old 07-16-2005, 04:35 PM   #5
Lord Markaine
 
Lord Markaine's Avatar
 
Join Date: Apr 2002
Posts: 17
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.

Last edited by Lord Markaine; 07-25-2005 at 02:58 PM.
Lord Markaine is offline   you may: quote & reply,
Old 07-16-2005, 10:36 PM   #6
razorace
Impressive, Terran!
 
razorace's Avatar
 
Join Date: May 2002
Posts: 9,187
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.


---Jedi Guardian of the Newbie Questions
---Masters of the Force Team Leader / Creator
---Open Jedi Project Lead Moderator / Co-Founder
razorace is offline   you may: quote & reply,
Old 07-22-2005, 03:23 PM   #7
Lord Markaine
 
Lord Markaine's Avatar
 
Join Date: Apr 2002
Posts: 17
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

Last edited by Lord Markaine; 07-25-2005 at 02:56 PM.
Lord Markaine is offline   you may: quote & reply,
Old 07-22-2005, 06:03 PM   #8
razorace
Impressive, Terran!
 
razorace's Avatar
 
Join Date: May 2002
Posts: 9,187
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.


---Jedi Guardian of the Newbie Questions
---Masters of the Force Team Leader / Creator
---Open Jedi Project Lead Moderator / Co-Founder
razorace is offline   you may: quote & reply,
Old 07-25-2005, 03:09 PM   #9
Lord Markaine
 
Lord Markaine's Avatar
 
Join Date: Apr 2002
Posts: 17
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.
Lord Markaine is offline   you may: quote & reply,
Old 07-25-2005, 07:03 PM   #10
razorace
Impressive, Terran!
 
razorace's Avatar
 
Join Date: May 2002
Posts: 9,187
sounds cool. How complicated is the code? Would you mind submitting it to OJP?


---Jedi Guardian of the Newbie Questions
---Masters of the Force Team Leader / Creator
---Open Jedi Project Lead Moderator / Co-Founder
razorace is offline   you may: quote & reply,
Old 07-25-2005, 09:13 PM   #11
Lord Markaine
 
Lord Markaine's Avatar
 
Join Date: Apr 2002
Posts: 17
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.
Lord Markaine is offline   you may: quote & reply,
Old 07-26-2005, 01:33 AM   #12
razorace
Impressive, Terran!
 
razorace's Avatar
 
Join Date: May 2002
Posts: 9,187
Well, I remember the icon. Is that yours?

And you're welcome.


---Jedi Guardian of the Newbie Questions
---Masters of the Force Team Leader / Creator
---Open Jedi Project Lead Moderator / Co-Founder
razorace is offline   you may: quote & reply,
Old 07-26-2005, 08:50 AM   #13
Lord Markaine
 
Lord Markaine's Avatar
 
Join Date: Apr 2002
Posts: 17
No, the icon isn't mine.

Long ago in my super noob days:

http://www.lucasforums.com/showthrea...threadid=90841
Lord Markaine is offline   you may: quote & reply,
Old 07-26-2005, 11:36 AM   #14
razorace
Impressive, Terran!
 
razorace's Avatar
 
Join Date: May 2002
Posts: 9,187
Woah, now you're making me feel old.


---Jedi Guardian of the Newbie Questions
---Masters of the Force Team Leader / Creator
---Open Jedi Project Lead Moderator / Co-Founder
razorace is offline   you may: quote & reply,
Old 07-27-2005, 08:48 PM   #15
Lord Markaine
 
Lord Markaine's Avatar
 
Join Date: Apr 2002
Posts: 17
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.
Lord Markaine is offline   you may: quote & reply,
Old 07-28-2005, 11:44 AM   #16
razorace
Impressive, Terran!
 
razorace's Avatar
 
Join Date: May 2002
Posts: 9,187
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.


---Jedi Guardian of the Newbie Questions
---Masters of the Force Team Leader / Creator
---Open Jedi Project Lead Moderator / Co-Founder
razorace is offline   you may: quote & reply,
Old 07-28-2005, 04:16 PM   #17
Wudan
Got Balance?
 
Wudan's Avatar
 
Join Date: Oct 2002
Location: Salt Lake, UT
Posts: 1,442
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?

Code:
Com_Printf( "Whaassssssup!?\n" );
Yes they do.


Mt-Wudan.com
I made a silly little program called Dragon, which is an animation tool for the GLA format, used in Jedi Outcast, Jedi Academy and Krakatoa.
Wudan is offline   you may: quote & reply,
Old 07-28-2005, 11:59 PM   #18
Lord Markaine
 
Lord Markaine's Avatar
 
Join Date: Apr 2002
Posts: 17
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.
Lord Markaine is offline   you may: quote & reply,
Old 07-29-2005, 01:36 PM   #19
razorace
Impressive, Terran!
 
razorace's Avatar
 
Join Date: May 2002
Posts: 9,187
why not put some if statements in there to differiencate between which functions are called for a particular class of object.


---Jedi Guardian of the Newbie Questions
---Masters of the Force Team Leader / Creator
---Open Jedi Project Lead Moderator / Co-Founder
razorace is offline   you may: quote & reply,
Old 08-03-2005, 09:14 AM   #20
GangsterAngel
Rookie
 
GangsterAngel's Avatar
 
Join Date: May 2004
Posts: 139
How i did it

Quote:
Originally Posted by Lord Markaine
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
Quote:
if ( Q_stricmp( "limb", ent->classname ) )
{//not a limb
Add:

Code:
							
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
Quote:
else if ( !Q_stricmp( "func_static", push_list[x]->classname ) )
{//force-usable func_static
Add:

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


Code:
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;
}
}
GangsterAngel is offline   you may: quote & reply,
Old 08-03-2005, 09:21 AM   #21
GangsterAngel
Rookie
 
GangsterAngel's Avatar
 
Join Date: May 2004
Posts: 139
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

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

Last edited by GangsterAngel; 08-03-2005 at 10:13 AM. Reason: Adding screenie link
GangsterAngel is offline   you may: quote & reply,
Post a new thread. Add a reply to this thread. Indicate all threads in this forum as read. Subscribe to this forum. RSS feed: this forum RSS feed: all forums
Go Back   LucasForums > Network > JediKnight Series > Editing Central > JA Coding > I'm force pulling too many items/weapons

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 Off
HTML code is Off

Forum Jump


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

LFNetwork, LLC ©2002-2011 - All rights reserved.
Powered by vBulletin®
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.