ChaosRider’s WML questions

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
iceiceice
Posts: 1056
Joined: August 23rd, 2013, 2:10 am

Re: ChaosRider’s WML questions

Post by iceiceice »

Hmm... if you look at my "Creep War Draft Mode" scenario, I use this change the side of the guard to whoever's turn it is to choose their hero so that they can recruit their choice. See for example here: https://github.com/cbeck88/WesnothCapta ... e.cfg#L343

Maybe you can compare to figure out what's going wrong?
User avatar
ChaosRider
Posts: 846
Joined: April 15th, 2012, 1:15 pm

Re: ChaosRider’s WML questions

Post by ChaosRider »

I made code which is working but not in 100%, its store units, and after changing unit side this code is stopped (so if our unit is near 6 enemy units on 0 lvl (which all in our turn start should be joined to our side) then only one have changed side). Looks like modify_side is killing my code, anyone know why :D ?
Spoiler:
Edit:
Ok, way to fix this bug was to change one of the last lines with other one ("clear" with "next a"):
http://forums.wesnoth.org/viewtopic.php ... 89#p567089
Creator of WOTG (+2880 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.12 Wesnoth server.
User avatar
ChaosRider
Posts: 846
Joined: April 15th, 2012, 1:15 pm

Re: ChaosRider’s WML questions

Post by ChaosRider »

So im trying now to stop spawned near ai leader his recruits in turn when they are spawned, but code dont works... these new ai creeps got royal trait :P... and i want stop them only once.
Spoiler:
edit:
units_who_must_be_stopped[$i].moves dont work, but units_who_must_be_stopped[$i].max_moves (but then unit have 1/1 moves (not 0), why .moves dont work?)

edit2:
i checked addons from 1.10 wesnoth and most codes in which are changed .moves are filtred on unit x,y (which my code higher dont do, so i thought maybe in this was my problem reason, after add filter with x,y game is blocked like in not ending loop (and i dont know why):
Spoiler:
Creator of WOTG (+2880 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.12 Wesnoth server.
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: ChaosRider’s WML questions

Post by Dugi »

Your problem is by the end of the code. You're mixing direct modifications with modify_unit macro, and you aren't unstoring it. If the rest of the code is correct, it should be correct if you replace this:

Code: Select all

      {FOREACH units_who_must_be_stopped i}
         {VARIABLE units_who_must_be_stopped[$i].attacks_left 0}
         {VARIABLE units_who_must_be_stopped[$i].moves 0}
         {MODIFY_UNIT id=$units_who_must_be_stopped[$i].id variables.already_once_stopped yes}
      {NEXT i}
by this:

Code: Select all

      {FOREACH units_who_must_be_stopped i}
         {VARIABLE units_who_must_be_stopped[$i].attacks_left 0}
         {VARIABLE units_who_must_be_stopped[$i].moves 0}
         {VARIABLE units_who_must_be_stopped[$i].already_once_stopped yes}
      {NEXT i}
      [unstore_unit]
          variable=units_who_must_be_stopped[$i]
          find_vacant=no
      [/unstore_unit]
User avatar
ChaosRider
Posts: 846
Joined: April 15th, 2012, 1:15 pm

Re: ChaosRider’s WML questions

Post by ChaosRider »

Once i was learning about drawing, someone told me that its good to make some break for 15 or more minuts to see later easier parts of sketch which should be change. About not ending loop just check "Next" in second posted by me code... Its really wierd that i didnt see it earlier...
edit:
.moves still dont work... Its like it wasnt read by game... but .max_moves works, i can decrease this unit movement to 1/1 by sub in effect... but still this unit is able to move...
Creator of WOTG (+2880 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.12 Wesnoth server.
User avatar
trewe
Translator
Posts: 122
Joined: December 24th, 2012, 5:37 pm
Location: Portugal
Contact:

Re: ChaosRider’s WML questions

Post by trewe »

.moves does work, but pointless as they are reset immediately after.

change the event name in the original code to 'turn refresh'.
User avatar
ChaosRider
Posts: 846
Joined: April 15th, 2012, 1:15 pm

Re: ChaosRider’s WML questions

Post by ChaosRider »

Where its reset? And its not works cause i can see, if it works then stored unit could had 0 left moves after this code.
Now it looks like that:
Spoiler:
Code is used just after creating new unit for ai side near his leader, in event with name=side turn.
Creator of WOTG (+2880 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.12 Wesnoth server.
User avatar
Astoria
Inactive Developer
Posts: 1007
Joined: March 20th, 2008, 5:54 pm
Location: Netherlands

Re: ChaosRider’s WML questions

Post by Astoria »

I think placing it in a side turn refresh should work.
Formerly known as the creator of Era of Chaos and maintainer of The Aragwaithi and the Era of Myths.
User avatar
ChaosRider
Posts: 846
Joined: April 15th, 2012, 1:15 pm

Re: ChaosRider’s WML questions

Post by ChaosRider »

Still not, its just like game didnt read it, in my last code i had stored unit, everything was working (effect/".max_moves"/kill and many other) on this unit besides ".moves" which i dont get why. Code to create units near ai are used sometimes more than once (1 lvl units once per 2 turns/2 lvl once per 5 turn/ 3 lvl per 10 turn/ 4 lvl per 20 turn so i need to at this code end give them variable to later dont stop them). Each spawned unit (by my code, not recruited) near ai leader can be stopped only once, after spawning it. Code below dont works with & without blocked parts :].
Spoiler:
Edit: I found a way how to deal with it, ofcourse its not fix my problem with not working .moves but still i reach my point, i spawn petrify units near ai leader and at player turn start i unpetrify them...
Units code:
Spoiler:
Unpetrify code:
Spoiler:
Creator of WOTG (+2880 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.12 Wesnoth server.
User avatar
ChaosRider
Posts: 846
Joined: April 15th, 2012, 1:15 pm

Re: ChaosRider’s WML questions

Post by ChaosRider »

Now i have to ask about something else, event for weapon special named/called "Growing fury", its work well when we know what type of units will have it (as for cyclops) but what when we wish to give it in item, for any other unit? Then ofcourse we change filter type for attack special filter. After such a change everything works fine, but at attack end (in battle between two units) our unit have decreased attack dmg (its lower than it was before attacking, sometimes 0, sometimes just decreased by 3 (as in event, each not missed attack increase dmg by 3 points)). Below is code for interested one:
Spoiler:
Edit:
Bug already found & fixed, it was not changed filter_attack for filter_second_attack in 5th event :]... (first 4 are for attacking unit, next 4 are for defending one). Also while looking for this bug i found other one, unit get doubled dmg, it was thx not added ids to events...
Spoiler:
Creator of WOTG (+2880 units), MWC (+615 units), SurvivorsArea, RandomColosseum, RC WOTG, RC MWC, ColosseumRandomClonesBattle, BetweenDarknessAndLight, StealingWeapons, MoreUnitsForms, MoreDamageTypes, CanBeOnlyOne, ColosseumOneWinner, BonusSpam, CriticalStrike - available at 1.12 Wesnoth server.
Post Reply