Forum

misc_model

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Postby Scrama » Thu Mar 11, 2010 3:25 am

Just a part of RTNC code
Code: Select all
/*QUAKED misc_model (0 1 0) (-8 -8 -8) (8 8 8)
Just sprite or model.
*/

void() misc_static_model =
{
   if (!self.model)
   {
      remove (self);
      return;
   }
   precache_model (self.model);
   setmodel (self, self.model);
   makestatic(self);
}

void() model_think =
{
   if (self.frame == self.cnt) self.frame = self.health;
   else self.frame = self.frame + 1;
   self.nextthink = time + 0.1;
};
/*QUAKED misc_animated_model (0 1 0) (-8 -8 -8) (8 8 8)
Animated sprite or model.
*/
void() misc_animated_model =
{
   if (!self.model)
   {
      remove (self);
      return;
   }
      
   precache_model (self.model);
   setmodel (self, self.model);
   
   self.movetype = MOVETYPE_NOCLIP;
   self.solid = SOLID_NOT;
   self.health = self.frame;
   self.think = model_think;
   self.nextthink = time + 0.1;
};

I using clip for collision, it can be better fited to model size/shape
User avatar
Scrama
 
Posts: 20
Joined: Fri Aug 28, 2009 6:16 am
Location: Siberia, Omsk

Postby Chip » Mon Mar 15, 2010 12:13 am

I finally did it. I added the SOLID declarations to the touch function. Easy as pie. The md3 model is now rock solid, I can stand on it and it blocks movement. Thanks for your help guys. Here is the function I'm using:

Code: Select all
void() object_touch =
{
   te_ElectricSparks(self.origin); // test
   self.solid = SOLID_BBOX;

   sprint(other, "This should be a model!\n");
};

void() misc_object =
{
   self.touch = object_touch;
   precache_model ("progs/barrel.md3");
   setmodel (self, "progs/barrel.md3");
   setsize (self, self.mins , self.maxs);
   
   setorigin (self, self.origin);

   StartItem ();
};


So far, the mod goes according to plan. This model was a big issue and it got me nailed down for a while. I also managed to implement a particle effect whenever I touch the object. That's why that sparks function is there.

Thus, it can be used to power up an electrical fence, and, upon touching, electrical sparks fly everywhere. Together with a hurt function, I might get something pretty solid.

I was also able to assign an explosion upon touching, and that's my first anti-personnel mine ever created. :P
QuakeWiki
getButterfly - WordPress Support Services
Roo Holidays

Fear not the dark, but what the dark hides.
User avatar
Chip
 
Posts: 575
Joined: Wed Jan 21, 2009 9:12 am
Location: Dublin, Ireland

Postby ceriux » Mon Mar 15, 2010 1:36 am

i suggest taking a look at the light entities with a model, after that make sure its not static and go from there.
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Postby Scrama » Mon Mar 15, 2010 2:09 am

Its not static coz its animated.
User avatar
Scrama
 
Posts: 20
Joined: Fri Aug 28, 2009 6:16 am
Location: Siberia, Omsk

Postby Chip » Mon Mar 15, 2010 8:35 pm

Thanks again, guys. The problem has been solved, and it works just fine. I have a movie for you, it's in production as we speak. And it will have a separate thread. It's something BIG!

EDIT: Until the new project has some "meat" on, I give you my md3 misc_model stuff. Working as planned.

http://vimeo.com/10201965
QuakeWiki
getButterfly - WordPress Support Services
Roo Holidays

Fear not the dark, but what the dark hides.
User avatar
Chip
 
Posts: 575
Joined: Wed Jan 21, 2009 9:12 am
Location: Dublin, Ireland

Postby Swift » Sat Apr 17, 2010 8:42 am

Why is
self.solid = SOLID_BBOX;
in the touch function and not in the spawn function?
Swift
 
Posts: 60
Joined: Tue Jan 26, 2010 11:02 am

Postby Chip » Sat Apr 17, 2010 9:28 am

Swift wrote:Why is
self.solid = SOLID_BBOX;
in the touch function and not in the spawn function?


Because it works in the touch function, and not in the spawn function. Don't know why. Could by DarkPlaces. Could be the version of Kleshik I'm using.
QuakeWiki
getButterfly - WordPress Support Services
Roo Holidays

Fear not the dark, but what the dark hides.
User avatar
Chip
 
Posts: 575
Joined: Wed Jan 21, 2009 9:12 am
Location: Dublin, Ireland

Postby Spike » Sat Apr 17, 2010 10:25 am

self.solid = FOO; should be followed by a setorigin or setmodel, otherwise your entity may still be non-solid as it'll not be in the clipping list.
But don't do setsorigin or setmodel inside a touch function! (unless you know they're using DP or FTE or sommit that has the crash bug fixed).
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby Chip » Mon Apr 19, 2010 7:47 pm

Spike wrote:self.solid = FOO; should be followed by a setorigin or setmodel, otherwise your entity may still be non-solid as it'll not be in the clipping list.
But don't do setsorigin or setmodel inside a touch function! (unless you know they're using DP or FTE or sommit that has the crash bug fixed).


Thanks Spike! It's on my TODO list now!
QuakeWiki
getButterfly - WordPress Support Services
Roo Holidays

Fear not the dark, but what the dark hides.
User avatar
Chip
 
Posts: 575
Joined: Wed Jan 21, 2009 9:12 am
Location: Dublin, Ireland

Previous

Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest