Page 360 of 400

Re: Ask a simple question, get a simple answer

Posted: Sat Nov 07, 2020 5:38 am
by minmay
ItemComponent has a setStackSize() method that lets you change the number of items in the stack. Use that to make a stack of pellets (or any other stackable item).

dm_lock_coinslot decreases its coinsNeeded counter value by 1 each time a coin is inserted, and when the value reaches 0, it disables its LockComponent. So if you want to reuse a coin slot after it's been fully paid, you can just enable the LockComponent again and set the coinsNeeded value again.

Or if you mean that you just want the coinslot to accept an unlimited number of coins, set the coinsNeeded counter value to a negative number; then it will never disable the LockComponent.

Re: Ask a simple question, get a simple answer

Posted: Sun Nov 08, 2020 3:48 am
by IttaBitta
minmay wrote: Sat Nov 07, 2020 5:38 am ItemComponent has a setStackSize() method that lets you change the number of items in the stack. Use that to make a stack of pellets (or any other stackable item).

dm_lock_coinslot decreases its coinsNeeded counter value by 1 each time a coin is inserted, and when the value reaches 0, it disables its LockComponent. So if you want to reuse a coin slot after it's been fully paid, you can just enable the LockComponent again and set the coinsNeeded value again.

Or if you mean that you just want the coinslot to accept an unlimited number of coins, set the coinsNeeded counter value to a negative number; then it will never disable the LockComponent.
I am not sure I understand. Can I have an example?

Re: Ask a simple question, get a simple answer

Posted: Sun Nov 08, 2020 8:10 am
by 7Soul
IttaBitta wrote: Sun Nov 08, 2020 3:48 am
minmay wrote: Sat Nov 07, 2020 5:38 am ItemComponent has a setStackSize() method that lets you change the number of items in the stack. Use that to make a stack of pellets (or any other stackable item).

dm_lock_coinslot decreases its coinsNeeded counter value by 1 each time a coin is inserted, and when the value reaches 0, it disables its LockComponent. So if you want to reuse a coin slot after it's been fully paid, you can just enable the LockComponent again and set the coinsNeeded value again.

Or if you mean that you just want the coinslot to accept an unlimited number of coins, set the coinsNeeded counter value to a negative number; then it will never disable the LockComponent.
I am not sure I understand. Can I have an example?
Spawn an item with

Code: Select all

local var = spawn( spawn stuff here )
Then you can refer to the newly created object using that variable name

Code: Select all

var.item:setStackSize(10)
Or you can do it all in one go

Code: Select all

spawn( spawn stuff here ).item:setStackSize(10)

Re: Ask a simple question, get a simple answer

Posted: Sun Nov 08, 2020 8:17 am
by minmay
To set the stack size of a pellet_box with an id of my_box_of_pellets to 500:

Code: Select all

my_box_of_pellets.item:setStackSize(500)
To "reset" a dm_lock_coinslot with an id of my_coin_slot_id so that it will accept 5 coins:

Code: Select all

my_coin_slot_id.lock:enable()
my_coin_slot_id.coinsNeeded:setValue(5)

Re: Ask a simple question, get a simple answer

Posted: Sun Nov 08, 2020 9:01 am
by IttaBitta
I'm spawning into an alcove though
...

Code: Select all

tomb_alcove_2.surface:addItem(spawn("pellet_box").item:setStackSize(10))
?

Re: Ask a simple question, get a simple answer

Posted: Sun Nov 08, 2020 12:31 pm
by hyteria
hello !

how i can stun my party for 2-3 sec plz ?

thx

Re: Ask a simple question, get a simple answer

Posted: Sun Nov 08, 2020 5:32 pm
by ratman
Where are the base conditions defined? I am trying to make my own polymorph potion, except an ogre instead of a bear 8-) , and when I look at the polymorph potion definition it says:

Code: Select all

champion:setCondition("bear_form", 1)
So I tried to look at the condition 'bear form', but none of the conditions are defined in the asset pack.

Re: Ask a simple question, get a simple answer

Posted: Sun Nov 08, 2020 6:08 pm
by Skuggasveinn
ratman wrote: Sun Nov 08, 2020 5:32 pm Where are the base conditions defined? I am trying to make my own polymorph potion, except an ogre instead of a bear 8-) , and when I look at the polymorph potion definition it says:

Code: Select all

champion:setCondition("bear_form", 1)
So I tried to look at the condition 'bear form', but none of the conditions are defined in the asset pack.
You are right, they are not part of the asset pack. But you can define your own condition, example is here.
https://github.com/JKos/log2doc/wiki/Asset-Definitions

Also this topic.
viewtopic.php?f=22&t=14528&hilit=polymorph

kind regards
Skuggasveinn.

Re: Ask a simple question, get a simple answer

Posted: Sun Nov 08, 2020 7:57 pm
by minmay
IttaBitta wrote: Sun Nov 08, 2020 9:01 am I'm spawning into an alcove though
...

Code: Select all

tomb_alcove_2.surface:addItem(spawn("pellet_box").item:setStackSize(10))
?
setStackSize() doesn't return the ItemComponent, so that won't work. You'll need this:

Code: Select all

do
	local pbox = spawn("pellet_box").item
	tomb_alcove_2.surface:addItem(pbox)
	pbox:setStackSize(500)
end

Re: Ask a simple question, get a simple answer

Posted: Tue Nov 10, 2020 6:54 am
by IttaBitta
Thanks for all your help, btw

More mod mishaps - I tried to use Zimber's assets and I've had a lot of trouble
Trouble one:
Image
things lead me to think it wants me to 'merge' zim_party with my party definition... but I don't know where or WHAT that definition is.