Sacrifice survival - solved
The place to post your WML questions and answers.
Moderator: Forum Moderators
Forum rules
- Please use [code] BBCode tags in your posts for embedding WML snippets.
- To keep your code readable so that others can easily help you, make sure to indent it following our conventions.
- ChaosRider
- Posts: 1168
- Joined: April 15th, 2012, 1:15 pm
Sacrifice survival - solved
Post by ChaosRider »
I have a problem with this addon cause unstoring units on new x,y doesnt work and thats the question for all of you who read this topic why it doesnt work? Any ideas? It was working in Wesnoth version 1.10. On Wesnoth v1.18 there is no error info and its not working.
Unstore code part:
Whole code:
Unstore code part:
Spoiler:
Code: Select all
#define SEND_SACRIFIED_UNIT X Y
{IF_VAR ai_target equals "Take that fort!" (
[then]
{VARIABLE sacrificed.goto_x {X}}
{VARIABLE sacrificed.goto_y {Y}}
[/then]
)}
{VARIABLE ox {X}}
{VARIABLE_OP ox add 29.5} # 14*2+3/2
{VARIABLE_OP ox divide 3}
{VARIABLE oy {Y}}
{VARIABLE_OP oy add 29.5} # 14*2+3/2
{VARIABLE_OP oy divide 3}
[unstore_unit]
variable=sacrificed
find_vacant=yes
x,y=$ox,$oy
{COLOR_HARM}
text="Reborn!"
[/unstore_unit]
#enddef
Spoiler:
Code: Select all
[multiplayer]
id=6p_Sacrifice_Survival_01
name="6p Sacrifice Survival 01"
map_data="{~add-ons/SacrificeSurvival/maps/SacrificeSurvival_01.map}"
description="6p competitive survival with sacrifices.
Sacrifice units in order to attack your enemies.
They will be reborn stronger with each next turn!
Blood decrease from turn 1 to 10 is equal 3, later it's equal 6.
From turn 10 you can sacrifice 2 units each turn.
With blood below 0 you'll gain punishment!
Any era, 70% XP, Gold: 125 +3/turn +5/village, no fog.
Leaders has increased hp by 50.
Each 5 turns monsters will appear to fight with everyone!
This version by ChaosRider."
turns="-1"
experience_modifier=70%
{DEFAULT_SCHEDULE}
random_start_time=on
objectives="Victory: Last leader standing.
Defeat: Death of your leader.
Preferred settings: 70% XP, Gold: 125 +3/turn +5/village, no fog.
Leaders has increased hp by 50.
Each 5 turns monsters will appear to fight with everyone!
Sacrifice units to send after your opponents.
They will be reborn stronger with each next turn!
Blood decrease from turn 1 to 10 is equal 3, later it's equal 6.
From turn 10 you can sacrifice 2 units each turn.
With blood below 0 you'll gain punishment!
Legend says nothing will stop a leader's revenge once he decides to sacrifice himself.
<small><i>This version by ChaosRider.</i></small>"
# -----------------------------------------------------------------------------------------------------------------
# Set up sides
[side]
side=1
color=red
id=Computer
controller=ai
user_team_name="Gods of Wesnoth"
enemy=2,3,4,5,6,7,8
canrecruit=no
allow_player=false
fog=no
shroud=no
no_leader=true
experience_modifier=50%
[ai]
aggression=0.9
caution=0.1
village_value=3
leader_value=4
grouping="offensive"
[/ai]
[unit]
side=1
type=Elder Mage
name=Edwin Bloodful
canrecruit=0
x,y=14,14
[/unit]
[/side]
#define HUMAN_SIDE SIDE TEAM
[side]
side={SIDE}
canrecruit=yes
controller=human
user_team_name={TEAM}
fog=no
shroud=no
income=+3
gold=125
village_gold=5
experience_modifier=70%
[/side]
#enddef
{HUMAN_SIDE 2 "North"}
{HUMAN_SIDE 3 "NorthEast"}
{HUMAN_SIDE 4 "SouthEast"}
{HUMAN_SIDE 5 "South"}
{HUMAN_SIDE 6 "SouthWest"}
{HUMAN_SIDE 7 "NorthWest"}
[side]
side=8
id=Computer_2
controller=ai
user_team_name="Gods Anger"
enemy=1,2,3,4,5,6,7
canrecruit=no
allow_player=false
fog=no
shroud=no
no_leader=true
experience_modifier=50%
[ai]
aggression=0.9
caution=0.1
village_value=3
leader_value=4
grouping="offensive"
[/ai]
[/side]
[event]
name=prestart
{VARIABLE temp_blood_changing 3}
[set_variables]
name=Sides
[value]
fill=0
[/value]
[value]
fill=1
[/value]
#define SideValue AltarX0 AltarY0 AltarX1 AltarY1 AltarX2 AltarY2
[value]
altarx0={AltarX0}
altary0={AltarY0}
altarx1={AltarX1}
altary1={AltarY1}
altarx2={AltarX2}
altary2={AltarY2}
blood=3
[/value]
#enddef
{SideValue 14 3 14 2 14 1}
{SideValue 25 9 26 8 27 8}
{SideValue 25 20 26 20 27 21}
{SideValue 14 25 14 26 14 27}
{SideValue 3 20 2 20 1 21}
{SideValue 3 9 2 8 1 8}
[/set_variables]
[/event]
#define SOUND:POISON
# A convenient way to use the standard poison sound in an attack
# animation. Put anywhere inside an attack animation block.
[if]
hits=hit
[filter_second]
[not]
[filter_wml]
[status]
poisoned="yes"
[/status]
[/filter_wml]
[or]
[filter_wml]
[status]
unpoisonable="yes"
[/status]
[/filter_wml]
[/or]
[/not]
[/filter_second]
poisoned_sound_start_time=-100
[poisoned_sound_frame]
sound=poison.ogg
[/poisoned_sound_frame]
[/if]
#enddef
#define SOUND:SLOW
# A convenient way to use the standard slowing sound in an attack
# animation. Put anywhere inside an attack animation block.
[if]
hits=hit
[filter_second]
[not]
[filter_wml]
[status]
slowed="yes"
[/status]
[/filter_wml]
[/not]
[/filter_second]
slowed_sound_start_time=-100
[slowed_sound_frame]
sound=slowed.wav
[/slowed_sound_frame]
[/if]
#enddef
#define ABILITY_LEADERSHIP_LEVEL_1
# Canned definition of the Leadership (level 1) ability to be included in an
# [abilities] clause.
[leadership]
id=leadership
value=25
cumulative=yes
name= _ "leadership"
female_name= _ "female^leadership"
description= _ "This unit can lead our own units that are next to it, making them fight better. Adjacent own units of lower level will do more damage in battle. When a unit adjacent to, of a lower level than, and on the same side as a unit with Leadership engages in combat, its attacks do 25% more damage times the difference in their levels."
affect_self=no
[affect_adjacent]
adjacent=n,ne,se,s,sw,nw
[filter]
level=0
[/filter]
[/affect_adjacent]
[/leadership]
#enddef
#define ABILITY_LEADERSHIP_LEVEL_2
# Canned definition of the Leadership (level 2) ability to be included in an
# [abilities] clause.
[leadership]
id=leadership
value=50
cumulative=yes
name= _ "leadership"
female_name= _ "female^leadership"
description= _ "This unit can lead our own units that are next to it, making them fight better. Adjacent own units of lower level will do more damage in battle. When a unit adjacent to, of a lower level than, and on the same side as a unit with Leadership engages in combat, its attacks do 25% more damage times the difference in their levels."
affect_self=no
[affect_adjacent]
adjacent=n,ne,se,s,sw,nw
[filter]
level=0
[/filter]
[/affect_adjacent]
[/leadership]
[leadership]
id=leadership
value=25
cumulative=yes
affect_self=no
[affect_adjacent]
adjacent=n,ne,se,s,sw,nw
[filter]
level=1
[/filter]
[/affect_adjacent]
[/leadership]
#enddef
#define ABILITY_LEADERSHIP_LEVEL_3
# Canned definition of the Leadership (level 3) ability to be included in an
# [abilities] clause.
[leadership]
id=leadership
value=75
cumulative=yes
name= _ "leadership"
female_name= _ "female^leadership"
description= _ "This unit can lead our own units that are next to it, making them fight better. Adjacent own units of lower level will do more damage in battle. When a unit adjacent to, of a lower level than, and on the same side as a unit with Leadership engages in combat, its attacks do 25% more damage times the difference in their levels."
affect_self=no
[affect_adjacent]
adjacent=n,ne,se,s,sw,nw
[filter]
level=0
[/filter]
[/affect_adjacent]
[/leadership]
[leadership]
id=leadership
value=50
cumulative=yes
affect_self=no
[affect_adjacent]
adjacent=n,ne,se,s,sw,nw
[filter]
level=1
[/filter]
[/affect_adjacent]
[/leadership]
[leadership]
id=leadership
value=25
cumulative=yes
affect_self=no
[affect_adjacent]
adjacent=n,ne,se,s,sw,nw
[filter]
level=2
[/filter]
[/affect_adjacent]
[/leadership]
#enddef
#define ABILITY_LEADERSHIP_LEVEL_4
# Canned definition of the Leadership (level 4) ability to be included in an
# [abilities] clause.
[leadership]
id=leadership
value=100
cumulative=yes
name= _ "leadership"
female_name= _ "female^leadership"
description= _ "This unit can lead our own units that are next to it, making them fight better. Adjacent own units of lower level will do more damage in battle. When a unit adjacent to, of a lower level than, and on the same side as a unit with Leadership engages in combat, its attacks do 25% more damage times the difference in their levels."
affect_self=no
[affect_adjacent]
adjacent=n,ne,se,s,sw,nw
[filter]
level=0
[/filter]
[/affect_adjacent]
[/leadership]
[leadership]
id=leadership
value=75
cumulative=yes
affect_self=no
[affect_adjacent]
adjacent=n,ne,se,s,sw,nw
[filter]
level=1
[/filter]
[/affect_adjacent]
[/leadership]
[leadership]
id=leadership
value=50
cumulative=yes
affect_self=no
[affect_adjacent]
adjacent=n,ne,se,s,sw,nw
[filter]
level=2
[/filter]
[/affect_adjacent]
[/leadership]
[leadership]
id=leadership
value=25
cumulative=yes
affect_self=no
[affect_adjacent]
adjacent=n,ne,se,s,sw,nw
[filter]
level=3
[/filter]
[/affect_adjacent]
[/leadership]
#enddef
#define ABILITY_LEADERSHIP_LEVEL_5
# Canned definition of the Leadership (level 5) ability to be included in an
# [abilities] clause.
[leadership]
id=leadership
value=125
cumulative=yes
name= _ "leadership"
female_name= _ "female^leadership"
description= _ "This unit can lead our own units that are next to it, making them fight better. Adjacent own units of lower level will do more damage in battle. When a unit adjacent to, of a lower level than, and on the same side as a unit with Leadership engages in combat, its attacks do 25% more damage times the difference in their levels."
affect_self=no
[affect_adjacent]
adjacent=n,ne,se,s,sw,nw
[filter]
level=0
[/filter]
[/affect_adjacent]
[/leadership]
[leadership]
id=leadership
value=100
cumulative=yes
affect_self=no
[affect_adjacent]
adjacent=n,ne,se,s,sw,nw
[filter]
level=1
[/filter]
[/affect_adjacent]
[/leadership]
[leadership]
id=leadership
value=75
cumulative=yes
affect_self=no
[affect_adjacent]
adjacent=n,ne,se,s,sw,nw
[filter]
level=2
[/filter]
[/affect_adjacent]
[/leadership]
[leadership]
id=leadership
value=50
cumulative=yes
affect_self=no
[affect_adjacent]
adjacent=n,ne,se,s,sw,nw
[filter]
level=3
[/filter]
[/affect_adjacent]
[/leadership]
[leadership]
id=leadership
value=25
cumulative=yes
affect_self=no
[affect_adjacent]
adjacent=n,ne,se,s,sw,nw
[filter]
level=4
[/filter]
[/affect_adjacent]
[/leadership]
#enddef
#define ABILITY_LEADERSHIP_LEVEL_6
# Canned definition of the Leadership (level 6) ability to be included in an
# [abilities] clause.
[leadership]
id=leadership
value=150
cumulative=yes
name= _ "leadership"
female_name= _ "female^leadership"
description= _ "This unit can lead our own units that are next to it, making them fight better. Adjacent own units of lower level will do more damage in battle. When a unit adjacent to, of a lower level than, and on the same side as a unit with Leadership engages in combat, its attacks do 25% more damage times the difference in their levels."
affect_self=no
[affect_adjacent]
adjacent=n,ne,se,s,sw,nw
[filter]
level=0
[/filter]
[/affect_adjacent]
[/leadership]
[leadership]
id=leadership
value=125
cumulative=yes
affect_self=no
[affect_adjacent]
adjacent=n,ne,se,s,sw,nw
[filter]
level=1
[/filter]
[/affect_adjacent]
[/leadership]
[leadership]
id=leadership
value=100
cumulative=yes
affect_self=no
[affect_adjacent]
adjacent=n,ne,se,s,sw,nw
[filter]
level=2
[/filter]
[/affect_adjacent]
[/leadership]
[leadership]
id=leadership
value=75
cumulative=yes
affect_self=no
[affect_adjacent]
adjacent=n,ne,se,s,sw,nw
[filter]
level=3
[/filter]
[/affect_adjacent]
[/leadership]
[leadership]
id=leadership
value=50
cumulative=yes
affect_self=no
[affect_adjacent]
adjacent=n,ne,se,s,sw,nw
[filter]
level=4
[/filter]
[/affect_adjacent]
[/leadership]
[leadership]
id=leadership
value=25
cumulative=yes
affect_self=no
[affect_adjacent]
adjacent=n,ne,se,s,sw,nw
[filter]
level=5
[/filter]
[/affect_adjacent]
[/leadership]
#enddef
#define ABILITY_LEADERSHIP_LEVEL_7
# Canned definition of the Leadership (level 7) ability to be included in an
# [abilities] clause.
[leadership]
id=leadership
value=175
cumulative=yes
name= _ "leadership"
female_name= _ "female^leadership"
description= _ "This unit can lead our own units that are next to it, making them fight better. Adjacent own units of lower level will do more damage in battle. When a unit adjacent to, of a lower level than, and on the same side as a unit with Leadership engages in combat, its attacks do 25% more damage times the difference in their levels."
affect_self=no
[affect_adjacent]
adjacent=n,ne,se,s,sw,nw
[filter]
level=0
[/filter]
[/affect_adjacent]
[/leadership]
[leadership]
id=leadership
value=150
cumulative=yes
affect_self=no
[affect_adjacent]
adjacent=n,ne,se,s,sw,nw
[filter]
level=1
[/filter]
[/affect_adjacent]
[/leadership]
[leadership]
id=leadership
value=125
cumulative=yes
affect_self=no
[affect_adjacent]
adjacent=n,ne,se,s,sw,nw
[filter]
level=2
[/filter]
[/affect_adjacent]
[/leadership]
[leadership]
id=leadership
value=100
cumulative=yes
affect_self=no
[affect_adjacent]
adjacent=n,ne,se,s,sw,nw
[filter]
level=3
[/filter]
[/affect_adjacent]
[/leadership]
[leadership]
id=leadership
value=75
cumulative=yes
affect_self=no
[affect_adjacent]
adjacent=n,ne,se,s,sw,nw
[filter]
level=4
[/filter]
[/affect_adjacent]
[/leadership]
[leadership]
id=leadership
value=50
cumulative=yes
affect_self=no
[affect_adjacent]
adjacent=n,ne,se,s,sw,nw
[filter]
level=5
[/filter]
[/affect_adjacent]
[/leadership]
[leadership]
id=leadership
value=25
cumulative=yes
affect_self=no
[affect_adjacent]
adjacent=n,ne,se,s,sw,nw
[filter]
level=6
[/filter]
[/affect_adjacent]
[/leadership]
#enddef
#define DIFFICULTY_OPTION NAME REBORN_XP
[option]
message="{NAME}: Sacrificed units need {REBORN_XP} xp to level-up."
[command]
{VARIABLE reborn_xp {REBORN_XP}}
[sound]
name=dragonstick.ogg
[/sound]
[print]
text="Difficulty: {NAME}
Sacrificed units need {REBORN_XP} xp to level-up."
size=40
duration=750
red,green,blue=255,0,0
[/print]
{SET_LABEL 14 13 "Difficulty: {NAME}"}
[/command]
[/option]
#enddef
#define AI_OPTION NAME DESCRIPTION
[option]
message="{NAME}: {DESCRIPTION}"
[command]
{VARIABLE ai_target "{NAME}"}
[sound]
name=dart.wav
[/sound]
[print]
text="AI target: $ai_target
{DESCRIPTION}"
size=40
duration=750
red,green,blue=0,0,255
[/print]
{SET_LABEL 14 15 "AI: $ai_target"}
[/command]
[/option]
#enddef
[event]
name=start
#define PLACE_ALTAR SIDE ALTARX ALTARY
{PLACE_IMAGE items/altar-evil.png $Sides[{SIDE}].{ALTARX} $Sides[{SIDE}].{ALTARY}}
{SET_LABEL $Sides[{SIDE}].{ALTARX} $Sides[{SIDE}].{ALTARY} "Sacrifice!" }
[if]
[variable]
name=turn_number
equals=1
[/variable]
[then]
[store_unit]
[filter]
side={SIDE}
canrecruit=yes
[/filter]
variable=stored_leader_of_side
[/store_unit]
[object]
silent=yes
duration=forever
[filter]
x,y=$stored_leader_of_side.x,$stored_leader_of_side.y
[/filter]
[effect]
apply_to=hitpoints
increase=50
increase_total=50
[/effect]
[/object]
{CLEAR_VARIABLE stored_leader_of_side}
[/then]
[/if]
#enddef
{PLACE_ALTAR 2 altarx1 altary1}
{PLACE_ALTAR 3 altarx1 altary1}
{PLACE_ALTAR 4 altarx1 altary1}
{PLACE_ALTAR 5 altarx1 altary1}
{PLACE_ALTAR 6 altarx1 altary1}
{PLACE_ALTAR 7 altarx1 altary1}
[message]
side=1
sound=dwarf-laugh.wav
caption="the Edwin Bloodful Elder Mage says:"
message="Welcome to my Sacrificed Survival!
I expect you to sacrifice some units to the gods of Wesnoth. Thus they will be reborn to relentlessly fight your opponents.
It is of course very interesting to see leaders sacrifice themselves from time to time... Mwahahahaw!"
[/message]
{HIGHLIGHT_IMAGE $Sides[2].altarx1 $Sides[2].altary1 items/altar-evil.png ()}
[/event]
[event]
name=side 1 turn 10
first_time_only=yes
[message]
side=1
sound=dwarf-laugh.wav
caption="the Edwin Bloodful Elder Mage says:"
message="Sacrifice more, more and more! Bring me more blood!
From this moment blood gonna decrease by 6 points."
[/message]
{VARIABLE temp_blood_changing 6}
[terrain]
x=14
y=1
terrain=Chr
[/terrain]
[terrain]
x=27
y=8
terrain=Chr
[/terrain]
[terrain]
x=27
y=21
terrain=Chr
[/terrain]
[terrain]
x=14
y=27
terrain=Chr
[/terrain]
[terrain]
x=1
y=21
terrain=Chr
[/terrain]
[terrain]
x=1
y=8
terrain=Chr
[/terrain]
{PLACE_ALTAR 2 altarx1 altary1}
{PLACE_ALTAR 3 altarx1 altary1}
{PLACE_ALTAR 4 altarx1 altary1}
{PLACE_ALTAR 5 altarx1 altary1}
{PLACE_ALTAR 6 altarx1 altary1}
{PLACE_ALTAR 7 altarx1 altary1}
{PLACE_ALTAR 2 altarx2 altary2}
{PLACE_ALTAR 3 altarx2 altary2}
{PLACE_ALTAR 4 altarx2 altary2}
{PLACE_ALTAR 5 altarx2 altary2}
{PLACE_ALTAR 6 altarx2 altary2}
{PLACE_ALTAR 7 altarx2 altary2}
{HIGHLIGHT_IMAGE $Sides[2].altarx2 $Sides[2].altary2 items/altar-evil.png ()}
[/event]
[event]
name=new_turn
first_time_only=yes
[message]
side=1
message="Choose difficulty: (how fast sacrificed units gain a level)"
{DIFFICULTY_OPTION Childlish "100%"}
{DIFFICULTY_OPTION Girlish "85%"}
{DIFFICULTY_OPTION Average "70%"}
{DIFFICULTY_OPTION Bravely "55%"}
{DIFFICULTY_OPTION Ambitiously "5..20"}
{DIFFICULTY_OPTION Epicly "3..13"}
{DIFFICULTY_OPTION Crazy "1..7"}
[/message]
[message]
side=1
message="Choose AI target: (what sacrificed units shall do)"
{AI_OPTION "Aggressive" "Regular AI tuned for high aggresssion."}
{AI_OPTION "Take that fort!" "Run for enemy forts."}
[/message]
[/event]
#define SEND_SACRIFIED_UNIT X Y
{IF_VAR ai_target equals "Take that fort!" (
[then]
{VARIABLE sacrificed.goto_x {X}}
{VARIABLE sacrificed.goto_y {Y}}
[/then]
)}
{VARIABLE ox {X}}
{VARIABLE_OP ox add 29.5} # 14*2+3/2
{VARIABLE_OP ox divide 3}
{VARIABLE oy {Y}}
{VARIABLE_OP oy add 29.5} # 14*2+3/2
{VARIABLE_OP oy divide 3}
[unstore_unit]
variable=sacrificed
find_vacant=yes
x,y=$ox,$oy
{COLOR_HARM}
text="Reborn!"
[/unstore_unit]
#enddef
#define UPDATE_BLOOD SIDE AMOUNT
{VARIABLE_OP Sides[{SIDE}].blood add {AMOUNT}}
[label]
x,y=$Sides[{SIDE}].altarx0,$Sides[{SIDE}].altary0
text="Blood: $Sides[{SIDE}].blood"
color=255,0,0
[/label]
#enddef
#define SACRIFICE_UNIT SIDE X1 Y1 X2 Y2 X3 Y3 X4 Y4 X5 Y5 ALTAR1 ALTAR2
{VARIABLE ax $Sides[{SIDE}].{ALTAR1}}
{VARIABLE ay $Sides[{SIDE}].{ALTAR2}}
[if]
[have_unit]
x,y=$ax,$ay
side={SIDE}
[/have_unit]
[then]
[object]
[filter]
x,y=$ax,$ay
[/filter]
silent=yes
[effect]
apply_to=image_mod
add="CS(50,-50,-50)"
[/effect]
[/object]
[if]
[have_unit]
x,y=$ax,$ay
canrecruit=yes
[/have_unit]
[then]
[message]
x,y=$ax,$ay
message="<big><b>I WILL REVENGE!!!</b></big>"
[/message]
[object]
[filter]
x,y=$ax,$ay
[/filter]
silent=yes
[effect]
apply_to=new_ability
[abilities]
{ABILITY_SKIRMISHER}
{ABILITY_LEADERSHIP_LEVEL_5}
[/abilities]
[/effect]
[effect]
apply_to=movement
increase=5
[/effect]
[/object]
[sound]
name=goblin-die-1.ogg
[/sound]
[/then]
[/if]
[store_unit]
[filter]
x,y=$ax,$ay
[/filter]
variable=sacrificed
[/store_unit]
[kill]
x,y=$sacrificed.x,$sacrificed.y
fire_event=no
[/kill]
{UPDATE_BLOOD {SIDE} $sacrificed.cost}
{UPDATE_BLOOD {SIDE} $sacrificed.experience}
{VARIABLE sacrificed.side 1}
{VARIABLE sacrificed.canrecruit no}
{VARIABLE_OP sacrificed.max_hitpoints sub 10}
{VARIABLE_OP sacrificed.max_hitpoints add $turn_number}
{VARIABLE sacrificed.hitpoints $sacrificed.max_hitpoints}
{VARIABLE sacrificed.status.poisoned no}
{VARIABLE sacrificed.status.slowed no}
{VARIABLE sacrificed.status.stoned no}
[if]
[variable]
name=reborn_xp
contains=".."
[/variable]
[then]
{RANDOM $reborn_xp}
{VARIABLE sacrificed.max_experience $random}
[/then]
[else]
[switch]
variable=reborn_xp
[case]
value="100%"
{VARIABLE_OP sacrificed.max_experience multiply 100}
[/case]
[case]
value="85%"
{VARIABLE_OP sacrificed.max_experience multiply 85}
[/case]
[case]
value="70%"
{VARIABLE_OP sacrificed.max_experience multiply 70}
[/case]
[case]
value="55%"
{VARIABLE_OP sacrificed.max_experience multiply 55}
[/case]
[/switch]
{VARIABLE_OP sacrificed.max_experience divide 100}
[/else]
[/if]
{VARIABLE n "$sacrificed.name"}
{VARIABLE sacrificed.description "$n is reborn after a ritual sacrifice and seeks revenge!"}
{THUNDER (
{COLOR_HARM}
{VARIABLE sacrificed.name "$n I"}
{SEND_SACRIFIED_UNIT {X1} {Y1}}
{VARIABLE sacrificed.name "$n II"}
{SEND_SACRIFIED_UNIT {X2} {Y2}}
{VARIABLE sacrificed.name "$n III"}
{SEND_SACRIFIED_UNIT {X3} {Y3}}
{VARIABLE sacrificed.name "$n IV"}
{SEND_SACRIFIED_UNIT {X4} {Y4}}
{VARIABLE sacrificed.name "$n V"}
{SEND_SACRIFIED_UNIT {X5} {Y5}}
)}
[/then]
[else]
[if]
[have_unit] # Maybe one from computer's side?
x,y=$ax,$ay
[/have_unit]
[else] # ... But no unit at all at altar?
[if]
[have_unit]
side={SIDE}
[/have_unit]
[then]
[if]
[variable]
name=temp_decrease_blood_{SIDE}
equals=$null
[/variable]
[then]
{UPDATE_BLOOD {SIDE} -$temp_blood_changing}
{VARIABLE temp_decrease_blood_{SIDE} "on"}
[/then]
[/if]
{IF_VAR Sides[{SIDE}].blood less_than 0 (
[then]
[if]
[variable]
name=Sides[{SIDE}].blood
less_than=-50
[/variable]
[then]
{UNIT 1 (Ghast) $ax $ay (
ai_special=guardian
description=Altar guardian
)}
[/then]
[else]
[if]
[variable]
name=Sides[{SIDE}].blood
less_than=-25
[/variable]
[variable]
name=Sides[{SIDE}].blood
greater_than_equal_to=-50
[/variable]
[then]
{UNIT 1 (Necrophage) $ax $ay (
ai_special=guardian
description=Altar guardian
)}
[/then]
[else]
{UNIT 1 (Ghoul) $ax $ay (
ai_special=guardian
description=Altar guardian
)}
[/else]
[/if]
[/else]
[/if]
[object]
[filter]
x,y=$ax,$ay
[/filter]
silent=yes
[effect]
apply_to=image_mod
add="CS(50,-50,-50)"
[/effect]
[/object]
[message]
sound=zombie-attack.wav
caption="Altar Guardian"
message="<big><b>YOU MUST SACRIFICE!</b></big>"
[/message]
[/then]
)}
[/then]
[/if]
[/else]
[/if]
[/else]
[/if]
#enddef
#define CLEAN_DEAD_SIDE SIDE XY
[if]
[have_unit]
side={SIDE}
[/have_unit]
[else]
[kill]
[filter_location]
x,y={XY}
radius=4
[/filter_location]
animate=no
fire_event=no
[/kill]
[/else]
[/if]
#enddef
#define SPAWN_UNIT SIDE UNIT_TYPE X Y
[if]
[have_unit]
side={SIDE}
canrecruit=yes
[/have_unit]
[then]
{UNIT (8) ({UNIT_TYPE}) ({X}) ({Y}) (
ai_special=guardian
description="Gods anger"
)}
[store_unit]
[filter]
side=8
[not]
[filter_wml]
[variables]
unit_after_image_changing="on"
[/variables]
[/filter_wml]
[/not]
[/filter]
variable=units_to_change_image
kill=no
[/store_unit]
{FOREACH units_to_change_image i}
[object]
[filter]
id=$units_to_change_image[$i].id
[/filter]
silent=yes
[effect]
apply_to=image_mod
add="CS(50,-50,-50)"
[/effect]
[/object]
{MODIFY_UNIT id=$units_to_change_image[$i].id variables.unit_after_image_changing "on"}
{NEXT i}
{CLEAR_VARIABLE units_to_change_image}
[/then]
[/if]
#enddef
[event]
name=new_turn
first_time_only=no
{CLEAR_VARIABLE temp_decrease_blood_2,temp_decrease_blood_3,temp_decrease_blood_4,temp_decrease_blood_5,temp_decrease_blood_6,temp_decrease_blood_7}
# Store Recruits and place them
{SACRIFICE_UNIT 2 25 9 25 20 14 25 3 20 3 9 altarx1 altary1}
{SACRIFICE_UNIT 3 25 20 14 25 3 20 3 9 14 3 altarx1 altary1}
{SACRIFICE_UNIT 4 14 25 3 20 3 9 14 3 25 9 altarx1 altary1}
{SACRIFICE_UNIT 5 3 20 3 9 14 3 25 9 25 20 altarx1 altary1}
{SACRIFICE_UNIT 6 3 9 14 3 25 9 25 20 14 25 altarx1 altary1}
{SACRIFICE_UNIT 7 14 3 25 9 25 20 14 25 3 20 altarx1 altary1}
[if]
[variable]
name=turn_number
greater_than=10
[/variable]
[then]
{SACRIFICE_UNIT 2 25 9 25 20 14 25 3 20 3 9 altarx2 altary2}
{SACRIFICE_UNIT 3 25 20 14 25 3 20 3 9 14 3 altarx2 altary2}
{SACRIFICE_UNIT 4 14 25 3 20 3 9 14 3 25 9 altarx2 altary2}
{SACRIFICE_UNIT 5 3 20 3 9 14 3 25 9 25 20 altarx2 altary2}
{SACRIFICE_UNIT 6 3 9 14 3 25 9 25 20 14 25 altarx2 altary2}
{SACRIFICE_UNIT 7 14 3 25 9 25 20 14 25 3 20 altarx2 altary2}
[/then]
[/if]
{CLEAN_DEAD_SIDE 2 14,6}
{CLEAN_DEAD_SIDE 3 22,10}
{CLEAN_DEAD_SIDE 4 22,18}
{CLEAN_DEAD_SIDE 5 14,22}
{CLEAN_DEAD_SIDE 6 6,18}
{CLEAN_DEAD_SIDE 7 6,10}
{VARIABLE_OP temp_count_time_for_monsters add 1}
[if]
[variable]
name=temp_count_time_for_monsters
equals=5
[/variable]
[then]
{VARIABLE temp_count_time_for_monsters 0}
{VARIABLE temp_do_loop 1}
[while]
[variable]
name=temp_end_loop
equals=$null
[/variable]
[do]
{VARIABLE_OP temp_do_we_increase rand 1..10}
[if]
[variable]
name=temp_do_we_increase
equals=1
[/variable]
[then]
{VARIABLE_OP temp_do_loop add 1}
[/then]
[else]
{VARIABLE temp_end_loop 0}
[/else]
[/if]
[/do]
[/while]
{CLEAR_VARIABLE temp_end_loop,temp_do_we_increase}
{VARIABLE temp_done_loop 0}
[while]
[variable]
name=temp_done_loop
less_than=$temp_do_loop
[/variable]
[do]
{VARIABLE_OP temp_random_enemies rand 1..20}
[switch]
variable=temp_random_enemies
[case]
value=1
{SPAWN_UNIT 2 Yeti 11 7}
{SPAWN_UNIT 3 Yeti 20 8}
{SPAWN_UNIT 4 Yeti 23 16}
{SPAWN_UNIT 5 Yeti 17 22}
{SPAWN_UNIT 6 Yeti 8 20}
{SPAWN_UNIT 7 Yeti 5 13}
[/case]
[case]
value=2
{SPAWN_UNIT 2 "Ancient Lich" 18 5}
{SPAWN_UNIT 3 "Ancient Lich" 25 13}
{SPAWN_UNIT 4 "Ancient Lich" 21 22}
{SPAWN_UNIT 5 "Ancient Lich" 10 23}
{SPAWN_UNIT 6 "Ancient Lich" 3 16}
{SPAWN_UNIT 7 "Ancient Lich" 7 7}
[/case]
[case]
value=3
{SPAWN_UNIT 2 "Armageddon Drake" 17 8}
{SPAWN_UNIT 3 "Armageddon Drake" 22 13}
{SPAWN_UNIT 4 "Armageddon Drake" 19 20}
{SPAWN_UNIT 5 "Armageddon Drake" 11 21}
{SPAWN_UNIT 6 "Armageddon Drake" 6 15}
{SPAWN_UNIT 7 "Armageddon Drake" 9 9}
[/case]
[case]
value=4
{SPAWN_UNIT 2 "Dwarvish Arcanister" 9 4}
{SPAWN_UNIT 3 "Dwarvish Arcanister" 22 5}
{SPAWN_UNIT 4 "Dwarvish Arcanister" 27 16}
{SPAWN_UNIT 5 "Dwarvish Arcanister" 19 25}
{SPAWN_UNIT 6 "Dwarvish Arcanister" 6 23}
{SPAWN_UNIT 7 "Dwarvish Arcanister" 1 13}
[/case]
[case]
value=5
{SPAWN_UNIT 2 "Elvish Sylph" 12 9}
{SPAWN_UNIT 3 "Elvish Sylph" 18 10}
{SPAWN_UNIT 4 "Elvish Sylph" 20 15}
{SPAWN_UNIT 5 "Elvish Sylph" 16 19}
{SPAWN_UNIT 6 "Elvish Sylph" 10 18}
{SPAWN_UNIT 7 "Elvish Sylph" 8 13}
[/case]
[case]
value=6
{SPAWN_UNIT 2 "Great Mage" 14 10}
{SPAWN_UNIT 3 "Great Mage" 18 12}
{SPAWN_UNIT 4 "Great Mage" 18 16}
{SPAWN_UNIT 5 "Great Mage" 14 18}
{SPAWN_UNIT 6 "Great Mage" 10 16}
{SPAWN_UNIT 7 "Great Mage" 10 12}
[/case]
[case]
value=7
{SPAWN_UNIT 2 "Grand Marshal" 13 12}
{SPAWN_UNIT 3 "Grand Marshal" 16 12}
{SPAWN_UNIT 4 "Grand Marshal" 17 15}
{SPAWN_UNIT 5 "Grand Marshal" 15 17}
{SPAWN_UNIT 6 "Grand Marshal" 12 16}
{SPAWN_UNIT 7 "Grand Marshal" 11 14}
[/case]
[case]
value=8
{SPAWN_UNIT 2 Khalid 16 6}
{SPAWN_UNIT 3 Khalid 23 12}
{SPAWN_UNIT 4 Khalid 21 20}
{SPAWN_UNIT 5 Khalid 12 22}
{SPAWN_UNIT 6 Khalid 5 17}
{SPAWN_UNIT 7 Khalid 7 9}
[/case]
[case]
value=9
{SPAWN_UNIT 2 "Fire Dragon" 20 4}
{SPAWN_UNIT 3 "Fire Dragon" 27 14}
{SPAWN_UNIT 4 "Fire Dragon" 21 24}
{SPAWN_UNIT 5 "Fire Dragon" 8 24}
{SPAWN_UNIT 6 "Fire Dragon" 1 15}
{SPAWN_UNIT 7 "Fire Dragon" 7 5}
[/case]
[case]
value=10
{SPAWN_UNIT 2 "Giant Spider" 17 7}
{SPAWN_UNIT 3 "Giant Spider" 23 13}
{SPAWN_UNIT 4 "Giant Spider" 20 20}
{SPAWN_UNIT 5 "Giant Spider" 11 22}
{SPAWN_UNIT 6 "Giant Spider" 5 16}
{SPAWN_UNIT 7 "Giant Spider" 8 8}
[/case]
[case]
value=11
{SPAWN_UNIT 2 "Sea Serpent" 15 7}
{SPAWN_UNIT 3 "Sea Serpent" 22 11}
{SPAWN_UNIT 4 "Sea Serpent" 21 19}
{SPAWN_UNIT 5 "Sea Serpent" 13 22}
{SPAWN_UNIT 6 "Sea Serpent" 6 17}
{SPAWN_UNIT 7 "Sea Serpent" 7 10}
[/case]
[case]
value=12
{SPAWN_UNIT 2 "Skeletal Dragon" 18 3}
{SPAWN_UNIT 3 "Skeletal Dragon" 27 12}
{SPAWN_UNIT 4 "Skeletal Dragon" 23 23}
{SPAWN_UNIT 5 "Skeletal Dragon" 10 25}
{SPAWN_UNIT 6 "Skeletal Dragon" 1 17}
{SPAWN_UNIT 7 "Skeletal Dragon" 5 6}
[/case]
[case]
value=13
{SPAWN_UNIT 2 "Water Serpent" 17 6}
{SPAWN_UNIT 3 "Water Serpent" 24 12}
{SPAWN_UNIT 4 "Water Serpent" 21 21}
{SPAWN_UNIT 5 "Water Serpent" 10 22}
{SPAWN_UNIT 6 "Water Serpent" 4 15}
{SPAWN_UNIT 7 "Water Serpent" 7 8}
{SPAWN_UNIT 2 "Water Serpent" 18 6}
{SPAWN_UNIT 3 "Water Serpent" 24 13}
{SPAWN_UNIT 4 "Water Serpent" 20 21}
{SPAWN_UNIT 5 "Water Serpent" 11 23}
{SPAWN_UNIT 6 "Water Serpent" 4 16}
{SPAWN_UNIT 7 "Water Serpent" 8 7}
[/case]
[case]
value=14
{SPAWN_UNIT 2 "Cuttle Fish" 14 6}
{SPAWN_UNIT 3 "Cuttle Fish" 22 10}
{SPAWN_UNIT 4 "Cuttle Fish" 22 18}
{SPAWN_UNIT 5 "Cuttle Fish" 13 23}
{SPAWN_UNIT 6 "Cuttle Fish" 5 18}
{SPAWN_UNIT 7 "Cuttle Fish" 6 9}
{SPAWN_UNIT 2 "Cuttle Fish" 15 6}
{SPAWN_UNIT 3 "Cuttle Fish" 23 11}
{SPAWN_UNIT 4 "Cuttle Fish" 22 19}
{SPAWN_UNIT 5 "Cuttle Fish" 14 22}
{SPAWN_UNIT 6 "Cuttle Fish" 6 18}
{SPAWN_UNIT 7 "Cuttle Fish" 6 10}
[/case]
[case]
value=15
{SPAWN_UNIT 2 "Death Knight" 17 3}
{SPAWN_UNIT 3 "Death Knight" 27 11}
{SPAWN_UNIT 4 "Death Knight" 24 22}
{SPAWN_UNIT 5 "Death Knight" 11 26}
{SPAWN_UNIT 6 "Death Knight" 1 18}
{SPAWN_UNIT 7 "Death Knight" 4 6}
[/case]
[case]
value=16
{SPAWN_UNIT 2 "Royal Warrior" 14 11}
{SPAWN_UNIT 3 "Royal Warrior" 17 13}
{SPAWN_UNIT 4 "Royal Warrior" 17 16}
{SPAWN_UNIT 5 "Royal Warrior" 14 17}
{SPAWN_UNIT 6 "Royal Warrior" 11 16}
{SPAWN_UNIT 7 "Royal Warrior" 11 13}
[/case]
[case]
value=17
{SPAWN_UNIT 2 "Elvish High Lord" 10 3}
{SPAWN_UNIT 3 "Elvish High Lord" 23 6}
{SPAWN_UNIT 4 "Elvish High Lord" 27 17}
{SPAWN_UNIT 5 "Elvish High Lord" 18 25}
{SPAWN_UNIT 6 "Elvish High Lord" 5 23}
{SPAWN_UNIT 7 "Elvish High Lord" 1 12}
[/case]
[case]
value=18
{SPAWN_UNIT 2 "Dwarvish Explorer" 12 4}
{SPAWN_UNIT 3 "Dwarvish Explorer" 23 8}
{SPAWN_UNIT 4 "Dwarvish Explorer" 25 18}
{SPAWN_UNIT 5 "Dwarvish Explorer" 16 24}
{SPAWN_UNIT 6 "Dwarvish Explorer" 5 21}
{SPAWN_UNIT 7 "Dwarvish Explorer" 3 11}
[/case]
[case]
value=19
{SPAWN_UNIT 2 "Troll Shaman" 17 4}
{SPAWN_UNIT 3 "Troll Shaman" 26 11}
{SPAWN_UNIT 4 "Troll Shaman" 23 22}
{SPAWN_UNIT 5 "Troll Shaman" 11 25}
{SPAWN_UNIT 6 "Troll Shaman" 2 17}
{SPAWN_UNIT 7 "Troll Shaman" 5 7}
{SPAWN_UNIT 2 "Troll Shaman" 18 4}
{SPAWN_UNIT 3 "Troll Shaman" 26 12}
{SPAWN_UNIT 4 "Troll Shaman" 22 22}
{SPAWN_UNIT 5 "Troll Shaman" 10 24}
{SPAWN_UNIT 6 "Troll Shaman" 2 16}
{SPAWN_UNIT 7 "Troll Shaman" 6 6}
[/case]
[case]
value=20
{SPAWN_UNIT 2 "Chocobone" 9 5}
{SPAWN_UNIT 3 "Chocobone" 21 6}
{SPAWN_UNIT 4 "Chocobone" 26 15}
{SPAWN_UNIT 5 "Chocobone" 19 24}
{SPAWN_UNIT 6 "Chocobone" 7 23}
{SPAWN_UNIT 7 "Chocobone" 2 13}
{SPAWN_UNIT 2 "Chocobone" 10 6}
{SPAWN_UNIT 3 "Chocobone" 20 7}
{SPAWN_UNIT 4 "Chocobone" 24 15}
{SPAWN_UNIT 5 "Chocobone" 18 22}
{SPAWN_UNIT 6 "Chocobone" 8 21}
{SPAWN_UNIT 7 "Chocobone" 4 13}
[/case]
[/switch]
{VARIABLE_OP temp_done_loop add 1}
[/do]
[/while]
{CLEAR_VARIABLE temp_random_enemies,temp_done_loop,temp_do_loop}
[/then]
[/if]
[/event]
[/multiplayer]
Last edited by ChaosRider on April 16th, 2025, 6:37 pm, edited 1 time in total.
Creator of WOTG (+5500 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.18 Wesnoth server.
- ChaosRider
- Posts: 1168
- Joined: April 15th, 2012, 1:15 pm
Re: Sacrifice survival
Post by ChaosRider »
Creator of WOTG (+5500 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.18 Wesnoth server.
- ChaosRider
- Posts: 1168
- Joined: April 15th, 2012, 1:15 pm
Re: Sacrifice survival
Post by ChaosRider »
Yup, that was a reason why units werent spawned after unstoring them. Now it works.
Below working code:
Below working code:
Code: Select all
[spoiler]
#define SEND_SACRIFIED_UNIT X Y
{IF_VAR ai_target equals "Take that fort!" (
[then]
{VARIABLE sacrificed.goto_x {X}}
{VARIABLE sacrificed.goto_y {Y}}
[/then]
)}
{VARIABLE ox {X}}
{VARIABLE_OP ox add 29.5} # 14*2+3/2
{VARIABLE_OP ox divide 3}
{VARIABLE oy {Y}}
{VARIABLE_OP oy add 29.5} # 14*2+3/2
{VARIABLE_OP oy divide 3}
{VARIABLE temp_find_variable_x 0}
[while]
[variable]
name=temp_check_variable
equals=$null
[/variable]
[do]
[if]
[variable]
name=temp_find_variable_x
less_than=$ox
[/variable]
[then]
{VARIABLE_OP temp_find_variable_x add 1}
[/then]
[else]
{VARIABLE_OP temp_check_variable add 1}
{VARIABLE_OP temp_find_variable_x sub 1}
[/else]
[/if]
[/do]
[/while]
{CLEAR_VARIABLE temp_check_variable}
{VARIABLE temp_find_variable_y 0}
[while]
[variable]
name=temp_check_variable
equals=$null
[/variable]
[do]
[if]
[variable]
name=temp_find_variable_y
less_than=$oy
[/variable]
[then]
{VARIABLE_OP temp_find_variable_y add 1}
[/then]
[else]
{VARIABLE_OP temp_check_variable add 1}
{VARIABLE_OP temp_find_variable_y sub 1}
[/else]
[/if]
[/do]
[/while]
{CLEAR_VARIABLE temp_check_variable}
[message]
message="Variable X: $ox
Rounded variable X: $temp_find_variable_x
Variable Y: $oy
Rounded variable Y: $temp_find_variable_y"
[/message]
[unstore_unit]
variable=sacrificed
find_vacant=yes
# x,y=$ox,$oy
x,y=$temp_find_variable_x,$temp_find_variable_y
{COLOR_HARM}
text="Reborn!"
[/unstore_unit]
#enddef
[/spoiler]
Creator of WOTG (+5500 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.18 Wesnoth server.
Post Reply
3 posts
• Page 1 of 1
Jump to
- Announcements
- ↳ News
- General
- ↳ Users’ Forum
- ↳ Tournaments
- ↳ Release Announcements, Compiling & Installation
- ↳ Technical Support
- ↳ iOS Support
- ↳ Strategies & Tips
- ↳ Gameplay Feedback
- ↳ Mainline Campaign Feedback
- ↳ Tutorial
- ↳ A Tale of Two Brothers
- ↳ An Orcish Incursion
- ↳ The South Guard
- ↳ Heir to the Throne
- ↳ Liberty
- ↳ Legend of Wesmere (single player)
- ↳ Legend of Wesmere (multiplayer)
- ↳ Eastern Invasion
- ↳ The Hammer of Thursagan
- ↳ Descent into Darkness
- ↳ Delfador’s Memoirs
- ↳ Dead Water
- ↳ Secrets of the Ancients
- ↳ Sceptre of Fire
- ↳ Son of the Black Eye
- ↳ The Rise of Wesnoth
- ↳ Northern Rebirth
- ↳ Under the Burning Suns
- ↳ Winds of Fate
- ↳ Add-on Feedback
- ↳ Website
- Development
- ↳ Art Contributions
- ↳ Art Workshop
- ↳ Writers’ Forum
- ↳ WML Workshop
- ↳ Lua Labs
- ↳ Faction & Era Development
- ↳ Multiplayer Development
- ↳ Scenario & Campaign Development
- ↳ Mainline Campaign Development
- ↳ UMC Replays
- ↳ Music & Sound Development
- ↳ Translations & Internationalization
- ↳ Translation Stats
- ↳ Ideas
- ↳ Coder’s Corner
- ↳ Developers’ Discussions
- ↳ Wesnoth Organizational Updates
- ↳ Art Development
- Miscellaneous
- ↳ Game Development
- ↳ Off-Topic
- ↳ Forum Games