RuneStorm
http://www.runestorm.com/forums/

My first coding attempt
http://www.runestorm.com/forums/viewtopic.php?f=6&t=20783
Page 1 of 1

Author:  Bjossi [ Fri Dec 01, 2006 9:26 pm ]
Post subject:  My first coding attempt

I recently started playing with the source code of Quake, the old 1996 classic.
I've been doing all sorts of things but what I'm trying now just isn't working, so I need help. This is mainly directed at DC, but if anyone knows this stuff, by all means post your input.

Here's a little background of the code below.
The thing is, two enemies of Quake, the Wizard and Hellknight, use the same void to calculate damage and such, as the nailgun that the player carries. I'm trying to seperate this, so the Wizard and the Hellknight will use seperate damage calculations.

I'm also making it depend on skill by the way, so the damage increases as the skill gets higher.

But my intentions aren't working correctly. If you read my changes, you'll see that the hellknight is supposed to do varying damage as the skill gets higher, but both the Wizard and the Hellknight do 9 damage no matter what skill I choose. :(

So here's the void in total, my changes are marked.

Code:
.float hit_z;
void() spike_touch =
{
local float rand;
   if (other == self.owner)
      return;

   if (other.solid == SOLID_TRIGGER)
      return;   // trigger field, do nothing

   if (pointcontents(self.origin) == CONTENT_SKY)
   {
      remove(self);
      return;
   }
   
// hit something that bleeds
   if (other.takedamage)
   {
      spawn_touchblood (9);

                if (self.classname == "monster_hell_knight") /my code begins here
         {local float d
                    d = (cvar("skill"));
                    if (d == 0)
                      {T_Damage (other, self, self.owner, 9);}
                    else if (d == 1)
                      {T_Damage (other, self, self.owner, 14);}
                    else
                      {T_Damage (other, self, self.owner, 18);}
                   }
                else if (self.classname == "monster_wizard")
         {local float d
                    d = (cvar("skill"));
                    if (d == 0)
                      {T_Damage (other, self, self.owner, 9);}
                    else if (d == 1)
                      {T_Damage (other, self, self.owner, 12);}
                    else
                      {T_Damage (other, self, self.owner, 15);}
                   }
                else
                   {T_Damage (other, self, self.owner, 9);} /my code ends here
   }
   else
   {
      WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
      
      if (self.classname == "wizspike")
         WriteByte (MSG_BROADCAST, TE_WIZSPIKE);
      else if (self.classname == "knightspike")
         WriteByte (MSG_BROADCAST, TE_KNIGHTSPIKE);
      else
         WriteByte (MSG_BROADCAST, TE_SPIKE);
      WriteCoord (MSG_BROADCAST, self.origin_x);
      WriteCoord (MSG_BROADCAST, self.origin_y);
      WriteCoord (MSG_BROADCAST, self.origin_z);
   }

   remove(self);
};


DC, please help me!

Author:  Captain Xavious [ Fri Dec 01, 2006 9:39 pm ]
Post subject:  My first coding attempt

You're still stuck.. dang, I hope you get help soon...

This is pretty cool so far. :)

Author:  darkonxy [ Sat Dec 02, 2006 4:10 am ]
Post subject:  My first coding attempt

cool are coding a new invaision monster?

Author:  Bjossi [ Sat Dec 02, 2006 7:39 am ]
Post subject:  My first coding attempt

If you'd read my post, it'd be quite obvious it is Quake that I'm coding.

Author:  Mr.UglyPants [ Sat Dec 02, 2006 8:20 am ]
Post subject:  My first coding attempt

plus the code is different from UT2k4.

Author:  Bjossi [ Sat Dec 02, 2006 8:28 am ]
Post subject:  My first coding attempt

I'm waiting in desperation for DC here, I've been trying to get that damn paragraph to read the 'if' and 'else if' functions of my code but it seems to jump straight to 'else', which defines 9 damage no matter what.

So that probably means I'm doing something incorrectly inside those functions, wrong enemy classname is not a possibility, I rechecked many times.

This is damn frustrating.

Author:  Bjossi [ Sat Dec 02, 2006 10:32 am ]
Post subject:  My first coding attempt

Ok, I got it sorted out, here's the updated paragraph.

Code:
                local string e
                e = (newmis.classname);
                if (e == "knightspike")
         {local float d
                    d = (cvar("skill"));
                    if (d == 0)
                      {T_Damage (other, self, self.owner, 9);}
                    else if (d == 1)
                      {T_Damage (other, self, self.owner, 14);}
                    else
                      {T_Damage (other, self, self.owner, 18);}
                   }
                else if (e == "wizspike")
         {local float d
                    d = (cvar("skill"));
                    if (d == 0)
                      {T_Damage (other, self, self.owner, 9);}
                    else if (d == 1)
                      {T_Damage (other, self, self.owner, 12);}
                    else
                      {T_Damage (other, self, self.owner, 15);}
                   }
                else
                   {T_Damage (other, self, self.owner, 9);}

Author:  ShadowBlade [ Sun Dec 03, 2006 6:34 am ]
Post subject:  My first coding attempt

nice.. i'm sure DC will post here soon :) he aint online too much..

so our own Bjossi has decided to begin.. whoo!!

Author:  DarkCarnivour [ Sun Dec 03, 2006 6:46 am ]
Post subject:  My first coding attempt

Ok, well if you got it working, good...
A brief glance across your first post, I noticed a line that looked like this :
"if(self.classname == "hellknight")"

You want: "if (self.owner.classname == "hellknight")", I think...

It is a projectile, not a guy... Th projectile is owned by a guy who 'might' be a hellknight.

Course I never coded Q1, but that line would have never worked...
Does it work now?

That Q1 code looks pretty simple... Good luck! ;)

I coded a LOT in Quake2 which was just plain C. Maybe we should release that mod...

That editor you are using is way ugly too, I must say... If you like it, great, but I much preferre black background with white text. My editors all look a bit like UEd's coder, they just work a lot better than it...

Author:  Captain Xavious [ Sun Dec 03, 2006 8:02 am ]
Post subject:  My first coding attempt

I can't wait to see this done, Bjossi, its pretty damn fun.
And hard. :D

Author:  Bjossi [ Sun Dec 03, 2006 9:16 am ]
Post subject:  My first coding attempt

DarkCarnivour wrote:
Ok, well if you got it working, good...
A brief glance across your first post, I noticed a line that looked like this :
"if(self.classname == "hellknight")"

You want: "if (self.owner.classname == "hellknight")", I think...

It is a projectile, not a guy... Th projectile is owned by a guy who 'might' be a hellknight.


You know, I did try owner.classname before trying a brand new approach, which was newmis.classname; means the missile the enemy fires. That one worked wonders

DarkCarnivour wrote:
That editor you are using is way ugly too, I must say... If you like it, great, but I much preferre black background with white text. My editors all look a bit like UEd's coder, they just work a lot better than it...
tag to post the code. I am using Notepad though, it is enough for the simple stuff I'm doing.

Author:  ShadowBlade [ Mon Dec 04, 2006 2:15 am ]
Post subject:  My first coding attempt

hey Bjossi, u should try coding in Q2 rather :)

Author:  Bjossi [ Mon Dec 04, 2006 5:53 am ]
Post subject:  My first coding attempt

I have tried reading the source, but QuakeC and C++ are pretty different, it is like reading English and Spanish; I see the similarity but have problems understanding the latter.

Author:  Dark_Watcher [ Mon Dec 04, 2006 8:32 am ]
Post subject:  My first coding attempt

Bjossi wrote:
I have tried reading the source, but QuakeC and C++ are pretty different, it is like reading English and Spanish; I see the similarity but have problems understanding the latter.


Hell, I have a limited knowledge of python and I see some vary frailer stuff, but it is just different enough to make it not worth the effort.

Author:  Bjossi [ Mon Dec 04, 2006 9:35 am ]
Post subject:  My first coding attempt

I think it is worth the effort to learn C++, it is a common used language. I think QuakeC is based on it, or was that just C without the pluses?

Author:  Dark_Watcher [ Mon Dec 04, 2006 9:51 am ]
Post subject:  My first coding attempt

I meant using my knowledge of python to try to help you with QuackC

Author:  Bjossi [ Mon Dec 04, 2006 11:20 am ]
Post subject:  My first coding attempt

Dark_Watcher wrote:
I meant using my knowledge of python to try to help you with QuackC


If you don't know the correct name of the code language, then how in the world can you help me with the language itself?

Author:  ShadowBlade [ Wed Dec 06, 2006 3:00 am ]
Post subject:  My first coding attempt

DC started coding in basic when he was 12.. from there, it was Quake 2 (something in between, like Pascal)... Q2 is where he made cool stuff (Q2 uses C++).. a mod with reloading, medieval weapons, ballistic weapons, nuke cannon, various stuff like that :) even monsters maps, etc.. then he learned Uscript and now we have BW :D

very good idea to learn C.. used by all game companies, and most others :)

Author:  Bjossi [ Wed Dec 06, 2006 6:38 am ]
Post subject:  My first coding attempt

Give me a link to a free compiler and I'll start playing with C++. ;)

Author:  ShadowBlade [ Wed Dec 06, 2006 1:09 pm ]
Post subject:  My first coding attempt

aahh.. maybe Dev C++.. i think thats one.. must look for it ..

Author:  Bjossi [ Wed Dec 06, 2006 2:13 pm ]
Post subject:  My first coding attempt

I'll check it out, thanks.

Author:  Bjossi [ Wed Dec 20, 2006 12:00 pm ]
Post subject:  My first coding attempt

Ok, I have finally made the changes I wanted. I downloaded & installed DevC++, but I don't have a clue how it works. Can anyone help me?

(mainly directed at DC)

Author:  ShadowBlade [ Fri Dec 22, 2006 2:46 am ]
Post subject:  My first coding attempt

hey.. uhmm.. hmm not sure.. i must get DC here :)

it uses C++ langauge, so you must just be wondering how the app itself works?

Author:  Bjossi [ Fri Dec 22, 2006 8:45 am ]
Post subject:  My first coding attempt

Yeah, that's the one, I have Quake 2 source ready and modified, I just don't know how to compile it with DevC.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/