Worms 3D example mission - Форум
W4Tweaks
Меню сайта
Последние файлы
Последние темы


Вход



Мини-чат
 
500

Статистика
Онлайн:

Сегодня заходили: Joker, Cyborg, KaMiKaZe, 4erveR, Unaited, agent007, Renny


Друзья сайта

Если вы хотите увидеть в этом спиcке свой сайт загляните сюда

Наш баннер:



· Регистрация · Вход
[ Новые сообщения · Участники · Подписки · Поиск · RSS ]
Страница 1 из 11
Форум » Worms 3D » Моддинг Worms 3D » Worms 3D example mission (Mission with explanation how it work.)
Worms 3D example mission
Woitek
Дата: ПТ, 10.10.2014, 00:55:59 | Сообщение # 1
Woitek
Его узнают в чате
Группа: Проверенные
Сообщений: 521
Репутация: 56
Статус: Offline
--Cocons Up
--Map by Alexbond

function Initialise()

    SendMessage("Commentary.NoDefault")
    bronzetime = (60 * 1000) * 9999
    silvertime = (60 * 1000) * 25
    goldtime = (60 * 1000) * 20

    SetData("Camera.StartOfTurnCamera","Default")
 
    SetData("Camera.Path.IgnoreInput", 1)    
 
    SetData("Mine.DudProbabilty", 0.1)
    SetData("Mine.MinFuse", 1000)
    SetData("Mine.MaxFuse", 5000)
    SetData("TurnTime", 0)
    SetData("RoundTime", 1500000)
    
    CrateCount = 0
    CratesCollected = false
    
    SetData("Camera.StartOfTurnCamera","Default")
    SetData("Camera.GameOverCamera", "Orbit")
    SendStringMessage("Camera.Disable", "Orbit") 
    SendStringMessage("Camera.Disable", "Blimp") 
    CrateSpawn()

    SetupWormsAndTeams()
    SetupInventories()
    Intro()
    --startt()

end

function SelectRandomWind()
   SetData("Wind.Speed", 0.0)
end

function SituationText()
    SetData("Text.TestComment", "It might be difficult situation for you!")
    SetData("CommentaryPanel.Comment", "Text.TestComment")
    SendMessage("CommentaryPanel.ScriptText") 
end

function SituationAnim()
    SendIntMessage("Worm.ResetAnim", 0)
    SetData("Worm.ScriptAnim", "Horror")
    SendIntMessage("Worm.QueueAnim", 0)
end

function Intro()
    CameraFly = 1
    SendMessage("EFMV.Start")
    StartTimer("SituationAnim", 10)
    StartTimer("SituationText", 1000)
    SetData("Camera.Path.Knots.Position", "Pos1")
SetData("Camera.Path.Knots.LookAt", "Look1")
SetData("Camera.Path.Loop.Position", 0)
SetData("Camera.Path.Loop.LookAt", 0)
SetData("Camera.Path.Steps.Position", 0)
SetData("Camera.Path.Steps.LookAt", 0)
SetData("Camera.Path.Tension.Position", 0)
SetData("Camera.Path.Tension.LookAt", 0)
SendMessage("Camera.Path.Start")
CamLoop = StartTimer("Intro2", 4500)
end

function SpiderText()
    SetData("Text.TestComment", "Spider mom looks little hungry...")
    SetData("CommentaryPanel.Comment", "Text.TestComment")
    SendMessage("CommentaryPanel.ScriptText") 
end

function Intro2()
    CameraFly = 1
    StartTimer("SpiderText", 1500)
    SetData("Camera.Path.Knots.Position", "Pos2,Pos3")
SetData("Camera.Path.Knots.LookAt", "Look2")
SetData("Camera.Path.Loop.Position", 0)
SetData("Camera.Path.Loop.LookAt", 0)
SetData("Camera.Path.Steps.Position", 500)
SetData("Camera.Path.Steps.LookAt", 0)
SetData("Camera.Path.Tension.Position", 0)
SetData("Camera.Path.Tension.LookAt", 0)
SendMessage("Camera.Path.Start")
CamLoop = StartTimer("Intro3", 4000)
end

function ExistText()
    SetData("Text.TestComment", "But exist exit from this situation")
    SetData("CommentaryPanel.Comment", "Text.TestComment")
    SendMessage("CommentaryPanel.ScriptText") 
end

function ExistAnim()
    SendIntMessage("Worm.ResetAnim", 0)
    SetData("Worm.ScriptAnim", "Angry3")
    SendIntMessage("Worm.QueueAnim", 0)
end

function Intro3()
    CameraFly = 1
    StartTimer("ExistText", 500)
ExistAnim()
    SetData("Camera.Path.Knots.Position", "Pos1")
SetData("Camera.Path.Knots.LookAt", "Look1")
SetData("Camera.Path.Loop.Position", 0)
SetData("Camera.Path.Loop.LookAt", 0)
SetData("Camera.Path.Steps.Position", 0)
SetData("Camera.Path.Steps.LookAt", 0)
SetData("Camera.Path.Tension.Position", 0)
SetData("Camera.Path.Tension.LookAt", 0)
SendMessage("Camera.Path.Start")
CamLoop = StartTimer("Intro4", 3200)
end

function BabyText()
    SetData("Text.TestComment", "Colllect six spider babies...")
    SetData("CommentaryPanel.Comment", "Text.TestComment")
    SendMessage("CommentaryPanel.ScriptText") 
end

function BabyText2()
    SetData("Text.TestComment", "and bring them back to the mother!")
    SetData("CommentaryPanel.Comment", "Text.TestComment")
    SendMessage("CommentaryPanel.ScriptText") 
end

function Intro4()
    CameraFly = 1
BabyText()
    SetData("Camera.Path.Knots.Position", "Pos4")
SetData("Camera.Path.Knots.LookAt", "Crate1")
SetData("Camera.Path.Loop.Position", 0)
SetData("Camera.Path.Loop.LookAt", 0)
SetData("Camera.Path.Steps.Position", 0)
SetData("Camera.Path.Steps.LookAt", 0)
SetData("Camera.Path.Tension.Position", 0)
SetData("Camera.Path.Tension.LookAt", 0)
SendMessage("Camera.Path.Start")
CamLoop = StartTimer("Intro4_1", 1000)
end

function Intro4_1()
    CameraFly = 1
    SetData("Camera.Path.Knots.Position", "Pos5")
SetData("Camera.Path.Knots.LookAt", "Crate2")
SetData("Camera.Path.Loop.Position", 0)
SetData("Camera.Path.Loop.LookAt", 0)
SetData("Camera.Path.Steps.Position", 0)
SetData("Camera.Path.Steps.LookAt", 0)
SetData("Camera.Path.Tension.Position", 0)
SetData("Camera.Path.Tension.LookAt", 0)
SendMessage("Camera.Path.Start")
CamLoop = StartTimer("Intro4_2", 1000)
end

function Intro4_2()
    CameraFly = 1
    StartTimer("BabyText2", 500)
    SetData("Camera.Path.Knots.Position", "Pos6")
SetData("Camera.Path.Knots.LookAt", "Crate3")
SetData("Camera.Path.Loop.Position", 0)
SetData("Camera.Path.Loop.LookAt", 0)
SetData("Camera.Path.Steps.Position", 0)
SetData("Camera.Path.Steps.LookAt", 0)
SetData("Camera.Path.Tension.Position", 0)
SetData("Camera.Path.Tension.LookAt", 0)
SendMessage("Camera.Path.Start")
CamLoop = StartTimer("Intro4_3", 1000)
end

function Intro4_3()
    CameraFly = 1
    SetData("Camera.Path.Knots.Position", "Pos7")
SetData("Camera.Path.Knots.LookAt", "Crate4")
SetData("Camera.Path.Loop.Position", 0)
SetData("Camera.Path.Loop.LookAt", 0)
SetData("Camera.Path.Steps.Position", 0)
SetData("Camera.Path.Steps.LookAt", 0)
SetData("Camera.Path.Tension.Position", 0)
SetData("Camera.Path.Tension.LookAt", 0)
SendMessage("Camera.Path.Start")
CamLoop = StartTimer("Intro4_4", 1000)
end

function Intro4_4()
    CameraFly = 1
DinnerAnim()
    SetData("Camera.Path.Knots.Position", "Pos8")
SetData("Camera.Path.Knots.LookAt", "Crate5")
SetData("Camera.Path.Loop.Position", 0)
SetData("Camera.Path.Loop.LookAt", 0)
SetData("Camera.Path.Steps.Position", 0)
SetData("Camera.Path.Steps.LookAt", 0)
SetData("Camera.Path.Tension.Position", 0)
SetData("Camera.Path.Tension.LookAt", 0)
SendMessage("Camera.Path.Start")
CamLoop = StartTimer("Intro4_5", 1000)
end

function Intro4_5()
    CameraFly = 1
    SetData("Camera.Path.Knots.Position", "Pos9")
SetData("Camera.Path.Knots.LookAt", "Crate6")
SetData("Camera.Path.Loop.Position", 0)
SetData("Camera.Path.Loop.LookAt", 0)
SetData("Camera.Path.Steps.Position", 0)
SetData("Camera.Path.Steps.LookAt", 0)
SetData("Camera.Path.Tension.Position", 0)
SetData("Camera.Path.Tension.LookAt", 0)
SendMessage("Camera.Path.Start")
CamLoop = StartTimer("Intro5", 1000)
end

function DinnerText()
    SetData("Text.TestComment", "Then maybe you not end as next dinner!")
    SetData("CommentaryPanel.Comment", "Text.TestComment")
    SendMessage("CommentaryPanel.ScriptText") 
end

function DinnerAnim()
    SendIntMessage("Worm.ResetAnim", 0)
    SetData("Worm.ScriptAnim", "Disbelief1")
    SendIntMessage("Worm.QueueAnim", 0)
end

function Intro5()
    CameraFly = 1
    StartTimer("DinnerText", 1000)
    SetData("Camera.Path.Knots.Position", "Pos1")
SetData("Camera.Path.Knots.LookAt", "Look1")
SetData("Camera.Path.Loop.Position", 0)
SetData("Camera.Path.Loop.LookAt", 0)
SetData("Camera.Path.Steps.Position", 0)
SetData("Camera.Path.Steps.LookAt", 0)
SetData("Camera.Path.Tension.Position", 0)
SetData("Camera.Path.Tension.LookAt", 0)
SendMessage("Camera.Path.Start")
CamLoop = StartTimer("startt", 3500)
end

function Spider()
    SetData("Text.TestComment", "It's time for dinner!")
    SetData("CommentaryPanel.Comment", "Text.TestComment")
    SendMessage("CommentaryPanel.ScriptText") 
end

function SpiderFailure()
    --CameraFly = 1
    SendMessage("EFMV.Start")
    StartTimer("Spider", 500)
    SetData("Camera.Path.Knots.Position", "Pos11,Pos12")
SetData("Camera.Path.Knots.LookAt", "Look2")
SetData("Camera.Path.Loop.Position", 0)
SetData("Camera.Path.Loop.LookAt", 0)
SetData("Camera.Path.Steps.Position", 250)
SetData("Camera.Path.Steps.LookAt", 0)
SetData("Camera.Path.Tension.Position", 0)
SetData("Camera.Path.Tension.LookAt", 0)
SetData("Camera.Path.IgnoreInput", 1) 
SendMessage("Camera.Path.Start")
StartTimer("End", 1500)
        --FailureMessages()
end

function End()
            SendMessage("GameLogic.Mission.Failure")
end

function CrateSpawn()
SetData("Crate.Spawn", "Crate1")
SetData("Crate.Type", "Weapon")
SetData("Crate.NumContents", 0)
SetData("Crate.Contents", "kWeaponBazooka")
SetData("Crate.Index", 1)
SetData("Crate.Pushable", 0)
    SetData("Crate.TeamDestructible", 10)
    SetData("Crate.TrackCam", 0)
    SendMessage("GameLogic.CreateCrate")

SetData("Crate.Spawn", "Crate2")
SetData("Crate.Type", "Weapon")
SetData("Crate.NumContents", 0)
SetData("Crate.Contents", "kWeaponBazooka")
SetData("Crate.Index", 2)
SetData("Crate.Pushable", 0)
    SetData("Crate.TeamDestructible", 10)
    SetData("Crate.TrackCam", 0)
    SendMessage("GameLogic.CreateCrate")

SetData("Crate.Spawn", "Crate3")
SetData("Crate.Type", "Weapon")
SetData("Crate.NumContents", 0)
SetData("Crate.Contents", "kWeaponBazooka")
SetData("Crate.Index", 3)
SetData("Crate.Pushable", 0)
    SetData("Crate.TeamDestructible", 10)
    SetData("Crate.TrackCam", 0)
    SendMessage("GameLogic.CreateCrate")

SetData("Crate.Spawn", "Crate4")
SetData("Crate.Type", "Weapon")
SetData("Crate.NumContents", 0)
SetData("Crate.Contents", "kWeaponBazooka")
SetData("Crate.Index", 4)
SetData("Crate.Pushable", 0)
    SetData("Crate.TeamDestructible", 10)
    SetData("Crate.TrackCam", 0)
    SendMessage("GameLogic.CreateCrate")

SetData("Crate.Spawn", "Crate5")
SetData("Crate.Type", "Weapon")
SetData("Crate.NumContents", 0)
SetData("Crate.Contents", "kWeaponBazooka")
SetData("Crate.Index", 5)
SetData("Crate.Pushable", 0)
    SetData("Crate.TeamDestructible", 10)
    SetData("Crate.TrackCam", 0)
    SendMessage("GameLogic.CreateCrate")

SetData("Crate.Spawn", "Crate6")
SetData("Crate.Type", "Weapon")
SetData("Crate.NumContents", 0)
SetData("Crate.Contents", "kWeaponBazooka")
SetData("Crate.Index", 6)
SetData("Crate.Pushable", 0)
    SetData("Crate.TeamDestructible", 10)
    SetData("Crate.TrackCam", 0)
    SendMessage("GameLogic.CreateCrate")
end

function Crate_Collected()
    CrateCount = CrateCount + 1
    SendMessage("Commentary.Clear")
    SendMessage("Commentary.NoDefault")
    DisplayCollectComment()
if CrateCount == 6 then
    WON()
end
end

function DisplayCollectComment()
   local Comment = { "That's it!", "Keep going!", "Just a few more!" }
   SendMessage("RandomNumber.Get")
   local RandomNumber = GetData("RandomNumber.Uint")
   local MyRandomNumber = math.mod(RandomNumber, 3) + 1
  -- SendMessage("Commentary.Clear")  
   SetData("Text.TestComment", Comment [MyRandomNumber])
   SetData("CommentaryPanel.Comment", "Text.TestComment")
   SetData("CommentaryPanel.Delay", 3000)
   SendMessage("CommentaryPanel.TimedText")
end

function startt()
    CameraFly = 0
    StartFirstTurn()
    SendMessage("EFMV.End")
end

function StartTurn()
    done_once_per_turn_functions = false
    SendMessage("Timer.StartHotSeatTimer")
    SendMessage("GameLogic.ActivateNextWorm")
    SendMessage("Weapon.Create")
    SetWind()
    SendMessage("GameLogic.Turn.Started")
    TurnStarted()
    RunAILogic()
else    
end

function StartFirstTurn()
   WaitUntilNoActivity = false
   SendMessage("Timer.StartGame")
   SendMessage("EFMV.End")
   StartTurn()
end

function Camera_Path_Stopped()
    if CameraFly == 1 then
        SendMessage("Commentary.Clear")
        CameraFly = 0
        CancelTimer(CamLoop)
        if TimerControl == 1 then
            CancelTimer(TextTime)
            TimerControl = 0
        end
        SendMessage("EFMV.End")
        StartFirstTurn()
    end
end

function TurnEnded()
    RoundTimeRemaining = GetData("RoundTimeRemaining")
    if (RoundTimeRemaining == 0 or RoundTimeRemaining < 0) and StartedSuddenDeath == false then
    SpiderFailure()
    end
    CheckOneTeamVictory()    
end

function CheckOneTeamVictory()
    SendMessage("WormManager.GetActiveTeamCount")
    TeamCount = GetData("TeamCount")
    if TeamCount == 0 then
SpiderFailure()
    else
    StartTurn()
    end
end

function FailureMessages()

    SendMessage("Commentary.Clear")
    SendMessage("Commentary.NoDefault")
    
    -- makes up a random number between 1 and 5
    SendMessage("RandomNumber.Get")
    RandomNumber = GetData("RandomNumber.Uint")
    MyRandomNumber = math.mod(RandomNumber, 5) + 1
   
    if MyRandomNumber == 1 then
        SetData("CommentaryPanel.Comment", "Miss.Generic.Lose1")
        SendMessage("CommentaryPanel.ScriptText")
    elseif MyRandomNumber == 2 then
        SetData("CommentaryPanel.Comment", "Miss.Generic.Lose2")
        SendMessage("CommentaryPanel.ScriptText")
    elseif MyRandomNumber == 3 then
        SetData("CommentaryPanel.Comment", "Miss.Generic.Lose3")
        SendMessage("CommentaryPanel.ScriptText") 
    elseif MyRandomNumber == 4 then
        SetData("CommentaryPanel.Comment", "Miss.Generic.Lose4")
        SendMessage("CommentaryPanel.ScriptText")
    elseif MyRandomNumber == 5 then
        SetData("CommentaryPanel.Comment", "Miss.Generic.Lose5")
        SendMessage("CommentaryPanel.ScriptText")        
    end
    
end

function WON()
    
    timetook = GetData("ElapsedRoundTime")
    
    if timetook < bronzetime then
        Movie = 1 
        if timetook < silvertime then
            Movie = 2
            if timetook < goldtime then
                Movie = 3                
            end
        end
    end
    
    
    if Movie == 1 then
        SetData("MCa.LastGameTime", 1)
        SetData("GameOver.AwardMovie","bronze")
    elseif Movie == 2 then
        SetData("MCa.LastGameTime", 2)
        SetData("GameOver.AwardMovie","silver")
    elseif Movie == 3 then
        SetData("MCa.LastGameTime", 3)
        SetData("GameOver.AwardMovie","gold")
    end
    
    SendMessage("GameLogic.Mission.Success")

end

function SetupWormsAndTeams()
    GM = QueryContainer("GM.GameInitData")
    lock, team = EditContainer("Team.Data00") 
    team.Active = true
    team.Name = GM.T1_Name
    team.FlagGfxName = GM.T1_Flag
    team.GraveIndex = GM.T1_Grave
    team.TeamColour = 0
    CloseContainer(lock)

    lock, worm = EditContainer("Worm.Data00") 
    worm.Active = true
    worm.Name = GM.T1_W1_Name
    worm.SfxBankName = GM.T1_Speech
    worm.Spawn = "Worm1"
    worm.Energy = 100
    worm.WeaponFuse = 3
    worm.WeaponIsBounceMax = false
    worm.TeamIndex = 0
    CloseContainer(lock) 

   SendMessage("WormManager.Reinitialise")
end

function SetupInventories()
    lock, inventory = EditContainer("Inventory.Team00")
    --inventory.Teleport = -1
    --inventory.Jetpack = -1
    inventory.Binoculars = -1
    inventory.Parachute = -1
    inventory.SkipGo = 0
    inventory.Surrender = 0
    CloseContainer(lock) 
end

Добавлено (10.10.2014, 00:55)
---------------------------------------------
I will update this post soon. With explanation how this script work.

 
Rz_etw
Дата: ПТ, 10.10.2014, 05:10:50 | Сообщение # 2
Только что регнулся
Группа: Новички
Сообщений: 6
Репутация: 0
Статус: Offline
what is this?

done_once_per_turn_functions = false
 
Woitek
Дата: ПТ, 10.10.2014, 22:06:35 | Сообщение # 3
Woitek
Его узнают в чате
Группа: Проверенные
Сообщений: 521
Репутация: 56
Статус: Offline
This check that StartTurn functions inside are initialised once per turn I guess. I never change this variable. It exist in standard function so better not touch this.
 
Rz_etw
Дата: СБ, 11.10.2014, 07:50:08 | Сообщение # 4
Только что регнулся
Группа: Новички
Сообщений: 6
Репутация: 0
Статус: Offline
but, is it just used for conditions? so it doesnt change anything in the game (not directly)
 
Woitek
Дата: СБ, 11.10.2014, 16:35:53 | Сообщение # 5
Woitek
Его узнают в чате
Группа: Проверенные
Сообщений: 521
Репутация: 56
Статус: Offline
function DoPostActivity()
if done_once_per_turn_functions == true then
SendMessage("GameLogic.Turn.Ended")
TurnEnded()
else
-- Done only once
SendMessage("Worm.ApplyPoison")
SetData("DoubleDamage", 0)
DoOncePerTurnFunctions()
done_once_per_turn_functions = true
CheckActivity() -- in case an earthquake or similar was just started
end
end

This is for coordinate functions what happen once in turn. Example if worm check Double damage then set this to 0 after turn end.
This is also standard function in stdlib.lua liblary


Сообщение отредактировал Woitek - СБ, 11.10.2014, 16:36:26
 
Rz_etw
Дата: ВС, 12.10.2014, 09:10:13 | Сообщение # 6
Только что регнулся
Группа: Новички
Сообщений: 6
Репутация: 0
Статус: Offline
and how does this work? 

function DisplayCollectComment() 
   local Comment = { "That's it!", "Keep going!", "Just a few more!" } 
   SendMessage("RandomNumber.Get") 
   local RandomNumber = GetData("RandomNumber.Uint") 
   local MyRandomNumber = math.mod(RandomNumber, 3) + 1 
  -- SendMessage("Commentary.Clear")   
   SetData("Text.TestComment", Comment [MyRandomNumber]) 
   SetData("CommentaryPanel.Comment", "Text.TestComment") 
   SetData("CommentaryPanel.Delay", 3000) 
   SendMessage("CommentaryPanel.TimedText") 
end
 
Woitek
Дата: ВС, 12.10.2014, 14:28:02 | Сообщение # 7
Woitek
Его узнают в чате
Группа: Проверенные
Сообщений: 521
Репутация: 56
Статус: Offline
function DisplayCollectComment()  --make function.
 local Comment = { "That's it!", "Keep going!", "Just a few more!" }  --Make local class(can be used only in this function) with 3 elements. 1,2,3.
 SendMessage("RandomNumber.Get")  --Send Message to game for get random number.
local RandomNumber = GetData("RandomNumber.Uint")  -- Give variable RandomNumber Random Uint number (0 to 4 294 967 295)
 local MyRandomNumber = math.mod(RandomNumber, 3) + 1  --In short. Give variable MyRandomNumber values 1-3.
SetData("Text.TestComment", Comment [MyRandomNumber])  --add to this Text.TestComment value from class Comment
SetData("CommentaryPanel.Comment", "Text.TestComment")  -- Add my text to commentary panel
SetData("CommentaryPanel.Delay", 3000)  -- Give panel 3 seconds delay
SendMessage("CommentaryPanel.TimedText")  --Run Panel and if time gone (3 seconds) then panel off
end --End function

Добавлено (12.10.2014, 14:28)
---------------------------------------------
This function  is called here so
function Crate_Collected() --If Crate collected then
    CrateCount = CrateCount + 1 --Count how many crates we collect
    SendMessage("Commentary.Clear")  --Clear other commentary
    SendMessage("Commentary.NoDefault") --Make Commentary NoDefaults like from crates.
    DisplayCollectComment()  --Display text from previous function. Example we collect crate and we get message "Keep going!"
if CrateCount == 6 then --If we collect total 6 crates then
    WON() --function WON()
end -- end if
end  --end function

 
Форум » Worms 3D » Моддинг Worms 3D » Worms 3D example mission (Mission with explanation how it work.)
Страница 1 из 11
Поиск:

Copyright W4Tweaks™ 2008-2016 Хостинг от uCoz