Petri consumes glögg and codes with you

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
LordYig
Posts: 175
Joined: Wed Jul 04, 2012 5:45 pm

Re: Petri consumes glögg and codes with you

Post by LordYig »

petri wrote:http://i.imgur.com/VdTj3.jpg
And this is how it's done:
Freaking awesome ! :o
flatline

Re: Petri consumes glögg and codes with you

Post by flatline »

Amazing indeed. Looking forward to the patch!
Grimwold wrote:I was keen for a way to make monsters flee for a time.. alternative solutions would be

#1 a new AI type = flee (instead of default or guard)

#2 monster:setFlee(5)
to make it flee the party for 5 seconds.

#3 monster:setSight(0)
set the sight of the monster on the fly so that it would at least wander
Oh, and this +1
Last edited by flatline on Tue Dec 04, 2012 10:06 pm, edited 1 time in total.
User avatar
petri
Posts: 1917
Joined: Thu Mar 01, 2012 4:58 pm
Location: Finland

Re: Petri consumes glögg and codes with you

Post by petri »

Ok, folks, our time is up! Thanks to all for ideas & participating!

Here is the complete changelog and documentation for the new gui system:

- lever click box can be adjusted by placing a Node named "lever_node" in the model file
- added Item:insertItem(slot, item), Item:removeItem(slot), Item:getItem(slot) and Item:getItem(slot)
- added new LightSource property: flicker (default value is true)
- added new optional 15th parameter for shootProjectile(): championOrdinal
- added Item:onEquipItem(champion, slot) and Item:onUnequipItem(champion, slot) hooks (works for all inventory slots)
- added Monster:setPosition(x, y, level, facing) and Party:setPosition(x, y, level, facing) for instantly teleporting the monster or party
- bug fix: shootProjectile's offsetX, offsetY, offsetZ parameters don't work
- added onGuiDraw, onDrawInventory, onDrawSkills, onDrawStats hooks to Party class for implementing custom guis (see below)

onGuiDraw hook is a Lua function which receives a single argument, a graphics context which can be used to draw custom gui graphics to the screen. The context has the following properties and methods:

width returns the width of the screen
height returns the height of the screen
color(r,g,b,a) set the pen current color
drawRect(x, y, width, height) draws a filled rectangle with current pen color
drawImage(filename, x, y) draws an image modulated with current pen color
drawText(text, x, y) draws a line of text with current pen color
button(id, x, y, width, height) returns true if the mouse was clicked in the given button rectangle

Buttons must be identified by unique string IDs.

onDrawInventory, onDrawSkills and onDrawStats are called when the corresponding page of the character sheet is visible. These functions receive a secondary parameter, the champion whose sheet is currently visible.

For example,

Code: Select all

cloneObject{
	name = "party",
	baseObject = "party",
	onGuiDraw = function(g)
      -- draw transparent background
      g.color(30,30,30,150)
      g.drawRect(30, 50, 345, 300)

      -- draw the portrait
      g.color(255,255,255,255)
      g.drawImage("assets/textures/portraits/human_female_01.tga", 40, 60)

      -- draw some text
      g.color(255, 128, 128)
      g.drawText("Well, Hello", 200, 80)
      g.color(128, 128, 255)
      g.drawText("Grimrockers!", 200, 95)

      -- draw button with text
      g.color(128, 128, 128)
      g.drawRect(200, 120, 115, 20)
      g.color(255, 255, 255)
      g.drawText("How u doing?!", 210, 135)

      -- button logic
      if g.button("button1", 200, 120, 115, 20) then
         hudPrint("*kick in the groin*")
      end
   end,
}
Ancylus
Posts: 50
Joined: Thu Oct 11, 2012 5:54 pm

Re: Petri consumes glögg and codes with you

Post by Ancylus »

I agree with the others, you're doing wonderful work, Petri!

As for suggestions, could you add Item:setPosition method, too?

Other things that occur to me are a method for controlling the exact angle at which an item is placed on the ground for situations where the normal random variation isn't fitting, and Item:getSubtileOffset method.
User avatar
HaunterV
Posts: 676
Joined: Mon Apr 16, 2012 9:54 pm
Location: Barrie, Ontario, Canada

Re: Petri consumes glögg and codes with you

Post by HaunterV »

We can have monster health bars over their heads now if we wanted... Via a spell of course.
Grimrock Community 'FrankenDungeon 2012. Submit your entry now!: http://tinyurl.com/cnupr7h
SUBMIT YOUR ASSETS! Community Asset Pack (C.A.P.): http://tinyurl.com/bqvykrp
Behold! The HeroQuest Revival!: http://tinyurl.com/cu52ksc
User avatar
Xanathar
Posts: 629
Joined: Sun Apr 15, 2012 10:19 am
Location: Torino, Italy
Contact:

Re: Petri consumes glögg and codes with you

Post by Xanathar »

Wow Petri, thanks!
:)
Waking Violet (Steam, PS4, PSVita, Switch) : http://www.wakingviolet.com

The Sunset Gate [MOD]: viewtopic.php?f=14&t=5563

My preciousss: http://www.moonsharp.org
User avatar
thomson
Posts: 337
Joined: Thu Sep 13, 2012 9:55 pm
Location: R'lyeh
Contact:

Re: Petri consumes glögg and codes with you

Post by thomson »

There are couple questions that everyone (community wide, I presume) would like to ask: Will those new goodies (together with result of the previous beverage enhanced coding sprint) be released soon or do we have to wait till OSX version is released? In any case, is there anything we can do help speed this patch up? Would OSX testers be helpful for you in any way?
[MOD] Eye of the Beholder: Waterdeep sewers forum sources; Grimtools (LoG1 -> LoG2 converter) sources
User avatar
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: Petri consumes glögg and codes with you

Post by JKos »

It's truly amazing indeed, but from that documentation I could not quite get it how the onGuiDraw get's triggered. If it's called continuously by small interval then it it's super awesome and gives endless possibilities for custom GUIs.
- LoG Framework 2http://sites.google.com/site/jkoslog2 Define hooks in runtime by entity.name or entity.id + multiple hooks support.
- cloneObject viewtopic.php?f=22&t=8450
User avatar
petri
Posts: 1917
Joined: Thu Mar 01, 2012 4:58 pm
Location: Finland

Re: Petri consumes glögg and codes with you

Post by petri »

All gui drawing hooks are called every frame so you can build animated guis or even complete mini games :)
User avatar
JKos
Posts: 464
Joined: Wed Sep 12, 2012 10:03 pm
Location: Finland
Contact:

Re: Petri consumes glögg and codes with you

Post by JKos »

Ok, now I get it that's just perfect. Thanks again.
- LoG Framework 2http://sites.google.com/site/jkoslog2 Define hooks in runtime by entity.name or entity.id + multiple hooks support.
- cloneObject viewtopic.php?f=22&t=8450
Post Reply