Announcement: Be excellent to each other.


Caravel Forum : DROD RPG Boards : RPG Architecture : Accessory On Use Example (a scripting helper reference)
New Topic New Poll Post Reply
Poster Message
Chaco
Level: Smitemaster
Rank Points: 3271
Registered: 10-06-2005
IP: Logged

File: Accessory On Use Example.drh (1.5 KB)
Downloaded 6 times.
License: Public Domain
icon Accessory On Use Example (+1)  
mauvebutterfly asked in CaravelNet chat earlier how it would be possible to equip a player accessory that did stuff when you clicked on it, beyond just having passive stat effects just by having it equipped. This example hold shows minimal code that should be a good reference.

Some things to note, hopefully fairly easy but I'll explicitly list them anyway:

* The accessory is implemented as a default character script, but the "treasure chest" is implemented as a one-off regular room character script, so the accessory granting only happens once in the entire hold (due to the way DROD RPG persists character state across multiple visits).

* The treasure chest character sets the player's accessory to 20000 directly. I did it this way for the test hold since it's the easiest, most direct way to give the player an accessory, but this will destroy any other accessory the player already has equipped. For swap-style equipping (where the previous accessory is left on the ground in an accessory slot), instead use the script command called "Equipment", option "Swap".

* The value 20000 corresponds to the character ID of the default character script that is your accessory; if that changes to e.g. 20018 because you have a lot of default characters in your hold then you'll want to use that value as appropriate (e.g. Set _Accessory 20018).

* Note that the accessory script itself has a Goto just after the "Each Use", that jumps immediately to the end of the script. This makes it so that the accessory doesn't do anything when first equipped; if you omit this such that the script effectively starts at the "OnUse" label, it will execute that "OnUse" part of the script immediately when first equipped. This might or might not be what you want to happen.

____________________________
Quick links to my stuff (in case you forgot where it was):
Click here to view the secret text

10-02-2018 at 05:53 AM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
New Topic New Poll Post Reply
Caravel Forum : DROD RPG Boards : RPG Architecture : Accessory On Use Example (a scripting helper reference)
Surf To:


Forum Rules:
Can I post a new topic? No
Can I reply? No
Can I read? Yes
HTML Enabled? No
UBBC Enabled? Yes
Words Filter Enable? No

Contact Us | CaravelGames.com

Powered by: tForum tForumHacks Edition b0.98.8
Originally created by Toan Huynh (Copyright © 2000)
Enhanced by the tForumHacks team and the Caravel team.