BFG Thunderbolt

InsideQC tutorials kleskby 0 688
Author: Cheezer
Source: https://www.insideqc.com/qctut/lesson-51.shtml

i haven't thuroughly tested this, but so far looks to work well in 1 player, !!hasn't been tested in multi!! So if its buggy give me a break i've only been doing QuakeC for 2 weeks and i had no programming experience, (pretty good for a 13 year old huh?). If u find a bug please tell me.

Step 1

1) Open weapons.qc

2) find W_FireLightning

3) Replace the Entire Funstion with this new function below

void() W_FireLightning =
{
        local   entity thunderbolt; // create thunderbolt entity

    if (self.ammo_cells < 1) // if u have more than 1 cell, this is the best weapon
        {
                self.weapon = W_BestWeapon ();
                W_SetCurrentAmmo ();
                        return;
        }
        self.currentammo = self.ammo_cells = self.ammo_cells - 1; // ammo it uses
        self.punchangle_x = -2; // kickback angle
        thunderbolt = spawn (); // spawning it
        thunderbolt.owner = self; // self (you) is owner of thunderbolt
        thunderbolt.movetype = MOVETYPE_FLYMISSILE; // flies straight on
        thunderbolt.solid = SOLID_BBOX; // its solid
        thunderbolt.classname = "thunderbolt"; // name it thunderbolt
        makevectors (self.v_angle); // i dont know
        thunderbolt.velocity = aim(self, 1000); // dont know this either
        thunderbolt.velocity = thunderbolt.velocity * 1000; //speed of 1000
        thunderbolt.angles = vectoangles(thunderbolt.velocity); // dont know
        thunderbolt.touch = LightningHit; // calls LightningHit when touched
        thunderbolt.nextthink = time + 5; // disappears after flying for 5 seconds
        thunderbolt.think = SUB_Remove; // does nothing after 5 seconds
        setmodel (thunderbolt, "progs/bolt.mdl"); // sets the thunderbolt model
        setsize (thunderbolt, '0 0 0', '0 0 0'); // thunderbolt model size
        setorigin (thunderbolt, self.origin + v_forward*8 + '0 0 16'); // thunderbolt spawn origin
};

4) Above W_FireLightning add these functions:

void() LightningHit =
{
        local   vector org; // creates org vector
        local   float damage=0; // floats damage starting at 0
        local   entity head; //creates head entity

        org = self.origin + '0 0 16'; // vector org origin
        head = findradius(self.origin, 250); //send lightning line to anything in 250 radius
        while (head) // while looking for head
        {
                if (head.takedamage)  // if head has health, attack it
                {
                        if(head != self.owner) // don't attack thunderbolt owner!!
            {
                                WriteByte (MSG_BROADCAST, SVC_TEMPENTITY); // temp entity
                                WriteByte (MSG_BROADCAST, TE_LIGHTNING2); // makes lightning line i think
                                WriteEntity (MSG_BROADCAST, head); // write head entity
                                WriteCoord (MSG_BROADCAST, org_x); // write orgs x coord
                                WriteCoord (MSG_BROADCAST, org_y); // write orgs y coord
                                WriteCoord (MSG_BROADCAST, org_z); // write orgs z coord
                                WriteCoord (MSG_BROADCAST, head.origin_x); // write heads x coord
                                WriteCoord (MSG_BROADCAST, head.origin_y); // write heads y coord
                                WriteCoord (MSG_BROADCAST, head.origin_z); // write heads z coord
                                sound (head, CHAN_WEAPON, "weapons/lhit.wav", 1, ATTN_NORM); // its sound
                                damage = 40 + random()*20; // 40 plus some random damage
                                T_Damage (head, self, self.owner, damage); // its damage
                        }
                }
        head = head.chain; // go to next enemy
        }
        remove(self);
};

Step 2

now just compile and have fun!



Tags: tutorial, quakec, qc, insideqc, weapon

Comments


captcha


No comments yet. Be the first!
Owned by kleskby#1837
Close

You have no new notifications.

SHOUTBOX
Open chat to load…
Log in to chat