View Single Post
12-21-07, 09:31 PM   #1
xtr3mz
A Murloc Raider
 
xtr3mz's Avatar
Join Date: Dec 2007
Posts: 5
shaaaakescreen when crit ]need help[

i know Comix has this function,but i want to make it simple
here is the code [stolen from Comix] ,but i don't have much lua knowldege.so it doest work
what shall i do?

function x_OnLoad()

this:RegisterEvent("CHAT_MSG_SPELL_SELF_DAMAGE");
this:RegisterEvent("CHAT_MSG_COMBAT_SELF_HITS");
this:RegisterEvent("OnUpdate");

SlashCmdList["x"] = x_Command;
SLASH_x1 = "/x";
SLASH_x1 = "/X";

x_ShakeDuration = 1;
x_ShakeIntensity = 70;
x_UpdateInterval = .01;
X_CRIT = "爆击";
end

function x_OnEvent(event, arg1)
if event == "CHAT_MSG_SPELL_SELF_DAMAGE" or event == "CHAT_MSG_COMBAT_SELF_HITS" then
if strfind(arg1, X_CRIT) then
--DEFAULT_CHAT_FRAME:AddMessage("Booooom!",0,0,1);
ShakeScreen();
end
end
end

function ShakeScreen()
if not IsShaking then
OldWorldFramePoints = {};
for i = 1, WorldFrame:GetNumPoints() do
local point, frame, relPoint, xOffset, yOffset = WorldFrame:GetPoint(i);
OldWorldFramePoints[i] = {
["point"] = point,
["frame"] = frame,
["relPoint"] = relPoint,
["xOffset"] = xOffset,
["yOffset"] = yOffset,
}
end
IsShaking = x_ShakeDuration;
end
end

x_UpdateInterval = .01

function x_OnUpdate(elapsed)
local TimeSinceLastUpdate = 0;
if elapsed == nil then
elapsed = 0
end

TimeSinceLastUpdate = TimeSinceLastUpdate + elapsed;

while (TimeSinceLastUpdate > x_UpdateInterval) do

-- ScreenShake
if type(IsShaking) == "number" then
IsShaking = IsShaking - elapsed;
if IsShaking <= 0 then
IsShaking = false;
WorldFrame:ClearAllPoints();
for index, value in pairs(OldWorldFramePoints) do
WorldFrame:SetPoint(value.point, value.xOffset, value.yOffset);
end
else
WorldFrame:ClearAllPoints();
local moveBy;
moveBy = math.random(-100, 100)/(101 - x_ShakeIntensity);
for index, value in pairs(OldWorldFramePoints) do
WorldFrame:SetPoint(value.point, value.xOffset + moveBy, value.yOffset + moveBy);
end
end
end
TimeSinceLastUpdate = TimeSinceLastUpdate-x_UpdateInterval;
end
end
__________________
http://www.spawn.net.ru
http://www.ghostintheshell.net.ru
再生侠spawn,攻壳机动队ghost in the shell,吸血莱恩bloodrayne,半条命,half-life,fansite

Last edited by xtr3mz : 12-21-07 at 10:47 PM.
  Reply With Quote