Jump to content

Recommended Posts

I want to have a character I'm working on start with a lantern that has no fuel

 

I already know the code for getting the fuel to be drained.  But I don't know the best way to have it start out drained.

 

So a couple questions:

 

First, is there a way to just adjust the properties of starting items simply? Or

 

 

Second, is there an event that triggers when the character spawns into the game for the first time?

 

 

Third, is there a reference I can check to see the available events, how they trigger, and what information they give?  Only reason I know about some of the events is from code that's using them, but I don't know what events are available to choose from.  I know they are a table of strings that's being referenced, but from where?

 

Edit: Fourth, is it only the ones that are from PushEvent() or is there more?

 

Edit 2: Five, did I just answer my own question as I wrote my question?

 

Edit 3: I think I found the list of events I'm looking for 0.o, still, aside from using events, anyone have an answer to question one?

Edited by Zackreaver

Events are a lot more simple than you make them out to be.  Try this in the console, for example:

GetPlayer():ListenForEvent("taco_tuesday", function() print("WOOHOO!") end)GetPlayer():PushEvent("taco_tuesday")

Note, however, that if you call PushEvent from some other prefab, your event handler won't see it.

 

 

As for starting items, you want the character's starting lantern to spawn initially with no fuel, but you dont wish that to be default functionality for spawning lanterns, correct?

 

All you need to do is access the lantern by its reference when it's first put into the character's inventory.

Edited by Corrosive

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...