Can anyone give me an example please of the script that I can use to spawn my own mob when I need? Say I talk, select specific answer to NPC question it updates the flag and sends an eventthat spawns a mob?
Please include full syntax to replace xxxx with:
case PLOT_FLAG:
{
xxxx - spawns the mob near player's location.
break;
}
xxxx is the part I am looking for.
Thanks in advance.
Conversation - Flag - mob spawns?
Débuté par
Ginggis Khan
, déc. 04 2009 04:58
#1
Posté 04 décembre 2009 - 04:58
#2
Posté 04 décembre 2009 - 05:24
Does this have to work anywhere? Does it have to work more than once? If it's only in one specific location and only fired once, I'd pre-place the creature and make it inactive. Then, in the script grab it either by tag or by team to activate it. For example (make sure to set the creature's team to 1, or whatever number):
const int TEAM_MY_CREATURE = 1;
...
case PLOT_FLAG:
{
UT_TeamAppears(TEAM_MY_CREATURE);
break;
}
If you're looking to spawn the creature near the player no matter where the player is, that's trickier. The following code will spawn the creature randomly near the player within a small radius, but you could use whatever logic.
case PLOT_FLAG:
{
object oPC = GetHero();
vector vPos = GetPosition(oPC);
float fRadius = 3.0f;
float fNewX = vPos.X + RandomFloat() * fRadius;
float fNewY = vPos.y + RandomFloat() * fRadius;
vPos = Vector(fNewX, fNewY, vPos.z);
location lNew = Location(GetArea(oPC), vPos, 0.0);
location lNew = GetSafeLocation(lNew);
CreateObject(OBJECT_TYPE_CREATURE, R"my_creature.utc, lNew);
break;
}
const int TEAM_MY_CREATURE = 1;
...
case PLOT_FLAG:
{
UT_TeamAppears(TEAM_MY_CREATURE);
break;
}
If you're looking to spawn the creature near the player no matter where the player is, that's trickier. The following code will spawn the creature randomly near the player within a small radius, but you could use whatever logic.
case PLOT_FLAG:
{
object oPC = GetHero();
vector vPos = GetPosition(oPC);
float fRadius = 3.0f;
float fNewX = vPos.X + RandomFloat() * fRadius;
float fNewY = vPos.y + RandomFloat() * fRadius;
vPos = Vector(fNewX, fNewY, vPos.z);
location lNew = Location(GetArea(oPC), vPos, 0.0);
location lNew = GetSafeLocation(lNew);
CreateObject(OBJECT_TYPE_CREATURE, R"my_creature.utc, lNew);
break;
}





Retour en haut






