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.
Re: ghype's Coding Problems - Modify Xp Reward
killing_experience is indeed not the correct name, I linked game_config documentation before.
Hiding bar might not be possible, but having large offset is good enough solution.
Soul catcher is designed to remove xp from unit with ability. Seems you want to remove it from unit without ability.
Hiding bar might not be possible, but having large offset is good enough solution.
Soul catcher is designed to remove xp from unit with ability. Seems you want to remove it from unit without ability.
Re: ghype's Coding Problems - Modify Xp Reward
(1) I checked again and I had typo. it worked after fixing the spelling.
(2) I haven spent enough time reading/learning about lua (2day was my first day) to make sense of what you sent me regarding the offset. For now, I will play around with the .png size to recreate the offset of the bar as I did with the AE_Fallen_Dragonriders in case you remember. If I am not satisfied with it, I will come back to your link and do some further research on it. thanks for it anyway.
(3) yes your right. but i actually gave that ability to the attacker, not the gate. so when the attacker killed the a unit, it would loose the xp, just like the dimensional gate. however, there are the two bugs which I mentioned earlier which prevent it to work as intendetn
(4) upon further thinking about (1) and the things I read in documentation about lua functions and tried to expand it.
(2) I haven spent enough time reading/learning about lua (2day was my first day) to make sense of what you sent me regarding the offset. For now, I will play around with the .png size to recreate the offset of the bar as I did with the AE_Fallen_Dragonriders in case you remember. If I am not satisfied with it, I will come back to your link and do some further research on it. thanks for it anyway.
(3) yes your right. but i actually gave that ability to the attacker, not the gate. so when the attacker killed the a unit, it would loose the xp, just like the dimensional gate. however, there are the two bugs which I mentioned earlier which prevent it to work as intendetn
quote:
this is what I ended up with:
stuff I worked on: Dunefolk Rework - ghype's Daily Art
Re: ghype's Coding Problems - Modify Xp Reward
2) Basically, add bar_offset_x=9999 and/or bar_offset_y=9999 under [unit_type]. That would have bars far away.
3) I guess the other units types do not have this event/do not match its filter.
4) Game config is global - it affects everything. You can change it for the duration of certain attacks, but it is not designed to support any kind of conditions. Minor syntax issue there too - function needs closing "end".
5) It might be possible by changing wesnoth.game_config.kill_experience before each attack to 0 or original value depending on who fight.
6) "u" is function parameter, its value would be provided by whoever calls this function.
7) I think you found documentation for modifying user interface, but not sure what exactly that is about.
3) I guess the other units types do not have this event/do not match its filter.
4) Game config is global - it affects everything. You can change it for the duration of certain attacks, but it is not designed to support any kind of conditions. Minor syntax issue there too - function needs closing "end".
5) It might be possible by changing wesnoth.game_config.kill_experience before each attack to 0 or original value depending on who fight.
6) "u" is function parameter, its value would be provided by whoever calls this function.
7) I think you found documentation for modifying user interface, but not sure what exactly that is about.
Re: ghype's Coding Problems - Modify Xp Reward
yeah indeed that doesnt mean u can hide hp the same way.. not sure that it's the post i talked about, my memory is crap..
well, since everyone given you 100 of ideas, I will give you mine as well, alternatively you could use image overlay instead of gate unit until the moment some unit enter hex near the gate (or moveto near the gate, event name=enter_hex or name=moveto).
Once unit comes near the gate, the gate image overlay is removed and [unit] gate appears with 1hp or whatever you like... you kill it, it reappears again.. but inside unit array (unit.variables.times_reappeared=4) you keep increasing the number with every death, you wanted to kill it 4 times, so when that variable is equal 4 then it stops reappearing (event name=die [unit] gate...)
This way you dont see any xp/hp bar until the moment the unit enters the hex near the gate.. then when unit is adjacent u see that the gate need to die as hp bar shows..
if you feel like this way would work for you then let me know, I could write code in details. Otherwise I hope you find suitable solution
Re: ghype's Coding Problems - Modify Xp Reward
(2) ravana, you are a wizard. look at these beautiful gates now - no hp bar. thank you.
ok so in order to decide if I follow the soul-catcher approach or the wesnoth.game_config.kill_experience approach, I want to make sure that I fully understood the soul-catcher ability. It has 4 events. Please correct me at any of those 4 events, if my statement is wrong.
(4)-(7) I will come back to this once (3) is cleared up for me.
image:
I am sorry I couldn test this before you give your answer, ravanas last suggestion was exactly what I needed, but I still appreciate your engagement.
ok so in order to decide if I follow the soul-catcher approach or the wesnoth.game_config.kill_experience approach, I want to make sure that I fully understood the soul-catcher ability. It has 4 events. Please correct me at any of those 4 events, if my statement is wrong.
(3.1):
(3.2):
(3.3):
(3.4):
(3.5)/summary:
stuff I worked on: Dunefolk Rework - ghype's Daily Art
Re: ghype's Coding Problems - Modify Xp Reward
3.2 primary unit is unstored - gate. It is needed to set new xp for unit on map.
3.3 primary unit and secondary unit meanings are added for each event description in wiki. Usually you can guess them from event name - for attack event attacker is primary unit, and defender is secondary unit. And for die, primary unit is the one without health and secondary unit is killer.
3.4 for custom events, [primary_unit] is exactly what defines, what "unit" means in that event. When you need gate not gaining xp, you can set it to 0 after each attack. More events are needed only if you want fighting gate give no xp.
3.3 primary unit and secondary unit meanings are added for each event description in wiki. Usually you can guess them from event name - for attack event attacker is primary unit, and defender is secondary unit. And for die, primary unit is the one without health and secondary unit is killer.
3.4 for custom events, [primary_unit] is exactly what defines, what "unit" means in that event. When you need gate not gaining xp, you can set it to 0 after each attack. More events are needed only if you want fighting gate give no xp.
Re: ghype's Coding Problems - Modify Xp Reward
Ok I think I understood the soulcatcher ability now.
I tried to strip it down and to think of what it is what I really need.
Situation:
- unit attacks gate with ABILITY_NO_XP
- either gate gets killed or survives:
- attacker should not receive 1; 2 ;3 ; 4 xp if gate survives (depending on gate's lv)
- attacker should not receive 4 ; 8; 16; 24 ; 32 xp if gate gets killed (depending on gate's lv)
so I thought this was possible to be done with 2 events - one that removes fighting reward and another that removes killing reward from the attackers.
But ofc my code doesn't work. what is missing?
I tried to strip it down and to think of what it is what I really need.
Situation:
- unit attacks gate with ABILITY_NO_XP
- either gate gets killed or survives:
- attacker should not receive 1; 2 ;3 ; 4 xp if gate survives (depending on gate's lv)
- attacker should not receive 4 ; 8; 16; 24 ; 32 xp if gate gets killed (depending on gate's lv)
so I thought this was possible to be done with 2 events - one that removes fighting reward and another that removes killing reward from the attackers.
But ofc my code doesn't work. what is missing?
code:
stuff I worked on: Dunefolk Rework - ghype's Daily Art
Re: ghype's Coding Problems - Modify Xp Reward
You modify second_unit, but unstore unit.
Re: ghype's Coding Problems - Modify Xp Reward
Ravana means it should be:
Code: Select all
[unstore_unit]
variable=second_unit
Re: ghype's Coding Problems - Modify Xp Reward
EDIT: "no error message"
thanks for elaborating, but its still nothing happen and I also get NO error messages. So i don't know where to start.
here are the events isolated and with the last suggestion fixed. neither event1 nor event2 does something.
thanks for elaborating, but its still nothing happen and I also get NO error messages. So i don't know where to start.
here are the events isolated and with the last suggestion fixed. neither event1 nor event2 does something.
event1:
event2:
Last edited by ghype on October 22nd, 2018, 5:42 pm, edited 1 time in total.
stuff I worked on: Dunefolk Rework - ghype's Daily Art
Re: ghype's Coding Problems - Modify Xp Reward
Note that units get experience based on what they fight/kill, not based on what level they themselves are.
Re: ghype's Coding Problems - Modify Xp Reward
Recently the amount of XP gained on combat/kill were made tunable, see bc89512a5c000e0546676a3d0ae0f1be20b31731. That's not been released yet.
Have you tried just decreasing $unit.experience by 8*enemy.level before the combat? Even if that makes it negative that doesn't seem to break anything. Then after the combat add 8*enemy.level XP points back.
Have you tried just decreasing $unit.experience by 8*enemy.level before the combat? Even if that makes it negative that doesn't seem to break anything. Then after the combat add 8*enemy.level XP points back.
Re: ghype's Coding Problems - Modify Xp Reward
for now i would suggest to try put {VARIABLE second_unit.name testname} and just test your event works at all.. see if the name will change..
if it change then we can think further.. i just woke up sorry I'm not very helpful..
what error message exactly?
if it change then we can think further.. i just woke up sorry I'm not very helpful..
what error message exactly?
Re: ghype's Coding Problems - Modify Xp Reward
thanks for noticing, I changed it accordingly but still not working (code 1).
well that sounds sweet. If we don't find a solution for this trouble, I could simply wait. Hope it won't be released too late though.
Yes I just tried it but still no results (code 1). also i am confused. can you use enemy.level instead of second_units.level? is there any specific difference between those two?
It is part of code 1 but even that did not worked...
code 1:
code 2:
also i just noticed something very odd. with all the trial and error with all the combinations sofar, i remarked that even if the attacker never actually lost any xp after attack or kill, the gate never received any xp (at least for the 2day).
thats exactly what I wanted for the attacker, not the gate. Here comes the odd thing:
They still don't get any xp when no ability is activated on either the attacker or the gate.
How can the xp be affected if all my abilites are commented out with an #?
stuff I worked on: Dunefolk Rework - ghype's Daily Art
Re: ghype's Coding Problems - Modify Xp Reward
Your abilities do not influence these events. All units and all attacks are affected currently. Missing filters.
For testing if code is reached, I would use wesnoth.message, [chat] or [message].
For testing if code is reached, I would use wesnoth.message, [chat] or [message].