Looking to mod Gangland

Started by
1 comment, last by ed_toast 14 years, 10 months ago
So, I love the game Gangland, an RTS game, and from what I can figure out the scripts and stuff are done in Lua. But I can't really gain access to any of the data cause everything is an .lfm file. I have no idea how to open this up. Can any one help me out? I cannot find anything, especially since this game went rather under the radar and there wasn't much of a community. P.S.- I am a noob and I am sorry if this is the wrong place. [Edited by - ed_toast on June 17, 2009 6:48:50 PM]
Advertisement
I just went to google and entered: gangland lfm file
The first hit has a description of the file format and a link to a tool that can supposedly open them. That tool appears to be crippled though...free version reads but you need paid version to write. Looks like a pretty simple raw archive format -- if you know how to do binary file I/O I'd just write up a quick extractor.
well, i feel like a dope! xD thanks, though.

so, i have installed the full version of game extractor and attempted to view a few of the archives but some are empty of files?

there are 12 archives-

animation
characters - empty apparently
effect_textures
fonts
game_textures
locale - empty apparently
lua - empty apparently
maps
models
sound
text - empty apparently
user_interface

yet not all of them have something to view.

i figured lua would have what im looking for but i cant find a way to see whats inside...

any suggestions?
and thanks for all the help! :D

is there any way to figure out what the lua commands and stuff they use for the game are? when you make a map you are able to link it up with a lua script, but i just don't know what to do with that...

Here is one of the scripts that came with the editor-

-- NOBOSS SCRIPT START
mm.include("data/lua/include/lualib.lua")


--------------------------------------------------
-- Functions
--------------------------------------------------

-- Returns a random starting position which is not taken
function GetPositionIdx()
while true do
local idx = math.floor(fw.rand() * countStartPos)
if not tUsedPositions[idx] then
tUsedPositions[idx] = true
return idx
end
end
end

-- Find nearest safehouse and remove from the global list
function GetNearestAvaliableSafehouse(tx,ty)
local safehouse=nil
local safehouseindex=nil
local dist=999999999
for index, value in tSafehouses do
bx, by = building.buildingtoworld(value,5,5)
newdist=((bx-tx)*(bx-tx))+((by-ty)*(by-ty))
if newdist<dist then
dist=newdist
safehouse=value
safehouseindex=index
end
end
if safehouseindex~=nil then table.remove(tSafehouses, safehouseindex); end;
return safehouse
end


-- Find nearest residential and remove from the global list
function GetNearestAvaliableResidential(tx,ty)
local residential=nil
local residentialindex=nil
local dist=999999999
for index, value in tResidentials do
bx, by = building.buildingtoworld(value,5,5)
newdist=((bx-tx)*(bx-tx))+((by-ty)*(by-ty))
if newdist<dist then
dist=newdist
residential=value
residentialindex=index
end
end
if residentialindex~=nil then table.remove(tResidentials, residentialindex); end;
return residential
end

-- Setup a residential with henchmen guarding at the windows
function setupResidential(player, residential, numgoons, npcbosscontrolled)
buildingcmd.buildingbuy(residential, player)
start_x, start_y = building.buildingtoworld(residential,5,5)
soldier={}
for i=0,numgoons-1 do
soldier = world.activatecharacter("HENCHMAN")
family.addsoldier(player, soldier)
charactercmd.setposition(soldier, start_x, start_y)
charactercmd.fortify(player, soldier, residential)
charactercmd.setnpcbosscontrolled(soldier, npcbosscontrolled);
if npcbosscontrolled==false then
family.addmember(player, soldier)
end
end
return soldier;
end


-- Function used to hire soldiers
function hireSoldier(player, soldierstring, cx, cy , npcbosscontrolled, is_ai)
soldiers = tokenize(soldierstring);
local dir = {"SOUTH", "NORTH"}

soldier={}
i=0
l=0
k=0

-- Hire the soldiers specified in the string
for chartype, amount in soldiers do
for j=0,amount-1 do
soldier=world.activatecharacter(chartype)
family.addsoldier(player, soldier)

if npcbosscontrolled~=nil and npcbosscontrolled==true then
charactercmd.setnpcbosscontrolled(soldier, true);
else
if character.issuperunit(string.upper(chartype)) then
family.addsuperunitmember(player, soldier)
else
family.addmember(player, soldier)
end
end;
charactercmd.setposition(soldier, cx+k, cy+l)
charactercmd.setdirection(player, soldier, dir[math.mod(i,2)+1])

i=i+1; l=l+1;
if l>2 then k=k+1; l=0; end;

end
end

return soldier;

end

-- Setup the capo
function setup(player, x, y)
-- Creates and initializes the capo
capo = world.activatecharacter(family.getplayerinfo(player).type)
family.setcapo(player, capo)
charactercmd.setposition(capo, x, y)
charactercmd.setname(capo, family.getplayerinfo(player).name)

-- Setting the correct bossmode
family.setbossmode(player,"NOBOSS")

-- Set the correct starting weapon for the selected hero
chartype= character.gettype(capo)
if chartype=="SONNY" then
charactercmd.setweapon(capo, 19) --semihandgun2x
else
if chartype=="MARIO" or chartype=="MARIO1" or chartype=="MARIO2" then
charactercmd.setweapon(capo, 17) -- semihandgun
else
charactercmd.setweapon(capo, 3) -- handgun
end
end

return capo
end

--------------------------------------------------
-- Global variables
--------------------------------------------------

tPlayers = family.getfamilies() -- Get list of all players
tStartingPositions = map.getmappoints("StartingPosition") -- Get starting positions [x,y,z,r][x,y,z,r]...
-- Get a list of all residentials and safehouses in the map
countStartPos = table.getn(tStartingPositions) / 4 -- Count staring positions (4 values pr. position)
tUsedPositions = {} -- Create empty table (array)

-- Get a list of all safehouses and residentials on the map
tSafehouses = findBusinessesInRadius("SAFEHOUSE",0,0,999999999)
tResidentials = findBusinessesInRadius("RESIDENTIAL",0,0,999999999)

--------------------------------------------------
--Init
--------------------------------------------------

-- Init the empty array
for i=0, countStartPos, 1 do
tUsedPositions = false
end

-- Init checks
if table.getn(tPlayers) > countStartPos then
error("There's more players than starting positions in the selected map! Define more starting positions.", 1);
end

if table.getn(tSafehouses)>0 and table.getn(tSafehouses)<table.getn(tPlayers) then
mm.cprint("Only safehoses enought for some players");
end

if table.getn(tResidentials)<table.getn(tSafehouses) then
mm.cprint("Only some players has both an residential and safehouses");
end


--------------------------------------------------
-- Main player init loop
--------------------------------------------------

for id, player in tPlayers do
local idx = GetPositionIdx() * 4 -- Get random unique starting position offset ;)
local tx = tStartingPositions[idx] -- x map coord
local ty = tStartingPositions[idx+2] -- z map coord
local x, y = map.getnearestaccessible(tx,ty)
local tPlayerinfo = family.getplayerinfo(player)


-- Get the nearest safehouse, and remove that from the global list
local safehouse = GetNearestAvaliableSafehouse(tx,ty)
local residential = GetNearestAvaliableResidential(tx,ty)

-- Set the correct starting points
if safehouse~=nil then
buildingcmd.buildingbuy(safehouse, player)
soldierstart_x, soldierstart_y = building.buildingtoworld(safehouse,5,10)
playerstart_x, playerstart_y = building.buildingtoworld(safehouse,5,5) -- outside safehouse
else
soldierstart_x, soldierstart_y = x,y
playerstart_x, playerstart_y = x,y -- Starting points
end

-- setup capo
capo = setup(player, playerstart_x, playerstart_y)

if tPlayerinfo.ai == true then -- SETUP FOR AI PLAYERS ------------------------------

-- Set the amount of units the capo can handle from the start
world.setherocontrollableunits(player, 3)

if residential~=nil then
-- Buy and put henchmen in the nearest residential
setupResidential(player, residential, 1, false)
end

-- Hire some starting goons
hireSoldier(player, "GUNMAN: 1, BOUNCER: 1", soldierstart_x, soldierstart_y , false, true)

-- Give the AI a wife for a start
local spouse=world.activatecharacter("SPOUSE")
family.setspouse(player,spouse)
charactercmd.setposition(spouse, soldierstart_x,soldierstart_y)

-- Adds starting resources for AI
family.addmoney(player,15000,true)

family.addammo(player,0,150) -- normal bullets
family.addammo(player,1,25)
family.addammo(player,2,0)

family.addammo(player,3, 30) -- medic
family.addammo(player,4, 5) -- explosives
family.addammo(player,5, 40) -- poison


else -- SETUP FOR HUMAN PLAYERS --------------------------------------------------


-- Set the amount of units the capo can handle from the start
world.setherocontrollableunits(player, 3)

if safehouse~=nil then
-- Place the capo in the chair
charactercmd.inoffice(player, capo, safehouse)
end
if residential~=nil then
-- Buy and put henchmen in the nearest residential
setupResidential(player, residential, 1, false)
end


-- Hire som starting goons
local soldier = hireSoldier(player, "GUNMAN: 1, BOUNCER: 1", soldierstart_x, soldierstart_y , false, false)
-- Place them more naturaly
for index, value in soldier do
charactercmd.positionclick(player, value, soldierstart_x, soldierstart_y, true)
end


-- Adds starting resources for human players
family.addmoney(player,15000,true)

family.addammo(player,0,150) -- normal bullets
family.addammo(player,1,25)
family.addammo(player,2,0)

family.addammo(player,3, 30) -- medic
family.addammo(player,4, 5) -- explosives
family.addammo(player,5, 40) -- poison

end

end

This topic is closed to new replies.

Advertisement