ghype's Problems:

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.
Post Reply
User avatar
ghype
Posts: 1069
Joined: December 13th, 2016, 4:43 pm
Location: Berlin, Germany

Re: ghype's Coding Problems

Post by ghype »

beetlenaut wrote: November 22nd, 2020, 12:31 pm The PLACE_IMAGE macro is for adding items to a hex like a storm trident or ring, so that's why it doesn't work now. You should use the map editor to make a map that has your tile in it. You just need the tile at the position marked "1", and the graphics will fill in the rectangle you defined. (You can also use [terrain] inside an event to modify a tile on the running map.)
Thanks, I made it work.
User avatar
ghype
Posts: 1069
Joined: December 13th, 2016, 4:43 pm
Location: Berlin, Germany

Re: ghype's Problem: [remove_shroud]

Post by ghype »

New Problem:

I am unsure how the [remove_shroud] works.
I plan to have a certain area's shroud to be removed when moving on a certain hex using this:

Code: Select all

[event]
    name=moveto
      first_time_only=yes
        [filter]
            x,y=49,43
        [/filter]
        {MODIFY_TERRAIN Iwr^Pw\o (48,48) (43,43)}
        [remove_shroud]
            x=46
            y=45
            raduis=3
        [/remove_shroud]   

    [/event]
But all it reveals is a tiny spot instead of the full radius at the given coordinates.
Screen Shot 2020-11-24 at 00.04.10.png
Screen Shot 2020-11-24 at 00.04.10.png (123.91 KiB) Viewed 856 times
User avatar
WhiteWolf
Forum Moderator
Posts: 769
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: ghype's Problem: [remove_shroud]

Post by WhiteWolf »

I'm pretty sure there's a typo there :) (raduis=3 -> radius=3)
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
User avatar
ghype
Posts: 1069
Joined: December 13th, 2016, 4:43 pm
Location: Berlin, Germany

Re: ghype's Problem: [remove_shroud]

Post by ghype »

well thanks about that! sign of being too late. it works as it should.
User avatar
ghype
Posts: 1069
Joined: December 13th, 2016, 4:43 pm
Location: Berlin, Germany

Re: ghype's Problem: [side] + custom unit

Post by ghype »

So here a question for a scenario. I have a [side] defined for a scenario and want to use custom unit as leader. It all works if I use a default unit, but once I replaces with a custom unit, the scenario gives me the "defeated" message. I suppose something is wrong with the custom unit I coded although I already coded in the past so many of them for my era. I cannot figure out what might be wrong. My[binary path] should be ok as well, so I really cannot tell what's missing.

Code: Select all

	[side]
        side=1
		controller=human
		type=PL_Khyret_Civilian
		id=Khyret
		name= _ "Khyret"
		unrenamable=yes
		canrecruit=yes

        shroud=yes
		defeat_condition=no_leader_left
		x,y=50,42
	[/side]

Code: Select all

[unit_type]
    id=PL_Khyret_Civilian
    name= _ "Khyret"
    race=dunefolk
    image="units/dunefolk/khyret-civilian.png"
    hitpoints=41
    movement_type=dunefoot
    movement=5
    experience=43
    level=1
    alignment=liminal
    advances_to=PL_Khyret_Armored
    cost=18
    usage=fighter
    description= _ "Hero Description"
    die_sound={SOUND_LIST:HUMAN_DIE}
[/unit_type]

Code: Select all

#ifdef Plagued

	[binary_path]
		path=data/add-ons/Plagued/
	[/binary_path]
	[units]
	{~add-ons/Plagued/units}
	[/units]
	{~add-ons/Plagued/utils}
	{~add-ons/Plagued/maps}
	{~add-ons/Plagued/scenarios}
	{~add-ons/Plagued/images}
#endif
User avatar
WhiteWolf
Forum Moderator
Posts: 769
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: ghype's Problem: [side] + custom unit

Post by WhiteWolf »

One thing that comes to mind: that should definitely be [+units], not [units]. Campaigns should expand the core units tag, not overwrite it.
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
User avatar
Lord-Knightmare
Discord Moderator
Posts: 2340
Joined: May 24th, 2010, 5:26 pm
Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.
Contact:

Re: ghype's Problem: [side] + custom unit

Post by Lord-Knightmare »

WhiteWolf wrote: November 25th, 2020, 2:08 pm One thing that comes to mind: that should definitely be [+units], not [units]. Campaigns should expand the core units tag, not overwrite it.
From what I have seen in Discord discussions, the [+units] thing was a workaround for a bug that has been fixed for quite some time now. However, UMC authors, such as you and I, still end up using [+units] since it's sort of a convention by now.

@ghype: Your #ifdef does not need to load the images and maps directories. If you do include those directories, your campaign would take longer to load.

May I see the entire scenario file code? From your snippets, I am unable to discern what's causing the instant "defeat" message.
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
User avatar
ghype
Posts: 1069
Joined: December 13th, 2016, 4:43 pm
Location: Berlin, Germany

ghype's Problem: lua error + custom unit

Post by ghype »

WhiteWolf wrote: November 25th, 2020, 2:08 pm One thing that comes to mind: that should definitely be [+units], not [units]. Campaigns should expand the core units tag, not overwrite it.
That the [+units] is written without the [+] is something that I have seen in many custom campaigns and even if I type it with the [+] i still get defeated immediately. As I assume that there is an error with unit type and not the scenario, I tried to spawn that unit external with a custom "spawn unit" macro.
Now I get a lua error, which I have not before as I directly jumped to the defeat_condition:
Screen Shot 2020-11-25 at 17.13.41.png


While I opened the correspondent lua files, I could not get any good information out it as I don't know it's language.
Lord-Knightmare wrote: November 25th, 2020, 4:33 pm May I see the entire scenario file code? From your snippets, I am unable to discern what's causing the instant "defeat" message.
I just saw your message when I was about to post my answer. the lua error posted might help you identifying the problem.
Regarding the [+units] ... do i close it like [/+units] or it remains [/units]?
User avatar
WhiteWolf
Forum Moderator
Posts: 769
Joined: September 22nd, 2009, 7:48 pm
Location: Hungary

Re: ghype's Problem: [side] + custom unit

Post by WhiteWolf »

Lord-Knightmare wrote: November 25th, 2020, 4:33 pm From what I have seen in Discord discussions, the [+units] thing was a workaround for a bug that has been fixed for quite some time now. However, UMC authors, such as you and I, still end up using [+units] since it's sort of a convention by now.
I must have missed that then, but I don't understand. The + is the amendment syntax, namely it lets you expand the core [units] tag, first defined in core/units.cfg, and lets you add your umc's content. How was this a workaround, and why is defining it a second time (without + sign) supposed to work?

EDITED to just made post:
The closing tag stays [/units].

Is it just this one unit that causes this error? I mean, are the other custom units under {~add-ons/Plagued/units} visible and spawnable? If not, then something's wrong with the path, if yes, then it's probably indeed something with the unit.
Main UMC campaigns: The Ravagers - now for 1.16, with new bugs!
Old UMC works: The Underness Series, consisting of 5 parts: The Desolation of Karlag, The Blind Sentinel, The Stone of the North, The Invasion Of The Western Cavalry, Fingerbone of Destiny
User avatar
Lord-Knightmare
Discord Moderator
Posts: 2340
Joined: May 24th, 2010, 5:26 pm
Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.
Contact:

Re: ghype's Problem: [side] + custom unit

Post by Lord-Knightmare »

Now I get a lua error, which I have not before as I directly jumped to the defeat_condition:
It seems as though your custom unit has not been imported into your campaign. May I assume that you have subdirectories in the units folder? If so, you have to include them.
Regarding the [+units] ... do i close it like [/+units] or it remains [/units]?

Code: Select all

[+units]
    {~add-ons/YOUR_ADDON/units}
[/units]
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
User avatar
ghype
Posts: 1069
Joined: December 13th, 2016, 4:43 pm
Location: Berlin, Germany

Re: ghype's Problem: [side] + custom unit

Post by ghype »

Lord-Knightmare wrote: November 25th, 2020, 4:47 pm It seems as though your custom unit has not been imported into your campaign. May I assume that you have subdirectories in the units folder? If so, you have to include them.
Yes I do have indeed.
User avatar
beetlenaut
Developer
Posts: 2814
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: ghype's Problem: [side] + custom unit

Post by beetlenaut »

We are just throwing out guesses because we can't see all your code. If you post your campaign like Lord-Knightmare suggested, we would be able to solve your problem quickly. (Use a zip file.)
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
User avatar
ghype
Posts: 1069
Joined: December 13th, 2016, 4:43 pm
Location: Berlin, Germany

Re: ghype's Problem: [side] + custom unit

Post by ghype »

my bad. it sounded he was onto something.

just note that the custom images contained in this zip here are all WIP and not representing the final versions.
Last edited by ghype on November 25th, 2020, 6:36 pm, edited 1 time in total.
User avatar
Lord-Knightmare
Discord Moderator
Posts: 2340
Joined: May 24th, 2010, 5:26 pm
Location: Somewhere in the depths of Irdya, gathering my army to eventually destroy the known world.
Contact:

Re: ghype's Problem: [side] + custom unit

Post by Lord-Knightmare »

The problem is where I suspected. Your custom unit is in units/dunefolk but you are not including that subdirectory in your [+units][/units]. Thus, it will never be loaded in game. You have to include it with:

Code: Select all

#ifdef Plagued

	[binary_path]
		path=data/add-ons/Plagued/
	[/binary_path]
	[units]
	{~add-ons/Plagued/units}
        {~add-ons/Plagued/units/dunefolk}
	[/units]
	{~add-ons/Plagued/utils}
	{~add-ons/Plagued/maps}
	{~add-ons/Plagued/scenarios}
	{~add-ons/Plagued/images}
#endif
Creator of "War of Legends"
Creator of the Isle of Mists survival scenario.
Maintainer of Forward They Cried
User:Knyghtmare | My Medium
User avatar
beetlenaut
Developer
Posts: 2814
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: ghype's Problem: [side] + custom unit

Post by beetlenaut »

You also have to fix the end tags of the attacks in the unit file or it will still fail to load.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
Post Reply