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

Kn1MS
Whelp
Posts: 20
Joined: Sun Apr 08, 2018 6:26 pm

Re: Level Editing: Scripting

Postby Kn1MS » Sun May 06, 2018 5:48 pm

Thanks, at first I thought these are different enemy classes.

Kn1MS
Whelp
Posts: 20
Joined: Sun Apr 08, 2018 6:26 pm

Re: Level Editing: Scripting

Postby Kn1MS » Thu May 10, 2018 7:10 pm

Hi there guys, it's me again. :D
The tutorials are really good, though I had to look into other people's scripts to figure out a few things. The thing is I have 2 problems I can't find any solution to. :?
1. I can't find any way to apply a texture on a lever (or to spawn a correct one?). It changes its texture depending on the view angle, it clearly doesn't work the needed way. A few screenshots:
https://puu.sh/AjzKI/26778b6128.png
https://puu.sh/AjzM9/e02ae6a679.png
https://puu.sh/AjzMp/d44f23759a.png
2. The Bladex.SetSun thing doesn't work. It just doesn't. :( I put needed coordinates into level light propeties (https://puu.sh/AjIVO/9fa563d0e7.png) and then wrote the sun code into DefFuncs file (I also tried to make a separate sol.py script for it, didn't help). Here's the line itself: Bladex.SetSun(1,10,0,15). I tried to do "10,15,0", then "10,-15,0", then "10,0,-15", yet nothing works. There are no shadows or sun anywhere. :(

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

Re: Level Editing: Scripting

Postby prospero » Thu May 10, 2018 8:06 pm

How are you going about applying the lever texture? Is it a new one you have created yourself?
You can overwrite textures without altering the 3DObjs.mmp by compiling your own bitmap into
new new .mmp file (mylever.mmp) Remember the name of the bitmap must be exactly
the same as material name compiled in the object's .BOD file. That's PALAN3
In the case of the Zocalo3 lever object. So your graphic should be named PALAN3.bmp

You need to load the new .mmp file in the .lvl file with the correct filepath. If the file is in the local map folder
you need only put Bitmaps -> newlever.mmp

Not sure whether this should be loaded before or after the Bitmaps -> ..\..\3dObjs\3dobjs.mmp line.
It works one way and not the other.... :roll:


The SetSun parameters don't conform the map coordinates as such. To be honest, I never have figured
it out completely. :oops:

There are 4 params:

First is a false/true flag. It must be 1
Second X axis
Third height. Must be a positive number
Fourth Y-axis.

It's largely a matter if trial and error. Make small adjustments and see what changes.

Try this:

Bladex.SetSun(1,-10,12,16)

I know that works.


All the sun flare code in the main game is executed in a sol.py file. I don't know why as you never get a
sunflare in a saved game. If you put the code in DefFuncs you do.

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

Re: Level Editing: Scripting

Postby prospero » Thu May 10, 2018 8:10 pm

Just spotted the problem. You seem have the third param as 0. So the sunflare/exterior light is at ground level. :D

Best to set the ext light in LED so the shadows are where you want them and use the same setting for the sunflare.

Kn1MS
Whelp
Posts: 20
Joined: Sun Apr 08, 2018 6:26 pm

Re: Level Editing: Scripting

Postby Kn1MS » Thu May 10, 2018 9:04 pm

I actually wasn't trying to change the texture, I thought the default one must work. Here's the code I used to create that lever:
door1lvr=Levers.PlaceLever("Door1Lever", Levers.LeverType3,(-5900,-1000,2500),(0.5,0.5,-0.5,0.5),0.8)
door1lvr.mode=1
door1lvr.OnTurnOnFunc=OpenDoor1
door1lvr.OnTurnOnArgs=()
door1lvr.OnTurnOffFunc=CloseDoor1
door1lvr.OnTurnOffArgs=()
I took it right from the tutorial and changed the coordinates and orientation to fit my map. It works fine but the texture is missing for some reason.
Bladex.SetSun(1,-10,12,16)

I know that works.


All the sun flare code in the main game is executed in a sol.py file. I don't know why as you never get a
sunflare in a saved game. If you put the code in DefFuncs you do.
I've tried it, but it doesn't work. :( I even changed the external light coordinates to match these numbers.

Oh, I've also found out that my map won't save the game... and the load menu is pretty bugged for some reason (https://puu.sh/AjMEg/7ccc91e6ca.png). If I run any other map everything is okay. Strange.

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

Re: Level Editing: Scripting

Postby prospero » Fri May 11, 2018 10:20 am

Have you got this code:



import GameText
GameText.MapList ['MYMAPNAME'] = 'mymapname'


...in you DefFuncs file?

It needs to be the the exact name on you map folder at the end and a CAPITALISED version
between the []s

This enables the savegame and the F1 key.




I can't think why the ext light doesn't work. :roll:

Have you any other objects in the map and if so is the texture ok an them.

Kn1MS
Whelp
Posts: 20
Joined: Sun Apr 08, 2018 6:26 pm

Re: Level Editing: Scripting

Postby Kn1MS » Fri May 11, 2018 4:41 pm

Have you got this code:

import GameText
GameText.MapList ['MYMAPNAME'] = 'mymapname'

...in you DefFuncs file?

It needs to be the the exact name on you map folder at the end and a CAPITALISED version
between the []s

This enables the savegame and the F1 key.
Yeah, I've got this code right after import lines. The folder name is "FirstMap" and the line looks like "GameText.MapList['FIRSTMAP'] = ['FirstMap']" without quotes. F1 button works though.

Have you any other objects in the map and if so is the texture ok an them.
Ugh, I've just checked one ladle I had placed on the map and it seems like it doesn't have the texture either. Something like that: https://puu.sh/Akh6u/565854333c.png. It changes depending on the angle.

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

Re: Level Editing: Scripting

Postby Tomash » Sun May 13, 2018 3:47 pm

The line:

GameText.MapList['FIRSTMAP'] = ['FirstMap']

must look like:

GameText.MapList['FIRSTMAP'] = 'FirstMap'

The value of GameText.MapList['FIRSTMAP'] must be a string, not a list

"I've just checked one ladle I had placed on the map and it seems like it doesn't have the texture either"

Seems your *.lvl file lacks some lines. Add the lines for lost textures and remove pak folder before restarting of the map

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

Re: Level Editing: Scripting

Postby prospero » Sun May 13, 2018 5:36 pm

Have you got....

Bitmaps -> ..\..\3dObjs\3dobjs.mmp

... in your .lvl file?

Kn1MS
Whelp
Posts: 20
Joined: Sun Apr 08, 2018 6:26 pm

Re: Level Editing: Scripting

Postby Kn1MS » Mon May 14, 2018 9:52 pm

The line:

GameText.MapList['FIRSTMAP'] = ['FirstMap']

must look like:

GameText.MapList['FIRSTMAP'] = 'FirstMap'

The value of GameText.MapList['FIRSTMAP'] must be a string, not a list
Thank you, that fixed the problem with saves!
Have you got....

Bitmaps -> ..\..\3dObjs\3dobjs.mmp

... in your .lvl file?
Yeah, I've looked into other people's .lvl files and found a few lines I didn't put into mine. Those bitmaps lines fixed the textures, thanks!

Upd: Wo-o-ow, the exterior light is actually working! It's just... looks like it's too low to put any shadows on the map. In fact, I've found this because of small bug with gate walls. I haven't placed any texture on them and so they could show the exterior part of the map. And here comes the sun ray! Dammit!
The pic: https://puu.sh/AmeEX/bc6c184579.png

Upd2: Oh, now I understand! I've changed the values in default properties but I forgot to change them for every sector on the map. My bad, I seem to be quite stupid. :D It all works now, finally.
https://puu.sh/Amg6D/b6a760ee38.png

Kn1MS
Whelp
Posts: 20
Joined: Sun Apr 08, 2018 6:26 pm

Re: Level Editing: Scripting

Postby Kn1MS » Wed May 16, 2018 12:15 am

Oh, umm, how do you make spike traps kill the player? I placed a few of them but they just get up and down and deal no damage.
I used this tutorial to spawn a trap.

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

Re: Level Editing: Scripting

Postby prospero » Wed May 16, 2018 1:56 am

You need to activate the damage with:


spike.MessageEvent(MESSAGE_START_WEAPON,0,0)

and deactivate it when it's finished with:

spike.MessageEvent(MESSAGE_STOP_WEAPON,0,0)


('spike' is the variable the object is assigned to. )

Kn1MS
Whelp
Posts: 20
Joined: Sun Apr 08, 2018 6:26 pm

Re: Level Editing: Scripting

Postby Kn1MS » Wed May 16, 2018 4:43 pm

You need to activate the damage with:

spike.MessageEvent(MESSAGE_START_WEAPON,0,0)
and deactivate it when it's finished with:
spike.MessageEvent(MESSAGE_STOP_WEAPON,0,0)

('spike' is the variable the object is assigned to. )
Oh, right, thanks, I've been trying to use an object instead of initial variable, that was the problem!

Kn1MS
Whelp
Posts: 20
Joined: Sun Apr 08, 2018 6:26 pm

Re: Level Editing: Scripting

Postby Kn1MS » Wed May 16, 2018 7:43 pm

Hi, it's me again! Is there any way to find the names for NPC animations without looking for 3D Max 2.5 (which I can't find anywhere)? I'd like to make a traitor knight use his taunt animation at the end of the cutscene, but devs themselves didn't use that one in their scripts, only the "relaxing" one. :(

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

Re: Level Editing: Scripting

Postby prospero » Thu May 17, 2018 4:06 pm

I think the ones you want are

Tkn_alarm01 and Tkn_alarm02


Heres a handy little function to test them..

def Anm1():
#### pers=Bladex.GetEntity("TestTraitorKnight")
####pers.LaunchAnmType("Tkn_alarm01")
####Actions.ReportMsg("Tkn_alarm01")

Bladex.AddInputAction("Anm1", 0)
Bladex.AddBoundFunc("Anm1", Anm1)
Bladex.AssocKey("Anm1", "Keyboard", "1", 1)

I have put the #s in just to preserve the indents.


Return to “Severance BoD: Modding Community”

Who is online

Users browsing this forum: No registered users and 2 guests