Hello + Script Question

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
User avatar
Fhizban
Posts: 68
Joined: Sun Oct 21, 2012 2:57 pm
Location: Germany
Contact:

Hello + Script Question

Post by Fhizban »

hello grimrock fans,
I just got the game and wanted to say hello to the modders. the release of the editor made me finally buy the game and while i am fighting and puzzling my way through the official storyline, im thinking about starting my own little dungeon mod. back in the good old days i enjoyed neverwinternights scripting and modding, and as i really like the old beholder games - grimrock is the new way to go.

okay, besides that - i have two questions regarding scripting. im still learning and checking out the editor and available online resources, maybe some of you can help me:

1. text display by walking over
to spice up my dungeon maps, i would like to display text whenever the party walks over or bumps into objects/tiles. i figured out how to display text when the party is interaction (for example with a button) but not by simply walking. is there a way to place a trigger on a tile and whenever the party walks over it a text like "the smell of decayed flesh is in the air" is displayed?

and: do the print() and hudprint() functions display text like seen in "walltext" (black box with white text in the middle of the screen), or is there a way to format text or display it in a more decent way? like a textbox at the bottom of the screen?

2. boat movement
okay, this is something i do not really plan to do - as it sounds crazy complicated already. im rather interested if something like this would theoretically be possible. in the old amiga game Knightmare, there was water in some maps and the player could move onto a boat and travel on the water, finally leaving the boat again.

as far as i know, grimrock does not support different floor tiles. so this would require a impassable asset that looks like water, placed on every tile you want to be water. the boat itself would also be an asset - but its beyond my scope if its possible to move the boat plus the party across water assets.

again: i dont plan to script this, im just asking out of curiosity (of course, if someone has a solution - this would be a real cool way to spice up maps).

thanks for your help!
--
Fhizban's Asset Repository - the place where you find all my LoG contributions:
viewtopic.php?f=14&t=3904
User avatar
Neikun
Posts: 2457
Joined: Thu Sep 13, 2012 1:06 pm
Location: New Brunswick, Canada
Contact:

Re: Hello + Script Question

Post by Neikun »

You can use a hidden pressure plate with activate once attached to your hudPrint script :3
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
  • Message me to join in!
User avatar
Fhizban
Posts: 68
Joined: Sun Oct 21, 2012 2:57 pm
Location: Germany
Contact:

Re: Hello + Script Question

Post by Fhizban »

Thanks Neikun!

Is there also a invisible object i can place to make a message appear when the player clicks on something? Like a cave-in the player can click on and then it displays a message.
--
Fhizban's Asset Repository - the place where you find all my LoG contributions:
viewtopic.php?f=14&t=3904
User avatar
Neikun
Posts: 2457
Joined: Thu Sep 13, 2012 1:06 pm
Location: New Brunswick, Canada
Contact:

Re: Hello + Script Question

Post by Neikun »

That is a good question. I am not sure how you'd go about that
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
  • Message me to join in!
User avatar
msyblade
Posts: 792
Joined: Fri Oct 12, 2012 4:40 am
Location: New Mexico, USA
Contact:

Re: Hello + Script Question

Post by msyblade »

make sure the P is capitalized in hudPrint :) and activate once. You can script the hudprint to clicking on an object, but it must be interactive to choose the trigger (alcove, hidden plate,etc) junk has no trigger to call :(
Last edited by msyblade on Sun Oct 21, 2012 6:57 pm, edited 1 time in total.
Currently conspiring with many modders on the "Legends of the Northern Realms"project.

"You have been captured by a psychopathic diety who needs a new plaything to torture."
Hotel Hades
Decayer
Posts: 65
Joined: Sat Oct 13, 2012 3:19 pm

Re: Hello + Script Question

Post by Decayer »

Fhizban wrote:Thanks Neikun!

Is there also a invisible object i can place to make a message appear when the player clicks on something? Like a cave-in the player can click on and then it displays a message.
Try putting a very large, silent and invisible button just in front of the cave-in and linking it to a script entity. I haven't looked at buttons much, but Neikun might be able to help you there.
nichg
Posts: 48
Joined: Thu Oct 11, 2012 12:38 pm

Re: Hello + Script Question

Post by nichg »

I think a button is a good idea, but you might be restricted to only using it on objects that are integrated into a 'solid' wall (as opposed to e.g. a hidden door, a blocker, a floor decoration, etc). It doesn't look like you can script the hitbox of a button though, so thats tricky.

Aha, I know. Give the party a 'magnifying glass' item. If they want to examine something, they hold the item in hand and click on it. Meanwhile, make a custom alcove for each unique examinable object that accepts no items, but in the check to see if it should accept an item have it do a hudPrint displaying the message you want.

Even better, make one class of alcove and then create a 'descriptor-holding' item that is a scroll but has an empty model or something, tied to the specific id of the alcove object. Use an init script to create a bunch of these and load them into the observable objects you want. Then, when the party clicks on the alcove with the magnifying glass, have the alcove check its containedItems for the descriptor object and display that object's getScrollText (which you can set in the init script). That will stop you from having to have three dozen new objects in your asset list all the time, and all the game's description text will be in a single more-or-less convenient script entity.
Decayer
Posts: 65
Joined: Sat Oct 13, 2012 3:19 pm

Re: Hello + Script Question

Post by Decayer »

Darn, I though buttons had definable sizes in their definitions like the alcoves.
User avatar
Edsploration
Posts: 104
Joined: Wed Sep 19, 2012 4:32 pm

Re: Hello + Script Question

Post by Edsploration »

Fhizban wrote:Is there also a invisible object i can place to make a message appear when the player clicks on something? Like a cave-in the player can click on and then it displays a message.
I have a solution for this I'm currently using in a dungeon about to be entered into Editing Challenge II.
Define an item to use the one-sided gobelin model:

Code: Select all

cloneObject{
	name = "invisible_item",
	baseObject = "rock",
	model = "assets/models/env/gobelin.fbx",
}
Define an alcove to position it in the right place:

Code: Select all

defineObject{
	name = "speech_alcove",
	class = "Alcove",
	anchorPos = vec(0, 0.5, -0.01),
	anchorRotation = vec(0, 180, 0),
	targetPos = vec(0, 0.5, -0.01),
	targetSize = vec(0, 0, 0),
	placement = "wall",
	replacesWall = false,
	editorIcon = 96,
}
Place a hidden pressure plate in front of the item/alcove. Have this gobelin spawn into and despawn from the alcove when the player is standing on the plate. (This will prevent the player from walking around and looking at the gobelin from its visible side.)

Code: Select all

function speechOn()
	speech_alcove_1:addItem(spawn("invisible_item"))
end

function speechOff()
	local temp = speech_alcove_1:containedItems()
	temp():destroy()
end
Prevent picking up the "invisible item" in the party's onPickUpItem hook, and call a script/function combo to do whatever it is you want to do when the player clicks!

Code: Select all

onPickUpItem = function(party, item)
	if item.name == "invisible_item" then
		speech:talk()
		return false
	end
end,
Admittedly this is a bit of a hassle... but it works great once you get it going! If you check item.id instead of item.name this trick can be reused in as many locations as you like.
Open Project -> Community FrankenDungeon: viewtopic.php?f=14&t=4276
User avatar
Fhizban
Posts: 68
Joined: Sun Oct 21, 2012 2:57 pm
Location: Germany
Contact:

Re: Hello + Script Question

Post by Fhizban »

thank you all very much! the invisible pressure plate is already working and Edsploration's solution seems to be the best to display klick-text. i will try to get this into my project as soon as possible. thanks again for being so helpful!
--
Fhizban's Asset Repository - the place where you find all my LoG contributions:
viewtopic.php?f=14&t=3904
Post Reply

Return to “Modding”