[ Обновленные темы · Новые сообщения · Участники · Поиск · RSS ]
  • Страница 1 из 1
  • 1
Форум » Моддинг » Моддинг Worms 3D » Worms 3D Custom Functions. (Scripts for Worms 3D)
Worms 3D Custom Functions.
Woitek
Проверенные
Сообщений: 523
Реп: 57 / Инв: 11
Here is topic where I will be write about scripts. Bond make script for respawn but (unfortunately) died again with him communication so don't call me it.
So I make my own script for respawn worm!

function Initialise()
CPUSpawn3 = 1 -- here write variables how many you want. Example if is 10 cpu write 10 spawns
CPUSpawn4 = 1
end
function StartTurn() --This function is needed for StartTurn where example: CPU respawn or for CheckVictory function.
done_once_per_turn_functions = false
SendMessage("Timer.StartHotSeatTimer")
SendMessage("GameLogic.ActivateNextWorm")
SendMessage("Weapon.Create")
SendMessage("GameLogic.Turn.Started")
SetWind()
RunAILogic()
end

function Worm_Died()
deadworm = GetData("DeadWorm.Id") -- Deadworm ID mean 16 worms 0-15. Example Worm.Data.00 is 0 here
if deadworm == 3 then ---here write variables how many you want. Example if is 10 cpu write 10 spawns
CPUSpawn3 = 0
elseif deadworm == 4 then
CPUSpawn4 = 0
end
end

function SpawnNewCPU()
TeamCount = GetData("TeamCount") -- this tell how many teams is on map
WhichTeam = GetData("SurvivingTeamIndex") -- this tell what team alive. 0-3. In Deathmatches where is two team 0 is for Human team 1 for CPU
if TeamCount == 1 and WhichTeam == 0 then -- If one team alive and this team is Human then
if CPUSpawn3 == 0 then -- if CPUSpawn3 is 0 (is when used Worm_Died function) then
CopyContainer("AIParams.CPU4", "AIParams.Worm03")
lock, worm = EditContainer("Worm.Data03")
worm.Active = true
worm.WeaponFuse = 3
worm.WeaponIsBounceMax = false
worm.Energy = 75
worm.SfxBankName = "Cowgirl"
worm.TeamIndex = 1
worm.Spawn = "spawn4"
CloseContainer(lock) -- worms stats
CPUSpawn3 = 1 -- =1 for no more worms respawns
SendIntMessage("Worm.Respawn", 3) --respawn worm
end
if CPUSpawn4 == 0 then -- analogic here...
CopyContainer("AIParams.CPU4", "AIParams.Worm04")
lock, worm = EditContainer("Worm.Data04")
worm.Active = true
worm.WeaponFuse = 3
worm.WeaponIsBounceMax = false
worm.Energy = 75
worm.Name = "Alexbond Clone"
worm.SfxBankName = "Cowgirl"
worm.TeamIndex = 1
worm.Spawn = "spawn5"
CloseContainer(lock)
CPUSpawn4 = 1
SendIntMessage("Worm.Respawn", 4)
end

end
end

function TurnEnded()
RoundTimeRemaining = GetData("RoundTimeRemaining")
if (RoundTimeRemaining == 0 or RoundTimeRemaining < 0) and StartedSuddenDeath == false then
StartedSuddenDeath = true
SetAllWormsEnergy(1)
end
SpawnNewCPU() -- need add this for function TurnEnded() other is orginal.
CheckOneTeamVictory()
end

function CheckOneTeamVictory()
TeamCount = GetData("TeamCount")
WhichTeam = GetData("SurvivingTeamIndex")

if TeamCount == 0 then
FailureMessages()
SendMessage("GameLogic.Challenge.Failure")
elseif TeamCount == 1 and WhichTeam == 1 then
FailureMessages()
SendMessage("GameLogic.Challenge.Failure")
elseif TeamCount == 1 and WhichTeam == 0 then
StartTurn() -- need add this because orginally when CPU dies we win.
--So need replace them. For win we can use now example when human die "TeamCount == 1 and WhichTeam == 1"
else
StartTurn()
end
end

This end =). Now CPU respawn when died fully.

Добавлено (31.08.2013, 11:55)
---------------------------------------------
I wrote Roulette function for weapons chances in crates. But not know why have one error!.

input:9: '=' or 'in' expected near '>='

function Roulette()

Weapon = {Bazooka , Grenade , Petrol , HHG , BananaBomb }
Chances = { 10 , 10 , 10 , 20 , 50 }
NewChances = { 0 , 0 , 0 ,0 ,0 }

for i=0,5 do --for (int i = 0; i < 5; i++) -- i=i+1
NewChances[i] = Chances[i]
for i >= j do --for (int j = 1; j<=i; j++) -- j=j+1
NewChances[i] = NewChances[i] + Chances[j]

Random = Random(NewChances[4])

i=0
while(random > NewChances[i]) do

i = i+1

SetData("Crate.Spawn", "CrateSpawn2")
SetData("Crate.Type", "Weapon")
SetData("Crate.NumContents", 1)
SetData("Crate.Contents", Weapon[i])
SendMessage("GameLogic.CreateCrate")
end
end
end
end

Anyone can help? My ICQ 587589902

Сообщение отредактировал Woitek - ЧТ, 29.08.2013, 21:33:40
 
Форум » Моддинг » Моддинг Worms 3D » Worms 3D Custom Functions. (Scripts for Worms 3D)
  • Страница 1 из 1
  • 1
Поиск: