Assign attacks
- IrateGiant
- Dragon
- Posts: 328
- Joined: Fri Jan 08, 2010 12:35 pm
- Location: Spain
- Contact:
-
- Dragon
- Posts: 737
- Joined: Thu Nov 15, 2001 12:58 am
- Location: Ireland
- Contact:
- IrateGiant
- Dragon
- Posts: 328
- Joined: Fri Jan 08, 2010 12:35 pm
- Location: Spain
- Contact:
-
- Dragon
- Posts: 737
- Joined: Thu Nov 15, 2001 12:58 am
- Location: Ireland
- Contact:
- IrateGiant
- Dragon
- Posts: 328
- Joined: Fri Jan 08, 2010 12:35 pm
- Location: Spain
- Contact:
-
- Dragon
- Posts: 737
- Joined: Thu Nov 15, 2001 12:58 am
- Location: Ireland
- Contact:
Use this email:
daniel@brayforum.com
daniel@brayforum.com
- IrateGiant
- Dragon
- Posts: 328
- Joined: Fri Jan 08, 2010 12:35 pm
- Location: Spain
- Contact:
-
- Dragon
- Posts: 737
- Joined: Thu Nov 15, 2001 12:58 am
- Location: Ireland
- Contact:
Ok,
I found these functions in Palanca.py (they should really be in DefFuncs.py, for savegame stability)
They should look like this:
You don't need 'GotoMapVars.EndOfLevel()' if you'restarting a fresh map with new player.
I found these functions in Palanca.py (they should really be in DefFuncs.py, for savegame stability)
Code: Select all
def Abredoor1():
GotoMapVars.EndOfLevel()
Bladex.LoadLevel("StartMap")
def Abredoor2():
GotoMapVars.EndOfLevel()
Bladex.LoadLevel("StartMap")
def Abredoor3():
GotoMapVars.EndOfLevel()
Bladex.LoadLevel("StartMap")
def Abredoor4():
GotoMapVars.EndOfLevel()
Bladex.LoadLevel("Barb_M1")
def Abredoor5():
GotoMapVars.EndOfLevel()
Bladex.LoadLevel("Ragnar_M2")
Code: Select all
def Abredoor1():
char=Bladex.GetEntity("Player1")
char.Freeze()
char.RemoveFromWorld()
Bladex.LoadLevel("StartMap")
- IrateGiant
- Dragon
- Posts: 328
- Joined: Fri Jan 08, 2010 12:35 pm
- Location: Spain
- Contact:
- IrateGiant
- Dragon
- Posts: 328
- Joined: Fri Jan 08, 2010 12:35 pm
- Location: Spain
- Contact:
Hi again guys! [:)]
I've been busy in last months but I returned in last days to modding and bring a little doubt.
I´m trying to create a sequence with levers but I don´t have idea.
This is the problem:
From the main map of my mod, I active a lever <font color="green">(palan)</font id="green">, this lever send me to the second map but not finish to load the map because the file "pj.py" of second map have a error in code:
<font color="green">if entityname == "palan":
char=Bladex.CreateEntity("Player1","Knight_N", 0, -1118, 0, "Person")
char.Level=2
char.Angle=4.5
char.Data=Basic_Funcs.PlayerPerson(char)
char.Data.ResetSounds("Player1")
char.SetOnFloor()</font id="green">
The error is <font color="green">if entityname == "palan":</font id="green">
What code I need to fix this error? Thanks!
I've been busy in last months but I returned in last days to modding and bring a little doubt.
I´m trying to create a sequence with levers but I don´t have idea.
This is the problem:
From the main map of my mod, I active a lever <font color="green">(palan)</font id="green">, this lever send me to the second map but not finish to load the map because the file "pj.py" of second map have a error in code:
<font color="green">if entityname == "palan":
char=Bladex.CreateEntity("Player1","Knight_N", 0, -1118, 0, "Person")
char.Level=2
char.Angle=4.5
char.Data=Basic_Funcs.PlayerPerson(char)
char.Data.ResetSounds("Player1")
char.SetOnFloor()</font id="green">
The error is <font color="green">if entityname == "palan":</font id="green">
What code I need to fix this error? Thanks!
-
- Dragon
- Posts: 737
- Joined: Thu Nov 15, 2001 12:58 am
- Location: Ireland
- Contact:
What have you assigned to the varianle 'entityname' ?
When you load a new map, all vars from the old map are lost. To pass a variable from one map to another, the easiest way is probably for the first map to create a text file and store the value of 'entityname' in it, and then the second map should open this file and read 'entityname' from it.
When you load a new map, all vars from the old map are lost. To pass a variable from one map to another, the easiest way is probably for the first map to create a text file and store the value of 'entityname' in it, and then the second map should open this file and read 'entityname' from it.
- IrateGiant
- Dragon
- Posts: 328
- Joined: Fri Jan 08, 2010 12:35 pm
- Location: Spain
- Contact:
I forget the func SR, I tried to assign the EntityName but I don´t have many ideas about how do this.
I placed this code on <font color="green">DefFuncs.py</font id="green"> from the main map(MAP1):
And this code on <font color="green">pj.py</font id="green"> from the second map(MAP2):
The console message persist:
<font color="red">File "pj.py", line 32, in ?
if GetEntity == "palan":
NameError: GetEntity
B_App::RunScriptFile() -> Error ejecutando Cfg.py
Start optimizing Astar...B_App::LoadWorld() -> Error trying to load PP.
OK!</font id="red">
The original problem with functions in "Palanca.py" that we talk above is solved but now I´m trying to assign a <font color="green">"palan"</font id="green"> to a character in (MAP2); for example:
<font color="green">"palan" -> "Knight_Traitor"
"palan2" -> "Skeleton"
etc...</font id="green">
I know that this code don´t is correct writen, I tried to adapt from another code sequence. [:(]
Any idea?
I placed this code on <font color="green">DefFuncs.py</font id="green"> from the main map(MAP1):
Code: Select all
<font color="green">def ChooseEnemie(EntityName):
char=Bladex.GetEntity(EntityName)
if char.Kind=="palan":
char.RemoveFromWorld()
Bladex.LoadLevel("MAP2")</font id="green">
Code: Select all
<font color="green">if GetEntity == "palan":
char=Bladex.CreateEntity("Player1","Knight_Traitor", 0, -1118, 0, "Person")
char.Level=2
char.Angle=4.5
char.Data=Basic_Funcs.PlayerPerson(char)
char.Data.ResetSounds("Player1")
char.SetOnFloor()</font id="green">
<font color="red">File "pj.py", line 32, in ?
if GetEntity == "palan":
NameError: GetEntity
B_App::RunScriptFile() -> Error ejecutando Cfg.py
Start optimizing Astar...B_App::LoadWorld() -> Error trying to load PP.
OK!</font id="red">
The original problem with functions in "Palanca.py" that we talk above is solved but now I´m trying to assign a <font color="green">"palan"</font id="green"> to a character in (MAP2); for example:
<font color="green">"palan" -> "Knight_Traitor"
"palan2" -> "Skeleton"
etc...</font id="green">
I know that this code don´t is correct writen, I tried to adapt from another code sequence. [:(]
Any idea?
-
- Dragon
- Posts: 737
- Joined: Thu Nov 15, 2001 12:58 am
- Location: Ireland
- Contact:
In your first map, you need to assign "palan" or "palan2" to the variable 'EntityName', and then call this func
ChooseEnemie(EntityName)
Funcs:
and put this in pj.py of map 2:
I don't know if that will work as is, but it's on the right track...
ChooseEnemie(EntityName)
Funcs:
Code: Select all
def ChooseEnemie(EntityName):
charname = "Skeleton"
if EntityName=="palan":
charname = "Knight_Traitor"
elif EntityName=="palan2":
charname = "Skeleton"
store_char = open("map2mapdata.txt", 'w')
store_char.write(charname)
if store_char:
store_char.close()
Code: Select all
store_char = open("map2mapdata.txt",'r')
charname=store_char.read()
if store_char:
store_char.close()
char=Bladex.CreateEntity("Player1",charname,0,0,0,"Person")
- IrateGiant
- Dragon
- Posts: 328
- Joined: Fri Jan 08, 2010 12:35 pm
- Location: Spain
- Contact:
Yes, it´s the right track SR! [:)]
I noticed from console to a syntax error from:
<font color="red">
I adapt him to this and now still loading.
<font color="green">
But now the problem is "map2mapdata.txt" that no exist this file...
I change the name "<font color="green">map2</font id="green">mapdata.txt" to another map name for example "StartMap", but what happens? I need to create a file named "...mapdata.txt"?
I don´t know if I follow the right track [:D] but I create the file "...mapdata.txt" but empty and show a message:
<font color="red">Trying to create a Person that was NOT preloaded:",</font id="red">
I need write something in this file?
I noticed from console to a syntax error from:
<font color="red">
Code: Select all
store_char = open("map2mapdata.txt",'r')
charname=store_char.read()
if store_char:
store_char.close()</font id="red">
<font color="green">
Code: Select all
store_char = open("map2mapdata.txt",'r')
charname=store_char.read()
if store_char:
store_char.close()</font id="green">
I change the name "<font color="green">map2</font id="green">mapdata.txt" to another map name for example "StartMap", but what happens? I need to create a file named "...mapdata.txt"?
I don´t know if I follow the right track [:D] but I create the file "...mapdata.txt" but empty and show a message:
<font color="red">Trying to create a Person that was NOT preloaded:",</font id="red">
I need write something in this file?
-
- Dragon
- Posts: 737
- Joined: Thu Nov 15, 2001 12:58 am
- Location: Ireland
- Contact:
The "map2mapdata.txt" file should have been created, and the EnemyName written to it, by the func:
<font color="green">ChooseEnemie(EntityName)</font id="green">
At the end of map 1.
Did you call this func with EntityName = "palan" or "palan2"? If not, the "map2mapdata.txt" file would not exist.
You can test it like this (map 1)
<font color="green">
EntityName = "palan"
ChooseEnemie(EntityName)</font id="green">
or you can put "Knight_Traitor" in the "mapdata.txt" file to test map 2.
<font color="green">ChooseEnemie(EntityName)</font id="green">
At the end of map 1.
Did you call this func with EntityName = "palan" or "palan2"? If not, the "map2mapdata.txt" file would not exist.
You can test it like this (map 1)
<font color="green">
EntityName = "palan"
ChooseEnemie(EntityName)</font id="green">
or you can put "Knight_Traitor" in the "mapdata.txt" file to test map 2.