"opby" question

This forum is for the Lua scriptable clone of DM/CSB called Dungeon Strikes Back by Sophia. Use DSB to build your own highly customised games.

Moderator: Sophia

Forum rules
Please read the Forum rules and policies before posting.
Post Reply
User avatar
Qwerty
Apprentice
Posts: 55
Joined: Sun Aug 30, 2009 6:21 am

"opby" question

Post 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)
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: "opby" question

Post 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.
User avatar
ian_scho
High Lord
Posts: 2806
Joined: Fri Apr 07, 2006 8:30 am
Location: Zaragoza, Spain

Re: "opby" question

Post by ian_scho »

clone_arch Isn't a standard lua funcion, is it?
User avatar
Qwerty
Apprentice
Posts: 55
Joined: Sun Aug 30, 2009 6:21 am

Re: "opby" question

Post 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. :)
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: "opby" question

Post 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.
User avatar
Adamo
Italodance spammer
Posts: 1534
Joined: Fri Apr 22, 2005 11:59 am
Location: Poland
Contact:

Re: "opby" question

Post 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?
Spoiler
(\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/)
Spoiler
(@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@)
Spoiler
(>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<)
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: "opby" question

Post by Sophia »

This is now much more easily doable in DSB 0.42 with the "trigger_controller" arch.
User avatar
Adamo
Italodance spammer
Posts: 1534
Joined: Fri Apr 22, 2005 11:59 am
Location: Poland
Contact:

Re: "opby" question

Post 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 ;)
Spoiler
(\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/)
Spoiler
(@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@)
Spoiler
(>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<)
User avatar
Qwerty
Apprentice
Posts: 55
Joined: Sun Aug 30, 2009 6:21 am

Re: "opby" question

Post 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.
User avatar
Adamo
Italodance spammer
Posts: 1534
Joined: Fri Apr 22, 2005 11:59 am
Location: Poland
Contact:

Re: "opby" question

Post by Adamo »

how to add the "x_relay" trigger? It`s not in FLOOR FLATS/MECHANICS section
Spoiler
(\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/)
Spoiler
(@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@)
Spoiler
(>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<)
User avatar
Adamo
Italodance spammer
Posts: 1534
Joined: Fri Apr 22, 2005 11:59 am
Location: Poland
Contact:

Re: "opby" question

Post 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).
Spoiler
(\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/)
Spoiler
(@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@)
Spoiler
(>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<)
User avatar
Adamo
Italodance spammer
Posts: 1534
Joined: Fri Apr 22, 2005 11:59 am
Location: Poland
Contact:

Re: "opby" question

Post 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.
Spoiler
(\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/)
Spoiler
(@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@)
Spoiler
(>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<)
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: "opby" question

Post 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. :)
User avatar
Adamo
Italodance spammer
Posts: 1534
Joined: Fri Apr 22, 2005 11:59 am
Location: Poland
Contact:

Re: "opby" question

Post 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
Spoiler
(\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/) (\__/)
Spoiler
(@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@) (@.@)
Spoiler
(>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<) (>s<)
User avatar
Sophia
Concise and Honest
Posts: 4240
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Re: "opby" question

Post 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.
Post Reply