pinku
Journeyman
Posts: 118
Likes Given: 4
Likes Received: 2 in 2 posts
Joined: Apr 2013
Reputation: 4
|
Rentable Room Script
Found on downloads section:
Code:
[comment]
Add this to your innkeeper speech file:
ON=*check out*
ON=*checkout*
ON=*leave*
SRC.F_CHECKOUT <UID>
Add this to your innkeeper sell template
SELL=I_KEY_RENTAL_YEAR,{5 10}
SELL=I_KEY_RENTAL_MONTH,{5 10}
SELL=I_KEY_RENTAL_WEEK,{5 10}
SELL=I_KEY_RENTAL_DAY,{5 10}
Add the event: T_DOOR_RENTAL to the doors of all rentable rooms in the inn.
Make sure you also add a I_SIGN_CHECKOUT in each room so that if the key expires while the player is in the room, they wont be locked in.
[TYPEDEF T_DOOR_RENTAL]
[TYPEDEF T_KEY_RENTAL]
ON=@DCLICK
IF (<TAG.LINKED>==0)
TARGETF F_RENTAL_LINK <UID>
RETURN 1
ELSE
RETURN 0
ENDIF
on=@DROPON_CHAR
IF (STRMATCH(*innkeeper*, <UID.<ARGO>.ID>)
IF (<TAG.EXPIRED>==1)
ARGO.SAY Thankyou <SRC.NAME>! Please come again.
remove
ENDIF
ENDIF
[ITEMDEF I_KEY_RENTAL_DAY]
ID=I_KEY_IRON
name=Rental (1 Day)
VALUE=100
TEVENTS=T_KEY_RENTAL
ON=@CREATE
TAG.EXPIRE=1*60*24
TAG.LINKED=0
[ITEMDEF I_KEY_RENTAL_WEEK]
ID=I_KEY_IRON
name=Rental (1 Week)
VALUE=500
ON=@CREATE
TAG.EXPIRE=7*60*24
TAG.LINKED=0
EVENTS=T_KEY_RENTAL
[ITEMDEF I_KEY_RENTAL_MONTH]
ID=I_KEY_IRON
name=Rental (1 Month)
VALUE=2500
ON=@CREATE
TAG.EXPIRE=30*60*24
TAG.LINKED=0
EVENTS=T_KEY_RENTAL
[ITEMDEF I_KEY_RENTAL_YEAR]
ID=I_KEY_IRON
name=Rental (1 Year)
VALUE=20000
ON=@CREATE
TAG.EXPIRE=365*60*24
TAG.LINKED=0
EVENTS=T_KEY_RENTAL
[FUNCTION F_RENTAL_LINK]
//say ARGN1= <uid.<ARGN1>.name>
//say name = <name>
//say SRC= <src.name>
IF !(<ARGO.EVENTS>==T_DOOR_RENTAL)
SYSMESSAGE=This key does Not fit that lock!(not a rental door)
RETURN 1
ELIF(<EVAL 0<ARGO.TAG.LINKED>>==1)
SYSMESSAGE=This key does not fit that lock! (Door already rented out)
RETURN 1
ELSE
ARGO.TAG.LINKED=1
argo.MORE1=<UID.<ARGN1>.UID>
ARGO.MESSAGE=Linked!
TRY UID.<ARGN1>.TAG.LINKED=1
TRY UID.<ARGN1>.LINK=<ARGO.UID>
TRY UID.<ARGN1>.MORE1=<UID.<ARGN1>.UID>
TRY UID.<ARGN1>.TIMERF=<EVAL <UID.<ARGN1>.TAG.EXPIRE>> F_RENTAL_EXPIRE
TRY UID.<ARGN1>.NAME Rental Key (<room.name>)
TRY UID.<ARGN1>.MESSAGE=Linked!
RETURN 1
ENDIF
[FUNCTION F_RENTAL_EXPIRE]
MESSAGE=The <name> has expired!
TAG.EXPIRED=1
SRC.CTAG.EXPIRINGKEY=<UID>
IF (<SRC.ISINRENTAL>==1)
//SRC.SAY I'm in the Inn
SRC.FINDINNKEEPER
//say <src.tag.inkeeper>
src. f_checkout <src.tag.innkeeper>
src.tag.innkeeper=
ENDIF
LINK.TAG.LINKED=0
LINK.TYPE T_DOOR_LOCKED
LINK.MORE1=1
Return 1
[FUNCTION ISINRENTAL]
//SAY key=<uid.<CTAG.EXPIRINGKEY>.MORE1>
FORITEMS 7
//SAY Door=<MORE1>
IF (<MORE1>==<uid.<SRC.CTAG.EXPIRINGKEY>.MORE1>)
RETURN 1
ENDIF
ENDFOR
[FUNCTION FINDINNKEEPER]
//SAY I'm looking for the Innkeeper
forchars 15
IF (STRMATCH(*innkeeper*, <ID>))
src.tag.innkeeper=<uid>
ENDIF
ENDFOR
[FUNCTION F_CHECKOUT]
FORCONTID i_key_rental_DAY 10
IF (<EVAL <TAG.EXPIRED>>==1)
TRY UID.<ARGN1>.SAY Thank you <src.name>! Please come again.
SRC.go <UID.<ARGN1>.P>
REMOVE
RETURN 1
ENDIF
ENDFOR
FORCONTID i_key_rental_week 10
IF (<EVAL <TAG.EXPIRED>>==1)
TRY UID.<ARGN1>.SAY Thank you <src.name>! Please come again.
SRC.go <UID.<ARGN1>.P>
REMOVE
RETURN 1
ENDIF
ENDFOR
FORCONTID i_key_rental_month 10
IF (<EVAL <TAG.EXPIRED>>==1)
TRY UID.<ARGN1>.SAY Thank you <src.name>! Please come again.
SRC.go <UID.<ARGN1>.P>
REMOVE
RETURN 1
ENDIF
ENDFOR
FORCONTID i_key_rental_year 10
IF (<EVAL <TAG.EXPIRED>>==1)
TRY UID.<ARGN1>.SAY Thank you <src.name>! Please come again.
SRC.go <UID.<ARGN1>.P>
REMOVE
RETURN 1
ENDIF
ENDFOR
[ITEMDEF I_SIGN_CHECKOUT]
ID=0bcf
NAME=Check Out
on=@create
ATTR=0c000
on=@dclick
forchars 10
IF (STRMATCH(*innkeeper*, <ID>))
src.tag.innkeeper=<uid>
ENDIF
ENDFOR
say <src.tag.inkeeper>
src. f_checkout <src.tag.innkeeper>
Return 1
I'm trying it.. but does not work..
Before trying, I made sure I set the door event with .xevents T_DOOR_RENTAL
After that, I double click the key and link to the door.
It says "Linked" and then, does not work anymore.
Keeps saying when I try to lock the door with the key:
"The key does not fit into that lock."
Any ideas? I can't get it..
|
|
11-15-2013 04:24 AM |
|
|