New mod: Difficulty for experts players and more

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

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

Post by Sir Random »

Character animations should be declared and linked when the character is initialised.

Look in Lib\Biped.py, and you will see how character data is assigned.

You will probably need to set the animation types in 'ActionTables.py' and link them in 'LinkTables.py', and there may be other stuff to do, I can't remember exactly, but you can see what's required in Biped.py.

User avatar
MBK_MBK
Dragon
Posts: 413
Joined: Sun Jun 19, 2011 9:06 am
Location: Spain
Contact:

Post by MBK_MBK »

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

Character animations should be declared and linked when the character is initialised.

Look in Lib\Biped.py, and you will see how character data is assigned.

You will probably need to set the animation types in 'ActionTables.py' and link them in 'LinkTables.py', and there may be other stuff to do, I can't remember exactly, but you can see what's required in Biped.py.
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
<font color="white">
Hello Sir Random, thank you very much for your quick response![:D]
You're right, I have pointed out the whole process needs to be done in each file, so no mistake. I have checked against all and it´s well, it was driving me crazy, looking in the code during hours... [|)] I was going blind. [8][8)]

But don´t worry, at last, I just fix it! I found errors in the files KgtBAct.py and KgtCombos.py [:I] It just was a stupid mistake of writing... [B)][xx(]

Everything is cool, I continue to advance, thanks again and see you soon! [8D][^]
</font id="white">

User avatar
MBK_MBK
Dragon
Posts: 413
Joined: Sun Jun 19, 2011 9:06 am
Location: Spain
Contact:

Post by MBK_MBK »

<font color="white">
Well, here I show a video of how I have left the combos for Knight.[:)]
The controls are very easy, just press the attack and the direction you want.
You can change the directions of the attacks on any turn before finishing the combo.
The other heroes and foes are also ready. [:p]

<font color="yellow"><b>Test: News and fast combos for Knight.</b></font id="yellow">
http://www.youtube.com/watch?v=k7Bt7kwo ... e=youtu.be

<font color="yellow"><b>Here is a picture of the diary, with the combos:</b></font id="yellow">
http://www.4shared.com/photo/o4PMd8_R/p ... ities.html

<font color="limegreen"><b>Here is more videos for test! </b></font id="limegreen">[8D]

<font color="yellow"><b>Test: News combos for the Amazon.</b></font id="yellow">
http://www.youtube.com/watch?v=iX_MQgY6i34

<font color="yellow"><b>Test: News combos for the Barbarian 1.</b></font id="yellow">
http://www.youtube.com/watch?v=GNP0kyBu9Hg

<font color="yellow"><b>Test: News combos for the Barbarian 2.</b></font id="yellow">
http://www.youtube.com/watch?v=uVDHAfmU6ho

<font color="yellow"><b>Test: News combos for the Dwarf.</b></font id="yellow">
http://www.youtube.com/watch?v=XcFRpaN4iqw

<hr noshade size="1">Well, on second thought, it was unreal to handle as well the Knight, so I corrected the speed factors. [:I] Anyway, the knight is still the fastest. [^]

I wanted to add more combos, but it can not be, the game crashes. It is because the maximum of combos is 115. Add more than 100 or 115 <font color="orange"><b>AddAttack</b></font id="orange">, in <font color="limegreen"><b>Xxxcombos.py</b></font id="limegreen">, makes the game crash. [:(]

I managed to fix the HUD. Now the defense and strength parameters are modified when the hero is equipped with anything, <b>including bows and double 1H weapons</b>. [:D][8D]

I am equipping weapons in his left hand to the enemy, and adding a double weapon attacks to Ragnar and Dal-Gurak. [:p]
I still ending the maps and correcting errors in the inventory. [:)]</font id="white">

charex
Hatchling
Posts: 4
Joined: Fri Jan 01, 2010 1:12 pm
Location: Argentina

Post by charex »

It looks great but very imba

User avatar
MBK_MBK
Dragon
Posts: 413
Joined: Sun Jun 19, 2011 9:06 am
Location: Spain
Contact:

Post by MBK_MBK »

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

It looks great but very imba
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
Hello Charex, [:)]
thanks, I try, that it is well. [8D] And I have less to finish.[:D]

sorry, "very imba?" [:I] what is "imba"? ...What does that mean?

User avatar
MBK_MBK
Dragon
Posts: 413
Joined: Sun Jun 19, 2011 9:06 am
Location: Spain
Contact:

Post by MBK_MBK »

<font color="white">
Hello friends. [:)]
<font color="yellow"><b>If anybody serves him, I will put here the files needed to be modified, to duplicate the animations.</b></font id="yellow">

<b><font color="limegreen"># FILES TO MODIFY, TO DUPLICATE ANIMATIONS And add them to another character:</font id="limegreen">
<font color="red">###########################################################
</font id="red">
EXAMPLE: ---></b> CONVERT "<font color="orange">Amz_g_katar31.BMV</font id="orange">" TO "<font color="orange">Kgt_g_katar31</font id="orange">". ADD ANIMATION TO KNIGHT.

<font color="limegreen"><b># MUST RESPECT THE PREFIX NAME AS THE CHARACTER.</b></font id="limegreen">
<font color="limegreen"><b># </b><font color="orange"><i>Xxx = Amz / Kgt / Bar / DWF / Ork / Org</i></font id="orange"> <b>...</b></font id="limegreen">
<b><font color="limegreen"># In this case, modify as well:</font id="limegreen"></b> <i><font color="orange">Xxx = Kgt</font id="orange"></i><hr noshade size="1">
<font color="red"><b>###########################################################
</font id="red"></b>

Code: Select all

<font color="orange"><i>.../Lib/AnmSets/XxxAnimationSet.py ---></i></font id="orange"> <font color="limegreen"># COPY <font color="yellow">Bladex.AddAnm</font id="yellow"> PARAMETERS OF THE ORIGINAL FOR WORK PROPERLY.</font id="limegreen">
	anm_name="<font color="yellow">Kgt_g_katar31</font id="yellow">"
	Bladex.LoadSampledAnimation("<font color="yellow">..\\..\\Anm\\Amz_g_katar31.BMV</font id="yellow">","<font color="yellow">Kgt_g_katar31</font id="yellow">",0)        
	Bladex.AddAnmRStep(anm_name,0)     
	Bladex.AddAnmLStep(anm_name,0)     
	Bladex.AddAnmRRelease(anm_name,0.007) 
	Bladex.AddAnmRStep(anm_name,0.201)    
	Bladex.AddAnmRRelease(anm_name,0.740) 
	Bladex.AddAnmRStep(anm_name,0.928)

<font color="orange"><i>.../Scripts/Biped/XxxBact.py ---></i></font id="orange"><font color="limegreen"> # COPY <font color="yellow">Bladex.AddBipedAction</font id="yellow"> PARAMETERS OF THE ORIGINAL.</font id="limegreen">
	Bladex.AddBipedAction("<font color="yellow">Kgt</font id="yellow">","<font color="yellow">g_katar31</font id="yellow">","<font color="yellow">Kgt_g_katar31</font id="yellow">",0.0,1.0,0)<font color="limegreen">#</font id="limegreen">

<font color="orange"><i>.../Scripts/anm_def.py ---></i></font id="orange"> <font color="limegreen"># COPY <font color="yellow">Bladex.AddAnmEvent</font id="yellow"> OF THE ORIGINAL PARAMETERS.</font id="limegreen">
	Bladex.AddAnmEvent("<font color="yellow">Kgt_g_katar31</font id="yellow">","HitInitialItp",0.183)
	Bladex.AddAnmEvent("Kgt_g_katar31","HitFinalItp",0.910)
	Bladex.AddAnmEvent("Kgt_g_katar31","Start_Weapon",0.405)
	Bladex.AddAnmEvent("Kgt_g_katar31","Stop_Weapon",0.911)

<font color="orange"><i>.../Scripts/anm_def_FX.py ---></i></font id="orange"> <font color="limegreen">#  MUST MATCH THE NAME OF THE EFFECT WITH THE HERO. DOES NOT WORK FOR ENEMIES.</font id="limegreen">
	Bladex.AddAnmEvent("<font color="yellow">Kgt_g_katar31</font id="yellow">","<font color="yellow">Kgt_g_27kata_new_1</font id="yellow">",0.1000)<font color="limegreen">#</font id="limegreen">
	Bladex.AddAnmEvent("Kgt_g_katar31","Kgt_g_27kata_new_1",0.3500)<font color="limegreen">#</font id="limegreen">
	Bladex.AddAnmEvent("Kgt_g_katar31","Kgt_g_27kata_new_1",0.5000)<font color="limegreen">#</font id="limegreen">

<font color="orange"><i>.../Scripts/AniSoundXxx.py ---></i></font id="orange">
	NetSounds.AddAnimSound(per,'<font color="yellow">Kgt_g_katar31</font id="yellow">', SesgadoCortoGrave, 0.2)<font color="limegreen">#</font id="limegreen">
	NetSounds.AddAnimSound(per,'Kgt_g_katar31', SesgadoLargoGrave, 0.3)<font color="limegreen">#</font id="limegreen">
	NetSounds.AddAnimSound(per,'Kgt_g_katar31', SesgadoEspecialLargo2, 0.5)<font color="limegreen">#</font id="limegreen">
	NetSounds.AddAnimSound(per,'Kgt_g_katar31', EsfuerzoCorto3Barb, 0.2)<font color="limegreen">#</font id="limegreen">
	NetSounds.AddAnimSound(per,'Kgt_g_katar31', EsfuerzoCorto2Barb, 0.3)<font color="limegreen">#</font id="limegreen">
	NetSounds.AddAnimSound(per,'Kgt_g_katar31', EsfuerzoGolpeAtrasBarb, 0.5)<font color="limegreen">#</font id="limegreen">

<font color="orange"><i>.../Scripts/Combos/XxxCombos.py ---></i></font id="orange">
	Bladex.SetActionEventTable("<font color="yellow">Knight</font id="yellow">","<font color="yellow">g_katar31</font id="yellow">","ATTACKING")<font color="limegreen">#</font id="limegreen">
	Bladex.SetAnimationFactor("<font color="yellow">Kgt_g_katar31</font id="yellow">",5.0)<font color="limegreen"># COPY OF <font color="orange">...Lib/AnmFact.py</font id="orange"> AND CHANGE SPEED PARAMETER.</font id="limegreen">
	kgt.AddAttack("<font color="yellow">KGT1H_A1</font id="yellow">","<font color="yellow">Kgt_g_katar31</font id="yellow">")<font color="limegreen"><b>#</b></font id="limegreen">
	kgt.AllowAttack("<font color="yellow">KGT1H_A1</font id="yellow">","A","<font color="yellow">GM1_1H</font id="yellow">","","","1H")<font color="limegreen"># FROM GENERIC UP</font id="limegreen">

<font color="orange"><i>.../Lib/Damage.py ---></i></font id="orange">
	AnimationData['<font color="yellow">Kgt_g_katar31</font id="yellow">']= 5.0<font color="limegreen"># DAMAGE MULTIPLIED BY 5.</font id="limegreen">
<font color="red"><b>###########################################################</b></font id="red">
</font id="white">

charex
Hatchling
Posts: 4
Joined: Fri Jan 01, 2010 1:12 pm
Location: Argentina

Post by charex »

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

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

It looks great but very imba
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
Hello Charex, [:)]
thanks, I try, that it is well. [8D] And I have less to finish.[:D]

sorry, "very imba?" [:I] what is "imba"? ...What does that mean?
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">

Imba = Imbalanced, Too strong, Overpowered, Muy poderoso

User avatar
MBK_MBK
Dragon
Posts: 413
Joined: Sun Jun 19, 2011 9:06 am
Location: Spain
Contact:

Post by MBK_MBK »

<font color="white">
Hello firends! [:)]
Can anyone help me?

I only have two things to finish correcting the inventory, to use double weapons. [8D]
But I'm trying and trying, and there is something that conflicts. The character does not do what it should.

In <b><font color="yellow">.../Lib/ScorerActions.py</font id="yellow"> ---></b>
<font color="limegreen">What I want to do is:</font id="limegreen">
<b>-</b> <font color="orange">When choosing a 1H weapon from the inventory, if you have free the left hand, and busy the right hand with a 1H weapon: equip the selected 1H weapon on the left.</font id="orange">
<b>- </b><font color="orange">When choosing a 1H weapon and is on the left, while the right has another weapon 1H, swap weapons. That works, but if the 1H weapons are in on back, something goes wrong. In fact, something in <font color="yellow">ScorerActions.py</font id="yellow"> or in <font color="yellow">Actions.py</font id="yellow"> removes the weapon of the left hand, and equip a shield. I want correct it: if both 1H weapons are back, swap the weapons and equip in their hands.</font id="orange">

Link to video, for example:
http://www.youtube.com/watch?v=GyWx-ppq ... e=youtu.be

If it helps, here is a link to the file I'm editing. <font color="yellow"><b>ScorerActions.py</b></font id="yellow">:
http://www.4shared.com/file/EYKCx1Z_/ScorerActions.html
<i><font color="orange">To locate where I changed something, search for the word:</font id="orange"></i> <b><font color="limegreen">MBEASTKING</font id="limegreen"></b>

Thanks! [:D]</font id="white">

User avatar
MBK_MBK
Dragon
Posts: 413
Joined: Sun Jun 19, 2011 9:06 am
Location: Spain
Contact:

Post by MBK_MBK »

Please, anyone can help a little with the problem I raised earlier? [:)]
Thanks!

User avatar
mingyue1371
Dragon
Posts: 206
Joined: Fri Aug 05, 2011 4:46 pm
Location: China
Contact:

Post by mingyue1371 »

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

<font color="white">
Greetings! [:D]
I managed to modify the amulets, and provide them with special attributes. [:)]

<b><font color="yellow">Test 1:</font id="yellow"></b>
<b><font color="limegreen">Warrior's Amulet </font id="limegreen">=</b> +1 Level.
<b><font color="limegreen">Destroyer Amulet</font id="limegreen"> =</b> Bursts or paralyzes the enemies. (I have to add some light effect here)
<b><font color="limegreen">Magic Amulet</font id="limegreen"> =</b> Protects with an energy shield.

http://www.youtube.com/watch?v=nWt9bDU4 ... e=youtu.be

<b><font color="yellow">Test 2:</font id="yellow"></b>
Some enemies are inmune to Destroyer Amulet.
The energy shield can be easily broken by the strongest foes.
The Warrior's Amulet also works in the maximun level.

http://www.youtube.com/watch?v=3R74SHS9 ... e=youtu.be
<hr noshade size="1">

</font id="white">
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">

Hi MBK £¡The Amulet you made are very cool![:0][:)][:D]
Especially the Destroyer Amulet and Ally Amulet.Turn Badguys to Allies with the Amulet,Great idear!

I want to included them in my map ,but I dont know how to make the code. can u give me a hint? or send a email to me? Thank very much !
Btw,how long will your Expert mod complete for us to enjoy it?[:D]

User avatar
MBK_MBK
Dragon
Posts: 413
Joined: Sun Jun 19, 2011 9:06 am
Location: Spain
Contact:

Post by MBK_MBK »

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


Hi MBK £¡The Amulet you made are very cool![:0][:)][:D]
Especially the Destroyer Amulet and Ally Amulet.Turn Badguys to Allies with the Amulet,Great idear!

I want to included them in my map ,but I dont know how to make the code. can u give me a hint? or send a email to me? Thank very much !
Btw,how long will your Expert mod complete for us to enjoy it?[:D]

<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
<font color="white">Hello again Ming![:)]


Sorry for the delay, friend. [:I] Well, I've been a bit absent, because I had no internet, [xx(] and now I have engaged another ADSL line. [B)] Anyway, it does not matter. [8)]
Probably this summer, I'll have more free time and I will achieve complete the version 1.3 of the mod, fully playable and error free. [:D][8D]

<b>About the amulets:</b> Thanks! [;)] I will try to explain to you what was I thinking. [:D]

<font color="yellow"><b>Ally Amulet:</b></font id="yellow"> For now, that does not work well. [:(] I do not get to adapt the code of the mod of allies. I did not succeed in all that time and after many attempts. [V]
What I have tried to do is: duplicate all the enemies to create new characters, and define them in <font color="limegreen">Basic_Funcs.py</font id="limegreen">.
From the file <font color="limegreen">ItemTypes.py</font id="limegreen">, using the amulet of the Allies, call a function that eliminates the enemy and then create an ally in the same place and with the same characteristics and statistics.
Propero and SirRandom already gave me an idea how to make it, but I have not gotten yet. There is errors I do not know how to fix it.
Prospero told me, he program an arrow that turned enemies into allies. [:0] I have not found where is his code, to investigate. [:p] [:(]


<font color="yellow"><b>Magic Amulet <font color="limegreen">(gives a magic shield)</font id="limegreen">:</b></font id="yellow"> This requires a bit of code. I adapted a couple of things in different files, now can not remember where it is.
If you are interested, let me know, and I wil search the code in the files of my mod. [:)]

<font color="yellow"><b>Destroyer Amulet</b></font id="yellow"> and <font color="yellow"><b>Warrior Amulet:</b></font id="yellow"> Not a complicated code, I put it here. [:D]

<b>Have to modify the file: <font color="limegreen">.../Scripts/ItemTypes.py</b></font id="limegreen">

Code: Select all

<font color="limegreen">################################################## AMULETO DEL GUERRERO. MBEASTKING. WARRIOR AMULET.
##################################################</font id="limegreen">

<font color="yellow">class </font id="yellow"><font color="limegreen"><i>Amuletofantasma </i></font id="limegreen">(ItemOfProtection):
	<font color="yellow">def </font id="yellow">__init__ (self, me):
		ItemOfProtection.__init__(self, me)
		self.UsedBy= "Player1"
		self.UseTime= 3.5
		self.Resistances= {}
		self.nUses= 1
		

	<font color="yellow">def </font id="yellow">UseStart (self, ObjectName, use_from):
		ItemOfProtection.UseStart (self, ObjectName, use_from)
		self.Resistances['Venom']= 1.0
		
		char = Bladex.GetEntity("Player1")
		if char.Life>0 and char.Level < 124:
			char.Level = char.Level+1
			char.Life  = CharStats.GetCharMaxLife(char.Kind,char.Level)
			
			# SONIDO. SOUND
			SoundName= "..\\..\\Sounds\\levelarriba1.mp3"
			nivelmas=Bladex.CreateEntity(char.Name+"nivelmas", "Entity Sound", 0, 0, 0)
			nivelmas.SetSound(SoundName)
			nivelmas.MinDistance=5000
			nivelmas.MaxDistance=100000
			char.Link(nivelmas)
			nivelmas.PlaySound(0)
			
			# EFECTO DE SUBIR NIVEL Y CORRECCION DE BARRA DE EXPERIENCIA. EFFECT OF LEVEL UP AND CORRECTION OF EXPERIENCE.
			import Scorer
			import pocimac
			import PowDefWidgets#
			pocimac.RestoreWoundsToLifeLevel(char.Name)
			
			LevelLimit=CharStats.GetCharExperienceCost(char.CharType,char.Level)#
			char.PartialLevel = 0#
			Scorer.SetLevelBarValue(char.PartialLevel)#
			Scorer.SetLevelValue(char.Level)#
			Scorer.SetEnemiesData(char)#
			PowDefWidgets.Draw()#
			
			Scorer.SlideTBS(0)#
			Scorer.LevelUpFlash()#
			Scorer.LevelUp()#
			Scorer.SetLevelLimits(0,CharStats.GetCharExperienceCost(char.CharType,char.Level))#
			
			Actions.ReportMsg("AMULET USED!")
			
			global DefTextWidget
			global PowTextWidget
			DefTextWidget.SetFlash(40)
			PowTextWidget.SetFlash(40)
			Bladex.AddScheduledFunc (Bladex.GetTime() + 2.0,DefTextWidget.SetFlash,(0,))
			Bladex.AddScheduledFunc (Bladex.GetTime() + 2.0,PowTextWidget.SetFlash,(0,))
			
		if char.Life>0 and char.Level == 124:
			char.Life  = CharStats.GetCharMaxLife(char.Kind,char.Level)
			import pocimac
			import Scorer
			pocimac.RestoreWoundsToLifeLevel(char.Name)
			Scorer.LevelUpFlash()
			Actions.ReportMsg("YOU HAVE REACHED THE MAXIMUM LEVEL!")
			
			# SONIDO
			SoundName= "..\\..\\Sounds\\levelarriba1.mp3"
			nivelmas=Bladex.CreateEntity(char.Name+"nivelmas", "Entity Sound", 0, 0, 0)
			nivelmas.SetSound(SoundName)
			nivelmas.MinDistance=5000
			nivelmas.MaxDistance=100000
			char.Link(nivelmas)
			nivelmas.PlaySound(0)
			
	def UseEnd (self,ObjectName, UserName):
		ItemOfProtection.UseEnd (self, ObjectName, UserName)
		


<font color="limegreen">##################################################     MBEASTKING. DESTROYER AMULET.
#####################################################  AMULETO DESTRUCTOR.</font id="limegreen">

class Amuleto (ItemOfProtection):
	def __init__ (self, me):
		ItemOfProtection.__init__(self, me)
		self.UsedBy= "Player1"
		self.UseTime= 0.0000000001
		self.Resistances= {}
		self.nUses= 35


	def UseStart (self, ObjectName, use_from):
		ItemOfProtection.UseStart (self, ObjectName, use_from)
		
		char = Bladex.GetEntity("Player1")
		if char.Data.selected_enemy:
			enemigo=Bladex.GetEntity(char.Data.selected_enemy[0])
			if enemigo.Kind == "Minotaur" or enemigo.Kind == "Golem_clay" or enemigo.Kind == "Golem_stone" or enemigo.Kind == "Golem_lava":
				if enemigo.Life >= 1:
					enemigo.InterruptCombat()
					
					# SONIDO DE EXPLOSION
					SoundName= "..\\..\\Sounds\\llave-estrella.wav"
					firesound=Bladex.CreateEntity(enemigo.Name+"firesound", "Entity Sound", 0, 0, 0)
					firesound.SetSound(SoundName)
					firesound.MinDistance=5000
					firesound.MaxDistance=100000
					enemigo.Link(firesound)
					firesound.PlaySound(0)
					
					## EFECTO CONGELADOR.
					enemigo.Freeze()# CONGELAR
					# PONER CUÃ

User avatar
MBK_MBK
Dragon
Posts: 413
Joined: Sun Jun 19, 2011 9:06 am
Location: Spain
Contact:

Post by MBK_MBK »

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

<font color="white">
Hello firends! [:)]
Can anyone help me?

I only have two things to finish correcting the inventory, to use double weapons. [8D]
But I'm trying and trying, and there is something that conflicts. The character does not do what it should.

In <b><font color="yellow">.../Lib/ScorerActions.py</font id="yellow"> ---></b>
<font color="limegreen">What I want to do is:</font id="limegreen">
<b>-</b> <font color="orange">When choosing a 1H weapon from the inventory, if you have free the left hand, and busy the right hand with a 1H weapon: equip the selected 1H weapon on the left.</font id="orange">
<b>- </b><font color="orange">When choosing a 1H weapon and is on the left, while the right has another weapon 1H, swap weapons. That works, but if the 1H weapons are in on back, something goes wrong. In fact, something in <font color="yellow">ScorerActions.py</font id="yellow"> or in <font color="yellow">Actions.py</font id="yellow"> removes the weapon of the left hand, and equip a shield. I want correct it: if both 1H weapons are back, swap the weapons and equip in their hands.</font id="orange">

Link to video, for example:
http://www.youtube.com/watch?v=GyWx-ppq ... e=youtu.be

If it helps, here is a link to the file I'm editing. <font color="yellow"><b>ScorerActions.py</b></font id="yellow">:
http://www.4shared.com/file/EYKCx1Z_/ScorerActions.html
<i><font color="orange">To locate where I changed something, search for the word:</font id="orange"></i> <b><font color="limegreen">MBEASTKING</font id="limegreen"></b>

Thanks! [:D]</font id="white">
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">

Please, can someone help me with this? [8)]
well, if not busy with some important thing, of course ... [:D]

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

Post by prospero »

The ally arrow is part of the Wizad code. It doesn't actually convert the enemy but replaces them with an ally version.

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

Post by prospero »

Code for the Magic Shield Gem.

Code: Select all

import Bladex
import ObjStore
import Reference
import Actions
import Sparks
import Language
import MenuText
import netgame
import BCopy
import whrandom
import AuxFuncs
import B3DLib
import Damage

class MagicShieldX:
	def __init__(self, me, owner):
		self.ObjId=ObjStore.GetNewId() # Para identificarlo al grabar/guardar
		ObjStore.ObjectsStore[self.ObjId]=self

		self.Name= self.CurrentName= me.Name
		self.OwnerName= owner.Name
		self.AuxFuncsData= None
		self.SpareShield=""
		me.Weapon= 1
		me.Alpha= 0.0
		me.RasterMode="Read"
		me.RasterMode="AdditiveAlpha"
		me.Solid= 0
		me.CastShadows=0
		me.HitShieldFunc= self.TakeImpact
		inv= owner.GetInventory()
		inv.AddMagicShield(self.Name)
		try:
			owner.Data.MagicShieldActivated()
		except AttributeError:
			pass

		shield2= Bladex.CreateEntity(self.Name+"Phase2","MagicShield2",0,0,0,"Weapon")
		shield2.Solid= 0
		shield2.SelfIlum=1.0
		shield2.Alpha= 0.0
		shield2.RasterMode="Read"
		shield2.RasterMode="AdditiveAlpha"
		shield2.CastShadows=0

		shield3= Bladex.CreateEntity(self.Name+"Phase3","MagicShield3",0,0,0,"Weapon")
		shield3.Solid= 0
		shield3.SelfIlum=1.0
		shield3.Alpha= 0.0
		shield3.RasterMode="Read"
		shield3.RasterMode="AdditiveAlpha"
		shield3.CastShadows=0

		shieldbr= Bladex.CreateEntity(self.Name+"Breaking","MagicShieldBreak",0,0,0,"Weapon")
		shieldbr.Solid= 0
		shieldbr.SelfIlum=1.0
		shieldbr.Alpha= 0.0
		shieldbr.RasterMode="Read"
		shieldbr.RasterMode="AdditiveAlpha"
		shieldbr.CastShadows=0

		self.shieldlight= Bladex.CreateEntity(self.Name+"ImpactLight", "Entity Spot", 0, 0, 0)
		self.shieldlight.Color=0, 0, 0
		self.shieldlight.Intensity=0.0
		self.shieldlight.Precission=0.01
		self.shieldlight.CastShadows=0
		self.shieldlight.Flick=0
		self.shieldlight.Visible=0

		me.Link(shield2)
		me.Link(shield3)
		me.Link(shieldbr)
		me.Link(self.shieldlight)

		self.AGE=0
		self.ParticleData=[]
		self.PrepareParticleData()

		kind = Bladex.GetEntity(self.Name).Kind
		if Reference.DefaultObjectData.has_key(kind):
			Reference.EntitiesObjectData[self.Name]= BCopy.deepcopy(Reference.DefaultObjectData[kind])
			self.MaxDefence= self.Defence= Reference.EntitiesObjectData[self.Name][2]
			self.IntDefence= self.MaxDefence/3.0
		else:
			print "Error -- Cannot find default object data for "+kind
			self.MaxDefence= self.Defence= 0
			self.IntDefence= 0
			
		# Create a looped sound
		SoundName= "..\\..\\Sounds\\campo-escudo-barrera1.wav"
		self.loopsound= Bladex.CreateEntity (me.Name+"LoopSound", "Entity Sound", 0, 0, 0)
		self.loopsound.SetSound (SoundName)
		self.loopsound.Volume=0.4
		self.loopsound.MinDistance=5000
		self.loopsound.MaxDistance=10000
		owner.Link(self.loopsound)
		self.loopsound.PlaySound(-1)

	def persistent_id(self):
		return self.ObjId

	def __getstate__(self):
		return (1,
				self.ObjId,
				self.Name,
				self.OwnerName,
				self.CurrentName,
				self.shieldlight,
				self.AGE,
				self.ParticleData,
				self.MaxDefence,
				self.Defence,
				self.IntDefence,
				self.AuxFuncsData,
				self.loopsound,
				self.SpareShield
				)

	def __setstate__(self,parm):
		if parm[0]==1:
			self.ObjId=parm[1]
			ObjStore.ObjectsStore[self.ObjId]=self
			self.Name=parm[2]
			self.OwnerName=parm[3]
			self.CurrentName=parm[4]
			self.shieldlight=parm[5]
			self.AGE=parm[6]
			self.ParticleData=parm[7]
			self.MaxDefence=parm[8]
			self.Defence=parm[9]
			self.IntDefence=parm[10]
			self.AuxFuncsData=parm[11]
			self.loopsound=parm[12]
			self.SpareShield=parm[13]
			
		else:
			print "Version mismatch in BreakSector"
			self.ObjId=ObjStore.GetNewId() # Para identificarlo al grabar/guardar
			ObjStore.ObjectsStore[self.ObjId]=self
			self.Name=""
			self.OwnerName=""
			self.CurrentName=""
			self.shieldlight=None
			self.AGE=0
			self.ParticleData=[]
			self.MaxDefence=0
			self.Defence=0
			self.IntDefence=0
			self.loopsound=None
			self.AuxFuncsData= None
			self.SpareShield=""
		
		if self.Defence>0:
			owner= Bladex.GetEntity(self.OwnerName)
			if owner:
				inv= owner.GetInventory()
				inv.AddMagicShield(self.Name)
				


	def TakeImpact (self,hit_entity,hitting_entity,xhit_point,yhit_point,zhit_point,ximpulse,yimpulse,zimpulse,DamageType):
		hitting_ent=Bladex.GetEntity(hitting_entity)
		if hitting_ent.Kind[:10]=="ProJavelin":
			print "Spears are allowed"
			return
		
		try: 
			ball=hitting_ent.Data.DamageEntityName
			
			if Bladex.GetEntity(ball).Kind=="EsferaOrbital":
				return
		except AttributeError:
			pass
		hitting_ent.MessageEvent(Reference.MESSAGE_STOP_WEAPON,0,0)
		hitting_ent.MessageEvent(Reference.MESSAGE_STOP_TRAIL,0,0)
		
		hit_ent=Bladex.GetEntity(hit_entity)

		datos_esc=Reference.DefaultObjectData[hit_ent.Kind]
		if datos_esc[0]==Reference.OBJ_SHIELD:
			Reference.DefaultObjectData[hit_ent.Kind][3].Play(xhit_point, yhit_point, zhit_point, 0)
		else:
			if datos_esc[0]==Reference.OBJ_WEAPON:
				if Reference.GiveWeaponFlag(hit_entity)<>Reference.W_FLAG_1H:
					Reference.DefaultObjectData[hit_ent.Kind][5][6].Play(xhit_point, yhit_point, zhit_point, 0)	

		VictimName=self.OwnerName
		AttackerName=hitting_ent.Parent
		pj=Bladex.GetEntity(VictimName)

		#if hitting_ent.Arrow and (hitting_ent.Parent):
		#	pdb.set_trace()
		pj.DamageFunc(VictimName, AttackerName, hitting_entity, DamageType, 0, -1, xhit_point, yhit_point, zhit_point, 1)

		if netgame.GetNetState() == 1:
			netgame.CallEventSound(hit_entity,4)

		# Make arrows stick temporarily
		if hitting_ent.Arrow and (not hitting_ent.Parent):
			hitting_ent.Stop()
			# Check type of damage
			impact= hitting_ent.GraspPos ("Impact")
			centre= hitting_ent.Position
			impact2centre= centre[0]-impact[0], centre[1]-impact[1], centre[2]-impact[2]
			abs_pos= xhit_point+impact2centre[0], yhit_point+impact2centre[1], zhit_point+impact2centre[2]
			rel_pos= hit_ent.Abs2RelPoint(abs_pos[0], abs_pos[1], abs_pos[2])
			# To bring it closer to centre, multiply vector by < 1.0
			hitting_ent.Position= rel_pos[0]*0.8, rel_pos[1], rel_pos[2]*0.8
			hit_ent.Link(hitting_ent)
			sticktime= (1.0)/hitting_ent.Mass
			Bladex.AddScheduledFunc (Bladex.GetTime()+sticktime, Damage.StuckWeaponFall, (hitting_ent.Name, hit_ent.Name), hitting_ent.Name+"_StuckWeaponFall")

		# Make the shield appear in the correct place
		pos= pj.Position
		hit_ent.Position= pos
		hit_ent.Orientation= (1,0,0,0)		
		x= xhit_point-pos[0]; y= yhit_point-pos[1]; z= zhit_point-pos[2]		
		xz_ang= B3DLib.GetXZAngle (x,y,z)
		y_ang = B3DLib.GetYAngle (x,y,z)		
		hit_ent.RotateRel(0,0,0, 0,-1,0, xz_ang)
		hit_ent.RotateRel(0,0,0, 1,0,0, y_ang)


	def PrepareParticleData(self):
		for i in range(30):
			if i>25:
				traux=(30.0-i)/5.0 #va de 0 a 1
				aux=traux**0.5
			else:
				traux=i/25.0 #va de 1 a 0
				aux=traux**2.0
			self.ParticleData.append(255.0*traux)
			self.ParticleData.append(300.0*aux)


	def ChangeParticleColour(self, r, g, b):
		for i in range(30):
			Bladex.SetParticleGVal("MulticolourEnergyDissip", i, r, g, b, self.ParticleData[2*i], self.ParticleData[2*i+1])


	def FadeOut(self, EntityName, r, g, b, nv, rv, pps, fadeTime):
		me= Bladex.GetEntity(EntityName)
		if me:
			self.shieldlight.Color=r, g, b
			self.ChangeParticleColour(r, g, b)
			psimpact=Bladex.CreateEntity(self.Name+"PSImpact"+`self.AGE`, "Entity Particle System Dobj", 0, 0, 0)
			psimpact.ObjectName=self.Name
			psimpact.ParticleType="MulticolourEnergyDissip"
			psimpact.YGravity=0
			psimpact.Velocity=0, 0, 0
			psimpact.NormalVelocity=nv
			psimpact.RandomVelocity=rv
			psimpact.FollowFactor=0.0
			psimpact.PPS=pps
			psimpact.Time2Live=30
			psimpact.DeathTime=Bladex.GetTime()+0.5
			if me.Kind=="MagicShieldBreak":
				shield=Bladex.GetEntity(self.Name)
				currentshield=Bladex.GetEntity(self.CurrentName)
				shield.Unlink(currentshield)
				AuxFuncs.SpotIntensityVariation(self.shieldlight.Name, 6.0, 0.0, fadeTime)
				AuxFuncs.FadeAndScale(me.Name, me.Position, 0.9, 0.0, -1, 1.0, 2.5, -1, fadeTime, 1.0, 1)
			else:
				AuxFuncs.SpotIntensityVariation(self.shieldlight.Name, 4.0, 0.0, fadeTime+0.5)
				AuxFuncs.FadeObject(me.Name, 0.9, 0.0, fadeTime)


	def AbsorbFunc (self, AttackerName, WeaponName, DamagePoints):
		owner=Bladex.GetEntity(self.OwnerName)
		if owner and owner.Life > 0:
			me= Bladex.GetEntity(self.Name)
			self.Defence= max (self.Defence-DamagePoints, 0)
			Reference.EntitiesObjectData[self.Name][2]= self.Defence
			Reference.EntitiesObjectData[self.Name][7]= self.Defence
			#print "Defence remaining "+`self.Defence`

			# play an impact sound
			randsound= whrandom.randint(1,3)
			if randsound==1:	
				SoundName= "..\\..\\Sounds\\M-impacto-berrera-22.wav"
			elif randsound==2:
				SoundName= "..\\..\\Sounds\\M-impacto-barrera-11.wav"
			else:
				SoundName= "..\\..\\Sounds\\M-impacto-barrera-44.wav"

			self.AGE= self.AGE+1
			impsound=Bladex.CreateEntity (me.Name+"ImpactSound_"+`self.AGE`, "Entity Sound", 0, 0, 0)
			impsound.SetSound (SoundName)
			impsound.MinDistance=5000
			impsound.MaxDistance=60000
			me.Link(impsound)
			impsound.PlaySound(0)

			if self.Defence==0:
				self.CurrentName=self.Name+"Breaking"
				r=255
				g=64
				b=16
				nv=60
				rv=20
				pps=600
				fadeTime=1.0
				inv= owner.GetInventory()
				inv.RemoveMagicShield(self.Name)
				try:
					owner.Data.MagicShieldDestroyed(self.Name, owner.Name)
				except AttributeError:
					pass
				
				self.MaxDefence= self.Defence= Reference.EntitiesObjectData[self.Name][2]= 0.0
				Bladex.AddScheduledFunc(Bladex.GetTime()+4.0, me.RemoveFromWorld, ())
				Bladex.AddScheduledFunc(Bladex.GetTime()+4.1, me.SubscribeToList, ("Pin",))
				self.loopsound.StopSound()
				try:
					if owner.Data.MagicShieldAct:
						owner.Data.MagicShieldAct=0
				except AttributeError:
					pass
				if self.SpareShield !="":
					shname=Bladex.GetEntity(self.SpareShield).Name
					owner= Bladex.GetEntity(self.OwnerName)
					Actions.TakeObject(owner.Name, shname)
					print "replaced spare shield"
				print"magic shield Broken"
			elif self.Defence<self.IntDefence:
				self.CurrentName=self.Name+"Phase3"
				n=self.Defence/self.IntDefence
				r=255
				g=min(255, max(0, 75+155*n))
				b=0
				nv=4
				rv=2
				pps=100
				fadeTime=0.5
			elif self.Defence<(2.0*self.IntDefence):
				self.CurrentName=self.Name+"Phase2"
				n=(self.Defence-self.IntDefence)/self.IntDefence
				r=min(255, max(0, 255-255*n))
				g=min(255, max(0, 230+25*n))
				b=min(255, max(0, 128*n))
				nv=4
				rv=2
				pps=100
				fadeTime=0.5
			else:
				n=(self.Defence-2.0*self.IntDefence)/self.IntDefence
				r=0
				g=min(255, max(0, 255-127*n))
				b=min(255, max(0, 128+127*n))
				nv=4
				rv=2
				pps=100
				fadeTime=0.5
			self.FadeOut (self.CurrentName, r, g, b, nv, rv, pps, fadeTime)
			
			
			
def MakeMagicShieldX(EntityName, owner):
	
	# Bug here. If you try to activate Magic Shield and you have max number of Shields in inventory,
	# it will not work, but the gem will not work again. So remove one shield before creating Magic Shield
	spareshield=""
	inv=owner.GetInventory()
	if inv.nShields==inv.maxShields:
		for i in range(inv.nShields):
			sh_name = inv.GetShield(i)
			sh=Bladex.GetEntity(sh_name)
			if sh:
				heldshields=[]
				lsh=Bladex.GetEntity(owner.InvLeft)
				if lsh:
					heldshields.append(lsh.Name)
				lshb=Bladex.GetEntity(owner.InvLeftBack)
				if lshb:
					heldshields.append(lshb.Name)
				if sh.Name not in heldshields:
					Actions.RemoveFromInventory (owner, sh, "")
					sh.Position=0,50000,0
					spareshield=sh.Name
					print "removing extra shield"
					break
	
	shield= Bladex.CreateEntity(EntityName,"MagicShield",0,0,0,"Weapon")
	shield.SelfIlum=1.0
	Sparks.MakeShield(EntityName)	
	shield.Data= MagicShieldX(shield, owner)
	if spareshield !="":
		shield.Data.SpareShield=spareshield
	
	print "created magic shield"
	return shield
			
			
			
class MagicGem:
	def __init__ (self, me):
		me.UseFunc= self.UseStart
		self.Age_num= 0
		self.UsedBy= "Player1"
		self.UseTime= 15.0
		self.OldFDefense = 0.0
		self.OldFAttack	= 0.0
		self.FDefense = 4.0
		self.FAttack = 4.0
		self.nUses= 1
		
		
		
		self.ObjId=ObjStore.GetNewId() # Para identificarlo al grabar/guardar
		ObjStore.ObjectsStore[self.ObjId]=self
		

	def persistent_id(self):
		return self.ObjId

	def __getstate__(self):
		# Tiene que devolver c䮯 poder guardar el estado de la clase
		return (1,
					self.ObjId, 
					self.Age_num,
					self.UsedBy,
					self.UseTime,
					self.OldFDefense,
					self.OldFAttack,
					self.FDefense,
					self.FAttack,
					self.nUses
				)


	def __setstate__(self,parm):
		# Toma como par⮥tro lo que devuelve __getstate__() y debe recrear la clase
		if parm[0]==1:
			self.ObjId=parm[1]
			ObjStore.ObjectsStore[self.ObjId]=self
			self.Age_num=parm[2]
			self.UsedBy=parm[3]
			self.UseTime=parm[4]
			self.OldFDefense=parm[5]
			self.OldFAttack=parm[6]
			self.FDefense=parm[7]
			self.FAttack=parm[8]
			self.nUses=parm[9]

		else:
			print "ItemOfProtection.__setstate__() -> Version mismatch"
			# Valores por si valen para algo.
			self.UsedBy= "Player1"
			self.UseTime= 15.0
			self.OldFDefense = 0.0
			self.OldFAttack	= 0.0
			self.FDefense = 4.0
			self.FAttack = 4.0
			self.nUses= 2
			self.ObjId=ObjStore.GetNewId() # Para identificarlo al grabar/guardar
			ObjStore.ObjectsStore[self.ObjId]=self
		
		
	def UseStart (self, ObjectName, use_from):
		if use_from==Actions.USE_FROM_INV:
			object= Bladex.GetEntity(ObjectName)
			if object: 
				object.UseFunc= 0
			Bladex.AddScheduledFunc(Bladex.GetTime()+self.UseTime, self.UseEnd,(ObjectName,self.UsedBy), ObjectName+"_UseEnd")
			

	def UseEnd (self,ObjectName, UserName):
		self.nUses= self.nUses-1
		if self.nUses<1:
			user= Bladex.GetEntity(UserName)
			if user:
				inv= user.GetInventory()
				if inv:
					inv.RemoveObject(ObjectName)
					object= Bladex.GetEntity(ObjectName)
					if object: object.SubscribeToList("Pin")
					return
		
			# In case of any problems obtaining handles etc...
			Bladex.AddScheduledFunc(Bladex.GetTime()+self.UseTime, self.UseEnd,(ObjectName, UserName), ObjectName+"_UseEnd")
		else:
			object= Bladex.GetEntity(ObjectName)
			if object: 
				object.UseFunc=self.UseStart
			
			
			

			
			
			
class ShieldGem (MagicGem):
	def __init__ (self, me):
		MagicGem.__init__(self, me)
		self.UsedBy= "Player1"
		self.Age_num=0
		self.UseTime= 1.0
		self.nUses= 1
		
		self.Name=me.Name
		if Language.Current == "Spanish":
           		MenuText.ForeingDict['Shield Gem'] = 'Gema Escudo'
		Reference.EntitiesSelectionData[self.Name]=(8,4000,MenuText.GetMenuText('Shield Gem'))
		
		
		
	def UseStart (self, ObjectName, use_from):
		
		me=Bladex.GetEntity(self.UsedBy)
		try:
			if me.Data.MagicShieldAct==1:
				Actions.ReportMsg("I already have a magic shield")
			else:
				magsh=MakeMagicShieldX(ObjectName+"_MagicShield", me)
				print"MagicShield on"
				object= Bladex.GetEntity(ObjectName)
				if object: 
					object.UseFunc= 0
				Actions.ReportMsg("Magic Sheild Activated")
				self.UseEnd(ObjectName,self.UsedBy)
		except AttributeError:
			magsh=MakeMagicShieldX(ObjectName+"_MagicShield", me)
			object= Bladex.GetEntity(ObjectName)
			if object: 
				object.UseFunc= 0
			self.UseEnd(ObjectName,self.UsedBy)
			print"MagicShield on"
			Actions.ReportMsg("Magic Sheild Activated")
		
		

	def UseEnd (self,ObjectName, UserName):
		me=Bladex.GetEntity(UserName)
		MagicGem.UseEnd (self, ObjectName, UserName)
		





def MakeSheildGem(name,pos):
	shgem=Bladex.CreateEntity(name,"Gemapurpura",pos[0],pos[1],pos[2], "Weapon")
	shgem.Scale=1.4
	shgem.SelfIlum=-1
	shgem.Impulse(0,0,0)
	shgem.Data=ShieldGem(shgem)
	return shgem.Data
	
	
	
	
	
	
"""
Create in objs.py with:


import magicsheild

gem1=magicsheild.MakeSheildGem("ShieldGem1",(1000,-2000, 9000))
gem2=magicsheild.MakeSheildGem("ShieldGem2",(4000,-1000,-7000))

etc.....




"""

User avatar
MBK_MBK
Dragon
Posts: 413
Joined: Sun Jun 19, 2011 9:06 am
Location: Spain
Contact:

Post by MBK_MBK »

Thank you very much Prospero! [:)]

MingYue, I hope this code can help you. [;)]

Post Reply