MultiDamage fix

Discuss programming in the QuakeC language.
Cobalt
Posts: 445
Joined: Wed Jun 10, 2009 2:58 am
Location: New England, USA
Contact:

Re: MultiDamage fix

Post by Cobalt »

Ok , going back to the original discussion where it was decided you have to loop through the entire entity list. Not that it really soaks up a heck of a lot of CPU resources doing that, but I noticed this code that might speed things up. I think you could assign a new string .float like in this code and still find the effected clients:

Code: Select all

local entity p;
p = find (world, stringname, "client");
	while ((p != world))
	{
		/// do whatever to the entity here....

		p = find (p, stringname, "client");
	}



In this example the coder used a float .stringname and set it to "client" in clientconnect which defines them more clearly as a client.

So lets say for multidamage you set a .multidamage string field, and put the players netname into it, then use this code to walk through the matching entities? It ought to work.....
taniwha
Posts: 401
Joined: Thu Jan 14, 2010 7:11 am
Contact:

Re: MultiDamage fix

Post by taniwha »

That should work if by "player's name" you mean the name of the player firing the shotgun. You're still looping over the entities list, but at least doing so as quickly as possible.
Leave others their otherness.
http://quakeforge.net/
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Re: MultiDamage fix

Post by Spike »

the find builtin is kinda slow due to the string compares inside. There is always the findfloat[chain] builtin if you want to avoid slow stuff. Or you can build a list/chain of entities yourself.
Cobalt
Posts: 445
Joined: Wed Jun 10, 2009 2:58 am
Location: New England, USA
Contact:

Re: MultiDamage fix

Post by Cobalt »

Orion and I have been exchanging some code ideas privately, and I finally have the code working to an extent. One thing I notice is the shotguns always do 4 or 5 points of damage no matter what, which is not like it had done with the original code before the changes.

I looked at the original code again, and am unsure how it takes the original 4 or 5 points of damage from the initial command and increases them. does it merely wind up doubling them, or is there more that I am missing here...? (yea)
Post Reply