Urban Wars

Help => Programming/Coding => Topic started by: Mexicouger on April 24, 2010, 09:25:27 pm



Title: is there a ragdoll effect for quake?
Post by: Mexicouger on April 24, 2010, 09:25:27 pm
Can I tie a ragdoll effect to a brush? say i make an 8 side cylinder in worldcraft, can I code in a function an dti eit to the brush so th eplayer can move it and rockets can blow it away? can you shoow me a code? is it hard to add?


Title: Re: is there a ragdoll effect for quake?
Post by: DukeInstinct on April 24, 2010, 09:37:44 pm
Through qc. No.

Through the engine. Possibly but I have no clue how you'd program that in.


Title: Re: is there a ragdoll effect for quake?
Post by: Mexicouger on April 24, 2010, 11:12:21 pm
How about in the qc, just being able to walk up to  abrush and move it. I remember seeing a tutorial on inside 3d about movable gib. that is what i`d like to do. basically have something that can be moved by being walked into. is that possible?


Title: Re: is there a ragdoll effect for quake?
Post by: DukeInstinct on April 25, 2010, 12:19:32 am
I'd use the touch function to set the brush's velocity to the velocity of the player that touched it and set the brush's think function to dampen it's velocity gradually so it slides to a halt due to friction or air resistance once there is no longer a player pushing the brush.

Code:
void() ragdoll_think =
{
if (self.velocity_x==0.0||self.velocity_y==0.0||self.velocity_z==0.0) return;

self.velocity*=0.9;
if (vsize(self.velocity)<=10) self.velocity='0 0 0';

self.nextthink=time+0.04;
}

void() ragdoll_touch =
{
self.velocity=other.velocity;

self.think=ragdoll_think;
self.nextthink=time+0.04;
};



Code:
self.velocity*=0.9;
if (vsize(self.velocity)<=10)

You should try a couple different values for those two lines to get the exact effect you want.


Title: Re: is there a ragdoll effect for quake?
Post by: Mexicouger on April 26, 2010, 07:29:17 am
2 things: where do I find the player speed and thins is for my fusion coil halo. can i make the coil rotate and fall over also?


Title: Re: is there a ragdoll effect for quake?
Post by: Mexicouger on April 26, 2010, 07:48:16 am
Also, the compiler doesnt know what vsize is and I have no clue what it is... so I can`t test....


Title: Re: is there a ragdoll effect for quake?
Post by: Mexicouger on April 26, 2010, 08:44:41 am
Can you declare vsize. And where do i add thi sthink function? Do i add this code to misc_fcoil        self.touch = ragdoll_touch;  ?


Title: Re: is there a ragdoll effect for quake?
Post by: Mexicouger on April 26, 2010, 01:01:56 pm
Please answer me on this 1. I would love to have a somewat ragdoll effect! we are so close too. I mean, half lif epsp had it. you could move the chairs.


Title: Re: is there a ragdoll effect for quake?
Post by: DukeInstinct on April 26, 2010, 06:25:27 pm
Oh sorry, I meant vlen.

vsize is UnrealScript's equivalent function.


And yes do assign self.touch to ragdoll_touch. And change those || to && in the first if statement of ragdoll_think. I don't know why I made them || at first.

Making it rotate is easy, but making it rotate in the direction you're moving is tricky. I'll have to think about that one.


Title: Re: is there a ragdoll effect for quake?
Post by: Mexicouger on April 26, 2010, 07:38:10 pm
for one, I wasn`t able to move the fusion coil. Is there a certain movetype I need to attacth to this touch function?     Ok, so in void()misc_fcoil ( my func), I added a line called self.touch = ragdoll touch;   Am I supposed to do that? Is there a certain movetype I nee dto put in fcoil? My current movetype is MOVETYPE_BOUNCE. Should I change it to slidebox or bbox or does it matter. And when it compiled it said       in function ragdoll_think (line 198)     misc.qc:204: error: type mismatch for *= (pointer and float)  How do I make this work. And thanks for working with me Duke.


Title: Re: is there a ragdoll effect for quake?
Post by: DukeInstinct on April 26, 2010, 09:51:53 pm
What are you currently using for its solid property? I'd try using Slidebox. Movetypes Toss or Bounce should work.

The error must be talking about "self.velocity*=0.9;". Try changing "self.velocity*=0.9" to "self.velocity_x*=0.9; self.velocity_y*=0.9; self.velocity_z*=0.9;"

The only confusing part about that error is it says pointer and float when it's really a vector and a float. I thought the only pointers in QC were entities.


Title: Re: is there a ragdoll effect for quake?
Post by: Mexicouger on April 26, 2010, 11:26:43 pm
That code ran flawlessly. I stuck a .touch function on the fusion coil, I changed the movetype to movetype bounce, and i made the solid slidebox. Even with all that, The coils still wouldn`t move at all