The Harvest Moon Consortium

A NeverWinterNights Guild and Player community

This scripting forum is to discuss scripting and for those needing help scripting to get help from others.

Moderators: Mermut, rdjparadis

Creating universal scripts by placing variables on areas

Postby Winterhawk99 » Sun Jan 20, 2019 10:22 am

I'm using areas as an example here. You can create more scripts on Placeables, NPCs, Items and anything else that has an advanced tab on their properties and variable editing on the variable tab of the advance properties.

So what we are looking for is a script that can so a lot of different things so that you don't need to keep rewriting similar scripts to clog up a module. The example I will be using is an area damage script that is versatile enough to handle any type of extreme or mildly painful environmental condition a builder can think of. It should also be able to handle different amounts of damage during different time periods and different types of damage. It goes something like this as an example:

lets say that a group of people want to explore Antarctica and reach the south pole. As they start the journey and go through areas its going to get colder. So perhaps you want to have a check for cold damage and make your cold damage checks closer together at greater saves for more points as they journey area to area. Now lets say they find an active volcano with lots of caves to explore. Some are so hot they need to check for fire damage. Some have acid all over and they have to check with acid damage. We are going to handle all of this with one script.

The first thing we need to do is to create a function to define what ambient damage is and another to handle and do the damage to pcs entering the area.

* a few notes first I'm doing this a little backwards so its easier to understand normally you would write the script and plug the variables in but here its easier to explain all this in a backward sort of way.*

*Also the script was created by Mermut for harvest moon it is a marvel of elegance in scripting.*

Ok back to our regularly featured program. Here are your two functions that you will need to plug in the variables

Code: Select all
void AmbientDamage(object oPC, object oArea);

This function defines what you want to do. You want to affect the PCs as long as they stay in the area

Code: Select all
void DoDamage(object oPC, object oArea, int iDie, int iCount, int iType, int iFortDC, float fDelay)

This function does the damage and handles the conditions.

So now that you have the functions on what you want to do and how to do it we are going to plug in the variables. In this example I will use a mountainous area at high altitude and set up cold damage for the pcs to cope with.

I'll have to rewrite this and work on it next week.
CTP team member
Chief cook and bottle washer for Harvest Moon
User avatar
Posts: 1294
Joined: Thu Oct 08, 2009 12:00 am
Location: Pa.


Return to Scripting Forum

Who is online

Users browsing this forum: No registered users and 1 guest