The Dark Master Project

Discussion and development of scenarios and campaigns for the game.

Moderator: Forum Moderators

Post Reply
User avatar
hermestrismi
Posts: 626
Joined: February 6th, 2016, 11:28 pm
Location: Tunisia
Contact:

Re: The Dark Master Project

Post by hermestrismi »

white_haired_uncle wrote: December 19th, 2023, 11:35 pm Update from 1.0.3k (which I downloaded from addons.wesnoth.org) to 1.0.3o worked okay using the addons option in the game.
I am really curious what was wrong with it. I have an hypothesis. During the update, the internet server i use was shutdown in our country because of a technical problem. maybe the upload didn't completed becoz of that and the result was a corrupted file.
it is just an hypnosis.
anyway, I changed somethings with that version. mostly adding portraits, event of secret messages in ch. I and some minor bug fixing. I still can't found a way to fix the filtering of the weapon existence and so I can't add an option to store or unstore a weapon properly. also, I tried to work with lua but I figured out how ignorant I m in this field (but I got an idea about a good way to learn).
User avatar
hermestrismi
Posts: 626
Joined: February 6th, 2016, 11:28 pm
Location: Tunisia
Contact:

Re: The Dark Master Project

Post by hermestrismi »

Since wesnoth 1.17.22 became available, I uploaded a version of TDM on it with some modifications.
1. as White_haired_uncle suggested, the pack became only one campaign in the main menu,
2. since the seize became huge, I divided the image files into two Ressources files besides of the optional music file,
3. I am preparing to join the Hiden War campaigns to the file.
This only for the 1.17.22 version and later only
User avatar
hermestrismi
Posts: 626
Joined: February 6th, 2016, 11:28 pm
Location: Tunisia
Contact:

Re: The Dark Master Project

Post by hermestrismi »

Since BfW 1.18 is close, I will concentrate on the 1.17.x addon version.
unfortunately, I failed in two things (well, I succeeded partially but the final result was buggy):
1) creating a sure way to filter the modifications of units after taking items (a mandatory for the next step: stopping some units from taking some sort of weapons twice, which is necessary to create a store/unstore options),
2) creating a window of options that contains all the menu items to make the interface more easy and attractive (I did an example but the options are showing in lines and not as grids and boxes). my try with lua failed miserably lool
the good thing is that I made a progression in the AI_controller macro but it will not be used until it is completed.
hopefully, someone can help with the two objectives.
white_haired_uncle
Posts: 1202
Joined: August 26th, 2018, 11:46 pm
Location: A country place, far outside the Wire

Re: The Dark Master Project

Post by white_haired_uncle »

Can you post the code in question? Preferably with some descriptions so we don't have to figure out how it (almost) works by looking at all the code?
Speak softly, and carry Doombringer.
User avatar
hermestrismi
Posts: 626
Joined: February 6th, 2016, 11:28 pm
Location: Tunisia
Contact:

Re: The Dark Master Project

Post by hermestrismi »

white_haired_uncle wrote: December 23rd, 2023, 4:43 am Can you post the code in question? Preferably with some descriptions so we don't have to figure out how it (almost) works by looking at all the code?
sorry for being late
also, I want to thank Beetlenaut as he is the original creator of the macros

Code: Select all

#in item.cfg I have a macro with list of item as literal variables
    [literal]
        can_be_dropped_by="any"
		# who can leave this item after death? any=anyone
        id=pilum
		# item id
        sort=weapon
		# an item can be a weapon or object. each one have a different way to deal with
        type_of=spears
		# if it is a weapon, then a unit can't have the same type of twice. This is the part of modifications I want later
        description= _ "<b>Big Pilum</b>:
increase damage=4
<span color='red'>decrease attack=1</span>
<span color='green'>new ability=Dread</span>
"
        name= _ "Big Pilum"
        image="items/pilum.png"
        taker_filter={FILTER_Spear}
		# who can equip it?
        {FILTER}
		# other filter
        [effect]
            apply_to=attack
            name={FILTER_Spear}
            increase_damage=4
            increase_attacks=-1
        [/effect]
        [effect]
            apply_to=new_ability
            [abilities]
                {ABILITY_DREAD}
            [/abilities]
        [/effect]
        {Add_icon_to_unit_weapon}
		# add an overlay to the unit
    [/literal]

    [literal]
        can_be_dropped_by="any"
        id=pilum
        sort=weapon
        type_of=spears
        description= _ "<b>Lighter Pilum</b>:
increase attack=3
<span color='red'>decrease damage=1</span>
<span color='green'>new ability=Charisma</span>
"
        name= _ "Lighter Pilum"
        image="items/lighter-spear.png"
        taker_filter={FILTER_Spear}
        {FILTER}
        [effect]
            apply_to=attack
            name={FILTER_Spear}
            increase_damage=-1
            increase_attacks=3
        [/effect]
        [effect]
            apply_to=new_ability
            [abilities]
                {ABILITY_CHARISMA}
            [/abilities]
        [/effect]
        {Add_icon_to_unit_weapon}
    [/literal]
# now, to the Dead Oak part. in items_event.cfg

Code: Select all

# the relevant part:
    [event]
        name=moveto
        first_time_only=no
        [filter]
            [filter_side]
                controller=human
            [/filter_side]
            [filter_location]
                find_in=dropped_items
            [/filter_location]
        [/filter]

        {VARIABLE took_an_item false}
        # This needs to be a loop in case there is more than one object on the same hex.
        [foreach]
            array=dropped_items
            variable=this_item
            [do]
                [if]
                    [variable]
                        name=this_item.taken
                        equals="no"
                    [/variable]
					# the item still on the ground so
                    [and]
                        [have_unit]
                            id=$unit.id
                            [filter_location]
                                x=$this_item.x
                                y=$this_item.y
                            [/filter_location]
                        [/have_unit]
                    [/and]
                    [then]
                        [set_variable]
                            name=comparing_weapons
                            value=$this_item.sort
                        [/set_variable]
						# a weapon or something else?
                        [if]
                            [variable]
                                name=comparing_weapons
                                equals=weapon
                            [/variable]
                            [then]
                                [if]
								# the unit can take it?
                                    [have_unit]
                                        id=$unit.id
                                        [has_attack]
                                            name=$this_item.taker_filtering
                                        [/has_attack]
                                        [filter_location]
                                            x=$this_item.x
                                            y=$this_item.y
                                        [/filter_location]
                                    [/have_unit]
                                    [then]
                                        [message]
                                            speaker=narrator
                                            image="icons/screen-busy1.png"
                                            message= _ "$item_list[$this_item.index].description| What Should $unit.name do with the $item_list[$this_item.index].name?"
                                            [option]
                                                label= _ "Take it."
                                                [command]
                                                    # [store_unit]
                                                    # [filter]
                                                    # id=$unit.id
                                                    # [/filter]
                                                    # variable=unit_to_check_weapons
                                                    # kill=no
                                                    # [/store_unit]
													
													# now, we need to know if the unit already have a weapon from the same type.
													# this part sometimes works correctly, sometimes not!
                                                    [set_variable]
                                                        name=searching_positive
                                                        value=negative
                                                    [/set_variable]
                                                    [set_variable]
                                                        name=searching
                                                        value=0
                                                    [/set_variable]

                                                    [while]
                                                        [variable]
                                                            name=searching
                                                            less_than=$unit.modifications.object.length
                                                            # less_than=$unit.modifications.object.type_of.length
                                                        [/variable]
                                                        [do]
                                                            [if]
                                                                [variable]
                                                                    name=unit.modifications.object.type_of
                                                                    equals=$item_list[$this_item.index].type_of
                                                                [/variable]
                                                                [then]
                                                                    [set_variable]
                                                                        name=searching_positive
                                                                        value=positive
                                                                    [/set_variable]
                                                                    [set_variable]
                                                                        name=searching
                                                                        add=1
                                                                    [/set_variable]
																	# the unit have the same type of the weapon.
                                                                [/then]
                                                                [else]
                                                                    [set_variable]
                                                                        name=searching
                                                                        add=1
                                                                    [/set_variable]
                                                                [/else]
                                                            [/if]
                                                        [/do]
                                                    [/while]
																	# may be I should not clear the variable inside a bigger loop.
                                                    {CLEAR_VARIABLE searching}
                                                    [if]
                                                        [variable]
                                                            name=searching_positive
                                                            equals=positive
                                                        [/variable]
                                                        [then]
                                                            [message]
                                                                speaker=narrator
                                                                image="icons/screen-busy1.png"
                                                                message= _ "$unit.name already have $item_list[$this_item.index].type_of|."
                                                            [/message]
																# tell the player the unit have the type of item
																	# may be I should not clear the variable inside a bigger loop.
                                                            {CLEAR_VARIABLE searching_positive}
                                                        [/then]
                                                        [else]
                                                            # [unstore_unit]
                                                            # variable=unit_to_check_weapons
                                                            # find_vacant=no
                                                            # [/unstore_unit]
                                                            # {CLEAR_VARIABLE unit_to_check_weapons}
                                                            [remove_item]
                                                                x=$this_item.x
                                                                y=$this_item.y
                                                                image="$item_list[$this_item.index].id|_FROM_$this_item.unit_id"
                                                            [/remove_item]
																# or it doesn't
                                                            [store_unit]
                                                                [filter]
                                                                    id=$unit.id
                                                                [/filter]
                                                                variable=unit_to_list_1
                                                                kill=no
                                                            [/store_unit]
															# this part is for the menu items. I need to found a way to update the stat of the unit later
                                                            [set_variables]
                                                                name=unit_to_list_2
                                                                mode=append
                                                                [value]
                                                                    id=$unit_to_list_1.id|
                                                                    name=$unit_to_list_1.name|
                                                                    object=$item_list[$this_item.index].name
                                                                    sort=$item_list[$this_item.index].sort
                                                                    type_of=$item_list[$this_item.index].type_of
                                                                    image=$item_list[$this_item.index].image
                                                                    unit_image=$unit_to_list_1.image|
                                                                    type=$unit_to_list_1.type|
                                                                [/value]
                                                            [/set_variables]
                                                            {CLEAR_VARIABLE unit_to_list_1}
                                                            [set_variables]
                                                                name=add_message
                                                                mode=append
                                                                [value]
                                                                    [show_if]
                                                                        [have_unit]
                                                                            id=$unit_to_list_2.id|
                                                                        [/have_unit]
                                                                    [/show_if]
                                                                    image="$unit_to_list_2.unit_image|"
                                                                    label="
name=$unit_to_list_2.name|
type=$unit_to_list_2.type|
object=$unit_to_list_2.object
sort=$unit_to_list_2.sort
type_of=$unit_to_list_2.type_of
image=$unit_to_list_2.image
"
                                                                    [command]
                                                                        [if]
                                                                            [have_unit]
                                                                                id=$unit_to_list_2.id|
                                                                                [not]
                                                                                    x,y=recall,recall
                                                                                [/not]
                                                                            [/have_unit]
                                                                            [then]
                                                                                [scroll_to_unit]
                                                                                    id=$unit_to_list_2.id|
                                                                                [/scroll_to_unit]
                                                                            [/then]
                                                                        [/if]
                                                                    [/command]
                                                                [/value]
                                                            [/set_variables]

                                                            [set_variable]
                                                                name=item_list_begin
                                                                value=yes
                                                            [/set_variable]
															# end the part of the menu items. this will added to it by insert_tag
                                                            {CLEAR_VARIABLE unit_to_list_2}
                                                            [insert_tag]
                                                                name=object
                                                                variable=item_list[$this_item.index]
                                                            [/insert_tag]
                                                            # We can't delete items from this array
                                                            # inside the loop, so we'll just mark it.
                                                            [modify_unit]
                                                                [filter]
                                                                    id=$unit.id
                                                                [/filter]
                                                                [object]
                                                                    silent=yes
                                                                    duration=forever
                                                                    type_of=$item_list[$this_item.index].type_of
                                                                [/object]
                                                            [/modify_unit]
                                                            [set_variable]
                                                                name=this_item.taken
                                                                value=yes
                                                            [/set_variable]
                                                            {VARIABLE took_an_item true}

                                                            [message]
                                                                speaker=narrator
                                                                image="icons/screen-busy1.png"
                                                                message= _ "$unit.name now have $item_list[$this_item.index].name|."
                                                            [/message]
                                                            {CLEAR_VARIABLE searching_positive}
                                                        [/else]
                                                    [/if]
                                                [/command]
                                            [/option]
                                        [/message]
                                    [/then]
									# other options are irrelevant for now
                                [/if]
                            [/then]
                                [/message]
                            [/else]
                        [/if]
                    [/then]
                [/if]
            [/do]
        [/foreach]
        [if]
            # If the player left all the items, or there wasn't one there anymore, they can
            # undo their move.
            {VARIABLE_CONDITIONAL took_an_item boolean_equals false}
            [then]
                [allow_undo]
                [/allow_undo]
            [/then]
        [/if]
        [clear_variable]
            name=took_an_item
        [/clear_variable]
        [clear_variable]
            name=comparing_weapons
        [/clear_variable]
        [clear_variable]
            name=temposide
        [/clear_variable]
    [/event]


Attachments
item_menu.cfg
original menu items
(1.83 KiB) Downloaded 20 times
item_list.cfg
full list of items
(15.75 KiB) Downloaded 20 times
item_events.cfg
full list of items events
(53.12 KiB) Downloaded 25 times
white_haired_uncle
Posts: 1202
Joined: August 26th, 2018, 11:46 pm
Location: A country place, far outside the Wire

Re: The Dark Master Project

Post by white_haired_uncle »

"this part sometimes works correctly, sometimes not!"

Do you have a save file from when it doesn't work?

And which part is it that doesn't work? Is it that sometimes it fails to identify that the unit already has a weapon of that type?
Speak softly, and carry Doombringer.
User avatar
hermestrismi
Posts: 626
Joined: February 6th, 2016, 11:28 pm
Location: Tunisia
Contact:

Re: The Dark Master Project

Post by hermestrismi »

white_haired_uncle wrote: December 24th, 2023, 5:53 pm "this part sometimes works correctly, sometimes not!"

Do you have a save file from when it doesn't work?

And which part is it that doesn't work? Is it that sometimes it fails to identify that the unit already has a weapon of that type?
unfortunately, I can't provide a save but I will ASAP.
it is quite the opposite. it sometimes read that the unit doesn't have that type of weapons when it already have.
I guess (just wondering) it is because I clear the variable before inside a loop (since the while loop is inside a foreach loop).
it is simple to reproduce. in the introduction scenario, the probability of dropping is 100% . just-with debug- create and kill many units than create a paladin for example and try to take two spears or more
white_haired_uncle
Posts: 1202
Joined: August 26th, 2018, 11:46 pm
Location: A country place, far outside the Wire

Re: The Dark Master Project

Post by white_haired_uncle »

Code: Select all

[if]
                                                                [variable]
                                                                    name=unit.modifications.object.type_of
                                                                    equals=$item_list[$this_item.index].type_of
                                                                [/variable]
Shouldn't that be unit.modifications.object[$searching].type_of ?

And can you access modifications without store_unit? I never can keep the rules straight.

Try this... (note, I only worked on weapons, if you like it you'll need to apply the same change later in the file)
Attachments
item_events.cfg.gz
(4.35 KiB) Downloaded 22 times
Speak softly, and carry Doombringer.
User avatar
hermestrismi
Posts: 626
Joined: February 6th, 2016, 11:28 pm
Location: Tunisia
Contact:

Re: The Dark Master Project

Post by hermestrismi »

white_haired_uncle wrote: December 24th, 2023, 9:42 pm

Code: Select all

[if]
                                                                [variable]
                                                                    name=unit.modifications.object.type_of
                                                                    equals=$item_list[$this_item.index].type_of
                                                                [/variable]
Shouldn't that be unit.modifications.object[$searching].type_of ?

And can you access modifications without store_unit? I never can keep the rules straight.
that [if] is to make sure that the unit have an item of type_of the item on the ground.
I remember I test it with .object[$i] but it didn't work either. I forget the reason why but I will test it again asap.
may be I should make a [foreach] before [while] or found how to loop over the variables with [while] (a key like index=i in the usual [foreach] tag)
User avatar
hermestrismi
Posts: 626
Joined: February 6th, 2016, 11:28 pm
Location: Tunisia
Contact:

Re: The Dark Master Project

Post by hermestrismi »

I am so sorry for the delay. I am away from my computer. I use my phone and I only read cfg (and such) files but I have noway to access the game at all
white_haired_uncle
Posts: 1202
Joined: August 26th, 2018, 11:46 pm
Location: A country place, far outside the Wire

Re: The Dark Master Project

Post by white_haired_uncle »

You'll notice I used a for loop instead of the while that was there before. I've always assumed when I see a while loop like that that the author just hasn't learned for/foreach yet.

$i wouldn't work with the while loop the way it was, $searching might (looks like that was what was intended). Though I don't think anything will work w/o store_unit.

P.S. Rodd starts off as a Special Ruffian who is chaotic, but advances to a spearman which is lawful. That's kind of weird. Maybe not for Rodd, but in general, I wouldn't think a chaotic L0 would advance to a lawful L1 normally.
Speak softly, and carry Doombringer.
User avatar
hermestrismi
Posts: 626
Joined: February 6th, 2016, 11:28 pm
Location: Tunisia
Contact:

Re: The Dark Master Project

Post by hermestrismi »

white_haired_uncle wrote: December 24th, 2023, 10:33 pm You'll notice I used a for loop instead of the while that was there before. I've always assumed when I see a while loop like that that the author just hasn't learned for/foreach yet.

$i wouldn't work with the while loop the way it was, $searching might (looks like that was what was intended). Though I don't think anything will work w/o store_unit.

P.S. Rodd starts off as a Special Ruffian who is chaotic, but advances to a spearman which is lawful. That's kind of weird. Maybe not for Rodd, but in general, I wouldn't think a chaotic L0 would advance to a lawful L1 normally.
for 1, thank you for the explanation. I myself prefer foreach for a simple (and wiered) reason 😆 when foreach macro became deprecated, I used foreach tag because I thought it is the same. a wiered reason, I know but some repeated actions become habits difficult to change. so yes, I agree that [for] is more useful than [while] in this context but habits...
for 2) a very interesting point. this idea didn't cross my mind before but I know why. the second chapter was created before the first. while I needed Rodd as a Ruffian in the first, I wanted him as a Javelineer (which is more logical regarding the events). but I never thought about the changes from a chaotic to a lawful unit. really, a good note
User avatar
hermestrismi
Posts: 626
Joined: February 6th, 2016, 11:28 pm
Location: Tunisia
Contact:

Re: The Dark Master Project

Post by hermestrismi »

update:
version 1.0.3q (for 1.16)
new features:
1) a new menu item to show only geared units created originally by White_haired_uncle
the new menu will show the units with updated stats (without details about their items) in addition to the previous geared units menu ,
2) two new menus to give simple instructions to the allies. one (from Beetlenaut) to order the allied leader to move to a marked location, the other (by me) to give instructions about the strategies of the allied units. for now, there is a warning that once a choice was made, it can't be turned to the original states.
User avatar
hermestrismi
Posts: 626
Joined: February 6th, 2016, 11:28 pm
Location: Tunisia
Contact:

Re: The Dark Master Project

Post by hermestrismi »

version 1.0.3r
minor typos,
adding a race description for 7 races (Steelhive, Verlissh, Qesicans, Faeries...). the description included: general history, major events and characters, culture, languages or communications, reproduction (for robotic races), economy, demography, politic and relations, ...
Konrad2
Forum Moderator
Posts: 3340
Joined: November 24th, 2010, 6:30 pm

Re: The Dark Master Project

Post by Konrad2 »

Code: Select all

warning preprocessor: Redefining macro ABILITY_STEPPE_GIANTSLAYER2 without explicit #undef at ~add-ons/The_Dark_Master_full_pack/macros/general/abilities_ogres_kingdom.cfg:1919
    included from ~add-ons/The_Dark_Master_full_pack/_main.cfg:186
previously defined at ~add-ons/The_Dark_Master_full_pack/macros/general/abilities_khaganites.cfg:255
    included from ~add-ons/The_Dark_Master_full_pack/_main.cfg:186

Code: Select all

helper.lua has been deprecated and will be removed in version 1.19.0.; Everything in this module has been moved into the core modules
Errors/Notifications that showed up in my logs on 1.17.26 when loading 'introduction to TDM'.

The 'Sorceress' unit of the High Elves (and its advancements) (found in A Hidden War) has '+8 heal' and some improved heal ability (+10, +12, +14). I guess the normal +8 needs to be removed.

Starting the add-on with debug spams a lot of decepration info

Code: Select all

warning deprecation: MISSILE_FRAME_FIREBALL has been deprecated and may be removed at any time.; Use MISSILE_FRAME_FIREBALL_XY instead
info deprecation: FOREACH has been deprecated indefinitely.; You should use the [foreach] WML tag instead.
info deprecation: NEXT has been deprecated indefinitely.; You should use the [foreach] WML tag instead of {FOREACH}.
warning deprecation: OVERLAY_PLFB has been deprecated and may be removed in version 1.19.0.
warning deprecation: GENERIC_SINGLE_PLFB has been deprecated and may be removed in version 1.19.0.; This is an internal macro, direct use is not recommended in any case.
warning deprecation: BUILD_IMAGE has been deprecated and may be removed in version 1.19.0.; This is an internal macro, direct use is not recommended in any case.
warning deprecation: DISABLE_BASE_TRANSITIONS has been deprecated and may be removed in version 1.19.0.
warning deprecation: DISABLE_BASE_TRANSITIONS_F has been deprecated and may be removed in version 1.19.0.
warning deprecation: PEAKS_1x2_SW_NE has been deprecated and may be removed in version 1.19.0.; Use the NEW:PEAKS macros instead
warning deprecation: BUILD_IMAGE has been deprecated and may be removed in version 1.19.0.; This is an internal macro, direct use is not recommended in any case.
warning deprecation: PEAKS_LARGE has been deprecated and may be removed in version 1.19.0.; Use the NEW:PEAKS macros instead
warning deprecation: OVERLAY_RANDOM_LFB has been deprecated and may be removed in version 1.19.0.
warning deprecation: GENERIC_SINGLE_RANDOM_LFB has been deprecated and may be removed in version 1.19.0.; This is an internal macro, direct use is not recommended in any case.
warning deprecation: DISABLE_WALL_TRANSITIONS has been deprecated and may be removed in version 1.19.0.
warning deprecation: DISABLE_WALL_TRANSITIONS_F has been deprecated and may be removed in version 1.19.0.
warning deprecation: GENERIC_SINGLE_PLFB has been deprecated and may be removed in version 1.19.0.; This is an internal macro, direct use is not recommended in any case.
Post Reply