Page 1 of 1

"opby" question

Posted: Thu Apr 22, 2010 3:14 pm
by Qwerty
Hi,Sophia.

I'd like to continuously sound a Waterdrop-SE When the dungeon is begging (before a champion is ressurected or reincarnated)

So,How to check "Whether or not Theron?" when stepping on the Invisible-trigger?(like a "opby = party_empty" in RTC)

Re: "opby" question

Posted: Thu Apr 22, 2010 8:51 pm
by Sophia
The basic trigger can't be stepped on by an empty party. To make this possible, you'll need to create an objects.lua in your own custom dungeon's folder and add an object like this:

Code: Select all

obj.trigger_noparty = clone_arch(obj.trigger, {
   no_party_triggerable = true
} )
Then use your new "trigger_noparty" wherever you need it to be set off by an empty party and it will then allow opby_party to work even without characters in the party.

If you want a trigger that is triggered only by an empty party, that's a bit more tricky. :mrgreen:
I won't bore you with all the details unless this is what you actually need.

Re: "opby" question

Posted: Fri Apr 23, 2010 9:11 am
by ian_scho
clone_arch Isn't a standard lua funcion, is it?

Re: "opby" question

Posted: Fri Apr 23, 2010 1:14 pm
by Qwerty
Yeah, This is a good enough answer!! :D
The code was worked collectly in my custom dungeon.

Thanx!!

ian_scho wrote:clone_arch Isn't a standard lua funcion, is it?
Maybe clone_arch isn't a standard Lua function. But it is useful. :)

Re: "opby" question

Posted: Fri Apr 23, 2010 8:01 pm
by Sophia
ian_scho wrote:clone_arch Isn't a standard lua funcion, is it?
No, it's not. Lua has no built-in way to do a shallow copy of a table, actually-- which is all clone_arch actually does, for the most part. It lets you merge in a second table, too, because it's essentially automating the cut-and-paste-and-make-changes you'd have to do to clone an arch by hand. It just doesn't have a dsb_ prefix because it's defined in base/util.lua and thus isn't actually part of the DSB core as such.

Re: "opby" question

Posted: Fri Apr 23, 2010 8:04 pm
by Adamo
Sorry for dumbness, but is it possible to make a trigger, that is operated ONLY by a specific character? Like a floor trigger, that opens a door only when Zed steps on it?

Edit: hmm, it could be done by adding to Zed`s inventory a special, Zed-devoted item, that doesn`t exist elsewhere in the dungeon. But what if a player throws it out?

Re: "opby" question

Posted: Wed May 05, 2010 8:46 pm
by Sophia
This is now much more easily doable in DSB 0.42 with the "trigger_controller" arch.

Re: "opby" question

Posted: Mon Jun 28, 2010 11:45 am
by Adamo
what if I want to build a counter, or any trigger, that works ONCE ONLY? I used to do like that in CSbuild, because there was special "OO" option. I noticed, that adding "disable_self" or "destroy" exvars doesn`t work that way.
Sorry my questions are stupid, but it`s hard to switch from one editor to another without pain ;)

Re: "opby" question

Posted: Mon Jun 28, 2010 12:54 pm
by Qwerty
I suggest to you try to use "M_RESET" exver with trigger(counter or msg_handler) objects.
If you send "M_RESET" msg to object with "disable" which is worked,
The "inactive" object would reset "active" and work again.

Re: "opby" question

Posted: Mon Jun 28, 2010 3:04 pm
by Adamo
how to add the "x_relay" trigger? It`s not in FLOOR FLATS/MECHANICS section

Re: "opby" question

Posted: Mon Jun 28, 2010 5:05 pm
by Adamo
Qwerty, what I mean is I need a trigger, that operates OO (once_only). For example a doorbutton: you add special "OO" exvar and the doorbutton will work only once and won`t work any more later. For example: if you operate doorbutton with OO flag when the door are closed, the only thing you can do is to open it once and nothing more will happen; if they`re opened, the doorbutton will just close it (and won`t work later). That`s the exvar I need. I noticed that disable_self doesn`t work this way.

EDIT: I got it now. "disable_self" exvar works only with opby items, never with triggers like doorbutton etc. However, objects like doorbuttons can be destroyed by using ANY additional message as a target on them (which means doorbutton will just disappear after one use).

Re: "opby" question

Posted: Mon Jun 28, 2010 5:40 pm
by Adamo
I noticed one more: I assume open door are in ACTIVE state, while closed door are in INACTIVE state. But when you change a message sent by a doorbutton from "toggle" (currently opposite state, which is either activate or deactivate) to "deactivate", it will work just like it still sends "toggle" message! When a doorbutton sends "dectivate" message to closed door, it should open. But when a doorbutton sends "deactivate" to open door, nothing should happen! I don`t understand that.

Re: "opby" question

Posted: Mon Jun 28, 2010 9:29 pm
by Sophia
Adamo wrote:Qwerty, what I mean is I need a trigger, that operates OO (once_only).
Doorbuttons don't use the normal opby system so they're unfortunately not that easy to make work once only like most floor triggers and buttons. I'm not quite sure what use it'd be to disable some of the mechanics archs like this...
Adamo wrote:how to add the "x_relay" trigger? It`s not in FLOOR FLATS/MECHANICS section
Don't use it. It's just for porting RTC dungeons.
The "msg_sender" can do everything the "x_relay" can and more. Use it instead. :)
Adamo wrote:I noticed one more: I assume open door are in ACTIVE state, while closed door are in INACTIVE state.
It's the other way around. :)

Re: "opby" question

Posted: Mon Jun 28, 2010 9:54 pm
by Adamo
Sophia wrote:
Doorbuttons don't use the normal opby system so they're unfortunately not that easy to make work once only like most floor triggers and buttons. I'm not quite sure what use it'd be to disable some of the mechanics archs like this...
I tried to change a destination of the DOORBUTTON from the DOOR, as usual, to some other counter or something.. then that will send a message back to a DOOR.. but counters or msg_senders would also have to work once only.. and they floorFlats/Mechanics doesn`t accept disable_self exvar

Re: "opby" question

Posted: Mon Jun 28, 2010 10:38 pm
by Sophia
This code is experimental, I'm not sure if it'll break something down the line.
But, try replacing doorbutton_push found in base/triggers.lua with this:

Code: Select all

function doorbutton_push(self, id, what)
	if (exvar[id].disabled) then
	    return false
	end
	dsb_sound(snd.click)
	got_triggered(id, what)
end
This should make disable_self work for doorbuttons as well.