Level Editing: Scripting

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

Post Reply
User avatar
Trinitron
Dragon
Posts: 307
Joined: Sat Jul 12, 2008 5:53 pm
Location: Russia

Post by Trinitron »

btw, in Tut15. Death of Enemies there is an error. The question in that is it really error or the conceived typing error of the author?[:D]

This example does not work. Here:


Code: Select all

ork1.Data.OldImDeadFunc=ork1.ImDeadFunc
ork1.ImDeadFunc= Ork1DED

# In DefFuncs:

def Ork1DED(entity)
    me=Bladex.GetEntity(entity)
    if me.Data.OldImDeadFunc(entity)
         me.Data.OldImDeadFunc(entity)
    print "Ork1 is dead..hahahahaha. Opening door"
    door1.OpenDoor()



If to add '<font color="yellow">:</font id="yellow">', function will work


Code: Select all

ork1.Data.OldImDeadFunc=ork1.ImDeadFunc
ork1.ImDeadFunc= Ork1DED

# In DefFuncs:

def Ork1DED(entity)<font color="yellow">:</font id="yellow">
    me=Bladex.GetEntity(entity)
    if me.Data.OldImDeadFunc(entity)<font color="yellow">:</font id="yellow">
         me.Data.OldImDeadFunc(entity)
    print "Ork1 is dead..hahahahaha. Opening door"
    door1.OpenDoor()

User avatar
Trinitron
Dragon
Posts: 307
Joined: Sat Jul 12, 2008 5:53 pm
Location: Russia

Post by Trinitron »

prospero, you could check up files with VMBlackKnigth?

I have corrected the name, that you have resulted above - all does not work exactly.[B)]
Probably it would be better, if you lay out ready (only in scripts), a map ready to application....[:I]

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

Post by prospero »

Yes, I will do it to-night if not too tired.[|)]

Thanks for spotting my code error.[:D]

...You are learning.[;)]

User avatar
Tomash
Dragon
Posts: 247
Joined: Sat Oct 25, 2008 11:23 am
Location: Russia
Contact:

Post by Tomash »

When you have large group of hidden enemies, and you want to unhide them in following case:
First some emenies appear. When one of them die(any one) the next enemy appears.
You can use following code:

#Enemies must be named like 'enm_1' , 'enm_2' ... With ' not "
#And after enemy creating code you shall write:
o.Data.ImDeadFuncPlus = o.ImDeadFunc
o.ImDeadFunc = NextEnemyAppears

# In DefFuncs make a function:

k=2 # If 2 enemies appear first

def NextEnemyAppears(HowManyEnemiesDie):
________global k
________global prenumber
________global number
________global enmname

________Bladex.GetEntity(HowManyEnemiesDie).Data.ImDeadFuncPlus(HowManyEnemiesDie)
________k=k+1
________prenumber=str(k)
________number="enm_"+prenomer+"" ### we get Sk_3 , Sk_4 ...
________enmname="'"+nomer+"'" ### we get 'Sk_3' , 'Sk_4' ...
________exec_string="darfuncs.UnhideBadGuy("+enmname+")"
________exec(exec_string)

User avatar
Tomash
Dragon
Posts: 247
Joined: Sat Oct 25, 2008 11:23 am
Location: Russia
Contact:

Post by Tomash »

Hi all :)

#I want to use ghost pointer to launch function. I wrote:

ghostp=Bladex.CreateEntity("stone1","GhostPointer", -24438,-1010,16503)
ghostp.Static=1
ghostp.Scale=0.100000
ghostp.Orientation=0.504344,0.504344,-0.495618,0.495618
ghostp.UseFunc = DoSomething
darfuncs.SetHint(ghostp,"Loose Stone")

# Ghost pointer itself is created and I can see its name and select it.
#But when I select it and press "use" - it does NOT launch the function "DoSomething". What may be cause of it?)

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

Post by prospero »

Hi Tomash.

A 'Use' function needs two arguments:

Code: Select all

def DoSomething(ghostpointer, usefrom):
    print "Done Something"
You rarely need to make use of them, but they need to be defined in the function header.

User avatar
Tomash
Dragon
Posts: 247
Joined: Sat Oct 25, 2008 11:23 am
Location: Russia
Contact:

Post by Tomash »

Thanks)

User avatar
Tomash
Dragon
Posts: 247
Joined: Sat Oct 25, 2008 11:23 am
Location: Russia
Contact:

Post by Tomash »

HI :)

I made my map as a mod. And I have some trouble with mod's menu. In my MapNameMenu.py I used the code from the FIIIMenu.py, writing my names of files and path to files. And I have in console:

"Error Creating frame of class MenuWidget.B_MenuTree"

What it is? :)

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

Post by prospero »

Hi Tomash.

I have had this more than a few times. It will be a fault in the Menu.py. Quite hard to track down. If you want to send me your Menu.py, I will see if I can spot the error.[8)]

peterrobinsonfineart(at)btinternet.com

(at) = @

Some times it works if you start from the begining and make a completely new Menu.py. But delete the copy of YourMapMenu.py in Scripts folder before you run the map.

User avatar
Tomash
Dragon
Posts: 247
Joined: Sat Oct 25, 2008 11:23 am
Location: Russia
Contact:

Post by Tomash »

Hi Prospero )

I sent you my Menu.py
Message from [email protected]

User avatar
Trinitron
Dragon
Posts: 307
Joined: Sat Jul 12, 2008 5:53 pm
Location: Russia

Post by Trinitron »

Hi prospero.[8)]

Big to you thanks for that code which I have received, fashions really work.
At me it is some questions on it.

I have found in a code, that the trigger sector has co-ordinates

Code: Select all

(0, 0,-25000)
and the place where should will appear VMBlackKinght -

Code: Select all

(0,-1000,-140000)
So there is no this knight. In what a problem? I have run all map - anywhere there is no it. Explain, how to me you to game to cause it.


Still such question. In folder NUFiles there are three files - AllyNPCTypes, EnemyNPCTypes.
In these files I have found out superfluous functions, for example:


Code: Select all

	def ResetSounds(self, EntityName):
		me = Bladex.GetEntity(EntityName)
<font color="yellow">	AniSoundIrDwarf.AsignarSonidosIrDwarf(EntityName)
         		Bladex.ReadBitMap("../../Maps/ProsperoArena1/NUFiles/IrlichDwarfStuff/IrDwarf_NIcon.bmp","IrDwarfIcon")
		Reference.EnemiesScorerData[self.Name]=("IrDwarfIcon","Ird")</font id="yellow">	
		
		
	def ToolUp(self):
		me = Bladex.GetEntity(self.Name)
		rwptype=self.IrDwarfWeps[whrandom.randint(0, len(self.IrDwarfWeps)-1)]
		lwptype=self.IrDwarfShds[whrandom.randint(0, len(self.IrDwarfShds)-1)]
		if rwptype:
			rwp=Bladex.CreateEntity(me.Name+"RightWeapon",rwptype,0,0,0,"Weapon")
			ItemTypes.ItemDefaultFuncs(rwp)
			Actions.TakeObject(me.Name,rwp.Name)
		if lwptype:
			lwp=Bladex.CreateEntity(me.Name+"Shield",lwptype,0,0,0,"Weapon")
			ItemTypes.ItemDefaultFuncs(lwp)
			Actions.TakeObject(me.Name,lwp.Name)


Code: Select all

def LoadXtraAnims():
	Bladex.LoadSampledAnimation("..\\..\\Anm\\Tkn_fury.BMV","Fury",1,"Dwarf_N")
	Bladex.AddBipedAction("Dwarf_N","Fury","Tkn_fury",0.0,1.0,0)

	Bladex.LoadSampledAnimation("..\\..\\Anm\\Tkn_fury.BMV","Fury",1,"Barbarian_N")
	Bladex.AddBipedAction("Barbarian_N","Fury","Tkn_fury",0.0,1.0,0)

	Bladex.LoadSampledAnimation("..\\..\\Anm\\Tkn_fury.BMV","Fury",1,"Knight_N")
	Bladex.AddBipedAction("Knight_N","Fury","Tkn_fury",0.0,1.0,0)

	Bladex.LoadSampledAnimation("..\\..\\Anm\\Tkn_fury.BMV","Fury",1,"Amazon_B")
	Bladex.AddBipedAction("Amazon_B","Fury","Tkn_fury",0.0,1.0,0)

	<font color="yellow">Bladex.LoadSampledAnimation("..\\..\\Anm\\Tkn_fury.BMV","Fury",1,"IrDwarf_N")
	Bladex.AddBipedAction("IrDwarf_N","Fury","Tkn_fury",0.0,1.0,0)</font id="yellow">
and, maybe, other code.

Claims are not present, but this code is necessary or it can be removed, that there would be an information only on VMBK.
But, nevertheless I am am disturbed by a question on not to occurrence in game VMBK.

User avatar
Trinitron
Dragon
Posts: 307
Joined: Sat Jul 12, 2008 5:53 pm
Location: Russia

Post by Trinitron »

And still such here the question, can not considerable, but probably many the irritating.

Ladders.

What would not be ladders and inclinations - the character on them runs and often happens so, that he runs on a ladder and then as though falls from a step on a step through a step.

It can be corrected somehow or it is feature of a cursor? That for example the attraction would not be also the character did not come as invisible blocks. It is difficult to explain, as I badly know English, I hope that you have understood, that I had in view of.

That the character would be started up on ladders as the normal person and did not fall.[:o)]

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

Post by prospero »

Hi Trintron.

For ladders read steps or stairs.[:)]

If you make steps too big or too steep, the BOD engine will sense a drop and launch the appropriate animation. For realistic stairways the maximum height of the step should be about 0.5 of a LED unit.
0.3 high and 0.75 along is nice.

User avatar
Trinitron
Dragon
Posts: 307
Joined: Sat Jul 12, 2008 5:53 pm
Location: Russia

Post by Trinitron »

Hi prospero.[8)]

0.3 high and 0.75 along - thanks, I will consider on the future.

But I wished to ask probably another, after all it in any way cannot be avoided? That the cursor would not perceive falling of characters from abrupt inclinations (for example a corner in 45 degrees.) that the character somehow would run on inclinations and each time did not fall from them.

And still the question, prospero, at you works call VMBK? Scripts are on it, and it is not present on map, or you did not do, what it would be?[B)]

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

Post by prospero »

I think there is a method in the BOD engine that checks collisions many times per second to keep the characters on the ground. Sometimes if you are moving quickly they can sink through the floor. Nothing much you can do about it. If a slope is over a certain angle, the slip animation is triggered.

Not sure what you mean about the VM Knight. Doesn't he appear?

Post Reply