Page 26 of 396

Re: Ask a simple question, get a simple answer

Posted: Fri Dec 05, 2014 1:51 am
by Grimfan
I thought delayedCall only worked specifically with script functions? Is it supposed to work with any go in the game?

Re: Ask a simple question, get a simple answer

Posted: Fri Dec 05, 2014 2:09 am
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.

Re: Ask a simple question, get a simple answer

Posted: Fri Dec 05, 2014 2:54 am
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.

Re: Ask a simple question, get a simple answer

Posted: Fri Dec 05, 2014 9:27 pm
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)

Re: Ask a simple question, get a simple answer

Posted: Sat Dec 06, 2014 6:26 am
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

Re: Ask a simple question, get a simple answer

Posted: Sat Dec 06, 2014 2:38 pm
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 :/

Re: Ask a simple question, get a simple answer

Posted: Sat Dec 06, 2014 4:01 pm
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)

Re: Ask a simple question, get a simple answer

Posted: Sat Dec 06, 2014 6:26 pm
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....

Re: Ask a simple question, get a simple answer

Posted: Sat Dec 06, 2014 6:49 pm
by GoldenShadowGS
because you need to remove "set" when defining

Code: Select all

 {
         class = "ScrollItem",
ScrollImage = ("mod_assets/portraits/prvnimapapokladu.dds"),
      },

Re: Ask a simple question, get a simple answer

Posted: Sat Dec 06, 2014 7:12 pm
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.