Spawm a item into, Sack rename it, add text

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
User avatar
Eleven Warrior
Posts: 752
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Spawm a item into, Sack rename it, add text

Post by Eleven Warrior »

Hi guys'...

I am trying to spawn a tome into a sack, rename the tome, and then setscrolltext.

Ie:

s3:addItem(spawn("the_king", "The_King_Volume_1")):setScrollText([[

Onec apon a time, long ago etc.........................

]]))

I tried the above code but it wants a number..I think it wants the Spawn location..

s3: Is the sack name..
the_king: Is the tome name.. and I want to rename it to The King Volume 1

Thxs for any help, I did do this before but I cant remember how I did it.....
User avatar
Dr.Disaster
Posts: 2876
Joined: Wed Aug 15, 2012 11:48 am

Re: Spawm a item into, Sack rename it, add text

Post by Dr.Disaster »

Eleven Warrior wrote: I am trying to spawn a tome into a sack, rename the tome, and then setscrolltext.

Ie:

s3:addItem(spawn("the_king", "The_King_Volume_1")):setScrollText([[

Onec apon a time, long ago etc.........................

]]))
from Scripting reference:

Item:setScrollText(text)
Sets the text for a scroll item. Lines are separated with ‘\n’ characters.

Item:addItem(item)
Adds a given item to a free container slot.


Seems you need to prepare the item you want to add before actually adding it i.e.
first
cloneObject{
name = "The_King_Volume_1",
baseObject = "the_king",
description = "Once upon a time .."
}
then s3:addItem("The_King_Volume_1")

Yet i don't think that setScrollText() will work with a book ...
Last edited by Dr.Disaster on Sun Sep 15, 2013 12:28 am, edited 4 times in total.
User avatar
Eleven Warrior
Posts: 752
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Re: Spawm a item into, Sack rename it, add text

Post by Eleven Warrior »

Hii Doc...

This my Object

defineObject{
name = "the_king",
baseObject = "scroll",
uiName = "King Of Humans",
class = "Item",
model = "assets/models/items/tome.fbx",
gfxIndex = 30,
scroll = true,
weight = 0.3,
description = "This book was written by a king.",
}

At the end of this can I just add setScrollText(([[ ]])) I tried this and had a error of sorts

defineObject{
name = "the_king",
baseObject = "scroll",
uiName = "King Of Humans",
class = "Item",
model = "assets/models/items/tome.fbx",
gfxIndex = 30,
scroll = true,
weight = 0.3,
setScrollText([[ Once long ago etc..............
]]))
description = "This book was written by a king.",
}

Would this work, I think I tried this and it crashed
THXS
User avatar
Eleven Warrior
Posts: 752
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Re: Spawm a item into, Sack rename it, add text

Post by Eleven Warrior »

This is one I have already done.. I made a object called (gludo's_recipe_boof_1) and did the below script..
Recipe2 Is the name of the Sack...

All I want to do is rename gludo's_recipe_book_1 to gludo's_recipe_book_3

Recipe2:addItem(spawn("gludo's_recipe_book_1"new name here):setScrollText([[

Sage Gludo's: Famous Alchemy. Volume 1

Potion Healing
ingredients :
1 Flask
1 Night Bead or Tar Bead

Potion Energy
ingredients:
1 Flask
1 Blooddrop Blossom or Dewdroop Root
]]))
User avatar
Dr.Disaster
Posts: 2876
Joined: Wed Aug 15, 2012 11:48 am

Re: Spawm a item into, Sack rename it, add text

Post by Dr.Disaster »

As said above you can't rename an item in an inline-statement. Clone a copy with the right name and place that one. setScrollText() works with scroll items only and you set "scroll = true" as needed so all you need to do is the cloneObject to rename your book.
User avatar
Eleven Warrior
Posts: 752
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Re: Spawm a item into, Sack rename it, add text

Post by Eleven Warrior »

Thanks Doc it works..
Post Reply