Files
boe-scenarios/BoEArchFull/Utility/Designers/Starcode (Utility)/starcode.txt
2025-08-01 10:47:35 -05:00

186 lines
11 KiB
Plaintext

Blades Coding Contest Entry
By: Stareye
This entry contains five pieces of code. All are accessed within the Global Special nodes. They are as follows:
0-5 -- Simple Special Spell
6-14 -- Simple Counterspell
15-51 -- Complex Counterspell/Special Spell Sequence
52-62 -- Soul Crystal (Conditional spells)
63-69 -- NPC Town Encounter Saver
Demonstrations of the first four sequences can be accessed simply by playing the scenario. The fifth, the NPC Town Encounter Saver, does not lend itself to demonstration because it prides itself on its ability NOT to be noticed so it is not included. Note that only the global special nodes and the demonstration itself are to be judged. This does not include the internal mechanics (i.e. the town nodes), but does include their execution.
*** Simple Special Spell ***
The purpose of this sequence is to illustrate perhaps one of the simplest sequences of special spells producable. Basically, the engine calls a sequence of nodes that simulates the casting of a spell. This is generally called during a battle. The sequence is connected to a timer and is recalled every so often until the monster that is "casting" the spell dies.
This specific spell is called 'Fireblast' which damages the party with fire.
100,0 -- Monster L/D
0 - IF SDF 100,0 = 0 THEN GOTO 1; ELSE END
1 - Disp Sm Msg ("Wizard casts: Fireblast")
2 - Play Sound
3 - Do Damage
4 - Start General Timer, x moves, CALL 0; END
* The 'Play Sound' and the 'Do Damage' nodes have been left blank in this example because which sound is played is the designer's preference. Suggested sounds are 24 or 25 which are cast Priest and Mage spells respectively.
* Note that you may wish to call a One-Time Place Town Enc node before this sequence to place the monster that is casting the spell.
5 - Set SDF 100,0 = 1; END
* This is the flag you want attached to the monster. Note that it is possible to just have the flag set through the Advanced Monster Details, but it is often nice to display a message after the monster is killed. Also note that the flags in the Advanced Monster Details have been known to fail periodically for unknown reasons.
*** Simple Counterspell ***
If monsters can cast these evil special spells, it would be nice to provide a way to block them. Now there is! The counterspell is simply a flag that is checked upon the casting of the special spell. If the flag indicates the party has the counterspell, the special spell is interrupted.
100,0 -- Monster L/D
105,0 -- Have Counterspell?
0 - No; 1 - Yes
6 - IF SDF 100,0 = 0, THEN GOTO 7; ELSE END
7 - Disp Sm Msg ("Wizard casts: Fireblast")
8 - Play Sound
9 - IF SDF 105,0 = 1, THEN GOTO 12; ELSE GOTO 10
10 - Do Damage
11 - Start General Timer; x moves, CALL 6; END
12 - Disp Sm Msg ("Spell Countered!")
13 - Play Sound; END
* The sequence begins much as the previous one did with the monster "casting" the spell.
* However, before the PCs receive the ill effects, the engine checks SDF 105,0 to see if the party has the counterspell.
* If the party does not have the counterspell, the special spell proceeds as in the last entry.
* If the party does have the counterspell, instead of the effects, the party is notified that the special spell has been countered and the sequence terminates since there is no point to casting a spell again that will be countered.
* An excellent sound is the magical boom (sound 53) after the counter.
* Note that it may be desireable to have the counterspell be delivered on a percentage chance by using an IF Random Number? node. You would probably want the sequence to repeat after the spell is countered in this case.
14 - Set SDF 105,0 = 1; END
* This is the special that gives the counterspell. It's pretty simple.
* Note that you could make this more elaborate by making a book on a pedestal and implementing mage lore checks.
*** Complex Special Spell/Counterspell Sequence ***
The best way to understand special spells is to actually see them in action in a fairly complex way. This sequence is much like the previous one, however, it is a bit more complex. Basically, the monster "casts" its special spells, but this time it has three (Arctic Fury, Excommunicate, Mindshock) of them at its disposal. There is a 25% chance of each being cast and a 25% chance of the monster "resting" and not casting a spell during that cycle.
In addition, counterspells are worked into the example. Once a special spell is countered, a sequence will prevent it from being cast again and instead randomly cast another spell that has not been countered. The sequence only terminates if all the special spells are countered or the monster is killed.
Note that you can play the scenario to see this variation worked out.
110,0 -- Monster L/D
111,0 -- Have Arctic Fury Counterspell?
111,1 -- Have Excommunicate Counterspell?
111,2 -- Have Mindshock Counterspell?
112,0 -- Arctic Fury Blocked?
112,1 -- Excommunicate Blocked?
112,2 -- Mindshock Blocked?
15 - IF SDF 110,0 = 0, THEN GOTO 16; ELSE END
16 - IF Random Number? < 50 THEN GOTO 17; ELSE GOTO 34
17 - IF Random Number? < 50 THEN GOTO 18; ELSE GOTO 27
18 - IF SDF 112,0 = 0, THEN GOTO 19; ELSE GOTO 41
19 - Disp Sm Msg ("Wizard casts: Arctic Fury")
20 - Play a Sound (25)
21 - IF SDF 111,0 = 1, THEN GOTO 24; ELSE GOTO 22
22 - Do Damage (Ice)
23 - Start General Timer; 5 moves, CALL 15; END
24 - Set SDF 112,0 = 1
25 - Disp Sm Msg ("Spell Countered!")
26 - Play a Sound (53), GOTO 23
27 - IF SDF 112,1 = 0, THEN GOTO 28; ELSE GOTO 45
28 - Disp Sm Msg ("Wizard casts: Excommunicate")
29 - Play a Sound (24)
30 - IF SDF 111,1 = 1, THEN GOTO 33; ELSE GOTO 31
31 - Affect Curse (4)
32 - Affect Slow (4); GOTO 23
33 - Set SDF 112,1 = 1; GOTO 25
34 - IF Random Number? < 50 THEN GOTO 35; ELSE GOTO 23
35 - IF SDF 112,2 = 0, THEN GOTO 36; ELSE GOTO 48
36 - Disp Sm Msg ("Wizard casts: Mindshock")
37 - Play a Sound (53)
38 - IF SDF 111,2 = 1, THEN GOTO 40; ELSE GOTO 39
39 - Affect Dumbfounding (2); GOTO 23
40 - Set SDF 112,2 = 1; GOTO 25
41 - IF Random Number? < 50 THEN GOTO 42; ELSE GOTO 44
42 - IF SDF 112,1 = 0, THEN GOTO 28; ELSE GOTO 43
43 - IF SDF 112,2 = 0, THEN GOTO 36; ELSE END
44 - IF SDF 112,2 = 0, THEN GOTO 36; ELSE GOTO 42
45 - IF Random Number? < 50 THEN GOTO 46; ELSE GOTO 47
46 - IF SDF 112,0 = 0, THEN GOTO 19; ELSE GOTO 42
47 - IF SDF 112,2 = 0, THEN GOTO 36; ELSE GOTO 46
48 - IF Random Number? < 50 THEN GOTO 49; ELSE GOTO 50
49 - IF SDF 112,0 = 0, THEN GOTO 19; ELSE GOTO 42
50 - IF SDF 112,1 = 0, THEN GOTO 28; ELSE GOTO 49
51 - Set SDF 110,0 = 1; END
* The node sequence is fairly self-explanatory (if you know how special spells and counterspells work) until you reach 40.
* In case it is not, the concept is as follows: The engine randomly assigns the cycle to one of three subcycles, one for each special spell. Note there is a fourth which simply returns the cycle to the timer to repeat the loop.
* In each subcycle, the engine checks to see if the respective special spell has been countered. If so, it jumps to nodes 40-50 which assign another special spell. If not, the monster casts the spell. Before the effects, the engine checks to see if the party has the appropriate counterspell. If they do, the spell is countered and the engine takes note that the spell was countered so it will not be cast should the subcycle be selected again. If they do not have the counterspell, the effects occur and the engine returns to the timer to select a new subcycle and repeats until the monster is killed.
* Nodes 40-50 are fairly complicated and difficult to explain. Basically, it is split into three parts, one for each special spell subcycle. These randomly assign one of the other two special spells to be cast. Before casting it, however, the engine checks to see if that one too has been countered. If so, it selects the other, if not, the other spell is cast. If all spells have been countered, then the sequence will terminate as there is no reason to cast any further spells. The purpose of this is to give the monster some artificial intelligence in casting its special spells and to stop annoying the play with constant "Spell Countered!" messages.
* Note that 40-50 seem kind of messy at first glance, often having redundant checks. The purpose of this design was to limit the node usage. As these sequences tend to long, it is a good idea to save as much space as possible.
* Node 51 is called when the monster is killed.
*** Soul Crystal (Conditional Spells) ***
One of the features lacking in the Blades Editor is the Soul Crystal. For those who have not played the Exile trilogy, the Soul Crystal was a special item which was necessary to have in order to cast Capture Soul and Simulacrum. Now it is possible to simulate a Soul Crystal.
115,0 - Know Capture Soul?
115,1 - Know Simulacrum?
Special Item 0 - Soul Crystal
// Call this sequence when you find Capture Soul (not in a shop)
52 - Set SDF 115,0 = 1 ("You learned Capture Soul!")
53 - If Have Special Item 0, THEN GOTO 54; ELSE END
54 - Give Mage Spell (Capture Soul); END
// Call this sequence when you find Simulacrum (not in a shop)
55 - Set SDF 115,1 = 1 ("You learned Simulacrum!")
56 - If Have Special Item 0, THEN GOTO 57; ELSE END
57 - Give Mage Spell (Simulacrum); END
// Call this sequence when you find the Soul Crystal
58 - Give Special Item 0 ("You found a Soul Crystal!")
59 - IF SDF 115,0 = 1 THEN GOTO 60; ELSE GOTO 61
60 - Give Mage Spell (Capture Soul)
61 - IF SDF 115,1 = 1 THEN GOTO 62; ELSE END
62 - Give Mage Spell (Simulacrum); END
* Basically what the first two sequences do is record via a flag that the spell was found but does not actually give the spell unless the party has a Soul Crystal.
* The third sequence gives the Soul Crystal and checks to see if the party has located the other two spells and actually gives them if they have already found them.
* Note that you cannot sell these spells in shops for this to work.
* Also this can be applied to all sorts of other things beyond spells such as special items and such.
*** NPC Town Enc Saver ***
NPCs have become very popular recently. Several designers have complained that the number of NPCs that they could use was heavily limited by the number of Town Monster Encounters available. This sequence eliminates that problem by only requiring one Town Encounter. It does this by placing all of the NPCs in one encounter and then destorying any that are not in the party. This all occurs so fast that the player does not notice the unwanted NPCs.
This sequence should be placed in the scenario specials so it can be called conveniently at the start of every battle.
120,0 - NPC 1
120,1 - NPC 2
120,2 - NPC 3
Values:
0 - Not joined party
1 - In party
2 - Dead
63 - One-Time Place Town Enc (Place NPCs)
64 - IF SDF 120,0 = 1, THEN GOTO 66; ELSE GOTO 65
65 - Destroy Monster (NPC 1)
66 - IF SDF 120,1 = 1, THEN GOTO 68; ELSE GOTO 67
67 - Destroy Monster (NPC 2)
68 - IF SDF 120,2 = 1, THEN END; ELSE GOTO 69
69 - Destory Monster (NPC 3)
* Note this sequence is designed for three NPCs. This number can be expanded simply by continuing the sequence.