Forum

Monsters being annoying

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Monsters being annoying

Postby Willem » Fri Feb 15, 2008 2:40 pm

OK, I'm trying to spawn monsters by hand and having a hard time. I can get them into the world at the location/rotation that I want but I can't seem to activate them (aka make them hostile towards the player) without them doing bizarro stuff.

I do something like this:

Code: Select all
local entity SS;

SS = self;
self = spawn();

monster_army();

self.origin = origin_i_want;
self.angles = angles_i_want;
self.fixangle = TRUE;

monster_use();

self = SS;


This is not my exact code, but close enough. The problem that I'm having is the "monster_use" function. This makes them hostile towards me, but they don't turn to look at me and I can't hurt them (bullets hit them but don't hurt them). If I don't call "monster_use", everything is fine except that I have to shoot them to get them angry.

Does this ring a bell for anyone or do I need to slog through this over the weekend?
Willem
 
Posts: 73
Joined: Wed Jan 23, 2008 10:58 am

Postby Spike » Fri Feb 15, 2008 2:57 pm

its because they've not 'started' yet.

spawn functions have a tendancy to set think functions, ensuring that all the solid items in the map are spawned before anything else is moved, and making sure that all references to entities (via name) are valid.

Anyway, it should be safe to just call self.think(); then your monster_use(); call.
You'll want to ensure that the 'activator' global is set to the right player, but that might be done for you if its inside a use function.
Also, monsters depend on their classname in a few cases (death messages), so be sure to set the classname before calling the spawn function.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby FrikaC » Fri Feb 15, 2008 4:18 pm

Also if you haven't already guarded the precache calls inside monster_army from running if this is not the initial level load, make sure you do that, otherwise your mod will only run on DarkPlaces.
FrikaC
Site Admin
 
Posts: 1026
Joined: Fri Oct 08, 2004 11:19 pm

Postby Willem » Fri Feb 15, 2008 4:28 pm

OK, thanks guys! I think I've got a handle on it now...
Willem
 
Posts: 73
Joined: Wed Jan 23, 2008 10:58 am


Return to QuakeC Programming

Who is online

Users browsing this forum: Bing [Bot] and 1 guest