Weapon Views from scratch QC

Discuss programming in the QuakeC language.
ScatterBox
Posts: 50
Joined: Sun Oct 13, 2013 7:53 pm

Re: Weapon Views from scratch QC

Post by ScatterBox »

OK, I think the problem is that it doesn't load the gun at the start of a map (like the axe/shotgun in original quake) I know how to change this in default QuakeC in client.qc with SetNewParms but how would I do this with scratch QC? :)
ceriux
Posts: 2230
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Re: Weapon Views from scratch QC

Post by ceriux »

the same? i maybe wrong. everything iv learned has either been from tutorials, or from reading the 1.06 qc. so i'd assume the best way to do things would be either similar or the same as ID.
ScatterBox
Posts: 50
Joined: Sun Oct 13, 2013 7:53 pm

Re: Weapon Views from scratch QC

Post by ScatterBox »

ceriux wrote:the same? i maybe wrong. everything iv learned has either been from tutorials, or from reading the 1.06 qc. so i'd assume the best way to do things would be either similar or the same as ID.
I literally copy and pasted all of the need Parm code from client.qc (eg SetNewParms ect.) and adjusted it some places and it didn't work.
:roll:
frag.machine
Posts: 2126
Joined: Sat Nov 25, 2006 1:49 pm

Re: Weapon Views from scratch QC

Post by frag.machine »

You must ensure that updateweapon is called somewhere at every frame, so any weapon change (pickups, running out of ammo, etc) are visually represented to the player. Are you doung this ? And where exactly ?
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
ScatterBox
Posts: 50
Joined: Sun Oct 13, 2013 7:53 pm

Re: Weapon Views from scratch QC

Post by ScatterBox »

frag.machine wrote:You must ensure that updateweapon is called somewhere at every frame, so any weapon change (pickups, running out of ammo, etc) are visually represented to the player. Are you doung this ? And where exactly ?
OK, I'm calling UpdateWeapon (like W_SetCurrentAmmo in original Quake) in these places

- Weapons.qc
: W_CheckNoAmmo
: W_ChangeAmmo
: CheatCommand

- items_btl.qc (items.qc)
: at the top of the file - Line 1: void() UpdateWepaon;
: weapon_touch

That's the places I'm calling it.. Hope this helps! :)
frag.machine
Posts: 2126
Joined: Sat Nov 25, 2006 1:49 pm

Re: Weapon Views from scratch QC

Post by frag.machine »

ScatterBox wrote:- items_btl.qc (items.qc)
: at the top of the file - Line 1: void() UpdateWepaon;
This one doesn't even count as a call. It's just the function declaration for use further down in the code.
A function call will look something like this:

Code: Select all

void blablabla ()
{
// some code
UpdateWeapon();
// more code
};
From what I see, you are not calling it at least once per frame, as I said it should be.
For comparison, W_SetCurrentAmmo () is called in the following points in regular QuakeC:

Code: Select all

client.qc:
  - PutClientInServer()
  - PlayerPreThink()

items.qc:
  - weapon_touch()
  - ammo_touch()
  - BackpackTouch()

weapons.qc:
  - W_CheckNoAmmo()
  - W_ChangeWeapon()
  - CheatCommand()
  - CycleWeaponCommand()
  - CycleWeaponReverseCommand()
You' re lacking a call to updateWeapon() in PlayerPreThink (), which is ALWAYS executed at the beggining of every game frame (10 times per second).
The remaining calls are optional depending if your scratch-based code have the equivalent functions.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
ScatterBox
Posts: 50
Joined: Sun Oct 13, 2013 7:53 pm

Re: Weapon Views from scratch QC

Post by ScatterBox »

frag.machine wrote:
ScatterBox wrote:- items_btl.qc (items.qc)
: at the top of the file - Line 1: void() UpdateWepaon;
This one doesn't even count as a call. It's just the function declaration for use further down in the code.
A function call will look something like this:

Code: Select all

void blablabla ()
{
// some code
UpdateWeapon();
// more code
};
From what I see, you are not calling it at least once per frame, as I said it should be.
For comparison, W_SetCurrentAmmo () is called in the following points in regular QuakeC:

Code: Select all

client.qc:
  - PutClientInServer()
  - PlayerPreThink()

items.qc:
  - weapon_touch()
  - ammo_touch()
  - BackpackTouch()

weapons.qc:
  - W_CheckNoAmmo()
  - W_ChangeWeapon()
  - CheatCommand()
  - CycleWeaponCommand()
  - CycleWeaponReverseCommand()
You' re lacking a call to updateWeapon() in PlayerPreThink (), which is ALWAYS executed at the beggining of every game frame (10 times per second).
The remaining calls are optional depending if your scratch-based code have the equivalent functions.
Thanks for explaining the whole function declaration thing! :P That does help. Here I tried this and it didn't work. I'm stuck, so here's my quakec files for anyone to muck through who wants to help... just beware, it's truly a mess... good luck in there. http://www.mediafire.com/download/5y34fjwyxzldro9/QC.rar
Max_Salivan
Posts: 96
Joined: Thu Dec 15, 2011 1:00 pm

Re: Weapon Views from scratch QC

Post by Max_Salivan »

impulse test(works)

Code: Select all

	
if(self.impulse == 20)
	{
		self.weapon = IT_BLUN;
		UpdateWeapon();
	}
what about items(lol)

you missed SUB_UseTargets and DelayThink(for SUB_UseTargets) from original quake

you just defined it in your defs.qc but not wrote the code:)

your doors,buttons will not work without SUB_UseTargets
Sorry for my english :)
frag.machine
Posts: 2126
Joined: Sat Nov 25, 2006 1:49 pm

Re: Weapon Views from scratch QC

Post by frag.machine »

It seems to me you dont have (yet) the required experience and engine knowledge to use the scratch code base. Maybe you should just take progs 106, strip out the unused parts and add your code ? At least would be easier to ask for help if something gets screwed.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
ScatterBox
Posts: 50
Joined: Sun Oct 13, 2013 7:53 pm

Re: Weapon Views from scratch QC

Post by ScatterBox »

frag.machine wrote:It seems to me you dont have (yet) the required experience and engine knowledge to use the scratch code base. Maybe you should just take progs 106, strip out the unused parts and add your code ? At least would be easier to ask for help if something gets screwed.
You're probably right.. which is why I still have a backup copy of my old progs build off of the 1.06 source. :) I will stick to this until I gather more knowledge. Thanks everyone for your help!! :)
Post Reply