ghype's Problems:
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.
ghype's Problems:
This thread will contain smaller questions on how to code certain things since I am still at the beginning. Technically I have someone to ask about such things but I don't want to bother him always and figured the best way to handle this is to make these public.
Solved: Ignore Specific Trait:
Solved: UtbS Special Shock - Making work only on hit:
Not Needed Anymore: modify xp rewards:
Solved: auto-defeat when entering scenario:
Solved: unclear unit type for PLACE_UNIT macro:
Solved: hide life & exp bar and more:
Solved: REMOVE_IMAGE has 2 arguments, but reads 3:
Last edited by ghype on December 4th, 2020, 5:37 pm, edited 28 times in total.
stuff I worked on: Dunefolk Rework - ghype's Daily Art
- James_The_Invisible
- Posts: 536
- Joined: October 28th, 2012, 1:58 pm
- Location: Somewhere in the Northlands, fighting dark forces
- Contact:
Re: ghype's Coding Problems
Well, arguments in macro calls are separated by space so you used 3. And actually macro REMOVE_IMAGE takes just X and Y as arguments:
.
To your other question: you do not have to provide an id for event unless you want to avoid adding the same event (I mean content, not type) multiple times or remove the event at some point.
Code: Select all
#define REMOVE_IMAGE X Y
# Removes a previously set image from a tile.
#
# Example:
#! {REMOVE_IMAGE 14 5}
[remove_item]
x,y={X},{Y}
[/remove_item]
#enddef
To your other question: you do not have to provide an id for event unless you want to avoid adding the same event (I mean content, not type) multiple times or remove the event at some point.
My content: For Power series
Ports: Danse Macabre Story of the Wose
Guides: How to translate your UMC
Ports: Danse Macabre Story of the Wose
Guides: How to translate your UMC
Re: ghype's Coding Problems
yeeah. thanks a lot. I checked the tutorial again and it really has only 2 arguments. guess I was not paying as much attention as i should have.
but this works now.
but this works now.
stuff I worked on: Dunefolk Rework - ghype's Daily Art
Re: ghype's Coding Problems - Modify Xp Reward / Hide Exp Bar
This is the picture for my question regarding: hiding life & exp bar and more
As you can see it would look so much better without those visual aspects
As you can see it would look so much better without those visual aspects
- Attachments
-
- Screen Shot 2018-10-18 at 11.13.57.png (34.95 KiB) Viewed 5113 times
stuff I worked on: Dunefolk Rework - ghype's Daily Art
Re: ghype's Coding Problems - Modify Xp Reward / Hide Exp Bar
I would recommend to use the impassable overlay,
Also note that when you want to remove it later with [terrain], it's possible to only remove the overlay. (see NR S2 for an example)
For blocking with an unit:
You can set zoc=none for the [unit]. The health bar probably remains, you can petrify the unit to get rid of that.
The stats and status in the sidebar will still be shown though.
^Xo
, instead of an invisible unit to block the terrain. ( -> full list )Also note that when you want to remove it later with [terrain], it's possible to only remove the overlay. (see NR S2 for an example)
For blocking with an unit:
You can set zoc=none for the [unit]. The health bar probably remains, you can petrify the unit to get rid of that.
The stats and status in the sidebar will still be shown though.
Try out the dark board theme.
Re: ghype's Coding Problems - Modify Xp Reward / Hide Exp Bar
There are some keys about offset, check unit type documentation.
Re: ghype's Coding Problems - Modify Xp Reward / Hide Exp Bar
this is no invisible unit, I actually coded a unit as gate in order to make use of the replace mechanism on death taken from the AE_rat_pack ability. I wouldn't know how to make use of the replacing mechanism with impassable overlay without an invisible unit.
I did not found any reference to "offset" in unit type documentation or anywhere else. However, I stumbled upon something that could potentially fix both issues - kill_experience and hp_bar_scaling. Both of which should be put in the game.cfg. I never worked with a game.cfg before. so I dont know what the strucutre should look like for that file regarding a campaign or scneario.
this is not the right way, because it ain't changed anything. But it also did not gave me an error. So how do I work with these keys exactly? I want these attributes to affect only units with race=abob_special_objects.
Code: Select all
#textdomain wesnoth-abob
[game_config]
[filter]
[unit]
race=abob_special_objects
[/unit]
kill_experience=0
hp_bar_scaling=0.01
[/filter]
[/game_config]
stuff I worked on: Dunefolk Rework - ghype's Daily Art
Re: ghype's Coding Problems - Modify Xp Reward / Hide Exp Bar
Yes, hp_bar_scaling is one of those I meant. You put it under unit_type I believe.
Re: ghype's Coding Problems - Modify Xp Reward / Hide Exp Bar
Hide Exp Bar:
I read that you can use hp_bar_scaling directly in the unit.cfg. I worked with it but it will always reserve 2px for the border and 1px for the health.
so you cannot make it disappear but it is as good as it gets. I will enlarge the .png image size so the hp bar moves out of the frame.
Modify Xp Reward:
tried to make sense on what is written in the documentation in order to make kill_experience work, but there is not enough info. I created a game.cfg as said.
"The game.cfg file begins by referring to other files in the data/ directory. It then sets the value of some [advanced_preference]s.
The main tag in game.cfg is [game_config] . The first 9 keys in [game_config] refer to game constants."
it references [advanced_preference] but I don't know how to implement any of these correctly ...
"This tag is a top level WML tag that defines an advanced preference. It only affects the appearance in the preference dialog (in the advanced section), the actual effect of the setting is part of the game engine and is not modifiable by WML."
I read that you can use hp_bar_scaling directly in the unit.cfg. I worked with it but it will always reserve 2px for the border and 1px for the health.
so you cannot make it disappear but it is as good as it gets. I will enlarge the .png image size so the hp bar moves out of the frame.
Modify Xp Reward:
tried to make sense on what is written in the documentation in order to make kill_experience work, but there is not enough info. I created a game.cfg as said.
"The game.cfg file begins by referring to other files in the data/ directory. It then sets the value of some [advanced_preference]s.
The main tag in game.cfg is [game_config] . The first 9 keys in [game_config] refer to game constants."
it references [advanced_preference] but I don't know how to implement any of these correctly ...
"This tag is a top level WML tag that defines an advanced preference. It only affects the appearance in the preference dialog (in the advanced section), the actual effect of the setting is part of the game engine and is not modifiable by WML."
stuff I worked on: Dunefolk Rework - ghype's Daily Art
Re: ghype's Coding Problems - Modify Xp Reward
You can change game_config only from Lua https://github.com/ProditorMagnus/Oroci ... ts.lua#L27 https://wiki.wesnoth.org/LuaWML/Misc#we ... ame_config
Its not documented, but you can add offset to bars, if it is large enough, it is out of screen https://github.com/wesnoth/wesnoth/comm ... 6e156cd3e0
Its not documented, but you can add offset to bars, if it is large enough, it is out of screen https://github.com/wesnoth/wesnoth/comm ... 6e156cd3e0
Re: ghype's Coding Problems - Modify Xp Reward
Not sure how the AE_rat_pack_ability works…
If you find an event suiting as trigger, it could be opened such as
One can as well do things like opening all gates simultaneously that way.
An disadvantage I see in above event is that it's specific to each gate, maybe create a macro for it.
What's the condition you want to use for opening the gate?
If you find an event suiting as trigger, it could be opened such as
Code: Select all
[event]
name=moveto # or die if that comes closer to the AE_rat_pack
[filter]
x,y= e.g. the coordinates in front of the gate
(it's a SUF, but a SLF can be used with [filter_location] inside the [filter])
[/filter]
[terrain]
x,y=the gate's coordinates (or any other SLF)
layer=overlay
terrain=^
[/terrain]
# (mainline has a REMOVE_TERRAIN macro, however, it doesn't use layer=overlay… )
# if you placed the gate image with [item] before, e.g. in prestart
[remove_item]
x,y=… (or any other SLF)
[/remove_item]
[/event]
An disadvantage I see in above event is that it's specific to each gate, maybe create a macro for it.
What's the condition you want to use for opening the gate?
Try out the dark board theme.
Re: ghype's Coding Problems - Modify Xp Reward
Modify XP Reward:
as far as i understood the LuaWML is already implemented into wesnoth, so I dont have to download anything for that.
also it is now possible to open the [lua] tag inside of [scenario] or thus a [event] too. The documentation says to use the [game_congig] but you should me an alternative.
I don't think it this simple, but how could I make this work?
Hide XP Bar:
i can make sense of your approach Shiki, it understandable to me.
however, I have a total of 23 gates which each of them break down into 4 more broken versions. For example, a unit in order to break the gate he has to attack/kill the gate 4 times until it is broken down completely. thats why I thought the using a unit.cfg for my gate combined with the mechanism for breaking down works pretty well. but that is the reason why I also need the killing_reward to work, since you are killing this game 4x23 times, which gives too much xp.
this is the code for the mechanism, which is not all too complicated.
as far as i understood the LuaWML is already implemented into wesnoth, so I dont have to download anything for that.
also it is now possible to open the [lua] tag inside of [scenario] or thus a [event] too. The documentation says to use the [game_congig] but you should me an alternative.
I don't think it this simple, but how could I make this work?
code:
i can make sense of your approach Shiki, it understandable to me.
however, I have a total of 23 gates which each of them break down into 4 more broken versions. For example, a unit in order to break the gate he has to attack/kill the gate 4 times until it is broken down completely. thats why I thought the using a unit.cfg for my gate combined with the mechanism for breaking down works pretty well. but that is the reason why I also need the killing_reward to work, since you are killing this game 4x23 times, which gives too much xp.
this is the code for the mechanism, which is not all too complicated.
code:
stuff I worked on: Dunefolk Rework - ghype's Daily Art
Re: ghype's Coding Problems - Modify Xp Reward
StandardUnitFilter does not recognize [unit], so even when you [fire_event] lua.killing.experience, filter would not let it run.
Though game_config values are global, affecting everything. Normal way for your use is removing xp after attack. https://github.com/ProditorMagnus/Agele ... er.cfg#L17
That is how you would usually run Lua code.
Though game_config values are global, affecting everything. Normal way for your use is removing xp after attack. https://github.com/ProditorMagnus/Agele ... er.cfg#L17
That is how you would usually run Lua code.
Code: Select all
[event]
name = preload
[lua]
code = << wesnoth.game_config.killing_experience = 0 >>
[/lua]
[/event]
Re: ghype's Coding Problems - Modify Xp Reward
it might not be helpful but removing hp and xp bar was discussed before in forums, and i think somebody removed them succesfully. Try to use search within/inside this forum, it may have a good chance u find something more useful than links to documentation.. i think it was about experience bar, but if you can remove experience bar, u probably can remove hp bar the same way. I haven't personally removed them (as far as I remember) so I don't have a code ready to paste it here..
Re: ghype's Coding Problems - Modify Xp Reward
i tried that lua line as you posted it, but I assume there is more to it than those couple of lines. upon loading the game I received this error.
the approach with the soulcatcher ability seems to be exactly what I needed. It also seems to work at first. I kill a unit lv4 gate, it gives me 32xp and then when I end turn it reduces it back to 0xp. There are two problems with this.
(1) it only happens once. when I kill another unit (e.g. the lv3 gate) this ability stops working. no more xp reducing even if first_time_only=no is checked everywhere
(2) currently it happens only when you end turn. It would be much more immersive if it happens right after the kill before the battle ends. The events however are are clearly defined for attack_end and die.
this is the modified code, where I basially only changed the ability names and Id's ...
error:
(1) it only happens once. when I kill another unit (e.g. the lv3 gate) this ability stops working. no more xp reducing even if first_time_only=no is checked everywhere
(2) currently it happens only when you end turn. It would be much more immersive if it happens right after the kill before the battle ends. The events however are are clearly defined for attack_end and die.
this is the modified code, where I basially only changed the ability names and Id's ...
code:
if you refer this post, the yes it was discussed and you eventually found a solution on hiding the xp bar. but those approaches do not indicate that it is possible with the hp as well.
stuff I worked on: Dunefolk Rework - ghype's Daily Art