Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- CHAOS WAND ( SOURCE CODE )
- -- AUTHOR : ALTAMURENZA
- -- GLOBAL ENV
- _G.ANIMATION = {}
- _G.ELECTROCUTION = {}
- _G.BURNT = {}
- -- LOCAL ENV
- local ANIM_SPEED_PER_FRAME = 1
- local ANIM_DELAY_PER_FRAME = 100
- local ANIM_RANGE = 5
- local EFFECT_MIN_TIMER = 1
- local EFFECT_MAX_TIMER = 3
- -- FRAMEWORK
- function FRAMEWORK()
- while true do
- Wait(0)
- -- ANIMATION
- for I, V in ipairs(ANIMATION) do
- if EffectIsRunning(V[1]) then
- if V[5] < GetTimer() then
- EffectSetPosition(V[1], V[3][V[4]][1], V[3][V[4]][2], V[3][V[4]][3] + (V[2] == "ElectrocuteLRG" and 1 or 0.5))
- V[4], V[5] = V[4] + ANIM_SPEED_PER_FRAME, GetTimer() + ANIM_DELAY_PER_FRAME
- end
- if V[4] < table.getn(V[3]) then
- for K, PED in {PedFindInAreaXYZ(0, 0, 0, 99999)} do
- if PedIsValid(PED) and PED ~= V[6] and PedGetHealth(PED) > 0 and PedIsInAreaXYZ(PED, V[3][V[4]][1], V[3][V[4]][2], V[3][V[4]][3] + (V[2] == "ElectrocuteLRG" and 1 or 0.5), 1.5) then
- local M = {
- ["ElectrocuteLRG"] = {"ELECTROCUTION", {GetTimer() + math.random(EFFECT_MIN_TIMER * 1000, EFFECT_MAX_TIMER * 1000), nil, GetTimer() + 0}},
- ["GymFire"] = {"BURNT", {GetTimer() + math.random(EFFECT_MIN_TIMER * 1000, EFFECT_MAX_TIMER * 1000), "BarrelFire", nil}},
- }
- if M[V[2]] then
- if not _G[M[V[2]][1]][PED] then
- _G[M[V[2]][1]][PED] = M[V[2]][2]
- end
- end
- end
- end
- else
- if EffectIsRunning(V[1]) then
- EffectSlowKill(V[1], 1, true)
- end
- table.remove(ANIMATION, I)
- end
- else
- table.remove(ANIMATION, I)
- end
- end
- -- ELECTROCUTION
- for PED, EFFECT in pairs(ELECTROCUTION) do
- if PedIsValid(PED) then
- if PED ~= gPlayer then
- if not SoundSpeechPlaying(PED) and PedGetHealth(PED) > 0 then
- SoundPlayAmbientSpeechEvent(PED, math.random(1, 2) == 1 and "FIGHT_FLEE" or "FLEE")
- end
- end
- local PX, PY, PZ = PedGetPosXYZ(PED)
- if EFFECT[1] == nil or EFFECT[1] > GetTimer() then
- if not EFFECT[2] then
- EFFECT[2] = EffectCreate("ElectrocuteLRG", PX, PY, PZ + 0.2)
- else
- EffectSetPosition(EFFECT[2], PX, PY, PZ + 0.2)
- end
- if EFFECT[3] < GetTimer() then
- PedSetActionNode(PED, "/Global/HitTree/Standing/PostHit/BellyDown/OnGroundBounce/BackBounceSmall", "Act/HitTree.act")
- PedApplyDamage(PED, 5)
- EFFECT[3] = GetTimer() + 400
- end
- end
- for I, PED in {PedFindInAreaXYZ(0, 0, 0, 99999)} do
- if PedIsValid(PED) and PedIsInAreaXYZ(PED, PX, PY, PZ, 1.5) and PedGetHealth(PED) > 0 and not ELECTROCUTION[PED] then
- ELECTROCUTION[PED] = {GetTimer() + math.random(EFFECT_MIN_TIMER * 1000, EFFECT_MAX_TIMER * 1000), nil, GetTimer() + 0}
- end
- end
- if EFFECT[1] ~= nil and EFFECT[1] < GetTimer() then
- if EffectIsRunning(EFFECT[2]) then
- EffectSlowKill(EFFECT[2], 1, true)
- end
- ELECTROCUTION[PED] = nil
- end
- else
- if EffectIsRunning(EFFECT[2]) then
- EffectKill(EFFECT[2])
- end
- ELECTROCUTION[PED] = nil
- end
- end
- -- BURNT
- for PED, EFFECT in pairs(BURNT) do
- if PedIsValid(PED) then
- if PED ~= gPlayer then
- PedFlee(PED)
- if not SoundSpeechPlaying(PED) and PedGetHealth(PED) > 0 then
- SoundPlayAmbientSpeechEvent(PED, math.random(1, 2) == 1 and "FIGHT_FLEE" or "FLEE")
- end
- end
- local PX, PY, PZ = PedGetPosXYZ(PED)
- if EFFECT[1] == nil or EFFECT[1] > GetTimer() then
- if not EFFECT[3] then
- local EXPLOSION = EffectCreate("BigExplosion", PX, PY, PZ + 1)
- SoundPlay3D(PX, PY, PZ + 0.5, "Chrybmb_Exp", "large")
- if not ELECTROCUTION[PED] then
- PedSetActionNode(PED, "/Global/HitTree/KnockOuts/Rear/Rear", "Act/HitTree.act")
- end
- EFFECT[3] = EffectCreate(EFFECT[2], PX, PY, PZ)
- EffectSlowKill(EXPLOSION, 3, true)
- end
- EffectSetPosition(EFFECT[3], PX, PY, PZ + ((PedGetHealth(PED) < 1 or PedMePlaying(PED, "BellyDown") or PedMePlaying(PED, "BellyUp") or PedMePlaying(PED, "SitOnWall")) and 0.1 or 1))
- if PedGetHealth(PED) > 0 then
- PedApplyDamage(PED, 0.3)
- end
- end
- for I, PED in {PedFindInAreaXYZ(0, 0, 0, 99999)} do
- if PedIsValid(PED) and PedIsInAreaXYZ(PED, PX, PY, PZ, 1) and PedGetHealth(PED) > 0 and not BURNT[PED] then
- BURNT[PED] = {GetTimer() + math.random(EFFECT_MIN_TIMER * 1000, EFFECT_MAX_TIMER * 1000), "BarrelFire", nil}
- end
- end
- if EFFECT[1] ~= nil and EFFECT[1] < GetTimer() then
- if EffectIsRunning(EFFECT[3]) then
- EffectSlowKill(EFFECT[3], 1, true)
- end
- BURNT[PED] = nil
- end
- else
- if EffectIsRunning(EFFECT[3]) then
- EffectKill(EFFECT[3])
- end
- BURNT[PED] = nil
- end
- end
- end
- end
- -- PROCESS
- function main()
- while not SystemIsReady() or AreaIsLoading() do
- Wait(0)
- end
- -- SETUP
- local STORYLINE = {
- {QST = "6_B", 5, 0, 30, 5, 9},
- {QST = "4_06", 4, 0, 20, 5, 7},
- {QST = "3_B", 3, 0, 15, 4, 6},
- {QST = "2_B", 2, 0, 12, 3, 5},
- {QST = "1_B", 1, 0, 8, 2, 4},
- }
- for I, V in ipairs(STORYLINE) do
- if IsMissionCompleated(V.QST) then
- ANIM_SPEED_PER_FRAME, ANIM_DELAY_PER_FRAME, ANIM_RANGE, EFFECT_MIN_TIMER, EFFECT_MAX_TIMER = V[1], V[2], V[3], V[4], V[5]; break
- end
- end
- -- REQUIRED ANIMATION
- local ANIM = {
- "W_Stick", "Umbrella",
- }
- for I, V in ipairs(ANIM) do
- if HasAnimGroupLoaded(V) == false then
- LoadAnimationGroup(V)
- end
- end
- -- FRAMEWORK
- CreateThread("FRAMEWORK")
- -- SWAP TO WAND
- local TIMER = GetTimer()
- while true do
- Wait(0)
- -- POSITION
- local X, Y, Z = PlayerGetPosXYZ()
- -- DESTROY WAND
- PickupDestroyTypeInAreaXYZ(X, Y, Z, 4, 410)
- -- TARGET
- local TARGET = PedIsValid(PedGetTargetPed(gPlayer)) and PedGetTargetPed(gPlayer) or gPlayer
- -- REAL WAND
- if IsButtonBeingPressed(6, 0) and not PlayerIsInAnyVehicle() then
- local MEET_REQUIREMENTS = true
- local NODE_LIST = {
- "BlockHits", "BellyDown", "BellyUp", "SitOnWall", "TreeCheck", "Dead", "Climb_ON_BOT",
- "HoistUp_Spawns", "Jump", "HitTree"
- }
- for K, V in ipairs(NODE_LIST) do
- if PedMePlaying(gPlayer, V) then
- MEET_REQUIREMENTS = false; break
- end
- end
- if MEET_REQUIREMENTS then
- if PedHasWeapon(gPlayer, 410) and not PedMePlaying(gPlayer, "Swing3") then
- local SPEECH = {
- "INFIRMARY",
- "MP_TAUNT_JIMMY",
- "PLAYER_TAUNT_VICTIM",
- "PLAYER_DEJECTED",
- "PLAYER_NEGATIVE",
- "PLAYER_TAUNT_HARASS",
- "PLAYER_TAUNT_BURN",
- "PLAYER_EXCUSE",
- "PLAYER_JEER",
- "PLAYER_TAUNT_HUMILIATE",
- "PLAYER_TAUNT_HUMILIATE_HIT",
- "PLAYER_TAUNT_KO",
- }
- if SoundSpeechPlaying(gPlayer) then
- SoundStopCurrentSpeechEvent(gPlayer)
- end
- SoundPlayAmbientSpeechEvent(gPlayer, math.random(1, 5) == 3 and "PLAYER_LAUGH_CRUEL" or SPEECH[math.random(1, table.getn(SPEECH))])
- PedSetActionNode(gPlayer, "/Global/umbrella/Actions/Attacks/HeavyAttacks/Swing1/Swing2/Swing3", "Act/Weapons/umbrella.act")
- Wait((600 / GameGetPedStat(gPlayer, 20)) * 100)
- local XYZ = {}
- for CURRENT_DIST = 1, ANIM_RANGE do
- for INTEGER = 1, 10 do
- local PX, PY, PZ = PedGetOffsetInWorldCoords(gPlayer, 0, CURRENT_DIST + INTEGER/10, 0)
- table.insert(XYZ, {PX, PY, PZ})
- end
- end
- local EFFECT_TYPE = IsButtonPressed(6, 0) and "ElectrocuteLRG" or "GymFire"
- local EFFECT = EffectCreate(EFFECT_TYPE, XYZ[1][1], XYZ[1][2], XYZ[1][3] + (EFFECT_TYPE == "ElectrocuteLRG" and 1 or 0.5))
- table.insert(ANIMATION, {EFFECT, EFFECT_TYPE, XYZ, 2, GetTimer() + ANIM_DELAY_PER_FRAME, gPlayer})
- end
- end
- end
- -- REPLACE FLASHLIGHT
- if PedHasWeapon(gPlayer, 420) then
- if TIMER + 500 < GetTimer() and not PedHasWeapon(gPlayer, 410) then
- PlayerSetWeapon(410, 1, false)
- end
- else
- TIMER = GetTimer()
- end
- -- IF LOST
- if ItemGetCurrentNum(420) == 0 then
- GiveWeaponToPlayer(420, 1, true)
- end
- -- LIMIT SPEED & DELAY
- ANIM_SPEED_PER_FRAME = ANIM_SPEED_PER_FRAME > 5 and 5 or (ANIM_SPEED_PER_FRAME < 1 and 1 or math.floor(ANIM_SPEED_PER_FRAME))
- ANIM_DELAY_PER_FRAME = ANIM_DELAY_PER_FRAME > 100 and 100 or (ANIM_DELAY_PER_FRAME < 0 and 0 or math.floor(ANIM_DELAY_PER_FRAME))
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement