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

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

Re: Level Editing: Scripting

Postby MBK_MBK » Sat Oct 01, 2016 7:55 pm

def timerfunctionOFF (self):#
me=Bladex.GetEntity (self.Name)# Get access to entity
me.RemoveFromList ("Timer15")# remove timer linked to that entity
me.TimerFuncs=""# remove function link
me.SuscribeToList ("Timer15")# but then create such timer again
me.Wuea=Reference.WUEA_ENDED# set Reference.WUEA_ENDED value for Wuea param, so when LaunchAnimation function will be called the current animation will be interrupted

Seems 4th line of this function is unwanted
Thank you, Tomash :)
Yes, sometimes still crash the game with these...
Should I to move the 4th line to put it before the second line or the 3rd? I will try later.
SuscribeToList can "create" and "erase"? :?:
Loose your ghosts, because they chain suspiciously your freedom.
My Youtube channel, tests with Hyperborean Mod:
https://www.youtube.com/user/MBEASTKING1980
Web site of Hyperborean mod:
https://sites.google.com/view/bodhyperboreanmodbymbk

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

Re: Level Editing: Scripting

Postby Tomash » Sat Oct 01, 2016 9:48 pm

The rational way is to add timer right before the using of TimerFunc tool and to remove timer right after the action is done
SuscribeToList can "create" and "erase"?
Yes, depending on argument

livid
Whelp
Posts: 17
Joined: Sat Jun 03, 2017 11:00 am

Re: Level Editing: Scripting

Postby livid » Sat Jun 03, 2017 11:24 am

Hello everyone.
I have been messing around with a map lately and making a very simple cutscene with an animation, a text on screen, an aura effect and a couple of camera movements. It triggers when I grab an specific weapon. Everything works OK... that's if I haven't saved/loaded the game before starting the cutscene. It only shows the aura and the camera moves around, but neither the animation nor the text seem to work after loading the game.
The cutscene is in DefFuncs.py while the weapon is in weapons.py. The console doesn't show anything.
Any ideas as to why this happens?

Also, this doesn't seem to work either, not even before saving/loading. The character just won't turn around to look at the bed:

Code: Select all

Actions.TurnToFaceEntity, ("Player1","Bed")

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

Re: Level Editing: Scripting

Postby Tomash » Sat Jun 03, 2017 1:16 pm

Actions.TurnToFaceEntity, ("Player1","Bed")

Syntax error

livid
Whelp
Posts: 17
Joined: Sat Jun 03, 2017 11:00 am

Re: Level Editing: Scripting

Postby livid » Sat Jun 03, 2017 2:45 pm

Actions.TurnToFaceEntity, ("Player1","Bed")

Syntax error
Whoops, I overlooked it. It works now, thanks for pointing it out Tomash. I'm just starting with all of this.
The problem with saving/loading is still there though, making me go crazy. I'll need to fix it if I want to make a playable map one day, but my newbie eyes can't spot the issue. Not being able to save is never good.

If someone has had that problem before, help me out please.

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

Re: Level Editing: Scripting

Postby prospero » Sun Jun 04, 2017 4:28 am

Hi livid. :D

Savegames are always a pain. If you can't figure it out you can mail me the map and
I'll see if I can debug it if you like.

[email protected]

livid
Whelp
Posts: 17
Joined: Sat Jun 03, 2017 11:00 am

Re: Level Editing: Scripting

Postby livid » Sun Jun 04, 2017 2:19 pm

Hello Prospero :)
Thanks, but it seems I have fixed it somehow... for now. However, I'm sure something will happen again that I won't be able to fix, so I'm now relieved to know that if something goes wrong, I can have help from none other than Prospero!

BTW, I'm using this to make camera movements. It's simple enough for me to understand, and I can make it work, but I'm not exactly sure how the coords work.

AbreCam.AddNode ( (-1900,-1500,-1400),(3000,-1580,-4), 0)
AbreCam.AddNode ( (-1800,-1700,-2000),(0,-1000,0), 6)
AbreCam.AddNode ( (-2600,-2400,-1900),(0,-1300,0), 6)

My guess is: "(-1900,-1500,-1400)" is where the camera starts, "(3000,-1580,-4)" is where it looks at.
Then goes to "(-1800,-1700,-2000)", looking at "(0,-1000,0)" over 6 seconds. And the same for the next one.
After that, it returns to the character's back.

I have also been trying to add combos to different weapons and it seems easy, but I have some questions:

Code: Select all

dwf=Bladex.GetCharType("Dwarf_N","Dwf") dwf.AllowAttack("GM15_1H","&L","GM14_1H","","GM14_1H_Window","Martillo")
As the Dwarf, this one lets me do the War Axe combo with the hammer, but I have seen that some maps have it so you can unlock that combo at, say, level 5 instead. How can I do that? I just copied the code and replaced the weapon name, I have literally no idea what the meaning of everything else is.
For example, take a look at this, from Olympus map. Northern Lights one level later and omitting the cross attack:

Code: Select all

kgt=Bladex.GetCharType("Knight_N","Kgt_N") #simpyfied northern lights combo, level 19 needed, attack + left AND right kgt.AllowAttack("GM37_1H","R+L","","","GM23_1H_Window","Espadon")
But I don't see anything that refers to the level.

And yet another question...
How can I change the name/power of an specific weapon in the map, while leaving the rest of that kind with their usual names/power?
I can change the name for the weapon (all of them get that name), but they go back to their real name after loading a game, although this bug is in a lot of maps like Fugitive I. It does not seem to happen when I do that to the Minotaur club or the meat cleaver... they keep their new name after loading.

Thanks.

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

Re: Level Editing: Scripting

Postby prospero » Mon Jun 05, 2017 11:52 am

You can edit the combo levels like this:

From Combos.py...


bar=Bladex.GetCharType("Barbarian_N","Bar")

bar.AddAttack("GM12_2H","Bar_g2h_b6low")
bar.AttackWindow("Bar_g2h_b6low",0.338,0.470,"GM12_2H_Window")
bar.AssignTrail("GM12_2H","","EstelaRoja1")
bar.AddLevels("Bar_g2h_b6low",7,40)

The 7 parameter on the last line demotes the level, which will actually be level 8 (Python counts from 0)

On a mod you need to circumvent this code from within the mod. Not a good idea to edit source files.


Btw. Although you can enable combos at lower levels they may not work because of the energy required.

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

Re: Level Editing: Scripting

Postby prospero » Mon Jun 05, 2017 12:09 pm

The weapon names/power is easy enough. You do need to put the code in DefFuncs.py however
to ensure savegame integrity. When a game loads there are several key files that are executed.
DefFuncs is one. All the others are executed only on first load, otherwise all the obs/enemies and
such would be duplicated.


for single objs names...
import Reference

Reference.EntitiesSelectionData['IndividualWeapon']=(8.0,4000.0, "OrcKnobbler")

8.0 is the priority, 4000.0 is the range where the label appears.

for power stuff, etc....

Reference.EntitiesObjectData['IndividualWeapon']=Reference.[OBJ_WEAPON, 2, 0, 2.3, Reference. THR_SPINNING, [Reference.W_FLAG_1H,]]

The one to edit is the 2 which denotes the power. The others are not so important but they all have a purpose.

livid
Whelp
Posts: 17
Joined: Sat Jun 03, 2017 11:00 am

Re: Level Editing: Scripting

Postby livid » Tue Jun 06, 2017 6:57 pm

Thanks Prospero, that was very helpful.
However, the name when I go through my weapons in my inventory is not the same I assigned. I can only see the custom name while it's on the ground, like when I give it a hint name.

Btw...
What do I have to write there ↓ to make the weapon go straight when I throw it (Chaos Sword)?
Reference.EntitiesObjectData['IndividualWeapon']=Reference.[OBJ_WEAPON, 2, 0, 2.3, Reference. THR_SPINNING, [Reference.W_FLAG_1H,]]
And what if I change 1H to 2H? Does it become two-handed?

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

Re: Level Editing: Scripting

Postby prospero » Tue Jun 06, 2017 8:01 pm

I don't know about the label thing.... I'll have a play later. :D As far as I know or can remember
it should work. :roll:

if you change THR_SPINNING to THR_STRAIGHT it won't rotate when you throw.


W_FLAG_1H to W_FLAG_2H will make it 2-handed. But Knight,Dwarf and Amazon will handle it
like a 'clumsy' weapon.

livid
Whelp
Posts: 17
Joined: Sat Jun 03, 2017 11:00 am

Re: Level Editing: Scripting

Postby livid » Wed Jun 07, 2017 2:49 am

Thanks again!
If I use DefaultObjectData instead, the label does work in the inventory but it goes back to its original name after loading a game too, even if it's in DefFuncs... except if the weapon is the minotaur cudgel or the meat cleaver. Weird, but this also happens in Fugitive I, NamiurAL and a couple of maps so I think it's not our fault :|

Also, I'm having a weird issue with the Dark Knight. When I add one to my map, he doesn't play the alert sound when he spots me, no sound at all, but his sounds work as they should apart from that. It says "InsultoDkn1.wav not found", but it works fine in other maps...(using Spanish version) Could there be something missing in mine?

Just one more simple question... how can I make an aura dissapear? I mean, an aura attached to a weapon, such as...
aura=Auras.MakeAura("Weapon",-1, (30, 1.0, 0.6, 0, 0, 1),(),(),(2, 1, 0.5, 0.7, 0.6, 0.3 , 0.2, 0.4, 0.7, 0.4, 1.0))

I'll post more questions as they pop up. Thanks for answering.

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

Re: Level Editing: Scripting

Postby prospero » Wed Jun 07, 2017 5:31 pm

aura.SetAuraActive(0)

Is one way. It's an instant switch off though. Making it fade an die is a lot more complicated.

Best way is to fins something in the game that suits and try and find the code for it.

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

Re: Level Editing: Scripting

Postby prospero » Thu Jun 08, 2017 2:24 am

OK. I did find a solution to the savegame labels getting lost.

It's a tad complicated but it's the only surefire way that I know of.

The reason the stone club label works is that in the main game it's not pickupable. So if you give it a label
in a mod that is the only time it's defined. Regular usable weapon new labels get overwriiten in a savegame
load. It's a question of inserting the code earlier in the load routine.


Create a file objs_def.py and list all your new weapon stats/names....

e.g.

Code: Select all

import Reference import Bladex def InitNewStuff(): Reference.DefaultObjectData['Pike1']= [Reference.OBJ_WEAPON, 3, 0, 2.0, Reference.THR_SPINNING, [Reference.W_FLAG_SP,Reference.PI,2000,750,100,100,Reference.GolpeArmaEscudoMetal]] Reference.DefaultSelectionData['Pike1']=(8.0,4000.0, "Pike") Reference.DefaultObjectData['Pike2']= [Reference.OBJ_WEAPON, 3, 0, 2.0, Reference.THR_SPINNING, [Reference.W_FLAG_SP,Reference.PI,2000,750,100,100,Reference.GolpeArmaEscudoMetal]] Reference.DefaultSelectionData['Pike2']=(8.0,4000.0, "Pike") Reference.EntitiesSelectionData["Gema_3376"]=(0.0, 0.0, "") # and so on....

In cfg.py do this.

Code: Select all

import obj_def obj_def.InitNewStuff() execfile("..\\..\\Scripts\sys_init.py")
It must be at that exact point. Before execfile("..\\..\\Scripts\sys_init.py")

Then you need a file ActorsInit.py. This is a key file and must have that name.
Put this code in it...

Code: Select all

import obj_def obj_def.InitNewStuff()
ActorsInit.py is usually used to load extra animations but is handy because of it's place in the load routine.

Actually, it's not that complicated. Just a bit long to explain. :P

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

Re: Level Editing: Scripting

Postby prospero » Thu Jun 08, 2017 2:26 am

:o I don't know what is wrong with the code tags. They are suppose to preserve the formatting but
apparently they don't. Hope you can pick the bones out of it.


Return to “Severance BoD: Modding Community”

Who is online

Users browsing this forum: No registered users and 1 guest

cron