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: prospero, Ade

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

Post by IrateGiant »

Many thanks Tomash & pro, but I´m having problems with "Player 1 Duplicate" using this methods. I write another method that I implement into my "pj.py" but I need fix the player asignation: (I don´t know how to do this) [xx(]

Code: Select all

PlayerKind = "Dwarf_N"


char=Bladex.CreateEntity("Player1", PlayerKind ,0, -1118, 0,"Person")
char.Angle=1.5
char.Level=1
AniSound.AsignarSonidosEnano('Player1')
char.Data=Basic_Funcs.PlayerPerson(char)
char.Data.ResetSounds("Player1")
char.SetOnFloor()


def selectpalan():
      if char.Kind=="Palan":
		Abredoor1
                GotoMapVars.EndOfLevel()
                Bladex.LoadLevel("Barb_M1")
                #char=Bladex.CreateEntity("Player1","Knight_N,-83243,8785,-127941,"Person")

      elif char.Kind=="Palan2":
		Abredoor2
                GotoMapVars.EndOfLevel()
                Bladex.LoadLevel("Barb_M1")
                #char=Bladex.CreateEntity("Player1","Amazon_N,-83243,8785,-127941,"Person")


char.SendTriggerSectorMsgs=1
Honestly, I don´t have many knowledge coding, it´s possible this code don´t be correct. I write this code without any errors but I don´t know how to do the player change. [:I] Any suggestion?

When I fix this little error, I try to implement all your tips to new maps guys. [:)] Thanks!

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

Post by Sir Random »

Hi IG,

I'm not sure where you put that code, but if you are moving directly from Map1 to Map2, then the 'pj.py' of Map2 is NOT executed (because the Player already exists).

GoToMapVars stores all the vars needed for the new map (Player Kind, Level, Inventory, Health, etc). There is no need to re-create the Player.

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

Post by prospero »

As SR says.....[:D]

If the next map doesn't use the same Player, then you omit the GoToMapVars bit and simply Bladex.LoadLevel("NextmapName").

One thing. You may have noticed while playing the main game and then loading a custom map <i>without exiting the game completely</i>, that you get the Player from the main game in the custom map and not the one you were expecting. Complete with level/inventory.[:p]

There is some code that needs to go in cfg.py that clears the Player info.

Code: Select all

import MemPersistence
try:
	Bladex.DeleteStringValue("MainChar")
	
	props=MemPersistence.Get("MainChar")
	if props:
      		props[2]["Objects"]      = []
      		props[2]["Weapons"]      = []
      		props[2]["Shields"]      = []
      		props[2]["Quivers"]      = []
      		props[2]["Keys"]         = []
      		props[2]["SpecialKeys"]  = []
      		props[2]["Tablets"]      = []
      		props[2]["InvLeft"]      = None
      		props[2]["InvLeft2"]     = None
      		props[2]["InvRight"]     = None
      		props[2]["InvRightBack"] = None
      		props[2]["InvLeftBack"]  = None
      		print"Old info scrubbed out"
      
except:
	print"Don't like this code"
If you want to do a sort of tag-team sequence, where you change Players but keep the same level/inventory then I think you would need to make a custom version of GoToMapvars.

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

Post by IrateGiant »

I tried to delete the "pj.py" files of my test maps (placed in the same mod folder), but I think I need to edit my own "GotoMapVars.py" for the mod.

I'm trying to create a method to select different characters on the same map, pressing the lever of a character or another one.

Image

For example, I select "Ork lever" and Load ("TestMap") playing with "Ork", or select "Golem lever" and play with "Golem".

First I try to implement this method. Then I would try a menu to choose different maps after selecting a character [:)].

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

Post by Sir Random »

You don't have to delete any pj.py files, Blade will only use the pj.py if there is no "Player" defined.

In your testmap, the "Player" is already defined as a Dwarf, so the Dwarf will go to any map you choose.
To get around this, try removing the "Player" before loading the new map:

char=Bladex.GetEntity("Player1")
char.Freeze()
char.RemoveFromWorld()
Bladex.LoadLevel("NEXTMAP")


That might work....


EDIT\
You will need to store the player.Kind in a text file that can be read by your new map's pj.py, so it knows what Kind of character to create.

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

Post by IrateGiant »

Ok, I tried to use the method to remove the player after loading the new map. I placed the code in the "pj.py" of the new map, but the original player of my map is not loaded. Maybe I not put the code in correct file. It´s placed in cfg.py

I edit the pj.py of new map writing only the "playerposition=" and "playerangle=" because if I put "char=Bladex.CreateEntity" appear the message "player1 duplicated". But if I not put this last code, the new map it´s loaded without a player character. [xx(]

How can I make a reference of the before map into the new map? [:(]

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

Post by Sir Random »

<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>

Ok, I tried to use the method to remove the player after loading the new map.<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
You must remove the player BEFORE loading the new map. You should put the code in the function that sends you to the new map (activated by the lever)

Wherever you have:

<font color="green">Bladex.LoadLevel("NEXTMAP")</font id="green">

Add these lines before it:

char=Bladex.GetEntity("Player1")
char.Freeze()
char.RemoveFromWorld()
<font color="green">Bladex.LoadLevel("NEXTMAP")</font id="green">

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

Post by IrateGiant »

Thanks SR! It works! [;)]

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

Post by prospero »

IG.

You could use a .cfg file like the method used in the menu file:

call this function after you select the next Player and close the map:

Code: Select all

PlayerType = "Dwarf_N" # set his var using your next Player selection method 

def SaveConfiguration():
	cfgfile = open("../../Config/ThinkOfAName.cfg", "w")
	cfgfile.write('PlayerType = "' + str(PlayerType) + '"\n')
	cfgfile.close()

Then in the follow-on map pj.py:

Code: Select all

PlayerType="Knight_N"


try:
	execfile("../../Config/ThinkOfAName.cfg")
except:
	pass


char = Bladex.CreateEntity("Player1",PlayerType,....etc

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

Post by IrateGiant »

It don´t work guys, I placed the code correctly but continues giving character duplication.

I'm trying to implement code like this from "Wizard Domain":

Code: Select all

<font color="green">
LeverName=""

try:
	execfile("../../Config/BM.cfg")
except:
	pass


char=Bladex.CreateEntity("Player1","Dwarf_N",-3841, -1069, -11508, "Person")
standin.Angle=0.0

	
if Lever.Kind=="Palan":
	char.Bladex.CreateEntity("Player1","Ork",-3841, -1069, -11508, "Person")
        standin.Angle=0.0
elif Lever.Kind=="Palan2":
	char.Bladex.CreateEntity("Player1","Vamp",-3841, -1069, -11508, "Person")
        standin.Angle=0.0
</font id="green">
I know many code is incorrect but really I don´t have idea how to adapt them. I´m trying to extract code from other maps and mods.

I want to load differents characters in many maps. Explanation:

Push Lever1 --> Load NewMap1 playing with Ork.
Push Lever2 --> Load NewMap2 playing with Ork.

Push Lever3 --> Load NewMap3 playing with Vamp.
Push Lever4 --> Load NewMap4 playing with Vamp.

etc...

Any idea guys? [:(]

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

Post by prospero »

IG.

Why are you trying to create two Player1s?

Forget the levers. You only need them to set the player type in the next map. Make each lever call the relevant function below:

Code: Select all

PlayerType="Ork"

def SaveConfiguration():
    cfgfile = open("../../Config/ThinkOfAName.cfg", "w")
    cfgfile.write('PlayerType = "' + str(PlayerType) + '"\n')
    cfgfile.close()


def Lever1():
   PlayerType="Ork"
   SaveConfiguration()
   Bladex.LoadLevel("NewMap1")

def Lever2():
   PlayerType="Ork"
   SaveConfiguration()
   Bladex.LoadLevel("NewMap2")

def Lever3():
   PlayerType="Vamp"
   SaveConfiguration()
   Bladex.LoadLevel("NewMap3")

def Lever4():
   PlayerType="Vamp"
   SaveConfiguration()
   Bladex.LoadLevel("NewMap4")

Then in the pj.py files in the 4 next maps:

Code: Select all

PlayerType="Knight_N"


try:
	execfile("../../Config/ThinkOfAName.cfg")
except:
	pass


char = Bladex.CreateEntity("Player1",PlayerType,....etc

The var PlayerType is declared as Knight_N as a failsafe. When the .cfg file is exec'd it will be updated to the race you picked by operating the lever in the previous map.

There are a few refinements you can put in such as delaying the LoadLevel command to do a slow fade out. Also you could save the Players current Life/Level and even invetory items in the cfg file and reinstate them in the next map.

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

Post by IrateGiant »

OK guys, the mod is ready, but the failure still persists in the character transition.

Pro, I don´t try to create two Player1s. This the method that I try to implement:

"Init the Mod --> You play as Dwarf(Player1) --> Dwarf select a lever --> Player1(Dwarf) is erased --> (NewMap) is loaded and you play as Ork."

I see this problem are solved with the main game maps (Barb_M1, Tomb_M7, Volcano_M14, etc), also work this method with "Arena7" map, but I don´t know why. Maybe here the solution? [?]

I need to do a custom GotoMapVars.py, i´ll test how to do this.

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

Post by Sir Random »

Hi IG,

What happens when the NewMap is loaded? Does it have a pj.py to create Player1 as an Ork??

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

Post by IrateGiant »

Hi SR!

I don´t have added right now any "change-player" method in my mod. I have as "TESTMAP" the original "StartMap" made by pro.
<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">What happens when the NewMap is loaded?<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
When "StarMap" is loaded (from MainModLevel), game show the message "Player 1 duplicated". My problem is that the original character aren´t erase. The only way to play with this method is erasing the "pj.py" from "StartMap".

I tried with this method but not work.

<font color="green">char=Bladex.GetEntity("Player1")
char.Freeze()
char.RemoveFromWorld()
Bladex.LoadLevel("NEXTMAP")</font id="green">
<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">Does it have a pj.py to create Player1 as an Ork??<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
The mod contain the followings files: InitNewChars.py, Installnewstuff.py, Cfg.py, ActorsInit.py, BLModInit.py, objs.py, DefFuncs.py, Palanca.py, pj.py & BeastModeMenu.py

Maybe I placed wrong the funtion to correct transition.[?]

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

Post by Sir Random »

<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 mod contain the followings files: InitNewChars.py, Installnewstuff.py, Cfg.py, ActorsInit.py, BLModInit.py, objs.py, DefFuncs.py, Palanca.py, pj.py & BeastModeMenu.py

Maybe I placed wrong the funtion to correct transition.[?]
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
What's in the Cfg.py of StartMap?

Post Reply