Page 45 of 395

Re: Ask a simple question, get a simple answer

Posted: Sun Feb 08, 2015 11:16 pm
by rlewarne04
Ahhh I see, ok thanks Isaac I'll check more prudently next time :)

Re: Ask a simple question, get a simple answer

Posted: Sun Feb 08, 2015 11:21 pm
by rlewarne04
I just tested it using :isActivated and it works fine. Onto specific item triggers now lol :)

Re: Ask a simple question, get a simple answer

Posted: Mon Feb 09, 2015 12:30 pm
by AndakRainor
Is it possible to loop through all spells definitions ? I would like to generate automatically all the corresponding scrolls rather than define them individually (and I have a ton of spells).

Re: Ask a simple question, get a simple answer

Posted: Mon Feb 09, 2015 4:02 pm
by Isaac
AndakRainor wrote:Is it possible to loop through all spells definitions ? I would like to generate automatically all the corresponding scrolls rather than define them individually (and I have a ton of spells).
What exactly are you trying to do? (Or, what specifically do you need done?)

Are you trying to 'loop through' a list of currently defined spells?, or trying to spawn a collection of scrolls? [..in an alcove?]

Re: Ask a simple question, get a simple answer

Posted: Mon Feb 09, 2015 5:48 pm
by AndakRainor
Isaac wrote:
AndakRainor wrote:Is it possible to loop through all spells definitions ? I would like to generate automatically all the corresponding scrolls rather than define them individually (and I have a ton of spells).
What exactly are you trying to do? (Or, what specifically do you need done?)

Are you trying to 'loop through' a list of currently defined spells?, or trying to spawn a collection of scrolls? [..in an alcove?]
Oh sorry ! It is not about spawning anything that's why I'm a little lost... I defined a lot of spells, and I need to define all the corresponding scrolls. I wondered if there was an easy way to do it or if I needed to write each definition individually (long task in perspective). I know how to manipulate entities or components but what about definitions themselves ?

Re: Ask a simple question, get a simple answer

Posted: Mon Feb 09, 2015 6:16 pm
by Isaac
AndakRainor wrote:Oh sorry ! It is not about spawning anything that's why I'm a little lost... I defined a lot of spells, and I need to define all the corresponding scrolls. I wondered if there was an easy way to do it or if I needed to write each definition individually (long task in perspective). I know how to manipulate entities or components but what about definitions themselves ?
There is.

You are free to create & call functions in the initial scripts.

You could do something like this [pseudo]:

Code: Select all

function makeScrolls()
...
end
makeScrolls()

Re: Ask a simple question, get a simple answer

Posted: Mon Feb 09, 2015 6:21 pm
by AndakRainor
Isaac wrote:
AndakRainor wrote:Oh sorry ! It is not about spawning anything that's why I'm a little lost... I defined a lot of spells, and I need to define all the corresponding scrolls. I wondered if there was an easy way to do it or if I needed to write each definition individually (long task in perspective). I know how to manipulate entities or components but what about definitions themselves ?
There is.

You are free to create & call functions in the initial scripts.

You could do something like this [pseudo]:

Code: Select all

function makeScrolls()
...
end
makeScrolls()
Thanks ! So any idea how I could access all the spells definitions in this function and for each get its name and uiName (the two values necessary to define a spell scroll) ?

Re: Ask a simple question, get a simple answer

Posted: Mon Feb 09, 2015 6:49 pm
by rlewarne04
Hi guys

I've been trying for hours to get a script to work in which a Skull placed on a forest altar will trigger a teleporter to activate. Simple if done using connectors, I know. But I only want it to activate the teleporter with the skull and have nothing happen with any other item placed on it. I've looked in the scripting reference and tried different methods and I even watched an alcove puzzle tutorial and tried to make it work with this but it didn't and I'm sure I'm either missing something very simple or very obvious.

Maybe one of you could help me write a script to make it possble?

Thanks in advance

Re: Ask a simple question, get a simple answer

Posted: Mon Feb 09, 2015 7:16 pm
by Isaac
rlewarne04 wrote:Hi guys

I've been trying for hours to get a script to work in which a Skull placed on a forest altar will trigger a teleporter to activate. Simple if done using connectors, I know. But I only want it to activate the teleporter with the skull and have nothing happen with any other item placed on it. I've looked in the scripting reference and tried different methods and I even watched an alcove puzzle tutorial and tried to make it work with this but it didn't and I'm sure I'm either missing something very simple or very obvious.

Maybe one of you could help me write a script to make it possble?

Thanks in advance
;)
This is the dungeon alcove version. Should be placed in object.lua

Code: Select all

defineObject{
	name = "dungeon_skull_alcove",
	baseObject = "base_alcove",
	components = {
		{
			class = "Model",
			model = "assets/models/env/dungeon_wall_alcove.fbx",
			staticShadow = true,

		},
		{
			class = "Occluder",
			model = "assets/models/env/dungeon_wall_alcove_occluder.fbx",
		},

						{
			class = "Surface",
			offset = vec(0, 0.85, 0.2),
			size = vec(1.3, 0.65),
			onInsertItem = function(self, item)
								if item.go.name == "skull" then
									skull_teleporter_1.controller:activate() -- This MUST match the name of your teleporter. In this case the name is "skull_teleporter_1"
								end
							end
		},

	},
}

Re: Ask a simple question, get a simple answer

Posted: Mon Feb 09, 2015 8:12 pm
by rlewarne04
Ok That looks great. I'm putting all of that into object.lua?

So do I change it to a forest altar by altering the script you gave me to fit what I need?

Thank you so much :)