Forum

help me please

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

help me please

Postby quakecorpse » Sun Nov 26, 2006 5:24 pm

I've found a tutorial for the shotgun's kickback, i tried but, of course, i failed.

-------------------------------------------------------------------------------------

It say:

Open up the weapons.qc file and add this function just under the prototypes:


float(float numb) kickback
{
local float kick;
kick = numb * -1; // reverse it
kick = kick * random(); // randomise it, by multiplying it by a random number from 0 to 1
if (kick > -5) kick = -5; // changes the number if its too small
return kick;
}

-------------------------------------------------------------------------------------

in my weapon.qc I have:

};

void (float numb) kickback =
{
local float kick;

kick = (numb * CONTENT_EMPTY);
kick = (kick * random ());
if ((kick > CONTENT_LAVA))
{
kick = CONTENT_LAVA;
}
};

------------------------------------------------------------------------------------

how do i have to mix them?

thank you
quakecorpse
 
Posts: 8
Joined: Tue Apr 18, 2006 11:13 am

Postby Dr. Shadowborg » Sun Nov 26, 2006 5:52 pm

I haven't the foggiest how that tutorial is laid out but...

If it's intended to affect your punchangle, then make sure it matches the tutorial, then in w_fireshotgun put:

self.punchangle_x = kickback(whatever amount of kickback you want);

If, on the other hand it actually affects your velocity, that's a whole 'nother kettle of fish.
User avatar
Dr. Shadowborg
InsideQC Staff
 
Posts: 1110
Joined: Sat Oct 16, 2004 3:34 pm

Postby FrikaC » Mon Nov 27, 2006 7:15 am

Why are you using decompiled code?
FrikaC
Site Admin
 
Posts: 1026
Joined: Fri Oct 08, 2004 11:19 pm

Postby quakecorpse » Mon Nov 27, 2006 7:46 pm

Dr. Shadowborg wrote:I haven't the foggiest how that tutorial is laid out but...


the second part of the tut. says:

Scroll down to the W_FireShotgun function, and add this code at bottom of it:


msg_entity = self; // send the message to yourself
WriteByte(MSG_ONE,10); // use the protocol 10 , the SVC_SETANGLES protocol, which obviously changes the viewport angles
WriteAngle(MSG_ONE,self.v_angle_x + kickback(12)); // add the kickback to the x axis, the vertical rotation axis
WriteAngle(MSG_ONE,self.angles_y); // the y axis rotates the view horizontaly, we don't want to modify it
WriteAngle(MSG_ONE,0); // reset the z axis, which rolls the view

but i don't know how to use the first part ...

FrikaC wrote:Why are you using decompiled code?


i'm sorry ... i just opened the progs.dat with winfrik26 and then i started to mess around with the code ... i don't know if i 've broken some rule or etiquette ...
quakecorpse
 
Posts: 8
Joined: Tue Apr 18, 2006 11:13 am

Postby quakecorpse » Sun Dec 03, 2006 11:44 am

ok, no kickback ...

about the wizard, scrag, what should i do to make him summon Tarbaby, Spawn, ?
quakecorpse
 
Posts: 8
Joined: Tue Apr 18, 2006 11:13 am

Postby scar3crow » Sun Dec 03, 2006 8:59 pm

Look at the code for putting an entity into the world, namely a spawn and see if you can emulate such behavior under certain conditions of the scrag.

The more difficult part would be finding a suitable location to summon them... Hrmm... if you made the summoning part of the attack routine, the scrag is in almost all cases where they would check to attack facing you, and thus there is open space between you... You could simply have them then summon the spawn x number of units in front of them... or do a check of distance between them and the player and use that value with a modifier of -10 randomized or something to place the spawn not necessarily in the same spot always, but in the general region and near the player. I dont know, Im not a coder =)

Regarding decompiled code, its not so much a matter of etiquette as decompiled code is generally ugly and hard to work with. It can put you at a disadvantage, needlessly usually.
User avatar
scar3crow
InsideQC Staff
 
Posts: 1054
Joined: Tue Jan 18, 2005 8:54 pm
Location: Alabama


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest