local function findInTable(table, value) for i, v in pairs(table) do if v == value then return i end end end local rjSpawn RocketJock = {} Attached = {} function OnWaveSpawnBot(bot, _, tags) RocketJock[bot] = nil Attached[bot] = nil if not findInTable(tags, "rocketJock") then print("fail") return end print("pass: " .. tostring(bot) .. tostring(RocketJock[bot])) RocketJock[bot] = true bot["$SetProp$m_spawnflags"](bot, 101) --print(rocketJock[bot]) print("CheckCheck Spawn: ") CheckCheck(bot) --bot["$SetVar$rocketJock"](bot, true) --timer.Simple(0.1, function() --bot["$GetVar$rocketJock"](bot, "player|$DisplayTextChat|def") --end) end function CheckCheck(bot) --print(tostring(bot) .. tostring(RocketJock[bot])) --print(RocketJock[bot]) print(bot.m_spawnflags) bot["$GetProp$m_spawnflags"](bot, "player|$DisplayTextChat|def") --bot["$GetVar$rocketJock"](bot, "player|$DisplayTextChat|def") --print(bot.rocketJock) end function AttachRocketJock(_, activator) print(activator) rjSpawn = ents.FindByName("rjspawn*") if rjSpawn then rjSpawn:Enable() end timer.Simple(1, function() for i, player in pairs(ents.GetAllPlayers()) do --timer.Simple(0.5, function() print("CheckCheck Attach: ") CheckCheck(player) if RocketJock[player] then print("attaching (allegedly)") player:SetFakeParent(activator) Attached[player] = true end --end) end end) timer.Simple(0.15, function() if rjSpawn then rjSpawn:Disable() end end) end function Artisan(_, activator) local rocketWeapons = { [1] = "MINELAUNCHER", [2] = "JOCKEYROCKET", } local THRESHOLD = { [1] = 22000, [2] = 10000, } local fireTime = { [1] = 3, [2] = 0.8 } local taunt = { [1] = "layer_taunt_flip_success_initiator" } local maxHealth = activator.m_iHealth local lastHealth = activator.m_iHealth local currentPhase = 0 local mineMimic = ents.CreateWithKeys("tf_point_weapon_mimic", { teamnum = activator.m_iTeamNum, ["$preventshootparent"] = 1, ["$weaponname"] = rocketWeapons[1], ["$firetime"] = fireTime[1], }) local offset = Vector(0, 0, 100) mineMimic["$SetOwner"](mineMimic, activator) --mineMimic["$PlaySequence"](activator, taunt[1]) mineMimic:SetFakeParent(activator) mineMimic["$fakeparentoffset"] = offset --mineMimic["$StartFiring"](mineMimic, math.huge) local rjMimic = ents.CreateWithKeys("tf_point_weapon_mimic", { teamnum = activator.m_iTeamNum, ["SpreadAngle"] = 30, ["$preventshootparent"] = 1, ["$weaponname"] = rocketWeapons[2], ["$firetime"] = fireTime[1], ["$onfire"] = "popscript,$AttachRocketJock,,0,-1", }) rjMimic["$SetOwner"](rjMimic, activator) rjMimic:SetFakeParent(activator) rjMimic["$fakeparentoffset"] = offset --rjMimic["$StartFiring"](rjMimic, math.huge) --timer.Simple(3, function() -- local mineLogic -- mineLogic = timer.Create(6, function() -- if not activator:IsAlive() then -- timer.Stop(mineLogic) -- return -- end -- print("mineMimic") -- mineMimic["FireOnce"](mineMimic) -- end, 0) --end) timer.Simple(1, function() local rjLogic rjLogic = timer.Create(4, function() if not activator:IsAlive() then timer.Stop(rjLogic) return end print("rjMimic") rjMimic["FireOnce"](rjMimic) end, 0) end) end