place_model in console

Discuss programming in the QuakeC language.
Post Reply
domis4
Posts: 19
Joined: Mon Dec 26, 2011 7:29 pm

place_model in console

Post by domis4 »

hi there. I've just got one question^^

well, i'd like to ask, if its possible to spawn a model during the game?
at first, it would be nice to know, how its possible to use "place_model" in
the console? Then it would be easy using stuffcmd to place a model.

greetings
hogsy
Posts: 198
Joined: Wed Aug 03, 2011 3:44 pm
Location: UK
Contact:

Re: place_model in console

Post by hogsy »

You can't precache new models while the server is running.
Ghost_Fang
Posts: 336
Joined: Thu Nov 12, 2009 4:37 am

Re: place_model in console

Post by Ghost_Fang »

domis4 wrote:hi there. I've just got one question^^

well, i'd like to ask, if its possible to spawn a model during the game?
at first, it would be nice to know, how its possible to use "place_model" in
the console? Then it would be easy using stuffcmd to place a model.

greetings

That would require a bit of engine, but sure its possible.
Its a but more annoying in qc.
You could use a set of impulses to change the value of lets say .float spawnmodel

each impulse would change the value of of self.spawnmodel

then in your spawn function have all your spawning stuff but for the setmodel function, have a bunch of arguments

if (self.spawnmodel == 1)
setmodel (e, model1);

if (self.spawnmodel == 2)
setmodel (e, model2);

etc.
hogsy wrote:You can't precache new models while the server is running.
Are you sure? Because this is working for me:

Code: Select all

void(entity e, string modelname) Precache_Set = 
{
local entity set
set = e;
 precache_model(modelname);
 setmodel(set, modelname);
};
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Re: place_model in console

Post by Spike »

precache_model called beyond the first second or so is an error in most engines.
it works in dp and fte, but those are the only two engines I know of in which its supported, and depending on it may induce stalls.
(q2 supports it, and q3 depends upon it for player models, but that's not quake).
(hexen2 would have had noticably less annoying code if it had supported it, but then hexen2 is quite horrible regardless of engine features).

There's no reason you can't call precache_model to precache some changable string in an editor - precache_model(self.netname) is perfectly valid in all quake engines (at least ones that still run qc).

You don't want to use stuffcmd to control server-side features...


If you're modding the engine itself, you can load/cache a model at any time. The only need to precache is to establish modelindex ordering to always match between server and client, as well as to reduce stalls mid-map. The engine itself doesn't actually care that much.
Post Reply