Author Topic: STICKY: Script Library  (Read 90 times)

Offline manikus

  • Skriptor
  • Administrator
  • Hero Member
  • *****
  • Posts: 9857
STICKY: Script Library
« on: November 15, 2017, 02:22:47 PM »
-=The Dungeon Craft Script Library=-

In this thread I am going to collect various scripts and script snippets. This first post will contain links to the various bits of code.


Special Abilities:
   item double damage versus undead
   day of the week
« Last Edit: November 15, 2017, 04:12:34 PM by manikus »

Offline manikus

  • Skriptor
  • Administrator
  • Hero Member
  • *****
  • Posts: 9857
item double damage versus undead
« Reply #1 on: November 15, 2017, 02:29:36 PM »
Here is a script to make your weapon do double damage against undead opponents.
The below instructions are for use with your texxt databases (but are easily adaptable to use in the editors)

You nee to add a line to your item that reads:
Code: [Select]
Special Ability = item_DoubleVsUndead

This script needs to be added to you special abilities database...
Code: [Select]
\(BEGIN)
name = item_DoubleVsUndead
[ComputeDamage] = $VAR tgt; $VAR p5;
-tgt = $IndexOf($TargetContext());
-p5 = $GET_HOOK_PARAM(5);
-$IF ($GET_CHAR_UNDEAD(tgt) != "none") {$RETURN p5 *# 2;};
\(END)

Offline manikus

  • Skriptor
  • Administrator
  • Hero Member
  • *****
  • Posts: 9857
day of the week
« Reply #2 on: November 15, 2017, 04:10:08 PM »
If you have ever wanted to know what day of the week it was in your design...
Code: [Select]
$VAR dow; $VAR dlist; $VAR day;
dow = $GET_PARTY_DAYS() %# 7;
dlist = "$Sunday$Monday$Tuesday$Wednesday$Thursday$Friday$Saturday";
day = $DelimitedStringSubstring(dayList, dow);

You can use this in places that display text, such as with the TimeText Hook for display during 3D view - the current default release uses a version of this to display the day of the week near the compass.

 

anything