Use code to label wall text?

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Post Reply
barronvonburp
Posts: 30
Joined: Mon Jul 13, 2015 7:41 am

Use code to label wall text?

Post by barronvonburp »

Is there any way to do this? I'd imagine so, maybe use a script to create it with a certaint orientation, text, and height, and remove the old one when needed?
Also another related thing, how to call up the party's heroes names, and put them on said wall text?
User avatar
Isaac
Posts: 3192
Joined: Fri Mar 02, 2012 10:02 pm

Re: Use code to label wall text?

Post by Isaac »

Spawning a text wall via script:

Code: Select all

--build text from champion names, for the wall.
heroes = ""
for x = 1,4 do 
	if party.party:getChampion(x):getEnabled() then
		heroes = heroes.."\n"..party.party:getChampion(x):getName()
	end
end

--create the wall_text.
spawn("dungeon_wall_text", 1, 15, 15, 2, 0).walltext:setWallText( heroes )
________________________________________________________________________
-- spawn( [object] , [level] , [X] , [Y] , [facing] , [elevation] , [optional object id] )
:setWallText( [text string] )
barronvonburp
Posts: 30
Joined: Mon Jul 13, 2015 7:41 am

Re: Use code to label wall text?

Post by barronvonburp »

Couple of questions: One how do I add something before the heroes names on the wall, [s]<s>and what does "level" reference in spawn?</s>[/s] -- Tried to strikethrough, did not work. I figgured out the level thing.
User avatar
Isaac
Posts: 3192
Joined: Fri Mar 02, 2012 10:02 pm

Re: Use code to label wall text?

Post by Isaac »

barronvonburp wrote:Couple of questions: One how do I add something before the heroes names on the wall, [s]<s>and what does "level" reference in spawn?</s>[/s] -- Tried to strikethrough, did not work. I figgured out the level thing.
Two dashes are used to comment out a line; the interpreter ignores the line.

To add text before the names is very easy in this case. Simply change the heroes variable from " " to whatever text you want.

Code: Select all

heroes = "Custom Message"
Post Reply