126

(0 replies, posted in Tutorials/Examples)

Here is some examples that might be useful for people who wish to learn more about making a game in Maratis:

http://forum.maratis3d.com/viewtopic.php?id=522 Rayhit function
http://forum.maratis3d.com/viewtopic.php?id=509 Bullet script
http://forum.maratis3d.com/viewtopic.php?id=508 Adding gravity

http://forum.maratis3d.com/viewtopic.php?id=514 Making text not colliding with objects
http://forum.maratis3d.com/viewtopic.php?id=506 If models too dark
http://forum.maratis3d.com/viewtopic.php?id=505 Characters and how animation affect physics.

Oh yeah, and dont forget this tutorial: http://www.dev-hq.net/lua/

It's great.

Hey! I thought this was a useful tutorial so I'm gonna put it up.

If you want to add, lets say 1 bullet to a variable then first you need to set up a variable for the bullet before the function onSceneUpdate().

So first you write:

bullet = 0 (remember that the variable "Bullet" is not the same as "bullet")

and then the next part is to add increment. You do it like this.

Write a function for it before the onSceneUpdate():

function increment(i)

       return i + 1

end

Then, inside onSceneUpdate function you write:

if onKeyDown("R") then

bullet = increment(bullet)

end

That will increase the bullets value by one. And if you want to see it happen in-game then just add a text to maratis from a true-type file (.ttf) and write Text0 = getObject("Text0") in the first row. And then inside onSceneUpdate function write:

setText(Text0, "Bullet: " .. bullet)

This will first set the text Text0 to the string (letters) "Ammo: " and then after that it will put the variable bullet. The two dots is for separating the string "Ammo: " and the variable bullet. So any time you want to separate any kind of texts or variables you have made just make two dots inbetween.

Next off if you want to decrease bullet, just add a decrement function before the onSceneUpdate function:

function decrement(i)

      return i - 1

end

and write following code inside onSceneUpdate() function:

if onKeyDown("MOUSE_BUTTON1") then

     bullet = decrement(bullet)

end

this will decrease the bullets value with 1.

This is the full code written together:


Text0 = getObject("Text0")
bullet = 0

function increment(i)

      return i + 1

end

function decrement(i)

      return i - 1

end

function onSceneUpdate()

      if onKeyDown("R") then

          bullet = increment(bullet)

      end

      if onKeyDown("MOUSE_BUTTON1") then

           bullet = decrement(bullet)

      end

end



Play around with it! See what you can do! smile





(Say what you think about the tutorial so I can fix any errors or any lack of clarity you might see)

128

(10 replies, posted in Scripting)

Hey, the point that you get from the rayhit-function. Can you get that somehow to match with different objects so you can make scripts depending on what it hits?

129

(9 replies, posted in General)

Nevermind, I got this working. smile

130

(9 replies, posted in General)

Hey, now it's the same problem again. But I have assigned all the meshes and parented the meshes with the bones. So what's wrong this time?

I made an eating-animation.

http://www.mediafire.com/?1i3p82j9kguc28c

131

(2 replies, posted in Gossip)

Maratis is totally awesome!

132

(9 replies, posted in General)

Thanks! Now everything works.

133

(9 replies, posted in General)

Ah, weight-painting? I cant use the automatic weights. It makes the mesh look totally wierd.

134

(9 replies, posted in General)

Thanks Zester!

Anael, exactly, what is needed to be done?

135

(9 replies, posted in General)

Hey!

http://www.mediafire.com/?qlgh0r0qcw05tzd

When I export this blenderfile the animations doesn't follow into maratis, why?

This happened before, I guess it's time to ask about it.

Pär

136

(9 replies, posted in Scripting)

This is great, thank you. It works perfectly!

137

(9 replies, posted in Scripting)

I guess I have written a little too much on the forums lately and asking abit too much. My game is coming along really great, and now the only thing that's needed is a combat system. I have recently started to build an AI-system which makes enemys go somewhat randomly in the world. The only thing that's needed now is that I want to know if I have used the script up above correctly or if something is needed to make it work correctly.

138

(0 replies, posted in General)

More video-tutorials on using certain advanced functions like enableCameraLayer and Rayhit would be great. It's just an idea to add to the examples-section on the wiki.

139

(9 replies, posted in Scripting)

Nice, now I understand it more clearly.

guntip = getObject("guntip")

    Apos = getPosition(guntip)
       
    A = {Apos[1], Apos[2], Apos[3]}
        B = {100, 0, 0}
   
    if onKeyDown("MOUSE_BUTTON1") then
        point = rayHit(A, B)
        if point then
        print(point)   
        end
    end

This is what I came up with, is it used correctly?

140

(9 replies, posted in Scripting)

Hello! Could someone please explain to me how to use Rayhit?

   function onSceneUpdate()
       start = {0, 0, 0}
       end = {100, 0, 0}
       point = rayHit(start, end, object)
       if point then
           print(point)
       end
   end

I understand that it goes from the start to the end and if it intersects with an object it prints out "point" in the console. What I don't understand is from where the ray starts from.

141

(29 replies, posted in Scripting)

And what does the co-ordinates mean with {100, 0, 0} in end1? Is it that it stops after it has reached 100 steps in the X-axis?

function onSceneUpdate()
       start = {0, 0, 0}
       end1 = {100, 0, 0}
       point = rayHit(start, end, object)
       if point then
           print(point)
       end
   end

The way I see it is that you use "object" to see if it hits something within the range of start and end1, is this correct? And if so it prints out point in the Maratis-console.

142

(29 replies, posted in Scripting)

http://www.mediafire.com/?ae969pctg5v04za Am I using the script correctly? I have put it just under the fire-section.

This is also awesome, nice! Now I can make my game even greater! smile So I just need to

  GuiScene = getScene("GuiScene")
   Camera0 = getObject("Camera0")
   enableCameraLayer(Camera0, GuiScene)

and it will automatically get the other scenes camera-angle and use the gui for the first game-scene?

144

(29 replies, posted in Scripting)

Thank you, this is exactly what I was looking for. smile

How do you make the text "layer" over the graphics so it doesn't disappear all the time?

146

(29 replies, posted in Scripting)

Cool!

147

(29 replies, posted in Scripting)

Yes! Thanks.

148

(2 replies, posted in General)

Hm, somehow it solved. I unclicked textured solid and exported it as a different mesh name. Then in the editor it looked fine. tongue

Could you do me a favor and look at my bullet script?

Edit: I textured-painted it. smile

149

(2 replies, posted in General)

Hey, I made this blender file:

http://www.mediafire.com/?43zc0cvtccocsor
http://www.mediafire.com/view/?pem8c7h7opm0hzi

And the texture wont follow into maratis. smile Why?

150

(29 replies, posted in Scripting)

Wow! It looks really good! Can you upload it to another mediasite? Google has a hard time.