Why this script crashes?

A forum to discuss custom scenarios, campaigns and modding in general.

Moderators: Slitherine Core, The Lordz

Post Reply
Kossatx
Sergeant - 7.5 cm FK 16 nA
Sergeant - 7.5 cm FK 16 nA
Posts: 241
Joined: Wed Nov 27, 2013 3:27 pm

Why this script crashes?

Post by Kossatx »

The part for austria in this script crashes and I don't know why, anyone can help me to fix it?

Code: Select all

local germany = game:GetFactionById(2)
local austria = game:GetFactionById(3)

local berlin = GetHex(101, 22)
local budapest = GetHex(108, 33)

if GetEvent("FortressGarrisons") == 0 then

	if berlin.alliance.id == 0
	and germany.alliance.id == 0
	and berlin.unit == nil  then
	SpawnUnit(0, germany, 101, 22, 0, 100)
	germany:ConsumeManpower(10)
	end

	if austria.alliance.id == 2
	and budapest.alliance.id == 2 then
		local hexes = game.map:GetHexesInRange(budapest, 4)
		for _, hex in pairs(hexes) do
		if hex.unit ~= nil 
		and hex.unit.faction.alliance.id == 1
		and hex.unit.type == Unit.LAND then
		SpawnUnit(0, austria, 108, 33, 0, 100)
		austria:ConsumeManpower(10)
		end
	end
end
Robotron
Brigadier-General - Elite Grenadier
Brigadier-General - Elite Grenadier
Posts: 2151
Joined: Tue Nov 23, 2010 3:35 pm

Re: Why this script crashes?

Post by Robotron »

The script is not properly closed!

An "end" is missing at the end. :wink:

Use notepad++ to edit scripts, it will show you whether functions/loops/statements etc. are properly closed.
Image
Slitherine's Commander the Great War - Director's Cut: POTZBLITZ mod!
FIND IT HERE: http://www.slitherine.com/forum/viewtopic.php?f=218&t=77884&p=662610#p662610
Kossatx
Sergeant - 7.5 cm FK 16 nA
Sergeant - 7.5 cm FK 16 nA
Posts: 241
Joined: Wed Nov 27, 2013 3:27 pm

Re: Why this script crashes?

Post by Kossatx »

Thanks Robotron! :mrgreen:
Post Reply

Return to “Commander the Great War : Mods & Scenario Design”