View previous topic :: View next topic |
Author |
Message |
ajay

Joined: 29 Oct 2004 Posts: 295 Location: Swindon, UK
|
Posted: Wed May 26, 2010 10:52 am Post subject: Invisible monsters |
|
|
So I've set up monsters-only teleporting code, basically the usual teleporting code, with the player bits taken out and everything suitably renamed. All works well and monsters 'port in as they should, and it's all handled code-side.
What I'm now trying to do is make them invisible for a second when they 'port in (it's merely for aesthetic reasons), and then be visible as normal.
What I've done:
At the end of what is usually teleport_touch, but as said, renamed in this monsters only version, and after:
Code: | other.flags = other.flags - other.flags & FL_ONGROUND; |
is:
Code: | other.model = ("");
invisi_mode(); |
'invisi_mode' is this:
Code: | void () invisi_mode =
{
local entity player;
player = find(world, classname, "player");
centerprint (player, "invisi_mode....\n"); //just for testing...
self.think = invisi_mode_think;
self.nextthink = time + 1;
}; |
(the centerprint is just so I know that it's going through all the stages I expect it to, its useful too, as originally I put the "other.model = ("");" in invisi_mode(), but then it didn't go to 'invisi_mode_think()' so I moved it)
Anyway, invisi_mode_think() is this:
Code: | void () invisi_mode_think =
{
local entity player;
player = find(world, classname, "player");
centerprint (player, "invisi_mode_think....\n"); //just for testing...
if (other.classname == "monster_ogre")
{
setmodel (other, "progs/ogre.mdl");
setsize (other, VEC_HULL2_MIN, VEC_HULL2_MAX);
}
else if (other.classname == "monster_shambler")
setmodel (other, "progs/shambler.mdl");
else if (other.classname == "monster_demon1")
setmodel (other, "progs/demon.mdl");
else if (other.classname == "monster_wizard")
setmodel (other, "progs/wizard.mdl");
else if (other.classname == "monster_zombie")
setmodel (other, "progs/zombie.mdl");
}; |
(There's more for ogres as I'm testing it with them)
Anyway, and as you can guess, the monster stays invisible, but does 'port as expected.
Help please, especially to say if its possible...[/code] _________________ my site |
|
Back to top |
|
 |
Swift
Joined: 26 Jan 2010 Posts: 44
|
Posted: Fri May 28, 2010 2:05 pm Post subject: |
|
|
Using Darkplaces?
monster.nodrawtoclient = player;
Y/n? |
|
Back to top |
|
 |
ajay

Joined: 29 Oct 2004 Posts: 295 Location: Swindon, UK
|
Posted: Fri May 28, 2010 2:34 pm Post subject: |
|
|
Not darkplaces, no. Well not darkplaces specific. _________________ my site |
|
Back to top |
|
 |
Spike
Joined: 05 Nov 2004 Posts: 944 Location: UK
|
Posted: Fri May 28, 2010 5:18 pm Post subject: |
|
|
if it takes damage before it is made visible, its think function can be changed to animate the pain animation, this is one way it can remain invisible.
Also, your invis_mode uses self, while the place it is called from uses other. In other words, your invis_mode should use other too.
self and other are globals. They don't magically change because you called a different function. They only change for thinks+touches because the engine explicitly changes them before calling.
Small note: if you cleared out the model field, you don't need to do setmodel to restore it, just set the model field back to what it was. the modelindex will not have changed for the duration so it'll all still be valid, assuming it didn't die (so set it back if its still "" and not a gibbed head). This will save you checking each entity type to give it the correct size.
Alternatively, clear out the modelindex instead, as less code checks the modelindex (server doesn't care for modelindex except for networking and SOLID_BSP/MOVETYPE_PUSH, qc only directly uses it for the invis ring). Then you don't have to cache anything for longer than a function. To restore, tmin=self.mins;tmax=self.maxs;setmodel(self, self.model);setsize(self, tmin, tmax); job done. _________________ What's a signature? |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2004 phpBB Group
|