Completely rewrote the ghost/lost soul appearance events.

This commit is contained in:
Jan Rietema 2007-09-13 13:28:54 +00:00
parent e7f5d62a19
commit 3c19180947

View file

@ -126,7 +126,7 @@
# AI will attack a weak unit with a max of 4,5,6 units
# depending on the difficulty (default=5)
{ATTACK_DEPTH 4 5 6}
{ATTACK_DEPTH 3 4 5}
#!***removed [protect_location] -> will be done on per case basis allowing player to escape from ambushes rather***
#!***than fight to the dead each time***
@ -310,6 +310,7 @@
{FOREACH enemy i}
{VARIABLE enemy[$i].variables.dehydration 0}
{VARIABLE enemy[$i].variables.full_hitpoints $enemy[$i].hitpoints}
{VARIABLE enemy[$i].variables.max_hitpoints $enemy[$i].max_hitpoints}
[unstore_unit]
variable=enemy[$i]
find_vacant=no
@ -317,6 +318,7 @@
{NEXT i}
#enddef
# Special Encounter events
# Encounter 1: Scorpions attack
@ -858,6 +860,7 @@
[/then]
[else]
{VARIABLE black_patrol_dialogue 0}
[event]
name=sighted
@ -868,19 +871,32 @@
[filter_second]
description=Patrol Bandit
[/filter_second]
[if]
[variable]
name=black_patrol_dialogue
equals=0
[/variable]
[then]
[message]
description=Black Lieutenant
message= _ "We don't know who you are, and we don't much care. Tremble before the might of the Black Hand!"
[/message]
[message]
description=Black Lieutenant
message= _ "We don't know who you are, and we don't much care. Tremble before the might of the Black Hand!"
[/message]
[message]
speaker=Kaleh
message= _ "We need that water, and if we have to go through you to get it, so be it."
[/message]
{MODIFY_UNIT side=2 ai_special ""}
[message]
speaker=Kaleh
message= _ "We need that water, and if we have to go through you to get it, so be it."
[/message]
{VARIABLE black_hand_dialogue 1}
{MODIFY_UNIT side=2 ai_special ""}
[/then]
[/if]
[/event]
# events that spark off Bandit mobility
# a fight between one of the bandits
# and a player unit
[event]
name=attack
[filter]
@ -899,8 +915,53 @@
[filter_second]
side=1
[/filter_second]
{MODIFY_UNIT side=2 ai_special ""}
[if]
[variable]
name=black_hand_dialogue
equals=0
[/variable]
[then]
[message]
description=Black Lieutenant
message= _ "We don't know who you are, and we don't much care. Tremble before the might of the Black Hand!"
[/message]
[message]
speaker=Kaleh
message= _ "We need that water, and if we have to go through you to get it, so be it."
[/message]
{VARIABLE black_hand_dialogue 1}
{MODIFY_UNIT side=2 ai_special ""}
[/then]
[/if]
[/event]
# a player unit being killed by an ogre
[event]
name=die
[filter]
side=1
[/filter]
[filter_second]
side=3
[not]
type=Giant Scorpion
[/not]
[/filter_second]
{MODIFY_UNIT side=2 ai_special ""}
[/event]
# an ogre being killed by a player unit
[event]
name=die
[filter]
side=3
[not]
type=Giant Scorpion
[/not]
[/filter]
{MODIFY_UNIT side=2 ai_special ""}
[/event]
[/else]
[/if]
[/event]
@ -2058,101 +2119,177 @@
[/event]
# These events happen continually throughout the scenario
# All units (except unit carrying the traveler's ring) take 4/5/6 non-lethal
# damage (depending on difficulty) if they are standing in a desert, desert
# hills, or desert mountains hex during the day
# LOST SOULS:
# changed spawning of lost soul to happen in the vicinity of player units
# spawn a number of ghosts each turn depending on how "exposed"
# the player units are. Only units in the middle of the desert attract
# ghosts.
[event]
name=new turn
first_time_only=no
name=new turn
first_time_only=no
{VARIABLE turn_temp $turn_number}
{VARIABLE_OP turn_temp modulo 15}
# LOST SOUL DISAPPEARANCE at first daylight
[if]
[variable]
name=turn_temp
numerical_equals=1
[/variable]
[or]
[variable]
name=turn_temp
numerical_equals=7
[/variable]
[/or]
[then]
# reset the ghosts spawned counter
{VARIABLE ghosts_already_spawned 0}
[kill]
role=LostSoul
animate=no
fire_event=no
[/kill]
[/then]
[else]
# store "exposed" units - those surrounded by a lot of desert
[store_locations]
variable=ghost_spawn
[filter]
side=1
[/filter]
[not]
time_of_day=lawful
[/not]
terrain=Hd, Dd, Rr
[filter_adjacent_location]
count="5,6"
direction="n,ne,se,s,sw,nw"
terrain=Hd, Dd, Rr
[/filter_adjacent_location]
[/store_locations]
{VARIABLE ghosts $ghost_spawn.length}
{VARIABLE turn_temp $turn_number}
{VARIABLE_OP turn_temp modulo 15}
#!***Ghost apperance event***
[if]
[if]
[variable]
name=turn_temp
numerical_equals=5
name=ghosts
greater_than=0
[/variable]
[or]
[variable]
name=turn_temp
numerical_equals=11
[/variable]
[/or]
[then]
# Easy: 8 ghosts
# Medium: 10 ghosts
# Hard: 12 ghosts
{VARIABLE ghosts 8}
{VARIABLE i 0}
{VARIABLE ghosts_killed 0}
# spawn more rapidly as time goes by
{VARIABLE added_ghosts $turn_number}
{VARIABLE_OP added_ghosts add 15}
{VARIABLE_OP added_ghosts divide 30}
#ifdef EASY
# 1 ghost per 4 exposed units (roughly) per turn
{VARIABLE_OP ghosts add $added_ghosts}
{VARIABLE_OP ghosts add 2}
{VARIABLE_OP ghosts divide 4}
{VARIABLE max_ghosts 6}
{VARIABLE max_per_turn 2}
#endif
#ifdef MEDIUM
{ADD ghosts 2}
# 1 ghost per 2 exposed units (roughly) per turn
{VARIABLE_OP ghosts add $added_ghosts}
{VARIABLE_OP ghosts divide 2}
{VARIABLE max_ghosts 7}
{VARIABLE max_per_turn 3}
#endif
#ifdef HARD
{ADD ghosts 4}
# 1 ghost per 1.5 exposed units (roughly) per turn
{VARIABLE_OP ghosts multiply 2}
{VARIABLE_OP ghosts add $added_ghosts}
{VARIABLE_OP ghosts divide 3}
{VARIABLE max_ghosts 8}
{VARIABLE max_per_turn 4}
#endif
[store_locations]
x=1-40
y=1-80
terrain=Hd, Dd, Rr
variable=desert
[/store_locations]
[while]
[variable]
name=i
less_than=$ghosts
[/variable]
[do]
{RANDOM 1..$desert.length}
{CREATE_UNIT 4 "Ghost" $desert[$random].x $desert[$random].y "Lost Soul" (user_description=_"Lost Soul"
role=LostSoul)}
{ADD i 1}
[/do]
[/while]
[/then]
{CLEAR_VARIABLE desert}
{CLEAR_VARIABLE i}
[/if]
#!***Ghost disapperance event***
[if]
[variable]
name=turn_temp
numerical_equals=1
[/variable]
[or]
[variable]
name=turn_temp
numerical_equals=7
[/variable]
[/or]
[then]
[kill]
role=LostSoul
animate=no
fire_event=no
[/kill]
[/then]
[/if]
{CLEAR_VARIABLE turn_temp}
{CLEAR_VARIABLE added_ghosts}
# limit ghost appearance rate
[if]
[variable]
name=ghosts
greater_than=$max_per_turn
[/variable]
[then]
{VARIABLE ghosts $max_per_turn}
[/then]
[/if]
{CLEAR_VARIABLE max_per_turn}
# deduct already spawned ghosts - whether still alive or not
{VARIABLE_OP max_ghosts add -$ghosts_already_spawned}
[if]
[variable]
name=max_ghosts
less_than=0
[/variable]
[then]
{VARIABLE max_ghosts 0}
[/then]
[/if]
[if]
[variable]
name=ghosts
greater_than=$max_ghosts
[/variable]
[then]
{VARIABLE ghosts $max_ghosts}
[/then]
[/if]
# store all possible spawn locations in range
# pick one random ghost_spawn from which
# to store all locations in range
{RANDOM 1..$ghost_spawn.length}
[store_locations]
variable=spawn
x=$ghost_spawn[$random].x
y=$ghost_spawn[$random].y
radius=8
terrain=Hd, Dd, Rr
[/store_locations]
{VARIABLE i 0}
[while]
[variable]
name=i
less_than=$ghosts
[/variable]
[do]
{RANDOM 1..$spawn.length}
# don't spawn right adjacent to a player unit
[if]
[have_location]
x=$spawn[$random].x
y=$spawn[$random].y
[filter_adjacent_location]
adjacent="n,ne,se,s,sw,nw"
count="1-6"
[filter]
side=1
[/filter]
[/filter_adjacent_location]
[/have_location]
[else]
{CREATE_UNIT 4 "Ghost" $spawn[$random].x $spawn[$random].y "Lost Soul" (user_description=_"Lost Soul"
role=LostSoul)}
{VARIABLE_OP ghosts_already_spawned add 1}
[/else]
[/if]
{ADD i 1}
[/do]
[/while]
{CLEAR_VARIABLE ghost_spawn}
[/then]
[/if]
[/else]
[/if]
{CLEAR_VARIABLE turn_temp}
[/event]
[event]
name=turn 5
[message]
description=Garak
message= _ "The sands are haunted with the spirits of tortured souls long since dead. At dusk they rise again, and during the Long Dark they can be particularly nasty. They disappear again at dawn, but personally I prefer the heat of the day to the horrors of the night."
@ -2164,7 +2301,7 @@
[/message]
[/event]
# If player kills more than 25-50% of the undead on the map, then the rest flee
# If player kills more than 25-50% of the maximum number of lost souls, the rest flee
[event]
name=die
@ -2180,7 +2317,7 @@
{VARIABLE div 2}
#endif
{VARIABLE to_kill $ghosts}
{VARIABLE to_kill $max_ghosts}
{VARIABLE_OP to_kill divide $div}
[if]
@ -2199,6 +2336,9 @@
animate=no
fire_event=no
[/kill]
# don't respawn ghosts this night
{VARIABLE ghosts_already_spawned $max_ghosts}
[if]
[variable]