Wrongly spawned monsters problem.
Moderator: InsideQC Admins
3 posts
• Page 1 of 1
Wrongly spawned monsters problem.
iq has a mode called ``horde mode'' where monsters are continuously spawned and in nightmare difficulty level monsters respawn after death.
Seldom it happens that a monster is not correctly initialized and it starts acting weirdly, for example it cannot turn around, it cannot be hurt...
For example in this little movie, skip to time 6:25 and you will see I fight against a Grunt I cannot hurt and I even move through it.
My new monsters are created as the regular ones, as you can see in the ogre.qc file, I moved the monster initialization in another function and saved it in a field. (seek ``make_ogre'')
Instead in world.qc I spawn an entity and call the very same function (seek ``UnleashHorde''), so I cannot understand why it happens. I think in the original game it cannot happen as all monster are already spawned during gameplay... still I cannot understand why it happen here.
It is very similar in the subs.qc file to allow respawn of monster on nightmare difficulty level. (seek ``monster_respawn_think'')...
Any idea?
Thanks
Seldom it happens that a monster is not correctly initialized and it starts acting weirdly, for example it cannot turn around, it cannot be hurt...
For example in this little movie, skip to time 6:25 and you will see I fight against a Grunt I cannot hurt and I even move through it.
My new monsters are created as the regular ones, as you can see in the ogre.qc file, I moved the monster initialization in another function and saved it in a field. (seek ``make_ogre'')
Instead in world.qc I spawn an entity and call the very same function (seek ``UnleashHorde''), so I cannot understand why it happens. I think in the original game it cannot happen as all monster are already spawned during gameplay... still I cannot understand why it happen here.
It is very similar in the subs.qc file to allow respawn of monster on nightmare difficulty level. (seek ``monster_respawn_think'')...
Any idea?
Thanks
- ezzetabi
- Posts: 4
- Joined: Sat Oct 06, 2012 7:31 pm
Re: Wrongly spawned monsters problem.
- Code: Select all
monsterType.init(newmis);
this looks confusing. What happens if u break out of that while (monster) and monstertype wasnt defined?
- Code: Select all
//select a random monster (in the air)
monster = nextent(world);
while (monster) {
if(monster.flags & FL_MONSTER) {
if (pointcontents(monster.origin) == CONTENT_EMPTY) {
c = c + 1;
if (random() < 1/c)
monsterType = monster;
}
}
monster = nextent(monster);
}
//spawn the new monster
newmis = spawn();
monsterType.init(newmis);
newmis.flags = newmis.flags | FL_ROAMINGMONSTER;
- r00k
- Posts: 1110
- Joined: Sat Nov 13, 2004 10:39 pm
Re: Wrongly spawned monsters problem.
You cannot, read again. That is a very common trick to select a random object from a list you do not know the length.
In the first loop c is one so random() < 1 is always true. After all if you have to select a random object from a list of only one object you have no choice, in the second loop the new object has 50%, in the third it has 33%....
Beside you cannot reach this loop if there are no monsters in the level.
In the first loop c is one so random() < 1 is always true. After all if you have to select a random object from a list of only one object you have no choice, in the second loop the new object has 50%, in the third it has 33%....
Beside you cannot reach this loop if there are no monsters in the level.
- ezzetabi
- Posts: 4
- Joined: Sat Oct 06, 2012 7:31 pm
3 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 3 guests