Jump to content

Leadwerks 3 "How do I ____?" Questions and Answers


Chris Vossen
 Share

Recommended Posts

What we can't do is copy and paste scripts in the same foledr and view like you created a new one :(

Copy is displayed and you copy.

But Paste do'nt appear ?

And we don't have rename also ? (that could be usefull for new copied scripts)

Stop toying and make games

Link to comment
Share on other sites

I have been studying the scripts for darkness awaits and understand what they do but I can;t figure out how they are called and from where they are called Whats the sequence of events?

I just don;t get this engine(yet).

amd quad core 4 ghz / geforce 660 ti 2gb / win 10

Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++

Link to comment
Share on other sites

Cassius :

It's like lot of other engine framworks :

You have start()

All inits will be here for the model attached to that script

UpdatePhysics()

Will be called each frame of the game, here you'll manage AI, animations fo your character for example

or any other stuff

 

Each script that is binded so something in the scene : Barabarian, light, a cube model etc ... will be called each frame of the game.

For example you put 2 goblins and attach goblinAI to each :

The engine will know :

Goblin1 driven by GoblinAI.lua

Goblin2 driven by GoblinAI.lua

 

Running the game :

Each frame the engine will look up at models, when it will encounter Goblins, because they have GolbinAI attached, the engine will call

GoblinAI on each goblin.

 

 

the game will call each frame the updatePhysics() of each 2 scripts:

GoblinAI for goblin 1

GoblinAI for goblin 2

 

Because variable delcared in GoblinAI are not public , it means for example HEalth variable or state_Ai variables are created for each goblin.

You can see that as instances :

Attaching GoblinAI to goblin1 in the scene create some GoblinAI instance that will manage golbin1

Attaching GoblinAI to goblin2 in the scene create some GoblinAI other new in memory instance that will manage golbin2

 

You can attach as many scripts to a model or character because the script always refers to the model it is attached to.

 

Perhaps it should be a section later on User Guide explaining that to people not knwoing events and game frameworks ?

  • Upvote 1

Stop toying and make games

Link to comment
Share on other sites

  • Set the mass to >0 and set the physics mode to character.
  • Of course, he won't move unless there is a reason for him to, so he needs a player to attack.
  • Add the animation manager script to see his animation in motion.

Or you can just drop in the goblin prefab and not worry about it.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

Straneg ? Golbins don't attack each other in the game ?

The Goblin should attack player only ?

 

They will only attack players:

 


function EnemyAttackForEachEntityInAABBDoCallback(entity,extra)

if extra~=entity then

if entity.player~=nil then

extra.goblinai:AttackEnemy(entity.player)

end

end

end

Link to comment
Share on other sites

I just pasted the goblin from the one already in the scene.I suppose its scripts were copied too. The goblins don;t fight each other.

I am missing something cos when I just drag a character on scene and add script it don;t move.

But i am using the eval version. I won;t purchase until I fully understand how it works.

 

Funny enough my le 2 game is very similar to Darkness awaits. It has a castle with red carpet and sword fights, The enemies also follow player everywhere.

amd quad core 4 ghz / geforce 660 ti 2gb / win 10

Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++

Link to comment
Share on other sites

I am missing something cos when I just drag a character on scene and add script it don;t move.

But i am using the eval version. I won;t purchase until I fully understand how it works.

 

 

Sorry, but you'll have to learn scripting.

 

A character will only move , if the script you attached make it move.

If you attached GoblinAI.LUA scritp , this script only moves when it finds a character with a script named "Player" attached to it :

 

if entity.player~=nil then

 

This means :

entity : this is the model found by detection code

.player : Is the name of the script attached to that entity

so

entity.player means AN ENTITY WHOSE ATTACHED SCRIPT IS NAMED PLAYER.

 

Or am i wrong and didn't understood anything ?

Stop toying and make games

Link to comment
Share on other sites

Guest Red Ocktober

yeah... Andy's scene does sorta remind you of Portal, doesn't it.... same (similar) artwork style... similar lighting...

 

--Mike

Link to comment
Share on other sites

Is there currently any method I can pass a varying to all shaders in one go without looping through all materials form all surfaces to find shader and send shader:SetFloat ?

(like for fog if I wanted)

 

If not could maybe mat files be used for custom varys.

Or maybe a Shader:SetGlobalFloat/vec2,3,4.. for a push out to all. (not so sure if that would be smart either)

  • Upvote 1

HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB

Link to comment
Share on other sites

There's a couple ways to approach this: material hooks, shader hooks, or global shader variables. I will have to think about it and see which is most efficient. I don't want any real-time string comparisons to be used. Because this is highly repetitive code.

  • Upvote 1

 

 

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