How would I script to Spawn Random Numbers Of Creature when a PC enters an Area then have them random walk?
Spawn Random Numbers Of Creature On Enter
Débuté par
Guest_NWN Dragon-Blade_*
, mars 16 2011 02:29
#1
Guest_NWN Dragon-Blade_*
Posté 16 mars 2011 - 02:29
Guest_NWN Dragon-Blade_*
#2
Posté 16 mars 2011 - 05:41
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.
-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
Posté 16 mars 2011 - 06:24
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
-420
#4
Guest_NWN Dragon-Blade_*
Posté 16 mars 2011 - 08:58
Guest_NWN Dragon-Blade_*
Could I make that to multiple waypoints, and multiple creatures (1 more for female NPC)?
resrefs:
human025 , and human023
resrefs:
human025 , and human023
Modifié par NWN Dragon-Blade, 16 mars 2011 - 09:04 .
#5
Posté 19 mars 2011 - 01:13
I would check out random people on the vault.You can even make them evil so they are bad guys.
#6
Posté 19 mars 2011 - 01:13
Then look for random stats on the vault.
#7
Posté 19 mars 2011 - 01:56
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.





Retour en haut






