Announcement

Collapse
No announcement yet.

The Prospect of Changing Monster Drops

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • The Prospect of Changing Monster Drops

    Hello,

    I'm currently teaching myself quakec and quark tools and I eventually wanted to implement randomized item drops from monsters. Can anyone assess the possibility of achieving this or even changing what monsters like the grunt or ogre drop upon death?

    Thanks

  • #2
    Doable.

    Easiest way is to add ammo and health to monster backpacks / death drops, there are various ways to do it. You can then randomly select what they drop based on classname etc. We did that in the RemakeQuake mod.

    If you want a fully fledged random item drop system comparable to Diablo, that is also doable but more work.
    Scout's Journey
    Rune of Earth Magic

    Comment


    • #3
      As long as the latter is technically feasibe, its worth learning the code. Quake seems like the perfect atmosphere for a diablo mod, if it could be combined with the random level generators and inventory mods I've seen. I hope someone will be able to pick up where I leave off.

      Comment


      • #4
        to learn your task,

        look at the spawn() command and predefining entities

        within a function like this:
        local entity ent;

        or globally :

        entity myself;


        here's old code from CRCTF3.0 for tossing ammo, including ammo's touch functions
        Code:
        void() Team_Ammo_Touch=
        {
        	local entity etemp;
        	local float  donttake;	// 1998-08-15 Do not take unnecessary items but fire all targets by Maddes
        
        	if (((ctf_playmode & CTF_MATCH_MODE) && !(ctf_state & CTF_MATCH_STARTED)))
        	{
        		return;
        	}
        
        	if (pointcontents(self.origin) == CONTENT_LAVA)
        	{
        		remove (self);
        		return;
        	}
        
        	if (other == self.owner)
        	{
        		if (deathmatch != 2)
        		{
        			if (self.nextthink - time > 19)
        				return;
        		}
        	}
        
        	if (other.classname != "player")
        		return;
        
        	if (other.health <= 0)	
        		return;
        
        	donttake = 0;	// 1998-08-15 Do not take unnecessary items but fire all targets by Maddes
        
        	// shotgun
        	if (self.classname=="item_shells")
        	{
        		if (other.ammo_shells >= 100)
        		donttake = 1;
        		else
        		other.ammo_shells = other.ammo_shells + self.aflag;
        	}
        
        	// spikes
        	else if (self.classname=="item_spikes")
        	{
        		if (other.ammo_nails >= 200)
        		donttake = 1;
        		else
        		other.ammo_nails = other.ammo_nails + self.aflag;
        	}
        
        	//	rockets
        	else if (self.classname == "item_rockets")
        	{
        		if (other.ammo_rockets >= 100)
        		donttake = 1;
        		else
        		other.ammo_rockets = other.ammo_rockets + self.aflag;
        	}
        
        	//	cells
        	else if (self.classname == "item_cells")
        	{
        		if (other.ammo_cells >= 100)
        		donttake = 1;
        		else
        		other.ammo_cells = other.ammo_cells + self.aflag;
        	}
        
        	if (!donttake)
        	{
        		bound_other_ammo ();
        		sound (other, CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM);
        		etemp=self;
        		self=other;
        		if (other.weapon != IT_HOOK)
        		W_SetCurrentAmmo();
        		self=etemp;
        		self.model = string_null;
        		self.solid = SOLID_NOT;
        		remove(self);
        	}	// 1998-08-15 Do not take unnecessary items but fire all targets by Maddes
        
        	activator = other;
        	SUB_UseTargets();				// fire all targets / killtargets
        };
        
        
        //- code tosses the model of the ammo, not some silly backpack...
        
        void() TossAmmo =
        {
        	local entity	item;
        	local float	ammo;
        	local string	class;
        	local string	m;
        
        	if (self.style & CTF_OBSERVER) 
        	{
        		return; // no observer tossing items *CHEAT*
        	}
        
        	if (ctf_playmode & CTF_PRACTICE_MODE)
        	{
        		return;
        	}
        	
        	if (ctf_playmode & CTF_NO_FLAGS)//CRMOD mode
        		return;
        
        	if (((ctf_playmode & CTF_MATCH_MODE) && !(ctf_state & CTF_MATCH_STARTED)))
        	{
        		return;
        	}
        	
        	if (ctf_state & CTF_MATCH_PAUSED)
        	{
        		return;
        	}
        
        	if ((self.weapon == IT_AXE)||(self.weapon == IT_HOOK)) return;
        
        	if (!(self.flags & FL_CLIENT)) return;
        
        	if (self.health < 1) return;
        
        	if ((self.weapon == IT_SHOTGUN ) || (self.weapon == IT_SUPER_SHOTGUN ))
        	{
        		if (self.ammo_shells > 20)
        		{
        			self.ammo_shells = self.ammo_shells - 20;
        			ammo = 20;
        			class= "item_shells";
        			m="maps/b_shell0.bsp";
        		}
        		else
        		{
        			sprint(self,"not enough ammo.\n");
        			return;
        		}
        	}
        	else
        	{
        		if ((self.weapon == IT_NAILGUN ) || (self.weapon == IT_SUPER_NAILGUN))
        		{
        			if (self.ammo_nails > 25)
        			{
        				self.ammo_nails = self.ammo_nails - 25;
        				ammo = 25;			
        				class = "item_spikes";
        				m ="maps/b_nail0.bsp";
        			}
        			else
        			{
        				sprint(self,"not enough ammo.\n");
        				return;
        			}
        		}
        		else
        		{
        			if ((self.weapon == IT_GRENADE_LAUNCHER) || (self.weapon == IT_ROCKET_LAUNCHER))
        			{
        				if (self.ammo_rockets > 5)
        				{
        					self.ammo_rockets = self.ammo_rockets - 5;
        					ammo = 5;			
        					class = "item_rockets";
        					m ="maps/b_rock0.bsp";
        				}
        				else
        				{
        					sprint(self,"not enough ammo.\n");
        					return;
        				}
        			}
        			else
        			{
        				if (self.weapon == IT_LIGHTNING)
        				{
        					if (self.ammo_cells > 10)
        					{
        						self.ammo_cells = self.ammo_cells - 10;
        						ammo = 10;
        						class = "item_cells";
        						m ="maps/b_batt0.bsp";
        					}
        					else
        					{
        						sprint(self,"not enough ammo.\n");
        						return;
        					}
        				}
        				else
        				{								
        					return;//no other ammo to toss
        				}
        			}
        		}
        	}
        	
        	item = spawn();
        	item.owner = self;
        	makevectors(self.v_angle);
        
        	setorigin(item, self.origin + '0 0 16');
        	item.velocity = aim(self, 320);
        	item.velocity = item.velocity * 320;
        	item.flags = FL_ITEM;
        	item.solid = SOLID_TRIGGER;
        	item.movetype = MOVETYPE_BOUNCE;
        
        	item.aflag = ammo;
        	item.classname = class;
        	setmodel (item, m);
        	
        	setsize (item, '0 0 0', '32 32 56');
        	item.touch = Team_Ammo_Touch;
        
        	item.nextthink = time + 20;//must remove or else we will run out of server entities!!
        
        	item.think = SUB_Remove;
        	W_SetCurrentAmmo();
        };
        unlike DM, in ctf u can toss ammo to your friends!! >)
        Last edited by R00k; 04-22-2013, 05:29 PM.
        www.quakeone.com/qrack | www.quakeone.com/cax| http://en.twitch.tv/sputnikutah

        Comment

        Working...
        X