If anyone has played half life 2, im sure you remember the gravity gun. I'm trying to make a simple quake style gravity gun. So you can pick up various objects. But with my current code the object warps the the maps's center. What did i do wrong?
Center of the world is at '0 0 0' which tells me that your hold function isnt seeing the trace_endpos. You really dont have to define a th_grabbed for each entity, since self is global and you are swapping oldself and passing the grabbed object to that function as self, you can use parameters for the hold function, as hold_me(self, origin);
Even so, you could do all this within one function and just modify the movetype/velocity of trace_ent from within Fire_Grav. But MOVETYPE_NONE wouldnt be what I would use.
Last edited by r00k on Sat Sep 04, 2010 5:09 pm, edited 1 time in total.
r00k wrote:you can use parameters for the hold function, as hold_me(self, origin);
Even so, you could do all this within one function and just modify the movetype/velocity of trace_ent from within Fire_Grav. But MOVETYPE_NONE wouldnt be what I would use.
Hmm... forgive me, but im not entirely sure what you mean by that. Where i got this idea was simply the flashlight tutorial, it spawns a lightsource at the end of a given traceline. And i figured i could modify it to change the position of the entity hit by the traceline to the position where the lightsource would be. So maybe i butchered it too much, so maybe if you give me pointers based of the flashlight tutorial here it might be better.
@Sajt
grav_frames are the firing animations. Its being called in Fire_Grav();
Ghost_Fang wrote:If anyone has played half life 2, im sure you remember the gravity gun. I'm trying to make a simple quake style gravity gun. So you can pick up various objects. But with my current code the object warps the the maps's center. What did i do wrong?
A very lethal and annoying weapon to fight against.
The night is young. How else can I annoy the world before sunsrise? Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
Thanks! but um, dumb question: whats it called in the qc? I looked and none of them seem to be able to grab something. Airgun? Hook? Shrapnel gun? which weapon is it?
[sarcasm] Dont everyone answer my question at once ok? [/sarcasm] I'm just kidding. But after playing with the code somemore (and never finding the grav gun in runequake plus). I figured out wat was wrong. I was calling upon self (the grabber) as the oldself (as a LOCAL entity) and it wasnt carrying over to the new function i called if (trace_ent).
So now right now I can grab and hold an entity only if i hold down the fire button. What would be the easiest why to make it toggle?
How would i be able to reset the objects physics? I want it MOVETYPE_TOSS, and thats how the items starts out, but when i let go they float.
Ghost_Fang wrote:[sarcasm]
How would i be able to reset the objects physics? I want it MOVETYPE_TOSS, and thats how the items starts out, but when i let go they float.
Haven't checked your code, but you may try to call droptofloor() after setting movetype.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC (LordHavoc)
well im not sure when to call it. cause what happens is that objects origin is set to the end of my traceline so i dont think the object technically "knows" that its being grabbed, so when would i tell it "ok you can fall now"?
Ghost_Fang wrote:Thanks! but um, dumb question: whats it called in the qc? I looked and none of them seem to be able to grab something. Airgun? Hook? Shrapnel gun? which weapon is it?
Search for the word "gravity" in the source.
If you are going to be coding, you should have something that can do an easy text search. I use TextPad 5: Search --> Find in folder
The weapon can't grab on to something, it shoots a ball with an attractive gravitational field. I didn't mess around enough with Half Life 2 or whatever game had the gravity gun or whatever it was called that let you remotely manipulate objects to be thinking that was what you wanted to achieve.
The night is young. How else can I annoy the world before sunsrise? Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
Baker wrote:
Search for the word "gravity" in the source.
Oh ok, I was just wondering if it was a literal gravity gun or it was called something else but with the same effect.
If it doesnt pick up items I don't think I'll bother just yet. I think I have a way to fix all the problems now.
I THINK:
That I have to hold the fire button because the traceline is only getting called when I fire. So what i could do is call the traceline function in like weaponframe or playerprethink or something. Would that work?
I could have the firing traceline toggle a float on the object, and if the object's "i am grabbed float" is true then stay on the player's constant traceline. Anf firing at it again will disable it and call upon "droptofloor()" as frag.machine has mentioned.
I am going to try it now, please comment if you have any objections to this because you know something i dont on how and why this wont work.
Ghost_Fang wrote:Oh ok, I was just wondering if it was a literal gravity gun or it was called something else but with the same effect.
The gravity gun in Rune Quake Plus is a literal gravity gun shooting a gravity ball that attracts players and rockets and such, not a "grabber gravity gun" like in HL2.
I am going to try it now, please comment if you have any objections to this because you know something i dont on how and why this wont work.
Someone else will have to step in, my overall QuakeC knowledge is pretty weak.
The night is young. How else can I annoy the world before sunsrise? Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
Baker wrote:The gravity gun in Rune Quake Plus is a literal gravity gun shooting a gravity ball that attracts players and rockets and such, not a "grabber gravity gun" like in HL2.
Sounds more like the gravity well from SDQ.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC (LordHavoc)