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

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

Post by Trinitron »

Hi Prospero. Need help.[:D]

I've established Knight_Traitor's. I wished to create something similar to it: one person says mad prayers, 3-4 persons sit and one orator. I've created 4 NPC (Knight_Traitor):

Code: Select all

ort=Bladex.CreateEntity("Orator","Ragnar",45747.1304833,-70949.3861862,-11747.6464066, "Person")
ort.Scale=1.0
ort.Angle=2.50442164777
ort.Level=18
ort.Data=AllyTypes.Dwarf_Ally(ort)
ort.SetMesh("Man9")

zr1=Bladex.CreateEntity("Zritel1","Knight_Traitor",43217.9915737,-70969.288825,-12571.4753949, "Person")
zr1.Scale=1.0
zr1.Angle=4.97801608065
zr1.Level=11
zr1.Data=AllyTypes.Dwarf_Ally(zr1)
zr1.SetMesh("Man8")

zr2=Bladex.CreateEntity("Zritel2","Knight_Traitor",42267.9528562,-70949.288825,-13734.1047714, "Person")
zr2.Scale=1.0
zr2.Angle=4.97801608065
zr2.Level=11
zr2.Data=AllyTypes.Dwarf_Ally(zr2)
zr2.SetMesh("Man8")

zr3=Bladex.CreateEntity("Zritel3","Knight_Traitor",45843.4015794,-70949.288825,-15558.4399013, "Person")
zr3.Scale=1.0
zr3.Angle=0.0283528269568
zr3.Level=1
zr3.Level=11
zr3.Data=AllyTypes.Dwarf_Ally(zr3)
zr3.SetMesh("Man7")

Everything that is necessary, has added in folder Mods/MyModFolder. I come into game and now I see such picture:

Image

I know, when put new Mesh's on any enemys - they become on 180 degrees from usual position. But why hands every which way? As to me to make that hands would be in usual position. I want that people would listen orator with normal position of hands.

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

Post by prospero »

Hi Trinitron.

It's a little glitch. You can't put NWN meshes on original RAS models.
What you will have to do is create a new race using any NWN human model and use the Traitor Knight animation set.

** You could lift the entire NUMilitiaStuff folder out of ProsperoArena3 and use that. The base model is Militia_A (Mil). These behave like Traitor Knights and you can put any NWN meshes on them.

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

Post by Trinitron »

Ah, thanks. Certainly, I could guess that a problem in it, but... Thanks you Prospero.[:)]

* Creation NPC traids....
** TEXT question next...

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

Post by Trinitron »

I do not understand. I've made so. I copied folder NUMilitiaStuff in the a folder: "NecromancerPart1/NUFiles/NUMilitiaStuff":

Code: Select all

AniSoundMilitia.py
AnmFactMilitia.py
MilitiaAnimationSet.py
MilitiaAnm_def.py
MilitiaBAct.py
MilitiaCombos.py
MilitiaData.py
MilitiaStats.py
I copied Militia_A.BOD and Man7.mmp (textures with DWII) in "NecromancerPart1/To3DChars".


I've added in file MyMap.lvl:

Code: Select all

Bitmaps -> ..\\..\\3dchars\\man7.mmp
I've added in file BLModInfo.py:

Code: Select all

MakeDirs = ['../NecromancerPart1', 
	    '../NecromancerPart1/NUFiles',
	    '../NecromancerPart1/NUFiles/NUMilitiaStuff',
	    '../NecromancerPart1/TS',
            '../NecromancerPart1/pak']

##################################################################

NewFiles[66]    = {'File': 'NUFiles/NUMilitiaStuff/AniSoundMilitia.py'           ,      'Dest': '../NecromancerPart1/NUFiles/NUMilitiaStuff'}
NewFiles[67]    = {'File': 'NUFiles/NUMilitiaStuff/AnmFactMilitia.py'            ,      'Dest': '../NecromancerPart1/NUFiles/NUMilitiaStuff'}
NewFiles[68]    = {'File': 'NUFiles/NUMilitiaStuff/MilitiaAnimationSet.py'       ,      'Dest': '../NecromancerPart1/NUFiles/NUMilitiaStuff'}
NewFiles[69]    = {'File': 'NUFiles/NUMilitiaStuff/MilitiaAnm_def.py'            ,      'Dest': '../NecromancerPart1/NUFiles/NUMilitiaStuff'}
NewFiles[70]    = {'File': 'NUFiles/NUMilitiaStuff/MilitiaBAct.py'               ,      'Dest': '../NecromancerPart1/NUFiles/NUMilitiaStuff'}
NewFiles[71]    = {'File': 'NUFiles/NUMilitiaStuff/MilitiaCombos.py'             ,      'Dest': '../NecromancerPart1/NUFiles/NUMilitiaStuff'}
NewFiles[72]    = {'File': 'NUFiles/NUMilitiaStuff/MilitiaData.py'               ,      'Dest': '../NecromancerPart1/NUFiles/NUMilitiaStuff'}
NewFiles[73]    = {'File': 'NUFiles/NUMilitiaStuff/MilitiaStats.py'              ,      'Dest': '../NecromancerPart1/NUFiles/NUMilitiaStuff'}
I've added in file InitNewChars.py:

Code: Select all

BBLibc.LoadBOD("..\\..\\3dChars\\Militia_A.BOD") 
BBLibc.ReadBOD("..\\..\\3dChars\\Militia_A.BOD")
I've made in Friends.py so:

Code: Select all

import Ally_Def
import AllyTypes

akth=Bladex.CreateEntity("Akatosh_Ptmc","Militia_A",47981.5193732,-40503.5840304,14457.2978867, "Person")
akth.Scale=1.0
akth.Angle=4.22365901287
akth.Level=19
akth.Data=AllyTypes.Dwarf_Ally(akth)
akth.SetMesh("Man7")
I've made in Cfg.py so:

Code: Select all

import sys

sys.path.append("../../Maps/NecromancerPart1/NUFiles")               
sys.path.append("../../Maps/NecromancerPart1/NUFiles/NUMilitia") 


I come into game, but game takes off. In console does not write an error. I think that an error in Friends.py

What have I forgotten to add? Imports? Or?

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

Post by prospero »

All looks Ok.

Have you got

import MilitiaData


in InitNewChars.py

?

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

Post by Trinitron »

Huhm......

Code: Select all

.lvl NecromancerPart1.lvl loaded (6.231000 seconds).
Traceback (innermost last):
  File "Cfg.py", line 73, in ?
    execfile("InitNewChars.py")
  File "InitNewChars.py", line 4, in ?
    import MilitiaData
ImportError: No module named MilitiaData
B_App::RunScriptFile() -> Error ejecutando Cfg.py 
Start optimizing Astar...B_App::LoadWorld() -> Error trying to load PP.
OK!
There are any ideas about it?[B)]

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

Post by prospero »

cfg.py

sys.path.append("../../Maps/NecromancerPart1/NUFiles/NUMilitia")

Should read


sys.path.append("../../Maps/NecromancerPart1/NUFiles/NUMilitia<font color="yellow">Stuff</font id="yellow">")

Don't know why I name all these folders with 'Stuff' at the end. I did it once and it became a habit.[:)]

btw. You also need to decleare these filepaths in ActorsInit.py for the savegame rountine.

btw2. If it's any consolation, it very rarely works first time when I install a new character.[:I]

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

Post by Trinitron »

About my God.[:p] Works. I not the attentive. Really, it was necessary to add:

Code: Select all

sys.path.append("../../Maps/NecromancerPart1/NUFiles/NUMilitia<font color="yellow">Stuff</font id="yellow">")
I as have added and have included file ActorsInit.py just in case:

Code: Select all

import sys

sys.path.append ("././Maps/NecromancerPartI/NUFiles")             
     
sys.path.append ("././Maps/NecromancerPartI/NUFiles/NUMilitiaStuff")  


execfile ("InitNewChars.py")
Thanks big for the help. btw. I'm start learning C++ and Win API 2 mounths ago. I as have started studying python-code for BOD. Earlier I not strongly understood it. Only built map. But now it is interesting to me.[:)]

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

Post by Trinitron »

Again, little question Prospero.[:)]

I now looked your map - FugitiveI. I searched for functions which start the text when you come in trigg(?) sector. There was such moment in FugitiveI: you go out of doors and there is an inscription on the screen: The old necropolis. After - music is started. I wish to make at myself the such. When I'll come into a room - should there will be such inscription on the screen. But that the inscription would appear always when I come into a room.

For example. There is a market and street. I am in a small room. I leave a room on the market - there is a message: "CHEAP MARKET". OK, we go further. I go out of doors - there is a message "NORTHERN STREET". OK, now I again go from street on the market - there is a message "CHEAP MARKET". And so on, when I'll come on street and on the market.

I've found code in DefFuncs.py:

#######

Code: Select all

######################################################################

import Language
def LoadForeingDict ():
	if Language.Current == "Spanish":
		import MenuText
    		MenuText.ForeingDict["The Old Necropolis"] = "La Vieja Necrópolis"


LoadForeingDict()



#############################################################################
######### Captions

def GetText(s):
	return MenuText.GetMenuText(s)
	
def ClearText():
	GameText.ClearText()

def TextFunc1():
	GameText.WriteTextAux(GetText("The Old Necropolis"), 5, 130,190,170,[],300)

#############################################################################


def EnterGraveyard():
	Bladex.KillMusic()
	Bladex.AddScheduledFunc(Bladex.GetTime()+1, TextFunc1,())
First. Import Text in DefFuncs.
Two. Displays the colour text.(?)
Three. It is set trigg sector.(?)

I cannot understand. What will be a full code in my DefFucs that there would be what I've written above when you will go between the market and street?[B)]

I hope you understood me.[8)]

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

Post by prospero »

Hi Trinitron.

All you really need is this:

Code: Select all

import GameText

def WriteMessage(Msg):
	GameText.AbortText()
	GameText.WriteTextAux(Msg,6.0,255,0,0,[],160)
Then use the call:

Code: Select all

WriteMessage("Hello. This is my text. Or whatever..."):

The arguments are: (text, duration,red,green,blue,[],hight onscreen)

The empty list[]is not used but you have to have it there.

It you want to vary colour, duration, etc or use multi-language I can add extra bits later.

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

Post by Trinitron »

Hi Prospero.

I'm forgot answer you.[:I] Thanks you, it's work OK. I've one more question. On many maps I saw dark blue, red light from torches. I could not understand code in WizardDomain.

What parametres are responsible for colour from a torch flame? I would like to make for the cards light from torches of red, dark blue, green colour. How to make light from torches red, blue, green?

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

Post by Trinitron »

Again missed my post.[:o)][:o)]

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

Post by prospero »

Torch light is easy.[:D]


o.Lights = [(9.0, 0.55, (255, 196, 128))]


9.0 = Intensity
0.55 = Radius??? (not sure how this works exactly)
(255, 196, 128) = r,g,b

Change rgb and you get different colours.

The actual flame is a different matter. You can't change the colour of the flame particles, only the amount:

o.FiresIntensity=[ 9.0 ]

Higher the value, lower the flame.


There are some torches in Wiz map that I made myself that have blue flames. In this case they are made with internal light only and ther is an dummy anchor on the end to link an external particle sysrem to.

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

Post by Trinitron »

Hi Prospero.[:D]

Code: Select all

o.Lights = [(9.0, 0.55, (255, 196, 128))]
I changed their millions thousand times, but I did not receive different colours (green, dark blue, red). Colour remained - orange with yellow. I therefore also have written to you, you've a thought about it?[:o)][:o)][?][:I][?]

<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by prospero</i>
There are some torches in Wiz map that I made myself that have blue flames. In this case they are made with internal light only and ther is an dummy anchor on the end to link an external particle system to.
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">
Maybe you can give a code here?

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

Post by prospero »

It only changes the colour of the light. You only notice this when it falls on other objects or world. You can't change the flame colour on RAS torches.

If you take the ProFloorTorch1 model from the Wizard map you can link any particle system to it. There is a function to make it easier:

Code: Select all


o=Bladex.CreateEntity("FloorTorch1","ProFloorTorch1",61421.2526113,23854.1414469,50387.5053331)
o.Orientation=(0.249999970198,0.933012723923,-0.0670433118939,-0.249985009432)
MakeFloorTorch(o.Name)

def MakeFloorTorch(torchname,Intens=4.0):
	tor=Bladex.GetEntity(torchname)
	tor.CastShadows=0
	x,y,z=tor.GraspPos("Top")
	tor.Lights = [(Intens, 0.03125, (25, 146, 168))]
	torps=Bladex.CreateEntity(torchname+"_Flame","Entity Particle System D1",x,y,z)
	torps.ParticleType="CoolFlame"
	torps.PPS=100 
	torps.YGravity=-4000.0
	torps.Friction=0.12
	torps.Velocity=0.0, -1700.0, 0.0
	torps.RandomVelocity=20 #30
	torps.Time2Live=14

Note: I used a custom particle system and custom bitmap to get a blue flame. It's not great but not too bad. This PS needs to be defined before assigning it to the torch.
Try it with "GreenFire" instead of "CoolFlame" as this is in InitPartcleSystems.py.

Post Reply