View previous topic :: View next topic |
Author |
Message |
Willem
Joined: 23 Jan 2008 Posts: 73
|
Posted: Fri Feb 15, 2008 2:40 pm Post subject: Monsters being annoying |
|
|
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: | 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? _________________ www.wantonhubris.com |
|
Back to top |
|
 |
Spike
Joined: 05 Nov 2004 Posts: 944 Location: UK
|
Posted: Fri Feb 15, 2008 2:57 pm Post subject: |
|
|
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. _________________ What's a signature? |
|
Back to top |
|
 |
FrikaC Site Admin

Joined: 08 Oct 2004 Posts: 947
|
Posted: Fri Feb 15, 2008 4:18 pm Post subject: |
|
|
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. |
|
Back to top |
|
 |
Willem
Joined: 23 Jan 2008 Posts: 73
|
Posted: Fri Feb 15, 2008 4:28 pm Post subject: |
|
|
OK, thanks guys! I think I've got a handle on it now... _________________ www.wantonhubris.com |
|
Back to top |
|
 |
|