User Tools

Site Tools


scripting:time_based_script

The Quick Way

Holding your hand
So you want to spawn a chest in a certain part of the world at a certain time huh ? Well then here you go.

Find the level you would like to spawn a chest. You can spawn anything, I'm just using a chest as an example. Anyways, pick a level you want to add something.

Now open the tng and add these two lines:

XXXSectionStart V_StatueMaster;
XXXSectionEnd;

Anything you add between those two lines will only spawn a 12 noon. For example

XXXSectionStart V_StatueMaster;

NewThing Object;
Player 4;
UID 38446741874686296193;
DefinitionType “OBJECT_CHEST_OPENABLE”;
ScriptName StatueMasterChest;
ScriptData “NULL”;
ThingGamePersistent FALSE;
ThingLevelPersistent FALSE;
StartCTCPhysicsStandard;
PositionX 41.773193;
PositionY 120.024414;
PositionZ 31.920462;
RHSetForwardX 0.0;
RHSetForwardY 0.999994;
RHSetForwardZ 0.0;
RHSetUpX 0.0;
RHSetUpY 0.0;
RHSetUpZ 0.999994;
EndCTCPhysicsStandard;
StartCTCTargeted;
Targetable TRUE;
EndCTCTargeted;
StartCTCEditor;
EndCTCEditor;
StartCTCChest;
ContainerContents[0] “SWORD_OF_AEONS”;
ChestOpen FALSE;
EndCTCChest;
Health 1.0;
EndThing;

XXXSectionEnd;

Just make sure you remember to make a unique UID number and have the correct cordinates. Also make sure you add “StatueMasterChest” as the ScriptName.

You could also do this during quest. For example, say you want to spawn baddies ONLY during a boss fight (up the challenge).

For example, you want to spawn a nymph during the wasp queen battle. Add your nymph script in between

XXXSectionStart Q_WaspBoss;
XXXSectionEnd;

(Remember, you dont have to add those two lines to the picnic area, they're already there)

Anything you add in between those two lines will spawn ONLY during the wasp queen battle. For example;

XXXSectionStart Q_WaspBoss;

NewThing AICreature;
Player 0;
UID 29446741871111111151;
DefinitionType “CREATURE_WOOD_NYMPH_01”;
ScriptName NULL;
ScriptData “NULL”;
ThingGamePersistent FALSE;
ThingLevelPersistent FALSE;
StartCTCPhysicsNavigator;
PositionX 40.539795;
PositionY 42.694092;
PositionZ 33.862812;
RHSetForwardX 0.0;
RHSetForwardY 0.999994;
RHSetForwardZ 0.0;
RHSetUpX 0.0;
RHSetUpY 0.0;
RHSetUpZ 0.999994;
EndCTCPhysicsNavigator;
StartCTCTargeted;
Targetable TRUE;
EndCTCTargeted;
StartCTCTalk;
EndCTCTalk;
StartCTCEditor;
EndCTCEditor;
Health 500.0;
OverridingBrainName NULL;
HasInformation FALSE;
WanderWithInformation FALSE;
WaveWithInformation FALSE;
EnableCreatureAutoPlacing FALSE;
AllowedToFollowHero FALSE;
RegionFollowingOverriddenFromScript FALSE;
RespondingToFollowAndWait TRUE;
CanBeCourted FALSE;
CanBeMarried FALSE;
InitialPosX 4736.022461;
InitialPosY 3565.528564;
InitialPosZ 20.050686;
EndThing;

XXXSectionEnd;

Another example (works really well), would be to add these two lines to every map that you walk through on the way to escort the traders and after you meet them.
For example add these two lines to Greatwood1.tng

NOTE Please keep in mind, thats there are two escort missions… Q_TraderEscort; and QR_EscortTrader. The one we want to add to greatwood (everymap during the quest) is Q_EscortTrader;

XXXSectionStart Q_TraderEscort;
XXXSectionEnd;

In between those two lines add this.

NewThing Marker;
Player -1;
UID 18446741874686296403;
DefinitionType “MARKER_BASIC”;
ScriptName DarkwoodAssassinSpawn;
ScriptData “NULL”;
ThingGamePersistent FALSE;
ThingLevelPersistent FALSE;
StartCTCPhysicsStandard;
PositionX 53.044189;
PositionY 57.662842;
PositionZ 43.383373;
RHSetForwardX -0.936729;
RHSetForwardY 0.35004;
RHSetForwardZ 0.0;
RHSetUpX 0.0;
RHSetUpY 0.0;
RHSetUpZ 0.999994;
EndCTCPhysicsStandard;
StartCTCEditor;
EndCTCEditor;
Health 1.0;
EndThing;

Add as many as you want, but make sure you use the correct cordinates. Use a creature generator, chest, potion, item. ect. as a point of referrence and borrow it's corrdinates.

How It Works

Rotating Object
ScriptName StatueMasterStatue; This script will make an object rotate along with the SM_Center Script

Rotating Marker
NewThing Marker;
DefinitionType “MARKER_GLOBAL”;
ScriptName SM_Center;
This rotates. Each time it points at one of the 4 other markers it activates the associated script.


Static Markers
Time Keepers
By placing these at different spots around the sm_center you can change the times.
Theoretically you can place more than one of each type at different times to trigger the script multiple times in a day.
A good place to try this out is by using the “working” sundial, which I suspect was the original intent

NewThing Marker;
DefinitionType “MARKER_GLOBAL”;
ScriptName SM_Guild;
NewThing Marker;

DefinitionType “MARKER_GLOBAL”;
ScriptName SM_Greatwood;
NewThing Marker;

DefinitionType “MARKER_GLOBAL”;
ScriptName SM_Bowerstone;
NewThing Marker;

DefinitionType “MARKER_GLOBAL”;
ScriptName SM_Nothing;

scripting/time_based_script.txt · Last modified: 2006/01/09 05:11 (external edit)