SphereCommunity
OPEN BANK ONLY INSIDE THE HOUSE - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: OPEN BANK ONLY INSIDE THE HOUSE (/Thread-OPEN-BANK-ONLY-INSIDE-THE-HOUSE)



OPEN BANK ONLY INSIDE THE HOUSE - victorstelzer - 04-04-2014 11:35 PM

I have the script house, and I want that when the char has inside the house and talk to the bank to open bank ... but when he is out of the house the bank is not open ....

How to limit the area of spech



[SPEECH spk_player]
ON=*bank*
src.bankself
src.sysmessage You have <src.bankbalance> gold in your Bank Box
else
return 0
endif
endif
else
src.bankself
return 0
endif


RE: OPEN BANK ONLY INSIDE THE HOUSE - XuN - 04-04-2014 11:52 PM

Are you using any region event in the house? If so, it is as easy as adding the speech to the players when they @Enter in the region and remove it when they @Exit.

You can check Mordaunt's house system in the Add-on folder of the script pack, or in the Downloads section, for a working example Smile


RE: OPEN BANK ONLY INSIDE THE HOUSE - Shidhun - 04-05-2014 12:09 AM

You could add other Region_Flags.

For Script-purposes we added other Region-Flags years ago

Code:
[DEFNAME REGION_FLAGS]
.....
region_town         010000
region_house        020000
.....
region_no_mark
etc.

This way we can easily apply the according flags to the house-zones by adding |020000

In Scripts you can then easily check using :

Code:
if (<region.flags>&region_house)
....
endif

Or in your case
Code:
[SPEECH spk_player]
ON=*bank*
   if (<src.region.flags>&region_house)
       src.bankself
   endif



RE: OPEN BANK ONLY INSIDE THE HOUSE - Ben - 04-05-2014 06:30 AM

Why not just create a new speech block [SPEECH spk_houses] and add it to your multis using TSPEECH = spk_houses?
And if your multis already have a speech block attached to them, just add the bank command in there.
You may also want to add some checks to see if you own the house before you open the bank...


RE: OPEN BANK ONLY INSIDE THE HOUSE - JohnVeritas - 04-06-2014 11:35 AM

Well you can check players region with spk_player like;

on=bank
IF (<SRC.UID.<SRC.REGION.UID>.TYPE>==t_multi) || (<SRC.UID.<SRC.REGION.UID>.TYPE>==t_multi_custom)
//this line must be check owner/co-owner/friendship status of player who type "bank"
src.bankself
endif

Checking regions is only one part of solution, the other part is checking owner/co-owner/friendship status otherwise anyone can open his bank in a random house.