Added changes to how zones/areas are accessed in the lua scripts too.

This commit is contained in:
Filip Maj 2022-02-05 18:00:09 -05:00
parent 4e0cf36552
commit 68e55a1c76
18 changed files with 33 additions and 35 deletions

View file

@ -13,9 +13,9 @@ function onEventStarted(player, actor, triggerName, name, arg1, arg2, arg3, baza
local bazaarActor = nil;
if (name ~= nil) then
bazaarActor = player:GetZone():FindPCInZone(name);
bazaarActor = player.CurrentArea:FindPCInZone(name);
elseif (bazaarActorId ~= nil) then
bazaarActor = player:GetZone():FindActorInArea(bazaarActorId);
bazaarActor = player.CurrentArea:FindActorInArea(bazaarActorId);
end
if (bazaarActor ~= nil) then

View file

@ -25,7 +25,7 @@ function onEventStarted(player, actor, triggerName, isGoobbue)
player:ChangeSpeed(0.0, 5.0, 10.0, 10.0);
player:ChangeState(15);
else
player:ChangeMusic(player:GetZone().bgmDay);
player:ChangeMusic(player.CurrentArea.bgmDay);
worldMaster = GetWorldMaster();

View file

@ -12,10 +12,10 @@ function onEventStarted(player, actor, triggerName, name, arg1, arg2, arg3, acto
--ActorID Search
if (actorId ~= nil) then
otherActor = player:GetZone():FindActorInArea(actorId);
otherActor = player.CurrentArea):FindActorInArea(actorId);
--Name Search
elseif (name ~= nil) then
otherActor = player:GetZone():FindPCInZone(name);
otherActor = player.CurrentArea:FindPCInZone(name);
end
if (otherActor ~= nil) then

View file

@ -8,9 +8,8 @@ properties = {
function onTrigger(player, argc, actorName)
if (actorName ~= nil) then
zone = player:GetZone();
actor = zone:DespawnActor(actorName);
if (actorName ~= nil) then
actor = player.CurrentArea:DespawnActor(actorName);
end
end;

View file

@ -18,11 +18,11 @@ function onTrigger(player, argc, zone)
if player then
local messageID = MESSAGE_TYPE_SYSTEM_ERROR;
zone = zone or player:GetZoneID();
zone = zone or player.CurrentArea.ZoneId;
player:SendMessage(messageID, "[reloadzones] ", string.format("Reloading zone: %u", zone));
--[[ todo: get this working legit
player:GetZone():Clear();
player:GetZone():AddActorToZone(player);
player.CurrentArea:Clear();
player.CurrentArea:AddActorToZone(player);
player:SendInstanceUpdate();
]]
end;

View file

@ -14,23 +14,22 @@ function onTrigger(player, argc, actorClassId, width, height)
end
local pos = player:GetPos();
local x = pos[0];
local y = pos[1];
local z = pos[2];
local rot = pos[3];
local zone = pos[4];
local x = pos[1];
local y = pos[2];
local z = pos[3];
local rot = pos[4];
local zone = pos[5];
actorClassId = tonumber(actorClassId);
if (actorClassId ~= nil) then
zone = player:GetZone();
if (actorClassId ~= nil) then
local w = tonumber(width) or 0;
local h = tonumber(height) or 0;
printf("%f %f %f", x, y, z);
--local x, y, z = player.GetPos();
for i = 0, w do
for j = 0, h do
actor = zone:SpawnActor(actorClassId, "test", pos[0] + (i - (w / 2) * 3), pos[1], pos[2] + (j - (h / 2) * 3), pos[3]);
actor = player.CurrentArea:SpawnActor(actorClassId, "test", pos[0] + (i - (w / 2) * 3), pos[1], pos[2] + (j - (h / 2) * 3), pos[3]);
actor.SetAppearance(1001149)
end
end

View file

@ -108,7 +108,7 @@ function onTrigger(player, argc, name, width, height, blockCount)
for b = 0, blocks do
for i = 0, w do
for j = 0, h do
local actor = player.GetZone().SpawnActor(2104001, 'ass', x + (i * 1), y, z + (j * 1), rot, 0, 0, true);
local actor = player.CurrentArea:SpawnActor(2104001, 'ass', x + (i * 1), y, z + (j * 1), rot, 0, 0, true);
actor.ChangeNpcAppearance(modelIds[name]);
actor.SetMaxHP(5000);
actor.SetHP(5000);

View file

@ -18,7 +18,7 @@ function onTrigger(player, argc)
player:SendGameMessage(player, worldMaster, 34108, 0x20);
player:SendGameMessage(player, worldMaster, 50011, 0x20);
director = player:GetZone():CreateDirector("Quest/QuestDirectorMan0l001");
director = player.CurrentArea:CreateDirector("Quest/QuestDirectorMan0l001");
player:AddDirector(director);
player:SetLoginDirector(director);

View file

@ -31,7 +31,7 @@ function onTrigger(player, argc, animation, regionId, layoutId, maxLayoutId)
actorClassId = tonumber(actorClassId);
if (actorClassId ~= nil) then
zone = player:GetZone();
zone = player.CurrentArea;
actor = zone:SpawnActor(actorClassId, "mapobj", pos[1], pos[2], pos[3], tonumber(regionId), tonumber(layoutId));
print("test");

View file

@ -24,13 +24,13 @@ function onTrigger(player, argc, weather, updateTime, zonewide)
message = string.format("changed weather to %u ", weather);
if zonewide ~= 0 then
message = string.format(message.."for zone %u", player:GetZoneID());
message = string.format(message.."for zone %u", player.CurrentArea.ZoneId);
else
message = message..player:GetName();
end;
-- weatherid, updateTime
player:GetZone():ChangeWeather(weather, updateTime, player, zonewide ~= 0);
player.CurrentArea:ChangeWeather(weather, updateTime, player, zonewide ~= 0);
player:SendMessage(messageID, sender, message);
end;
print(sender..message);

View file

@ -159,7 +159,7 @@ function onTrigger(player, argc, width, height, blockCount)
for b = 0, blocks do
for i = 0, w do
for j = 0, h do
local actor = player.GetZone().SpawnActor(2104001, 'ass', x + (i * 1), y, z + (j * 1), rot, 0, 0, true);
local actor = player.CurrentArea.SpawnActor(2104001, 'ass', x + (i * 1), y, z + (j * 1), rot, 0, 0, true);
--actor.ChangeNpcAppearance(2200905);
actor.SetMaxHP(500);
actor.SetHP(500);