Assign attacks

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

User avatar
IrateGiant
Dragon
Posts: 328
Joined: Fri Jan 08, 2010 12:35 pm
Location: Spain
Contact:

Postby IrateGiant » Tue May 22, 2012 2:50 am

That´s strange SR, the function don´t create the file "mapdata.txt".

Only appears on console:

Code: Select all

<font color="red">File "pj.py", line 32, in ? store_char = open("BeastModemapdata.txt",'r') IOError: (2, 'No such file or directory', 'BeastModemapdata.txt') B_App::RunScriptFile() -> Error ejecutando Cfg.py Start optimizing Astar...B_App::LoadWorld() -> Error trying to load PP. OK!</font id="red">[code] And this message in screen: <font color="red">Player not declared on pj.py</font id="red"> Some clarifications: I named my "Map1" folder as "BeastMode", and the test map "Map2" I use "StartMap". I put the code like this on the file "DefFuncs.py" from "BeastMode": <font color="green">[code]###################FUNCIONES PARA ELEGIR ENEMIGOS################### def ChooseEnemie(EntityName): charname = "Skeleton" if EntityName=="palan": charname = "Knight_Traitor" elif EntityName=="palan2": charname = "Skeleton" store_char = open("BeastModemapdata.txt", 'w') store_char.write(charname) if store_char: store_char.close()</font id="green">
The file "pj.py" of "StartMap" contain the following code:

<font color="green">

Code: Select all

all imports . . . PlayerName="Sargon" try: execfile("../../Config/BeastMode.cfg") except: pass store_char = open("BeastModemapdata.txt",'r') charname=store_char.read() if store_char: store_char.close() char=Bladex.CreateEntity("Player1",charname,0,0,0,"Person")</font id="green">
I remark this because I think I´m doing something wrong, sorry SR.

Sir Random
Dragon
Posts: 737
Joined: Thu Nov 15, 2001 12:58 am
Location: Ireland
Contact:

Postby Sir Random » Tue May 22, 2012 12:31 pm

<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by IrateGiant</i>

That´s strange SR, the function don´t create the file "mapdata.txt".<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
Ok, just create one with "Knight_Traitor" as the contents.

<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by IrateGiant</i>

The file "pj.py" of "StartMap" contain the following code:

<font color="green">

Code: Select all

all imports . . . PlayerName="Sargon" try: execfile("../../Config/BeastMode.cfg") except: pass store_char = open("BeastModemapdata.txt",'r') charname=store_char.read() if store_char: store_char.close() char=Bladex.CreateEntity("Player1",charname,0,0,0,"Person")</font id="green">
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
Did you add the rest of the player code, or is that all you have in pj.py? (I just assumed you would fill in the rest)


Have you setup the 'Knight_Traitor' and 'Skeleton' as Player characters?

What's in Config/BeastMode.cfg?


I'm confused as to what you are trying to do.
Do you want to start map 2 with the Player as a 'Knight_Traitor' or 'Skeleton', depending on what lever is used in map 1 ?

User avatar
IrateGiant
Dragon
Posts: 328
Joined: Fri Jan 08, 2010 12:35 pm
Location: Spain
Contact:

Postby IrateGiant » Tue May 22, 2012 4:26 pm

I test it creating the "mapdata.txt" but nothing.

Sorry by my bad explanation SR, I'm trying to create a mod where the player can use the original Blade enemies as playable characters, with their original attack animations, sounds, etc.

This is a preview image:

Image

The sequence that I want to play is:

Init <font color="green">"BeastMode"</font id="green"> on BODLoader --> Push the leaver of enemie that you want --> <font color="green">"StartMap"</font id="green"> is loaded and you play as the enemie that you select.

PS:This is the method that I seek:

If I push the leaver of a concrete enemie on the main map (Knight_Traitor, Skeleton, Lich or another enemy), the map 2 can be played with the enemie that I choose.

Example:

<font color="green">I select Lich from main map --> I play as Lich on "StartMap"

I select Skeleton from main map --> I play as Skeleton on "StartMap"</font id="green">

I want to play with any of the enemies that I choice on the same map <font color="green">("StartMap")</font id="green"> without having to replace the file "pj.py".

[:)]

Sir Random
Dragon
Posts: 737
Joined: Thu Nov 15, 2001 12:58 am
Location: Ireland
Contact:

Postby Sir Random » Tue May 22, 2012 6:20 pm

Ok, I've tested the code and it works fine for me.

Whatever you're doing in map 1 with the lever func, it looks like the correct info is not being stored in mapdata.txt

Create a 'mapdata.txt' file in your mod folder and put the word <font color="green">Skeleton</font id="green"> in it (no spaces or anything, just that one word).
Then add this in map 1:

Code: Select all

charname = "Knight_Traitor" store_char = open("mapdata.txt", 'w') store_char.write(charname) if store_char: store_char.close()
In map 2 add these lines BEFORE the character creation code:

Code: Select all

store_char = open("mapdata.txt",'r') charname=store_char.read() if store_char: store_char.close()
and change the first line of your Player code to this:
char=Bladex.CreateEntity("Player1",<font color="green">charname</font id="green">,0,0,0,"Person")

You should have more lines, like these to complete the Player creation:

char.Data=Basic_Funcs.PlayerPerson(char)
char.Data.ResetSounds("Player1")
char.Angle=1
char.Level=19
char.SetOnFloor()


Now, start map1, goto map2 and see if you start with a Skeleton or a Knight_Traitor (hopefully a Knight_Traitor)

User avatar
IrateGiant
Dragon
Posts: 328
Joined: Fri Jan 08, 2010 12:35 pm
Location: Spain
Contact:

Postby IrateGiant » Tue May 22, 2012 9:19 pm

Don´t work for me SR. [xx(]

I put the code as you said but the same error appears:

<font color="red">File "pj.py", line 32, in ?
store_char = open("BeastModemapdata.txt",'r')
IOError: (2, 'No such file or directory', 'BeastModemapdata.txt')
B_App::RunScriptFile() -> Error ejecutando Cfg.py
Start optimizing Astar...B_App::LoadWorld() -> Error trying to load PP.
OK!</font id="red">

If not is inconvenient, I send you the original files of the MOD and the MAP, if you can clarify the error. I think the error is in the file <font color="green">DefFuncs.py</font id="green">.

Thanks in advance and sorry if I bother you SR. [:(]

Sir Random
Dragon
Posts: 737
Joined: Thu Nov 15, 2001 12:58 am
Location: Ireland
Contact:

Postby Sir Random » Tue May 22, 2012 9:36 pm

Did you create a BeastModemapdata.txt file in the same folder as pj.py?
Did you uninstall/install the mod before testing?

I don't understand why it doesn't see this file...

Sir Random
Dragon
Posts: 737
Joined: Thu Nov 15, 2001 12:58 am
Location: Ireland
Contact:

Postby Sir Random » Tue May 22, 2012 9:46 pm

Ah, I think I see the problem. You have the maps in different folders?

So, you need to change this line in pj.py:

store_char = open("../<font color="green">MAP1_FOLDERNAME</font id="green">/mapdata.txt",'r')

Change <font color="green">MAP1_FOLDERNAME</font id="green"> to the name of the folder that Map1 is in.

User avatar
IrateGiant
Dragon
Posts: 328
Joined: Fri Jan 08, 2010 12:35 pm
Location: Spain
Contact:

Postby IrateGiant » Tue May 22, 2012 9:48 pm

Yes SR, in same folder, and yes too I do the process before testing. :S

Sir Random
Dragon
Posts: 737
Joined: Thu Nov 15, 2001 12:58 am
Location: Ireland
Contact:

Postby Sir Random » Tue May 22, 2012 10:03 pm

In Planca.py, you need to add a store_char to each Abredoor func:

Code: Select all

def Abredoor1(): store_char = open("mapdata.txt", 'w') store_char.write("Skeleton") store_char.close() GotoMapVars.EndOfLevel() Bladex.LoadLevel("StartMap") def Abredoor2(): store_char = open("mapdata.txt", 'w') store_char.write("Knight_Traitor") store_char.close() GotoMapVars.EndOfLevel() Bladex.LoadLevel("StartMap")
etc....

User avatar
IrateGiant
Dragon
Posts: 328
Joined: Fri Jan 08, 2010 12:35 pm
Location: Spain
Contact:

Postby IrateGiant » Tue May 22, 2012 11:09 pm

It works SR! [:)]

Many thanks! Now the MAP2 load well the playable enemie.

Only the last doubts:

When I take any lever (Lich lever, Skeleton lever, etc) the MAP2 ever load "Knight_Traitor".

I think I need edit this line of code in "DefFuncs.py":

Code: Select all

<font color="red">charname = "Knight_Traitor"</font id="red"> <font color="green">store_char = open("mapdata.txt", 'w') store_char.write(charname) if store_char: store_char.close()</font id="green">
And If I wantt to aadd weapons to the playable enemies, what I need to do?

Thanks!!

Sir Random
Dragon
Posts: 737
Joined: Thu Nov 15, 2001 12:58 am
Location: Ireland
Contact:

Postby Sir Random » Wed May 23, 2012 2:08 am

<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by IrateGiant</i>

It works SR! [:)]

Many thanks! Now the MAP2 load well the playable enemie.

Only the last doubts:

When I take any lever (Lich lever, Skeleton lever, etc) the MAP2 ever load "Knight_Traitor".

I think I need edit this line of code in "DefFuncs.py":

Code: Select all

<font color="red">charname = "Knight_Traitor"</font id="red"> <font color="green">store_char = open("mapdata.txt", 'w') store_char.write(charname) if store_char: store_char.close()</font id="green">
And If I wantt to aadd weapons to the playable enemies, what I need to do?

Thanks!!

<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
You don't need to put any code in DefFuncs, everything is done in Palanca.py (Map 1) and pj.py (Map 2)

The Abredoor() funcs in Palanca.py <i>should</i> be in DefFuncs, but if it's just a 'menu' map, then I doubt anyone will save their game there.

User avatar
IrateGiant
Dragon
Posts: 328
Joined: Fri Jan 08, 2010 12:35 pm
Location: Spain
Contact:

Postby IrateGiant » Wed May 23, 2012 4:50 am

Yes SR, the process only need "Palanca.py" (Map1) and "pj.py" (Map2) but testing the files, the following func is placed in "DefFuncs.py" and this code line in green is responsible for loading the type of playable enemy.

Code: Select all

<font color="green">charname = "Knight_Traitor"</font id="green"> store_char = open("mapdata.txt", 'w') store_char.write(charname) if store_char: store_char.close()
To play with another playable enemy I need to edit the func and change "Knight_Traitor" by another one (Skeleton, Lich, Ork, etc).

And I also need to edit the file "pj.py" from (Map2) to change the inventory for each enemy.

Sir Random
Dragon
Posts: 737
Joined: Thu Nov 15, 2001 12:58 am
Location: Ireland
Contact:

Postby Sir Random » Wed May 23, 2012 10:59 am

<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by IrateGiant</i>

Yes SR, the process only need "Palanca.py" (Map1) and "pj.py" (Map2) but testing the files, the following func is placed in "DefFuncs.py" and this code line in green is responsible for loading the type of playable enemy.

Code: Select all

<font color="green">charname = "Knight_Traitor"</font id="green"> store_char = open("mapdata.txt", 'w') store_char.write(charname) if store_char: store_char.close()
To play with another playable enemy I need to edit the func and change "Knight_Traitor" by another one (Skeleton, Lich, Ork, etc).

And I also need to edit the file "pj.py" from (Map2) to change the inventory for each enemy.
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
I don't understand what you mean about the test func, you should have deleted that func when you added the code to the Abredoor funcs:

Code: Select all

def Abredoor1(): store_char = open("mapdata.txt", 'w') <font color="green">store_char.write("Skeleton")</font id="green"> store_char.close() GotoMapVars.EndOfLevel() Bladex.LoadLevel("StartMap") def Abredoor2(): store_char = open("mapdata.txt", 'w') <font color="green">store_char.write("Knight_Traitor")</font id="green"> store_char.close() GotoMapVars.EndOfLevel() Bladex.LoadLevel("StartMap")

User avatar
IrateGiant
Dragon
Posts: 328
Joined: Fri Jan 08, 2010 12:35 pm
Location: Spain
Contact:

Postby IrateGiant » Wed May 23, 2012 2:28 pm

Yes SR, the code in the function Abredoor should allow change of playable enemies, (I don´t know why not [xx(]) but I can´t delete the following function located in "Palanca.py":

Code: Select all

charname = <font color="green">"Knight_Traitor"</font id="green"> store_char = open("mapdata.txt", 'w') store_char.write(charname) if store_char: store_char.close()
because then, the console displays the error:

Code: Select all

File "pj.py", line 24, in ? store_char = open("../BeastMode/mapdata.txt",'r') IOError: (2, 'No such file or directory', '../BeastMode/mapdata.txt')
However, If I change the enemy by another one (For example: <font color="green">"Lich"</font id="green"> in that code line, the game load correctly the <font color="green">"Lich"</font id="green">.
But if I don´t change the code line, the game ever load the same playable enemy <font color="green">"Knight_Traitor"</font id="green"> [xx(]

Could be a conflict between codes of different files? [B)]

Sir Random
Dragon
Posts: 737
Joined: Thu Nov 15, 2001 12:58 am
Location: Ireland
Contact:

Postby Sir Random » Wed May 23, 2012 7:55 pm

<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by IrateGiant</i>

..the console displays the error:

Code: Select all

File "pj.py", line 24, in ? store_char = open("../BeastMode/mapdata.txt",'r') IOError: (2, 'No such file or directory', '../BeastMode/mapdata.txt')
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
Did you put the 'mapdata.txt' file in the BeastMode folder?


Return to “Severance BoD: Modding Community”

Who is online

Users browsing this forum: No registered users and 1 guest