Minor script fixes

=============
ChocoboRideCommand - Fixed the mount speed to be retail accurate.
TeleportCommand            - Added anima costs, mount check, and placeholder for Favoured destinations
nudge/spawn/warpid        - Plus 1 to GetPos() arrays
This commit is contained in:
CuriousJorge 2022-01-28 02:29:45 -05:00
parent 26fd79bea5
commit bad51717c2
5 changed files with 253 additions and 174 deletions

View File

@ -22,7 +22,7 @@ function onEventStarted(player, actor, triggerName, isGoobbue)
player:SetMountState(2);
end
player:ChangeSpeed(0.0, 5.0, 10.0, 10.0);
player:ChangeSpeed(0.0, 3.6, 9.0, 9.0);
player:ChangeState(15);
else
player:ChangeMusic(player:GetZone().bgmDay);

View File

@ -6,7 +6,7 @@ Functions:
eventRegion(numAnima)
eventAetheryte(region, animaCost1, animaCost2, animaCost3, animaCost4, animaCost5, animaCost6)
eventConfirm(isReturn, isInBattle, cityReturnNum, 138821, forceAskReturnOnly)
eventConfirm(isReturn, isInBattle, HomePointInn, HomePoint, forceAskReturnOnly)
--]]
@ -49,44 +49,116 @@ teleportMenuToAetheryte = {
[5] = {
[1] = 1280121,
[2] = 1280122
},
}
zoneIdToRegionChoice =
{
[128] = 1, [129] = 1, [130] = 1, [131] = 1, [132] = 1, [133] = 1, [134] = 1, [135] = 1, [230] = 1,
[143] = 2, [144] = 2, [145] = 2, [147] = 2, [148] = 2,
[150] = 3, [151] = 3, [152] = 3, [153] = 3, [154] = 3, [155] = 3, [157] = 3, [158] = 3, [159] = 3, [160] = 3, [206] = 3,
[170] = 4, [171] = 4, [172] = 4, [173] = 4, [174] = 4, [175] = 4, [176] = 4, [178] = 4, [180] = 4, [181] = 4, [209] = 4,
[190] = 5
}
function onEventStarted(player, actor, eventType, eventName, isTeleport)
local worldMaster = GetWorldMaster();
local playerState = player:GetState();
local currentAnima = 100;
local baseAnimaCost = 6;
local animaCost = 0;
local favoredLocation = {1280003, 1280005, 1280062};
local currentRegion = zoneIdToRegionChoice[player:GetPos()[5]] or 0;
local isCity = {[1280001] = true, [1280061] = true, [1280031] = true};
local isRegion = true;
local destination = 0;
if (isTeleport == 0) then
if (isTeleport == 0) then -- Teleport hit
while (true) do
regionChoice = callClientFunction(player, "delegateCommand", actor, "eventRegion", 100);
regionChoice = callClientFunction(player, "delegateCommand", actor, "eventRegion", currentAnima);
if (regionChoice == nil) then break end
while (true) do
aetheryteChoice = callClientFunction(player, "delegateCommand", actor, "eventAetheryte", regionChoice, 2, 2, 2, 4, 4, 4);
if (regionChoice > 0 and regionChoice < 6) then -- If Region selected
if (regionChoice == currentRegion) then -- Check if selected region matches player's region, reduce cost if so.
baseAnimaCost = baseAnimaCost - 2;
else
baseAnimaCost = 6;
end
-- Assign anima cost to the six possible slots after factoring in same region or not.
animaCost = {baseAnimaCost, baseAnimaCost, baseAnimaCost, baseAnimaCost, baseAnimaCost, baseAnimaCost};
if (isCity[teleportMenuToAetheryte[regionChoice][1]] == true) then
-- Halve the cost of applicable city aetheryte
animaCost[1] = animaCost[1] / 2;
end
elseif (regionChoice == 6) then -- Favored Destinations selected.
-- Dummy info. Favored would be half price after factoring in same region cost or not.
animaCost = {2, 3, 3, favoredLocation[1], favoredLocation[2], favoredLocation[3]};
isRegion = false;
end
aetheryteChoice = callClientFunction(
player,
"delegateCommand",
actor,
"eventAetheryte",
regionChoice,
animaCost[1],
animaCost[2],
animaCost[3],
animaCost[4],
animaCost[5],
animaCost[6]
);
if (aetheryteChoice == nil) then break end
player:PlayAnimation(0x4000FFA);
player:SendGameMessage(worldMaster, 34101, 0x20, 2, teleportMenuToAetheryte[regionChoice][aetheryteChoice], 100, 100);
if (isRegion == true) then
destination = aetheryteTeleportPositions[teleportMenuToAetheryte[regionChoice][aetheryteChoice]];
player:SendGameMessage(worldMaster, 34101, 0x20, 2, teleportMenuToAetheryte[regionChoice][aetheryteChoice], animaCost[aetheryteChoice], currentAnima);
else
destination = aetheryteTeleportPositions[favoredLocation[aetheryteChoice]];
player:SendGameMessage(worldMaster, 34101, 0x20, 2, favoredLocation[aetheryteChoice], animaCost[aetheryteChoice], currentAnima);
end
confirmChoice = callClientFunction(player, "delegateCommand", actor, "eventConfirm", false, false, 1, 138824, false);
if (confirmChoice == 1) then
player:PlayAnimation(0x4000FFB);
player:SendGameMessage(worldMaster, 34105, 0x20);
--Do teleport
destination = aetheryteTeleportPositions[teleportMenuToAetheryte[regionChoice][aetheryteChoice]];
if (destination ~= nil) then
if (destination ~= 0) then
randoPos = getRandomPointInBand(destination[2], destination[4], 3, 5);
rotation = getAngleFacing(randoPos.x, randoPos.y, destination[2], destination[4]);
if (playerState == ACTORSTATE_MOUNTED) then
player:SetMountState(0);
player:ChangeSpeed(0.0, 2.0, 5.0, 5.0)
player:ChangeState(ACTORSTATE_PASSIVE);
end
GetWorldManager():DoZoneChange(player, destination[1], nil, 0, 2, randoPos.x, destination[3], randoPos.y, rotation);
end
end
player:endEvent();
return;
end
end
else
else -- Return hit
player:PlayAnimation(0x4000FFA);
local choice, isInn = callClientFunction(player, "delegateCommand", actor, "eventConfirm", true, false, player:GetHomePointInn(), player:GetHomePoint(), false);
if (choice == 1) then
@ -115,8 +187,13 @@ function onEventStarted(player, actor, eventType, eventName, isTeleport)
if (destination ~= nil) then
randoPos = getRandomPointInBand(destination[2], destination[4], 3, 5);
rotation = getAngleFacing(randoPos.x, randoPos.y, destination[2], destination[4]);
GetWorldManager():DoZoneChange(player, destination[1], nil, 0, 2, randoPos.x, destination[3], randoPos.y, rotation);
if (playerState == ACTORSTATE_MOUNTED) then
player:SetMountState(0);
player:ChangeSpeed(0.0, 2.0, 5.0, 5.0)
player:ChangeState(ACTORSTATE_PASSIVE);
end
GetWorldManager():DoZoneChange(player, destination[1], nil, 0, 2, randoPos.x, destination[3], randoPos.y, rotation);
end
end
end
@ -124,3 +201,4 @@ function onEventStarted(player, actor, eventType, eventName, isTeleport)
player:endEvent();
end

View File

@ -26,11 +26,11 @@ vertical = {
function onTrigger(player, argc, arg1, arg2)
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];
local angle = rot + (math.pi/2);
local worldManager = GetWorldManager();

View File

@ -14,11 +14,11 @@ 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);
@ -30,7 +30,7 @@ function onTrigger(player, argc, actorClassId, width, height)
--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 = zone:SpawnActor(actorClassId, "test", x + (i - (w / 2) * 3), y, z + (j - (h / 2) * 3), rot);
actor.SetAppearance(1001149)
end
end

View File

@ -18,21 +18,22 @@ function onTrigger(player, argc, uID)
end;
actor = GetWorldManager():GetActorInWorldByUniqueId(uID);
actorId = actor:GetActorClassId();
if (actor ~= nil) then
local actorPos = actor:GetPos();
local playerPos = player:GetPos();
if actorPos[4] == playerPos[4] then
worldManager:DoPlayerMoveInZone(player, actorPos[0], actorPos[1], actorPos[2], actorPos[3], 0x00);
if actorPos[5] == playerPos[5] then
worldManager:DoPlayerMoveInZone(player, actorPos[1], actorPos[2], actorPos[3], actorPos[4], 0x00);
else
worldManager:DoZoneChange(player, actorPos[4], nil, 0, 0x02, actorPos[0], actorPos[1], actorPos[2], actorPos[3]);
worldManager:DoZoneChange(player, actorPos[5], nil, 0, 0x02, actorPos[1], actorPos[2], actorPos[3], actorPos[4]);
end
message = string.format("Moving to %s 's coordinates @ zone %s, %.3f %.3f %.3f ", uID, actorPos[4], actorPos[0], actorPos[1], actorPos[2]);
message = string.format("Moving to %s 's coordinates @ zone %s, %.3f %.3f %.3f ", uID, actorPos[5], actorPos[1], actorPos[2], actorPos[3]);
end ;
player:SendMessage(messageID, sender, message);
player:SendMessage(0x20, "", "Actor Class Id: "..actorId);
end