[ Обновленные темы · Новые сообщения · Участники · Поиск · RSS ]
  • Страница 1 из 1
  • 1
Результаты поиска
Новички
Сообщений: 1
Реп: 0
[ENG/RU]
I need algorithm to apply
a) Teleport worm from defined area of map to random localisation (stdsv)
workaround: high map, add poxel to map
heres working script for campaign

Код
function Initialise()

    SetupWormsAndTeams()

    SetData("TurnTime", 30000)
    SetData("RoundTime", -1)
    SetData("Camera.StartOfTurnCamera", "Default")
    StartFirstTurn()

--~     SendMessage("GameLogic.CrateShower")
--~     SendMessage("GameLogic.CrateShower")
--~     SendMessage("GameLogic.CrateShower")
    n = 0

    lock, AIParams = EditContainer("AIParams.Worm04")
    AIParams.WeightingPreferAttackHumans = 5000
    CloseContainer(lock)
    
    lock, AIParams = EditContainer("AIParams.Worm08")
    AIParams.WeightingPreferAttackHumans = 5000
    CloseContainer(lock)
    
    lock, AIParams = EditContainer("AIParams.Worm09")
    AIParams.WeightingPreferAttackHumans = 5000
    CloseContainer(lock)
    
    lock, AIParams = EditContainer("AIParams.Worm10")
    AIParams.WeightingPreferAttackHumans = 5000
    CloseContainer(lock)
    
    local worm = QueryContainer("Worm.Data04")
    Live = worm.Energy
    
    SetWormpotModes()
    SetupInventories()
    AntiUtop()
end

function SetWormpotModes()
    SetWeaponWind("kWeaponAirstrike",true)
    SetWeaponWind("kWeaponBananaBomb",true)
    SetWeaponWind("kWeaponBananette",true)
    SetWeaponWind("kWeaponClusterBomb",true)
    SetWeaponWind("kWeaponClusterGrenade",true)
    SetWeaponWind("kWeaponConcreteDonkey",true)
    SetWeaponWind("kWeaponGasCanister",true)
    SetWeaponWind("kWeaponGrenade",true)
    SetWeaponWind("kWeaponHolyHandGrenade",true)
    SetWeaponWind("kWeaponOldWoman",true)
    SetWeaponWind("kWeaponSheep",true)
    SetWeaponWind("kWeaponScouser",true)
    SetWeaponWind("kWeaponFatkins",true)
    SetWeaponWind("kWeaponPoisonArrow",true)
    SetWeaponWind("kWeaponFactoryWeapon",true)
    SetWeaponWind("kWeaponDynamite",true)
    SetWeaponWind("kWeaponLandmine",true)
    SetWeaponWind("kWeaponSuperAirstrike",true)
end

function SetupWormsAndTeams()
-- Activate Team 0
    lock, team = EditContainer("Team.Data00")
    team.Active = true
    team.Name = "Наша команда"
    team.TeamColour = 0
-- team.IsAIControlled = true
    CloseContainer(lock) -- must close the container ASAP

-- Activate Team 1
    lock, team = EditContainer("Team.Data01")
    team.Active = true
    team.Name = "Мастер Ветра"
    team.TeamColour = 1
    team.ATT_Hat = "WXFE.A.Hat.Wizard"
    team.ATT_Glasses = "WXFE.A.Glasses.Professor"
    team.ATT_Tash = "WXFE.A.Mustache.Professor"
    team.FlagGfxName = "Flag.Wizard"
    team.IsAIControlled = true
    team.Skill = 4
    CloseContainer(lock)

-- Activate Team 2
    lock, team = EditContainer("Team.Data02")
    team.Active = true
    team.Name = "Ученики"
    team.TeamColour = 1
    team.ATT_Hat = "WXFE.A.Hat.Wizard.D"
    team.ATT_Gloves = "WXFE.A.Gloves.White.Y"
    team.FlagGfxName = "Flag.Wizard"
    team.IsAIControlled = true
    team.Skill = 3
    CloseContainer(lock) -- must close the container ASAP

-- Worm 0, Team 0
    lock, worm = EditContainer("Worm.Data00")
    worm.Active = true
    worm.Name = "Наш червяк 1"
    worm.Energy = 200
    worm.WeaponFuse = 3
    worm.WeaponIsBounceMax = false
    worm.TeamIndex = 0
    worm.Spawn = "000Human1"
    worm.SfxBankName = "voclassi"
    CloseContainer(lock)
-- Worm 1, Team 0
    CopyContainer("Worm.Data00", "Worm.Data01")
    lock, worm = EditContainer("Worm.Data01")
    worm.Name = "Наш червяк 2"
    worm.Spawn = "000Human2"
    CloseContainer(lock)
-- Worm 2, Team 0
    CopyContainer("Worm.Data00", "Worm.Data02")
    lock, worm = EditContainer("Worm.Data02")
    worm.Name = "Наш червяк 3"
    worm.Spawn = "000Human3"
    CloseContainer(lock)
-- Worm 3, Team 0
    CopyContainer("Worm.Data00", "Worm.Data03")
    lock, worm = EditContainer("Worm.Data03")
    worm.Name = "Наш червяк 4"
    worm.Spawn = "000Human4"
    CloseContainer(lock)

-- Worm 4, Team 1
    CopyContainer("Worm.Data00", "Worm.Data04")
    lock, worm = EditContainer("Worm.Data04")
    worm.Energy = 530
    worm.Name = "Мастер ветра"
    worm.SfxBankName = "vowizar"
    worm.TeamIndex = 1
    worm.Spawn = "000Master1"
    CloseContainer(lock)

-- Worm 8, Team 2
    CopyContainer("Worm.Data00", "Worm.Data08")
    lock, worm = EditContainer("Worm.Data08")
    worm.Energy = 170
    worm.Name = "Ученик"
    worm.TeamIndex = 2
    worm.SfxBankName = "vowizar"
    worm.Spawn = "000Student1"
    CloseContainer(lock)
-- Worm 9, Team 2
    CopyContainer("Worm.Data08", "Worm.Data09")
    lock, worm = EditContainer("Worm.Data09")
    worm.Name = "Ученик"
    worm.Spawn = "000Student2"
    CloseContainer(lock)
-- Worm 10, Team 2
    CopyContainer("Worm.Data08", "Worm.Data10")
    lock, worm = EditContainer("Worm.Data10")
    worm.Name = "Ученик"
    worm.Spawn = "000Student3"
    worm.ArtilleryMode = true
    CloseContainer(lock)

    SendMessage("WormManager.Reinitialise")
    
end

function SetupInventories()
-- sets up a default container and adds our selection to it
    local inventory_lock, inventory = EditContainer("Inventory.Team.Default")
    inventory.Prod = -1
    inventory.SkipGo = -1
    inventory.NinjaRope = -1
    inventory.Parachute = -1
    CloseContainer(inventory_lock)
   CopyContainer("Inventory.Team.Default", "Inventory.Team00")
   CopyContainer("Inventory.Team.Default", "Inventory.Team01")
   CopyContainer("Inventory.Team.Default", "Inventory.Team02")
   
    lock, inventory = EditContainer("Inventory.Team00")
    inventory.Bazooka = -1
    inventory.Grenade = -1
    inventory.ClusterGrenade = -1
    inventory.Dynamite = 1
    inventory.FirePunch = 2
    inventory.HolyHandGrenade = 1
    inventory.HomingMissile = 1
    inventory.Jetpack = 1
    inventory.Landmine = 2
    inventory.ChangeWorm = 1
    inventory.Shotgun = 2
    inventory.Sheep = 1
    inventory.Airstrike = 1
    inventory.GasCanister  = 1
    inventory.BaseballBat = 1
    CloseContainer(lock)
    
    lock, delays = EditContainer("Inventory0.WeaponDelays")
    delays.Dynamite = 1
    delays.HolyHandGrenade = 5
    delays.HomingMissile = 3
    delays.Landmine = 2
    delays.Shotgun = 2
    delays.Sheep = 4
    delays.Airstrike = 4
    CloseContainer(lock)
    
    lock, inventory = EditContainer("Inventory.Team01")
    inventory.Bazooka = 6
    inventory.Grenade = 4
    inventory.ClusterGrenade = -1
    inventory.Dynamite = 1
    inventory.FirePunch = 2
    inventory.HolyHandGrenade = 1
    inventory.HomingMissile = 1
    inventory.Shotgun = 1
    inventory.GasCanister  = 1
    CloseContainer(lock)
    
    lock, delays = EditContainer("Inventory1.WeaponDelays")
    delays.Grenade = 2
    delays.HolyHandGrenade = 6
    delays.HomingMissile = 4
    delays.Shotgun = 3
    CloseContainer(lock)
    
    lock, inventory = EditContainer("Inventory.Team02")
    inventory.Bazooka = 3
    inventory.Grenade = 2
    inventory.ClusterGrenade = -1
    inventory.Dynamite = 1
    inventory.FirePunch = 1
    inventory.Shotgun = 1
    inventory.BananaBomb = 1
    CloseContainer(lock)
    
    lock, delays = EditContainer("Inventory2.WeaponDelays")
    delays.Bazooka = 2
    delays.Grenade = 4
    delays.BananaBomb = 7
    delays.Shotgun = 1
    CloseContainer(lock)
end

function Crate_Collected()
end

function DoWormpotOncePerTurnFunctions()
end

function SpawnCrate()
    SetData("Crate.Spawn", "CrateSpawn1")
    SetData("Crate.Type", "Utility")
    SetData("Crate.Contents", "kUtilityCrateShower")
    SetData("Crate.NumContents", 1)
    SetData("Crate.Index", 0)
    SetData("Crate.GroundSnap", 1)
    SendMessage("GameLogic.CreateCrate")
end

function SetWind() -- Keeps the wind nice and calm or the player.
    local nTeam = GetData("CurrentTeamIndex")
    local worm = QueryContainer("Worm.Data04")
    Live = worm.Energy
    
    if nTeam == 0 and Live > 0 then
    
    local myRandomInteger = lib_GetRandom(0, 9)
       WindCap = GetData("Wind.Cap")/10
       RandomNumber = GetData("RandomNumber.Float")
       MaxWind = GetData("Wind.MaxSpeed")
       SetData("Wind.Speed", ((WindCap*RandomNumber*RandomNumber*MaxWind)+0.0000425)*3)
       SetData("Wind.Direction", myRandomInteger)  -- Values use for the windspeed
        
     else
     
    local myRandomInteger = lib_GetRandom(0, 9)
       WindCap = GetData("Wind.Cap")/10
       RandomNumber = GetData("RandomNumber.Float")
       MaxWind = GetData("Wind.MaxSpeed")
       SetData("Wind.Speed", (WindCap*RandomNumber*RandomNumber*MaxWind)/2)
       SetData("Wind.Direction", myRandomInteger)  -- Values use for the windspeed
        
    end
    
end

function SetWeaponWind(ContainerName, IsAffectedByWind)
    local ContainerLock, Container = EditContainer(ContainerName)
    Container.IsAffectedByWind = IsAffectedByWind
    CloseContainer(ContainerLock)
end

function DoOncePerTurnFunctions()
       SendMessage("GameLogic.StartMineFactory")
    DoWormpotOncePerTurnFunctions()
    SetWind()
    SuperWeapon()
end

function AntiUtop()
    local worm = QueryContainer("Worm.Data04")

    SetData("Text.TestComment",worm.Position)
    lib_SubString("Text.TestComment","Text.TestComment","(","WVector = {")
    lib_SubString("Text.TestComment","Text.TestComment",")","}")
      
    local TextTable = GetData("Text.TestComment")
    assert(loadstring(TextTable))()
    if WVector.y<5 and worm.Energy > 30 then
        local worm = QueryContainer("Worm.Data04")
        local hpbossa = worm.Energy - 30
        local poisonbossa = worm.PendingPoison
        SendIntMessage("WXWormManager.UnspawnWorm", 4)
        local lock, EditWorm = EditContainer(lib_GetWormContainerName(4))
           EditWorm.Energy = hpbossa
           EditWorm.Active = true
        EditWorm.Spawn = "spawn"
        EditWorm.PendingPoison = poisonbossa
        CloseContainer(lock)
        SendIntMessage("Worm.Respawn", 4)
    end
    StartTimer("AntiUtop", 5)
end

function SuperWeapon()
    local nTeam = GetData("CurrentTeamIndex")
    if nTeam == 0 and Live > 0 then
        n = n + 1
        if (n - 5) == 0 then
            lock, delays = EditContainer("Inventory1.WeaponDelays")
            delays.Bazooka = delays.Bazooka+1
            delays.Grenade = delays.Grenade+1
            delays.Dynamite = delays.Dynamite+1
            delays.FirePunch = delays.FirePunch+1
            delays.HolyHandGrenade = delays.HolyHandGrenade+1
            delays.HomingMissile = delays.HomingMissile+1
            delays.Shotgun = delays.Shotgun+1
            delays.GasCanister  = delays.GasCanister+1
            CloseContainer(lock)
    
            lock, weapon = EditContainer("kWeaponClusterGrenade")
            weapon.NumBomblets = 15
            CloseContainer(lock)
        end
        if n == 5 then
            n = n - 5
        end
    else
        lock, weapon = EditContainer("kWeaponClusterGrenade")
        weapon.NumBomblets = 4
        CloseContainer(lock)
    end
end


My try at stdsv, please correct me


Код
function AntiUtop()
    local worm = QueryContainer("ActiveWormIndex")

    SetData("Text.TestComment",worm.Position)
    lib_SubString("Text.TestComment","Text.TestComment","(","WVector = {")
    lib_SubString("Text.TestComment","Text.TestComment",")","}")
      
    local TextTable = GetData("Text.TestComment")
    assert(loadstring(TextTable))()
    if WVector.y<5 and worm.Energy > 30 then
        local worm = QueryContainer("ActiveWormIndex")
        local hpbossa = worm.Energy + 30
        SendIntMessage("WXWormManager.UnspawnWorm", 4)
        local lock, EditWorm = EditContainer(lib_GetWormContainerName(4))
           EditWorm.Energy = hpbossa
           EditWorm.Active = true
        EditWorm.Spawn = "spawn"
        CloseContainer(lock)
        SendIntMessage("Worm.Respawn", 4)
    end
    StartTimer("AntiUtop", 5)
end

Other related problems

b) make positive damages after using a weapon (wormpot) (using if ?) (stdsv)
workaround: damage for both players

you can give me working example of function

c) Display a text in given coordinates (stdsv)
workaround: custom texture

d) Respawn worm that died after water impact or at least infinite mode (worm.dead ?) (stdsv)

e) Camera text before deathmatch (stdsv and mission)

f) Camera text after collecting crate that drops after several turns (stdsv and mission)

g) make teams for deatmatch from lua rather than in-game logic for easier operating (mission)

h) for g) After defeat of team display camera text (stdsv, mission)

i) Custom shotting challenge - link (mission)
https://www.youtube.com/watch?v=PjoCj0tX8DI

j) Custom shotting challenge - infinite mode without sticky mode (mission) -> that should be easier one
a workaround: simply shorten time of turn skip,

k) Destruction mode custom maps??? How? I managed only to have survival ones. (not lua)

Maybe someone is familiar with some simple hacks via lua. IDK, you can give me working examples/files of luas. Basic problem is to adopt code into stdvs or wormpot whatever is simplier.

Translation as attachment
Прикрепления: Translation.txt (29.1 Kb)
 
  • Страница 1 из 1
  • 1
Поиск: