Forum

MultiDamage fix

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Re: MultiDamage fix

Postby Cobalt » Fri May 11, 2012 1:38 am

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.....
User avatar
Cobalt
 
Posts: 445
Joined: Wed Jun 10, 2009 2:58 am
Location: New England, USA

Re: MultiDamage fix

Postby taniwha » Fri May 11, 2012 2:18 am

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/
taniwha
 
Posts: 399
Joined: Thu Jan 14, 2010 7:11 am

Re: MultiDamage fix

Postby Spike » Fri May 11, 2012 2:18 am

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.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Re: MultiDamage fix

Postby Cobalt » Fri May 18, 2012 3:34 am

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)
User avatar
Cobalt
 
Posts: 445
Joined: Wed Jun 10, 2009 2:58 am
Location: New England, USA

Previous

Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest