Jump to content

Insite into how to use new system of lua scripts


Jim
 Share

Recommended Posts

Could someone give me more detail instructions on how to get the lua scripts attached with the entity so they work together. The old way was to attach the scripts to the entity but now you can only attach one script. If you have several scripts that you want to effect that entity, how do you do this under the new system so that they will be recognized and interact. By that I mean you can call the functions and the variables in other scripts and they are recognized.

Link to comment
Share on other sites

Not sure what you mean. You can attach more than 1 script to an entity as far as I know. Also as far as I know you access the other scripts by their name off the entity variable like entity.scriptname:function(). Note I think scriptname has to be all lowercase to work.

Link to comment
Share on other sites

It has changed :

- Select your entity

- in the panel of bottom panels (general, appearence,physics) , you have now a tab by default named "script"

- go to that tab and choose a script

You can't no more choose several scripts per entity.

Stop toying and make games

Link to comment
Share on other sites

So that's what Josh meant when he sent me an IM asking how I liked the single entity system. Why in the world was that changed? Doesn't that sort of screw up scripts like the animation manager which does 1 task and does it well, while still allowing us to attach other functionality to entities?

 

That also screws up the flowgraph scripts like http://www.leadwerks.com/werkspace/files/file/430-next-level/. *sigh*

 

 

Was there an explanation somewhere for why that changed?

Link to comment
Share on other sites

What you do know is attach one script then include other scripts from that one for example I attach a player script and the top line of that is

require "Scripts/Animation/AnimationManager.lua"

check the Darkness Awaits scripts.

Elite Cobra Squad

Link to comment
Share on other sites

I'm not at home but I assume that script is reworked then to not have the Start()/Update() functions like the entities did? If so, is it like a class and we have to make the object, or just turned to functions and global variables defined in it?

 

This is a bummer for component design :( Component design needs a way to link the components (and this is the game specific code) so that each component can be unaware of other components. Doesn't sound like that was being done and instead the linking was happening right inside each component, which if that was the route of course doesn't make a ton of sense, but oh well. The flowgraph still eixsts so that's still a win for components.

Link to comment
Share on other sites

What you do know is attach one script then include other scripts from that one for example I attach a player script and the top line of that is

require "Scripts/Animation/AnimationManager.lua"

check the Darkness Awaits scripts.

What you do know is attach one script then include other scripts from that one for example I attach a player script and the top line of that is

require "Scripts/Animation/AnimationManager.lua"

check the Darkness Awaits scripts.

 

I have done this and it appears that the require lua script command does not run the script so the Script:Start() function is not run and some things are not initiated on start.

Link to comment
Share on other sites

Yeah the Animation script has been redone without a Start() etc.

 

As well as the require I think all that needed adding to the Start() of your entity code was

self.animationmanager = AnimationManager:Create(self.entity)

 

Also in your code where it would have said

self.entity.animationmanager:SetAnimationSequence(self.sequence.idle,0.05,200)

replace any self.entity with self.

 

I have yet to look at flowgraphs but they do look intresting and I imagine i will use them a lot.

I wonder if Aggror has done a tutorialbiggrin.png

Elite Cobra Squad

Link to comment
Share on other sites

I have a tutorial on the lua flowgraph but it is completely useless now.

I am holding back on a new tutorial for now until it is a little more clear what the new system does for us. Don't get me wrong, I want to make a video about it, but the new system confuses me in its approach.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...