Difference between revisions of "LUA:SpawnMob"

(Usage)
(Undo revision 8146 by Jabantiz (talk))
Line 23: Line 23:
 
     local zone = GetZone(Spawn)
 
     local zone = GetZone(Spawn)
 
     local new_spawn = SpawnMob(zone, 1234, true, 2, 3, 4, 5)
 
     local new_spawn = SpawnMob(zone, 1234, true, 2, 3, 4, 5)
 +
    if new_spawn ~= nil
 +
        AddSpawnAccess(new_spawn, Spawn)
 +
    end
 
end
 
end
 
</pre>
 
</pre>

Revision as of 23:33, 14 June 2018

LUA Functions: SpawnMob()

Spawns a mob


Syntax

var = SpawnMob(param1, param2, param3, param4, param5, param6, param7)


Parameters

Required - param1 (Zone), param2 (int32), param3 (int8), param4 (float), param5 (float), param6 (float), param7 (float)
param1 is the zone we want the new mob to spawn in
param2 is the DB ID of the mob we want to spawn
param3 is the flag to restrict the mob
param4 is the X coordinate
param5 is the Y coordinate
param6 is the Z coordinate
param7 is the heading


Usage

function hailed(NPC, Spawn)
    local zone = GetZone(Spawn)
    local new_spawn = SpawnMob(zone, 1234, true, 2, 3, 4, 5)
    if new_spawn ~= nil
        AddSpawnAccess(new_spawn, Spawn)
    end
end

When this NPC is hailed it will create a new restricted spawn with a DB ID of 1234 at location (2, 3, 4) with a heading of 5 and adds the player to allowed access list of the new spawn

Notes

param3 can be set to 1 to make it private, any other value will make it public