Aller au contenu

Photo

Conversation - Flag - mob spawns?


5 réponses à ce sujet

#1
Ginggis Khan

Ginggis Khan
  • Members
  • 71 messages
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.

#2
DavidSims

DavidSims
  • BioWare Employees
  • 196 messages
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;

}

#3
Ginggis Khan

Ginggis Khan
  • Members
  • 71 messages
Thank you. Yeah it was supposed to spawn, not just stand there inactive :)

#4
Tensor07

Tensor07
  • Members
  • 11 messages
Can one of you guys help me out? I'm trying to do the same thing however when i check for the PLOT FLAG it does not work so i'm unable to spawn anything after. What am i doing wrong here?

        case EVENT_TYPE_SET_PLOT: 
        {
            if(WR_GetPlotFlag(PLT_CLEAR_THE_HUT, QUEST_ACCEPT) == TRUE)
            {
               UT_TeamAppears(1); // Team 1 is the group i want to spawn
            }
            break;
        }

UPDATE:
I think i solved this by simply putting the if statement in side the main function ( void main() ).  However, if anyone has more information on this one please reply. Thanks

Modifié par Tensor07, 23 décembre 2009 - 03:23 .


#5
Craig Graff

Craig Graff
  • Members
  • 608 messages
You need to have the switch be on the plot flag, and set the case to be the flag name. Look at any of the plot scripts in the original campaign for examples.

With your current setup the code will fire on the next flag call or check, since when a plot flag is set to true or false it isn't actually set until after the associated script runs.

Modifié par Craig Graff, 23 décembre 2009 - 04:44 .


#6
Tensor07

Tensor07
  • Members
  • 11 messages
To Craig Graff:

Thanks for the reply Craig. I took your advice and spent some time going over some documentation. I finally figured it out. Thanks again.