Aller au contenu

Spawn Random Numbers Of Creature On Enter


  • Veuillez vous connecter pour répondre
6 réponses à ce sujet

#1
Guest_NWN Dragon-Blade_*

Guest_NWN Dragon-Blade_*
  • Guests
How would I script to Spawn Random Numbers Of Creature when a PC enters an Area then have them random walk?

#2
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
Well...we'd need a bit more specifics on things like if this is going to be used in more than one area, if you are going to be using different npcs/creatures, will the creatures spawn at different locations, should this only happen once, etc... But for what you have asked you could do something like this:

-first put down a waypoint where you want the creatures to spawn.
-then put a script in the area's OnEnter event like so:

void main()
{
    object oWaypoint = GetWaypointByTag("Tag of waypoint here");
    location lSpawn = GetLocation(oWaypoint);
    string sResRef = "res ref of creature to spawn here";
    int iRandom = Random(3)+1;//change the 3 to how many spawns you want

    while (iRandom > 0)
    {
        object oSpawn = CreateObject(OBJECT_TYPE_CREATURE, sResRef, lSpawn);
        AssignCommand(oSpawn, ActionRandomWalk());
        iRandom--;
    }
}

Hope this gets the ball rolling.

Modifié par GhostOfGod, 16 mars 2011 - 05:42 .


#3
420

420
  • Members
  • 190 messages
To make a creature walk around randomly set a variable (int) on the creature blueprint called X2_L_SPAWN_USE_AMBIENT and set it to 1.

-420

#4
Guest_NWN Dragon-Blade_*

Guest_NWN Dragon-Blade_*
  • Guests
Could I make that to multiple waypoints, and multiple creatures (1 more for female NPC)?


resrefs:  
human025 , and human023

Modifié par NWN Dragon-Blade, 16 mars 2011 - 09:04 .


#5
Builder_Anthony

Builder_Anthony
  • Members
  • 450 messages
I would check out random people on the vault.You can even make them evil so they are bad guys.

#6
Builder_Anthony

Builder_Anthony
  • Members
  • 450 messages
Then look for random stats on the vault.

#7
henesua

henesua
  • Members
  • 3 882 messages
There are spawn systems such as NESS which do much of this scripting for you. It might be worth it to check these systems out if you are doing things like this throughout your module.