Ask a simple question, get a simple answer

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!
Grimfan
Posts: 369
Joined: Wed Jan 02, 2013 7:48 am

Re: Ask a simple question, get a simple answer

Post by Grimfan »

I thought delayedCall only worked specifically with script functions? Is it supposed to work with any go in the game?
User avatar
QuintinStone
Posts: 72
Joined: Sat Nov 01, 2014 9:58 pm

Re: Ask a simple question, get a simple answer

Post by QuintinStone »

Grimfan wrote:I thought delayedCall only worked specifically with script functions? Is it supposed to work with any go in the game?
Strangely, it works in another script I have:

delayedCall(launchers[index], i-1, "activate")

The launcher array is a bunch of IDs of spawner objects. I must be just screwing something up.

Edit: Gah, ok, working now.
Crypt of Zulfar
User avatar
QuintinStone
Posts: 72
Joined: Sat Nov 01, 2014 9:58 pm

Re: Ask a simple question, get a simple answer

Post by QuintinStone »

cameronC wrote:I just can't get delayedCall to work. I've combed through the various posts regarding it in other threads and the brief mention of it in the scripting ref but I think I'm completely misunderstanding it. I've tried many things to get a script function to be ran after X seconds and sometimes the editor crashes on delayedCall() and sometimes it passes through it fine but gives me an invalidconnector warning onscreen and nothing else happens.

If I have entityID with a functionName I want to run after X seconds, is that something this can do?
The syntax for delayedCall is:
delayedCall(entity ID, delay in seconds, function name, function parameter 1, function parameter 2,...)

If your entity is a script, the function name should work. If it's a game object, your function name may have to be a controllercomponent function, I'm not sure.
Crypt of Zulfar
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: Ask a simple question, get a simple answer

Post by Drakkan »

Hi I´d like to insert object "scroll" with some image I have. Scroll is isnide the sack (sack_3), which is placed in the alcove(dungeon_alcove_1).
Do I need to define that scroll completely ? Or is it possible to define the image on defualt scroll with ... scrollitem:setScrollImage("mod_assets/....") and then somehow specify where the scroll is ? (sack inside alcove)
edit: oh I found out I can actulay edit name of the scroll inside the sack inside the alcove. but when i tell:
myscroll.scrollitem:setScrollImage("mod_assets/....")

editor disagree with attempt to index global "myscroll" ( anil value)
Breath from the unpromising waters.
Eye of the Atlantis
GoldenShadowGS
Posts: 168
Joined: Thu Oct 30, 2014 1:56 am

Re: Ask a simple question, get a simple answer

Post by GoldenShadowGS »

can't you just do \

Code: Select all

local scroll = findEntity("Your_Scroll_ID")
scroll.scrollitem:setScrollImage("mod_assets/....")
--do stuff to scroll
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: Ask a simple question, get a simple answer

Post by Drakkan »

GoldenShadowGS wrote:can't you just do \

Code: Select all

local scroll = findEntity("Your_Scroll_ID")
scroll.scrollitem:setScrollImage("mod_assets/....")
--do stuff to scroll
not working. Seems like this is bug. When I place scroll just inside alcove or some contaihner its ok. But when scroll is inside sack inside alcove, editor crashing with this global nil...
kind of weird :/
Breath from the unpromising waters.
Eye of the Atlantis
Scotty
Posts: 69
Joined: Fri Nov 07, 2014 2:59 pm

Re: Ask a simple question, get a simple answer

Post by Scotty »

What if you put it in the sack/alcove via script after you've added the image on?

Code: Select all

my_scroll.scrollitem:setScrollImage("mod_assets/....")
my_sack.containeritem:addItem(my_scroll)
my_alcove.surface:addItem(my_sack)
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: Ask a simple question, get a simple answer

Post by Drakkan »

Scotty wrote:What if you put it in the sack/alcove via script after you've added the image on?

Code: Select all

my_scroll.scrollitem:setScrollImage("mod_assets/....")
my_sack.containeritem:addItem(my_scroll)
my_alcove.surface:addItem(my_sack)
treasure_map_1.scrollitem:setScrollImage("mod_assets/portraits/prvnimapapokladu.dds")
dungeon_alcove_1.surface:addItem(sack_3)
sack_3.containeritem:addItem(treasure_map_1)

error on second row - bad argument 1 to additem (itemcomponent expected, got ???)

EDIT: ok iam trying to edit the scroll directly as item. why the hell it is not working now ? :)

Code: Select all

defineObject{
	name = "treasure_map_1",
	baseObject = "base_item",
	components = {
		{
			class = "Model",
			model = "assets/models/items/note.fbx",
		},
		{
			class = "Item",
			uiName = "Scroll",
			gfxIndex = 454,
			weight = 0.1,
		},
		{
			class = "ScrollItem",
setScrollImage = ("mod_assets/portraits/prvnimapapokladu.dds"),
		},
	},
}
error - onvalid component property setscrolllimage....
Breath from the unpromising waters.
Eye of the Atlantis
GoldenShadowGS
Posts: 168
Joined: Thu Oct 30, 2014 1:56 am

Re: Ask a simple question, get a simple answer

Post by GoldenShadowGS »

because you need to remove "set" when defining

Code: Select all

 {
         class = "ScrollItem",
ScrollImage = ("mod_assets/portraits/prvnimapapokladu.dds"),
      },
User avatar
Drakkan
Posts: 1318
Joined: Mon Dec 31, 2012 12:25 am

Re: Ask a simple question, get a simple answer

Post by Drakkan »

GoldenShadowGS wrote:because you need to remove "set" when defining

Code: Select all

 {
         class = "ScrollItem",
ScrollImage = ("mod_assets/portraits/prvnimapapokladu.dds"),
      },
ha, got it working finally ! thanks alot.
Breath from the unpromising waters.
Eye of the Atlantis
Post Reply