Page 22 of 25

Re: Level Editing: Scripting

Posted: Sat Oct 01, 2016 7:55 pm
Tomash wrote: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"? :?:

Re: Level Editing: Scripting

Posted: Sat Oct 01, 2016 9:48 pm
by Tomash
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

Re: Level Editing: Scripting

Posted: Sat Jun 03, 2017 11:24 am
by livid
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 while the weapon is in 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")

Re: Level Editing: Scripting

Posted: Sat Jun 03, 2017 1:16 pm
by Tomash
Actions.TurnToFaceEntity, ("Player1","Bed")

Syntax error

Re: Level Editing: Scripting

Posted: Sat Jun 03, 2017 2:45 pm
by livid
Tomash wrote: 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.

Re: Level Editing: Scripting

Posted: Sun Jun 04, 2017 4:28 am
by prospero
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.

Re: Level Editing: Scripting

Posted: Sun Jun 04, 2017 2:19 pm
by livid
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

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

#simpyfied northern lights combo, level 19 needed, attack + left AND right
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.


Re: Level Editing: Scripting

Posted: Mon Jun 05, 2017 11:52 am
by prospero
You can edit the combo levels like this:




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.

Re: Level Editing: Scripting

Posted: Mon Jun 05, 2017 12:09 pm
by prospero
The weapon names/power is easy enough. You do need to put the code in 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.

Re: Level Editing: Scripting

Posted: Tue Jun 06, 2017 6:57 pm
by livid
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.

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?

Re: Level Editing: Scripting

Posted: Tue Jun 06, 2017 8:01 pm
by prospero
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.

Re: Level Editing: Scripting

Posted: Wed Jun 07, 2017 2:49 am
by livid
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.

Re: Level Editing: Scripting

Posted: Wed Jun 07, 2017 5:31 pm
by prospero

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.

Re: Level Editing: Scripting

Posted: Thu Jun 08, 2017 2:24 am
by prospero
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 and list all your new weapon stats/names....


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 do this.

Code: Select all

import obj_def


It must be at that exact point. Before execfile("..\\..\\Scripts\")

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

Code: Select all

import obj_def
obj_def.InitNewStuff() 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

Re: Level Editing: Scripting

Posted: Thu Jun 08, 2017 2:26 am
by prospero
: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.