[DEVELOPER DISCUSSION] One Room Round Robin 2 (SPOILERS)

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
User avatar
Komag
Posts: 3658
Joined: Sat Jul 28, 2012 4:55 pm
Location: Boston, USA

Re: [OPEN - SIGNUP / DISCUSS] One Room Round Robin 2!

Post by Komag »

Diarmuid wrote:lightTracker.getLightState() returns true or false, checking if there is light based on the presence or not of active light spells and/or lit torches in hand.

As this was a while ago, do we have any more modern solution? If not I'll just put that script in, and everyone'll be able to use it.
I found that if I used onEquipItem and onUnequipItem hooks for the crystal ball to set flags it was a faster calculation to just check the flag than cycling through all the player's hands. Torches didn't work that way because there was always a chance the fuel burned out and it was only a dead torch, so needs to be checked at that moment.
Finished Dungeons - complete mods to play
Ancylus
Posts: 50
Joined: Thu Oct 11, 2012 5:54 pm

Re: [OPEN - SIGNUP / DISCUSS] One Room Round Robin 2!

Post by Ancylus »

I got the file from Dropbox and will start assembling my room.
User avatar
Diarmuid
Posts: 807
Joined: Thu Nov 22, 2012 6:59 am
Location: Montreal, Canada
Contact:

Re: [OPEN - SIGNUP / DISCUSS] One Room Round Robin 2!

Post by Diarmuid »

@Mahric, great, can't wait to see!

@Komag, if I'm cycling through the hands anyway for torches, checking for the orb too shouldn't add to the calcultion much, no?

@Ancylus, cool! I'll look at the file afterwards to play through both of your rooms, add in the lightTracker and fix the cube's room.
Ancylus
Posts: 50
Joined: Thu Oct 11, 2012 5:54 pm

Re: [OPEN - SIGNUP / DISCUSS] One Room Round Robin 2!

Post by Ancylus »

While moving my room into the dungeon, I ran into problems in setting up a party hook through grimwidgets / LoG Framework. Added hooks don't seem to get executed, and the test script given for grimwidgets also fails to produce any results. Autoexec functions and automatic secrets work fine, though.

I tried installing the frameworks into a clean project and got them working there. At least the grimwidgets version in ORRR2 is not quite identical to the version I downloaded, but I don't know whether it's an old or modified version.

Has someone used or tested the frameworks in this dungeon?
User avatar
SpiderFighter
Posts: 789
Joined: Thu Apr 12, 2012 4:15 pm

Re: [OPEN - SIGNUP / DISCUSS] One Room Round Robin 2!

Post by SpiderFighter »

Ancylus wrote:Has someone used or tested the frameworks in this dungeon?
I actually had it in my mod for a while, and then discovered it was causing conflicts with a specific item (it would crash the game when the player tried to equip it), so I haven't utilized it in my room for the ORRR.
User avatar
Diarmuid
Posts: 807
Joined: Thu Nov 22, 2012 6:59 am
Location: Montreal, Canada
Contact:

Re: [OPEN - SIGNUP / DISCUSS] One Room Round Robin 2!

Post by Diarmuid »

I'm definitely using the framework at least in mine... and I updated to the very last version of the framework, which includes now dynamic hooks for onDrawxxx functions. For this to work, nothing ever must actually clone the party and put a onDrawGui function in it, as was doing grimwidgets before. So I went and manually changed gw to add the following:
SpoilerShow

Code: Select all

function autoexec()

   fw.setHook('party.gw.onDrawGui', function(g)
         gw._drawGUI(g)
      end
   )

   fw.setHook('party.gw.onDrawInventory', function(g,champ)
         gw._drawInventory(g,champ)
      end
   )

   fw.setHook('party.gw.onDrawSkills', function(g,champ)
         gw._drawSkills(g,champ)
      end
   )

   fw.setHook('party.gw.onDrawStats', function(g,champ)
         gw._drawStats(g,champ)
      end
   )

end
I have never worked with gw, though so I'm not sure, and I don't know if it is the latest version. Also, grimq is not updated to the latest version either yet, as I wasn't sure how it did work with the newest framework. :shock: :?

I think mahric has some gui code in his room, didn't I see somewhere that he developped the lockpicking mini-game for that? Is his room working? Did he change something with hooks or gw? I'll take a look at the file.

EDIT: Aha. Found (at least a part of) the problem. In "mod_assets/mahric/md_npc/scripts/party.lua", all hooks are hardcoded there so overriding any dynamic hooks for the party. All that must go in an autohook, although for some reason authook didn't register onDrawxxx hooks correctly, we need Xanathar to look into it.

EDIT2: Try replacing that party.lua with this:
SpoilerShow

Code: Select all

fw_addModule("mahric_hooks",[[

function autoexec()

	autohook = 
	{

		party =
		{
		
		onMove = function(party, direction)
			-- direction =1-4 (north, east, south, west)
			return true
		end,
		
		onTurn = function(party, direction)
			-- direction = 1 (right) or -1 (left)
			return true
		end,
		
		onUseItem = function(champion, item, slot)
			return true
		end,
		
		onAttack = function(champion, weapon)
			return true
		end,
		
		onDamage = function(champion, damageAmount, damageType)
			return true
		end,
		
		onProjectileHit = function(champion, projectile, damageAmount, damageType)
			return true
		end,
		
		onDie = function(champion)
			return true
		end,
		
		onRest = function(party)
			return true
		end,
		
		onWakeUp = function(party)
			return true
		end,
		
		onReceiveCondition = function(champion, conditionName, value)
			return true
		end,
		
		onCastSpell = function(champion, spellName)
		end,
		
		onLevelUp = function(champion)
			return true
		end,
		
		onPickUpItem = function(party, item)
			return true
		end,
		
		}
	}

	fw.setHook('party.mahric.onDrawGui', function(ctx)
		mdNPC.onDraw(ctx)
		mdOgrePuzzle.onDraw(ctx)
		mdMarble.onDraw(ctx)
	  end
	)

end

]])
User avatar
mahric
Posts: 192
Joined: Sun Nov 04, 2012 3:05 pm

Re: [OPEN - SIGNUP / DISCUSS] One Room Round Robin 2!

Post by mahric »

Sorry,

Never used any of the frameworks so I didn't know that problems would occur.
I always thought multiple declarations of party were allowed, as long as they had party as their baseObject too.

:(
Did you visit the Wine Merchant's Basement? And heard about the Awakening of Taarnab?
Ancylus
Posts: 50
Joined: Thu Oct 11, 2012 5:54 pm

Re: [OPEN - SIGNUP / DISCUSS] One Room Round Robin 2!

Post by Ancylus »

@Diarmuid: Thanks, that got the hooks working again.

@Mahric: Multiple declarations are allowed, but the redefined parts will replace the previous ones. You could define one hook in one declaration, and then a different hook in another. However, you can't define one hook twice and get both effects, just like you couldn't define an item with two models. Anyway, I placed Diarmuid's code into your party.lua file and commented out the original contents. You'll need to check that the changes didn't break any of your hooks.
User avatar
Diarmuid
Posts: 807
Joined: Thu Nov 22, 2012 6:59 am
Location: Montreal, Canada
Contact:

Re: [OPEN - SIGNUP / DISCUSS] One Room Round Robin 2!

Post by Diarmuid »

Great! Ah, and mahric, to answer you question in the pm on "right click to use item", well the way the LoG framework does its dynamic hooks, is that actually it puts proxy hooks on all objects, pointing to a function in the framework which exectutes defined hooks there. So ALL items get:

Code: Select all

			onUseItem = function(self,p1,p2,p3)
				local retVal = fw.executeHooks('items_'..itemSubtype,'onUseItem',self,p1,p2,p3)
				if retVal == false then return false end
				retVal = fw.executeEntityHooks("items","onUseItem",self,p1,p2,p3)
				if retVal == false then return false end
				if retVal == nil and fw.lists.item.consumable[self.name] then
					return true
				end
				return retVal
			end,
Then the game thinks that they each have some effect, as this text is displayed when a onUseItem is present.

To continue on that override discussion, if let's say, you clone long_sword with an onUseItem, you'll erase the hook above and replace it with your own hook, preventing hooks registered dynamically through the framework to execute.
Ancylus
Posts: 50
Joined: Thu Oct 11, 2012 5:54 pm

Re: [OPEN - SIGNUP / DISCUSS] One Room Round Robin 2!

Post by Ancylus »

My room is now in the dungeon and the file in Dropbox. What few assets I added are rather specific to my room and probably not very useful for others. Most of the lower two levels in my room's area are empty, and may be used for secret areas and such.

I added buttons to toggle the secret doors near my room's entrance so that the party can't get stuck on the wrong side. I also set the swirl locks to accept swirl keys and open the corresponding doors, and fixed some locks with incorrect facing.

I played quickly through the already done rooms and really liked them. I didn't notice any significant issues, but there are a few minor graphical glitches:
JohnWordsworth: The door at the far end of your room on level 8 has a bit of clipping at the doorstep.
mahric: The walls around the arena clip with each other and leak light due to lack of pillars.
The cube: Doors placed side by side clip with each other. Maybe use grates and pillars instead?
Post Reply