Randomly placed enemies Mod in Singleplayer game

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

PigVomit
Dragon
Posts: 66
Joined: Wed Oct 21, 2009 1:45 pm
Location: Finland
Contact:

Randomly placed enemies Mod in Singleplayer game

Postby PigVomit » Sun Sep 25, 2016 3:10 pm

Hello,

We are working on "CreateRandomEnemy" mod. It creates enemies into random positions in singleplayer game. Orks, Knights, Lichs etc etc. depending on the map. Enemy frequency can be changed from Menu. Mod does not change/alter original map files in any way. When a level is started, our code browses through map coordinates and saves the ones which hit sectors. This is how we get valid positions for enemies. Then enemies are created and after this, collision detection removes enemies that are for example half inside the wall. I played Kashgar and Mines yesterday it worked very nicely. Still some work left of course:)
Vomit on the nearest asshole

User avatar
cieply
Dragon
Posts: 312
Joined: Wed Jun 26, 2013 3:43 pm

Re: Randomly placed enemies Mod in Singleplayer game

Postby cieply » Fri Sep 30, 2016 5:09 pm

sounds very interesting
by curiosity, how difficult it was to code that "map scanner"?
l'aria fresca,
vino puro, ...

PigVomit
Dragon
Posts: 66
Joined: Wed Oct 21, 2009 1:45 pm
Location: Finland
Contact:

Re: Randomly placed enemies Mod in Singleplayer game

Postby PigVomit » Tue Oct 04, 2016 1:28 pm

I think when creating new functions in Blade the hardest part is, in most cases, the starting point. You don´t know exactly what there is to work with and spend time searching for the info that may be useful in your code. Map scanner code is actually quite simple now when you look at it but of course it took some time to make it work since we had no idea from where to start. JJP made most of the code.
Vomit on the nearest asshole

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

Re: Randomly placed enemies Mod in Singleplayer game

Postby prospero » Tue Oct 04, 2016 4:21 pm

A little bit of handy code for recording the Player position.

Paste into DefFuncs.py file

Code: Select all

def GetPlayerPos(): char=Bladex.GetEntity("Player1") x=int(char.Position[0]) y=int(char.Position[1]) z=int(char.Position[2]) file = open("../../BODLoader/Mods/FugitiveIVpt1/pos.txt","a") file.write("("+str(x)+","+str(y)+","+str(z)+")"+"\n") file.close() Bladex.AddInputAction("GetPlayerPos", 0) Bladex.AddBoundFunc("GetPlayerPos", GetPlayerPos) Bladex.AssocKey("GetPlayerPos", "Keyboard", "V", 1)
Just edit to suit wherever you want the pos.txt file to be saved.

Walk to a spot and press the V key. Copy the recorded positions to wherever.

I have some more complicated code for random positioning which makes it so the enemy doesn't spawn
if the Player can see them and checks for chars that are too near to the spawn position.
Also another sneaky routine that spawns an enemy behind the Player pos if clear.


Return to “Severance BoD: Modding Community”

Who is online

Users browsing this forum: No registered users and 1 guest