Gladiator Mod with Allies mod

Talk about Severance Blade of Darkness modifications and maps here. No tips or tech support questions please, use the forum above. Note that the game is rated 18 so some content may be unsuitable for younger readers.

Moderators: Ade, prospero

Alric
Hatchling
Posts: 7
Joined: Thu Jul 17, 2014 7:36 pm

Gladiator Mod with Allies mod

Postby Alric » Thu Jul 17, 2014 7:42 pm

Hey folks, I was recently experimenting with the Gladiator mod to see if I could alter the Knight, Dwarf, Amazon, and Barbarian NPCs to be allies of the player in the match (done in conjunction with the Allies mod, of course). I edited the files in the mod and changed the four character's entries to allow for AllyNPCs as show in an earlier thread on this forum but so far they regard the player as hostile. I'll bring up the code here as soon as I can if there are further questions and if this problem isn't an easy fix.

Also...anyone figured out how to prevent the game from seizing up at the end of the temple level if the player has more than four weapons in his/her inventory?

User avatar
prospero
Ancient Dragon
Posts: 1728
Joined: Wed Nov 21, 2001 1:42 am
Location: United Kingdom

Re: Gladiator Mod with Allies mod

Postby prospero » Fri Jul 18, 2014 8:07 pm

I've done a lot of tweaking with the Allies code. Masklin's original works fine, but there are a few logic things that I have played around with. The mod itself is a module that contains a data class and few auxilary functions. Nothing to stop you copying, renaming it and editing a few things. You just have to make sure all the allies in the map use the data from the modded file.

import MyAllies

ally.Data= MyAllies.MyAllyClassName(ally)

The combat AI is quite complex and is driven by a lot of interacting functions. So it takes a lot of head-scratching to unravel. The basic behaviour is hard-code in the game engine so you have to work around
I have sometimes used a list within the class to designate just what races are hostile and can be attacked on sight. You have to hook this into the functions in the class. One thing I have noticed is that any NPC will not do anything unless the Player is in his sight. An Ally and an Enemy will stand next to each other quite happily until one or both catch sight of the Player and then they start knocking the crap out of each other, but the enemy will naturally go for the Player before the Ally even though the Ally may be nearer. This is another thing that can be fixed in the AI logic. And if you build in a periodical call to the StdSeeTheEnemy function you can get allies to attack enemies eve when the Player is somewhere else. Of course you really should mod the enemy code as well or they will not attack allies unless they are hit first. One cool thing I did was to give an NPC a special attack which means that if they are locked in combat and an enemy comes up behind them they will execute a back attack and switch opponents. Gives a more realistic feel to a skirmish. And also hook into an NPC's StdEnemyDead function to scan the nearby area for the nearest valid new target and turn them to attack.

It's very complicated when you get into it. Can be good fun though. 8)


btw. There is a function in the Temple map that changes the number of allowed weapons in the inventory to 5. What you need to do is make it so it checks the number of weapons allowed (if you have increased it), and assigns this number+1.

Alric
Hatchling
Posts: 7
Joined: Thu Jul 17, 2014 7:36 pm

Re: Gladiator Mod with Allies mod

Postby Alric » Mon Jul 21, 2014 10:54 pm

Thank you for the help!

BTW, do I have to create a new file called "MyAllies.py" for the mod? The Allies mod just came with AllyCombat, Ally_Def, BLModInfo, CreateSampleAllies, and SampleTypes. And what file do I place those lines of code in?

User avatar
prospero
Ancient Dragon
Posts: 1728
Joined: Wed Nov 21, 2001 1:42 am
Location: United Kingdom

Re: Gladiator Mod with Allies mod

Postby prospero » Thu Jul 24, 2014 2:56 am

You don't need to install this mod as such. Not if you want to use it it one map or mod only. The Allies mod has extra files for the BODLoader installation routine and the files are copied to folders that are within the scope of any map just by importing them. To use a new data class you just create a file and import it. Doesn't really matter where it is as long as it is in a directory within the scope of the interpreter.

AllyCombat.py is the same as Combat.py except for the name. I think Masklin did it this way so future customisation was possible. Combat.py contains all the combat charts for all characters - to define attack behaviour and probabilities. You can just as easily put these charts in the same file as the Data class. You just have to point to them from the ResetCombat function in the class. There are a few auxiliary functions, but just copy these across if you need them.

As I say, this stuff is enormously complicated with lots of interlinked methods. I don't understand how a lot is meant to work, as the developers were never really active in the BOD community. Not at all after RAS broke up. I've found out quite a lot of things by doodling around with the code. Sometimes it works how I want it to, but frankly I have no idea whether I'm doing it 'right'.

Therefore a lot of modding is guesswork. Sort of "try this and see what happens". :P

Alric
Hatchling
Posts: 7
Joined: Thu Jul 17, 2014 7:36 pm

Re: Gladiator Mod with Allies mod

Postby Alric » Sun Jul 27, 2014 10:08 pm

Thanks for the info, here's the gladtypes.py script that I edited...I altered a few more to change the PC gladiators to "Ally" but thus far I've had no success. Any glaring errors here?
################################################################################
# Defines custom type for gladiator
# by Josh Dahlby
################################################################################
import Bladex
import Ally_Def
import AniSound
import BCopy
import Reference
import GladCombat
import whrandom



# Boolean value
TRUE = 1==1
FALSE = not TRUE

################################################################################
# Base custom class
################################################################################

class BaseGladiatorType (Enm_Def.NPCPerson):
def __init__(self, me):
Enm_Def.NPCPerson.__init__(self, me)

# Set up sound priorities
self.SoundPriorities[Reference.SND_ARROW] = 10.0
self.SoundPriorities[Reference.SND_HIT] = 50.0
self.SoundPriorities[Reference.SND_NPC] = 25.0
self.SoundPriorities[Reference.SND_NOISYPC] = 30.0
self.SoundPriorities[Reference.SND_PC] = 80.0

self.Kind = me.Kind

def ResetSounds(self, EntityName):
# override this function to assign sounds
pass

# Functions for loading and saving state
def __getstate__(self):
NPCPerson_state=Ally_Def.NPCPerson.__getstate__(self)
if(NPCPerson_state[0]!=1):
Reference.debugprint("ERROR: BaseGladiatorType.__getstate__(): Base class version differs.")
return NPCPerson_state
NPCPerson_state[1][self.Kind]=()
return NPCPerson_state

def __setstate__(self,parm):
# Toma como parámetro lo que devuelve __getstate__() y debe recrear la clase
Ally_Def.NPCPerson.__setstate__(self,parm)
version=parm[0]
if version==1:
parms=parm[1][self.Kind]
#self.SoundPriorities=parms[0]

def ResetCombat (self,EntityName):
Ally_Def.NPCPerson.ResetCombat(self, EntityName)
me = Bladex.GetEntity(EntityName)
if me and me.Life>0:
self.SetCombatInfo(me)

def SetCombatInfo(self, me):
pass

def CheckAttackList(self, me, levelData, weaponData):
# Add level related combos
for i in range(me.Level + 1):
if levelData.has_key(i):
data = levelData
for info in data:
me.AttackList.append(info)

weapon = Bladex.GetEntity(me.InvRight)
if weapon != None:
if weaponData.has_key(weapon.Kind):
me.AttackList.append(weaponData[weapon.Kind])

################################################################################
# Define the Gladiator Knight class
################################################################################
class AllyKnight_N (Ally_Def.NPCAlly):
def __init__(self, me):
Ally_Def.NPCAlly.__init__(self, me)
names = ("Knight_N", "KgtSkin1", "KgtSkin2")
idx = whrandom.randint(0, len(names)-1)
me.MeshName = names[idx]

def ResetSounds(self, EntityName):
AniSound.AsignarSonidosCaballero(EntityName)

def SetCombatInfo(self, me):
self.AttacksOwnKind=TRUE
self.AttackNPCTime = 2.0
me.AttackList = BCopy.deepcopy(GladCombat.AllyKnightAttackData)
self.CheckAttackList(me, GladCombat.AllyKnightLevelCombos, GladCombat.AllyKnightCombos)
self.ChanceOfFuryOnHurt = 0.0
self.ChanceOfFuryOnLeaderDeath = 0.0
inv= me.GetInventory()
if inv.HoldingShield:
me.BlockingPropensity = 1.0
me.RangeDefenceCapable = TRUE
else:
me.BlockingPropensity = 0.2
me.RangeDefenceCapable = FALSE

################################################################################

################################################################################
# Define the Gladiator Barbarian class
################################################################################
class AllyBarbarian_N (Ally_Def.NPCAlly):
def __init__(self, me):
Ally_Def.NPCAlly.__init__(self, me)
names = ("Barbarian_N", "BarSkin1", "BarSkin2")
idx = whrandom.randint(0, len(names)-1)
me.MeshName = names[idx]

def ResetSounds(self, EntityName):
AniSound.AsignarSonidosBarbaro(EntityName)

def SetCombatInfo(self, me):
self.AttacksOwnKind=TRUE
self.AttackNPCTime = 1.5
me.AttackList = BCopy.deepcopy(GladCombat.AllyBarbarianAttackData)
weapon = Bladex.GetEntity(me.InvRight)
if weapon != None:
levelCombos = None
if weapon.Kind == "QueenSword":
levelCombos = GladCombat.AllyBarbarianLevelCombos1H
elif weapon.Kind in ("Eclipse", "Guadanya", "Hacha2hojas", "IceAxe", "RhinoClub", "Hacharrajada"):
levelCombos = GladCombat.AllyBarbarianLevelCombosAxe
else:
levelCombos = GladCombat.AllyBarbarianLevelCombos2H
self.CheckAttackList(me, levelCombos, GladCombat.AllyBarbarianCombos)
# Special case for a weapon with 2 combos
if weapon.Kind == "FireBigSword" and me.Level >= 17:
me.AttackList.append(GladCombat.AllyBarbarianCombos["FireBigSword_18"])
self.ChanceOfFuryOnHurt = 0.0
self.ChanceOfFuryOnLeaderDeath = 0.0
inv= me.GetInventory()
if inv.HoldingShield:
me.BlockingPropensity = 0.7
me.RangeDefenceCapable = TRUE
else:
me.BlockingPropensity = 0.4
me.RangeDefenceCapable = FALSE

################################################################################


################################################################################
# Define the Gladiator Dwarf class
################################################################################
class AllyDwarf_N (Ally_Def.NPCAlly):
def __init__(self, me):
Ally_Def.NPCAlly.__init__(self, me)
names = ("Dwarf_N", "DwfSkin1", "DwfSkin2")
idx = whrandom.randint(0, len(names)-1)
me.MeshName = names[idx]

def ResetSounds(self, EntityName):
AniSound.AsignarSonidosEnano(EntityName)

def SetCombatInfo(self, me):
self.AttacksOwnKind=TRUE
self.AttackNPCTime = 2.0
me.AttackList = BCopy.deepcopy(GladCombat.AllyDwarfAttackData)
self.CheckAttackList(me, GladCombat.AllyDwarfLevelCombos, GladCombat.AllyDwarfCombos)
self.ChanceOfFuryOnHurt = 0.15
self.ChanceOfFuryOnLeaderDeath = 0.1
inv= me.GetInventory()
if inv.HoldingShield:
me.BlockingPropensity = 1.0
me.RangeDefenceCapable = TRUE
else:
me.BlockingPropensity = 0.2
me.RangeDefenceCapable = FALSE

################################################################################

################################################################################
# Define the Gladiator Amazon class
################################################################################
class AllyAmazon_N (Ally_Def.NPCAlly):
def __init__(self, me):
Ally_Def.NPCAlly.__init__(self, me)
names = ("Amazon_N", "AmzSkin1", "AmzSkin2")
idx = whrandom.randint(0, len(names)-1)
me.MeshName = names[idx]

def ResetSounds(self, EntityName):
AniSound.AsignarSonidosAmazona(EntityName)

def SetCombatInfo(self, me):
self.AttacksOwnKind=TRUE
self.AttackNPCTime = 2.0
me.AttackList = BCopy.deepcopy(GladCombat.AllyAmazonAttackData)
weapon = Bladex.GetEntity(me.InvRight)
if weapon != None:
levelCombos = None
if weapon.Kind == "QueenSword":
levelCombos = GladCombat.AllyAmazonLevelCombos1H
else:
levelCombos = GladCombat.AllyAmazonLevelCombosSP
self.CheckAttackList(me, levelCombos, GladCombat.AllyAmazonCombos)
self.ChanceOfFuryOnHurt = 0.15
self.ChanceOfFuryOnLeaderDeath = 0.1
inv= me.GetInventory()
if inv.HoldingShield:
me.BlockingPropensity = 0.7
me.RangeDefenceCapable = TRUE
else:
me.BlockingPropensity = 0.4
me.RangeDefenceCapable = FALSE

################################################################################

################################################################################
# Parse the CharType automatically
################################################################################
classes_defined= dir()
def GladiatorDefaultFuncs (pers):
if pers.CharType in classes_defined:
exec_string = 'pers.Data=' + pers.CharType + '(pers)'
exec (exec_string)
Bladex.CheckPyErrors()
if not pers.Data:
raise NameError, 'CharType must not have valid associated class'
Bladex.CheckPyErrors()
else:
Reference.debugprint("WARNING: "+pers.CharType+" is an unrecognised class in GladiatorTypes.py!")
pers.Data= Ally_Def.NPCPerson (pers)
################################################################################

Alric
Hatchling
Posts: 7
Joined: Thu Jul 17, 2014 7:36 pm

Re: Gladiator Mod with Allies mod

Postby Alric » Sun Sep 07, 2014 3:03 pm

Anyone have any idea on what I'm doing wrong here?

Also, on a related note...can folks help on finding how to alter arrow/bow damage so that it'll scale with character level? And how do you get the medium and heavy bows to show up in game? I'm figuring I'll have to edit saved game inventory files or the level inventory files.

User avatar
prospero
Ancient Dragon
Posts: 1728
Joined: Wed Nov 21, 2001 1:42 am
Location: United Kingdom

Re: Gladiator Mod with Allies mod

Postby prospero » Sun Sep 07, 2014 10:02 pm

Hi Alric.

Can't really spot any errors with your code. I would have to test it in-game and haven't really got the spare time at the mo. :(

I can help with the bows/arrows though. There is a file - QuiverTypes.py that you can find in a few of my mods. If you assign the Quiver data to use this file rather than ItemTypes then you get -

Arrow damage set pro rata with the character level, plus x2 of that value for Medium Bow and x3 Heavy. Also disables shadows on fire arrows so you can shoot them all over with less performance loss.

Making the bows couldn't be easier. A light bow is "Arco". The Medium is "Arco3" and Heavy is "Arco2". (I think. :roll: ) You don't need any extra code, just the usual ItemTypes stuff which puts the string on.

* I've always suspected that what is labelled the heavy bow in the game should really be the medium. The medium bow looks more elaborate.

Alric
Hatchling
Posts: 7
Joined: Thu Jul 17, 2014 7:36 pm

Re: Gladiator Mod with Allies mod

Postby Alric » Sun Sep 07, 2014 10:19 pm

Thank you for the advice!

From what I can tell the code is good but it doesn't seem to work. I did get the bows to work right in game, but I'm curious to test out that code and also how to expand the player's arrow carrying capacity. Where can I find the strings to edit for arrow capacity, and where can I find your mods?

User avatar
prospero
Ancient Dragon
Posts: 1728
Joined: Wed Nov 21, 2001 1:42 am
Location: United Kingdom

Re: Gladiator Mod with Allies mod

Postby prospero » Sun Sep 07, 2014 10:34 pm

Open Lib/Reference.py and scroll down to lines 674-676

Code: Select all

DefaultObjectData['Carcaj']= [OBJ_QUIVER, 10, "Flecha"] DefaultObjectData['CarcajFuego']= [OBJ_QUIVER, 10, "FlechaFuego"] DefaultObjectData['CarcajEnvenenado']= [OBJ_QUIVER, 10, "FlechaEnvenenada"]
The 10 set the capacity. Change it to how many you want.


You can d/l some of my mods off my site. Click the link in my sig line. Go to Demos page. I think ProsperoArena3 has the quiver file. Lots else beside. :lol:

Alric
Hatchling
Posts: 7
Joined: Thu Jul 17, 2014 7:36 pm

Re: Gladiator Mod with Allies mod

Postby Alric » Mon Sep 08, 2014 2:37 am

I'm pretty certain I tried that but it didn't work, I'll give it another try though.


Return to “Severance BoD: Modding Community”

Who is online

Users browsing this forum: No registered users and 3 guests