find() map entitites in CSQC
Moderator: InsideQC Admins
4 posts
• Page 1 of 1
find() map entitites in CSQC
In FTEQW, I'm doing something like
But csqc places the entity always at 0 0 0 (also cprint said that).
I print that code in CSQC_Init, but I think that's pretty useless where I execute that
In map there's an entity my_spawning_point. Infact in SSQC it works. How is it possible to find map entities in CSQC?
Thanks in advance guyyyys!!
- Code: Select all
local entity e = find(world,classname,"my_spawning_point");
myentity = spawn();
setorigin(myentity ,e.origin);
myentity.origin = e.origin;
cprint(vtos(e.origin));
setmodel(myentity ,ENEMY_MODEL);
myentity .drawmask = MASK_NORMAL;
myentity .movetype = MOVETYPE_STEP;
myentity .solid = SOLID_BBOX;
myentity .predraw = EnemyPredraw;
But csqc places the entity always at 0 0 0 (also cprint said that).
I print that code in CSQC_Init, but I think that's pretty useless where I execute that
In map there's an entity my_spawning_point. Infact in SSQC it works. How is it possible to find map entities in CSQC?
Thanks in advance guyyyys!!
Meadow Fun!! - my first commercial game, made with FTEQW game engine
- toneddu2000
- Posts: 1352
- Joined: Tue Feb 24, 2009 4:39 pm
- Location: Italy
Re: find() map entitites in CSQC
I don't know if it's possible to find() server-side entities in CSQC at all, but I notice that your code isn't ready to deal with invalid returns from find(). I suggest you rewrite it as:
IMHO a way to avoid the problem would be the server to push this information to the client in putclientonserver(). Not saying this is the correct or even the only way to deal with the situation tho. Let's see what Spike says.
- Code: Select all
local entity spot;
spot=find(world, classname, "my_spawning_point");
if(spot!=world) {
... // place your spawning code here
}
IMHO a way to avoid the problem would be the server to push this information to the client in putclientonserver(). Not saying this is the correct or even the only way to deal with the situation tho. Let's see what Spike says.
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC
(LordHavoc)
-

frag.machine - Posts: 2090
- Joined: Sat Nov 25, 2006 1:49 pm
Re: find() map entitites in CSQC
ssqc and csqc are separate and independant. entities in ssqc do not exist in csqc unless you explicitly create them (SendEntity, deltalisten, or other writes/prints/etc).
If you want to parse the maps entity section clientside, you can find an example of this in my purecsqc mod (CSQC_WorldLoaded is called once the worldmodel (and thus the entity lump / .ent file) have actually been loaded, and the qc then calls spawn.qc:SpawnEntities which does the actual work in purecsqc).
If you want to parse the maps entity section clientside, you can find an example of this in my purecsqc mod (CSQC_WorldLoaded is called once the worldmodel (and thus the entity lump / .ent file) have actually been loaded, and the qc then calls spawn.qc:SpawnEntities which does the actual work in purecsqc).
- Spike
- Posts: 2892
- Joined: Fri Nov 05, 2004 3:12 am
- Location: UK
Re: find() map entitites in CSQC
Thanks a lot Spike, SpawnEntities() function in CSQC_WorldLoaded did the trick! For everyone that wants to try, don't forget to copy parsenewmapentity() which actually does the parsing.
There's some sideeffect to make a pure csqc game? There's some limitation(of course talking about a single player game, obviously)?
There's some sideeffect to make a pure csqc game? There's some limitation(of course talking about a single player game, obviously)?
Meadow Fun!! - my first commercial game, made with FTEQW game engine
- toneddu2000
- Posts: 1352
- Joined: Tue Feb 24, 2009 4:39 pm
- Location: Italy
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 1 guest