Monsters being annoying
Moderator: InsideQC Admins
4 posts
• Page 1 of 1
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:
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?
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
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.
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
4 posts
• Page 1 of 1
Who is online
Users browsing this forum: Bing [Bot] and 1 guest