recruits to die with leader

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
Tallan
Posts: 5
Joined: October 29th, 2006, 1:34 am

recruits to die with leader

Post by Tallan »

ive been trying to get all of a side to die when the leader dies but have only been able to find coding that will make the leader die and not the recruites aswell.Who can help me :?: :?:
User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Post by Sapient »

Like this:

Code: Select all


# kill leaderless minions
[event]
 name=die
 first_time_only=no
 [filter]
  canrecruit=1
 [/filter]
 {STORE_UNIT_VAR x,y=$x1,$y1 side deadleader_side}
 [unhide_unit]
 [/unhide_unit]
 [hide_unit]
  x=$x1
  y=$y1
 [/hide_unit]
 [kill]
  animate=yes
  fire_event=no
  side=$deadleader_side
  canrecruit=0
 [/kill]
[/event]

http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
Tallan
Posts: 5
Joined: October 29th, 2006, 1:34 am

Post by Tallan »

sorry i should have said before that this is for a multiplayer game.will this code still work :?:
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

Tallan wrote:sorry i should have said before that this is for a multiplayer game.will this code still work :?:
Yes.
User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Post by Sapient »

If it doesn't work, then what version of Wesnoth are you using? I'm assuming that macro is defined in your version.
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
Tallan
Posts: 5
Joined: October 29th, 2006, 1:34 am

Post by Tallan »

Im using version 1.0.2 and tryed out this code and it worked too well!. That is i just played a 4p game and killed a leader and found out every side expect the side that just killed there enemy leader lost there recruits aswell.
Tallan
Posts: 5
Joined: October 29th, 2006, 1:34 am

Post by Tallan »

in fact it kills all recruites on the map.
User avatar
zookeeper
WML Wizard
Posts: 9742
Joined: September 11th, 2004, 10:40 pm
Location: Finland

Post by zookeeper »

The above piece of code only works with the dev releases. Switching to 1.1.11 should make you a lot happier in other ways, too.
User avatar
Sapient
Inactive Developer
Posts: 4453
Joined: November 26th, 2005, 7:41 am
Contact:

Post by Sapient »

Well, you should have specified your version of Wesnoth. Here's an example that doesn't use any utility macros. I'm not going to reinstall Wesnoth 1.0.2 just to test it though. Let me know if it works.

Code: Select all

# kill leaderless minions 
[event] 
 name=die 
 first_time_only=no 
 [filter] 
  canrecruit=1 
 [/filter]
 [store_unit]
  [filter]
   x=$x1
   y=$y1
  [/filter]
  kill=no
  variable=stored_unit
 [/store_unit]
 [set_variable]
  name=deadleader_side
  format=$stored_unit.side
 [/set_variable]
 [clear_variable]
  name=stored_unit
 [/clear_variable]
 [unhide_unit] 
 [/unhide_unit] 
 [hide_unit] 
  x=$x1 
  y=$y1 
 [/hide_unit] 
 [kill] 
  animate=yes 
  fire_event=no 
  side=$deadleader_side 
  canrecruit=0 
 [/kill] 
[/event] 
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
Tallan
Posts: 5
Joined: October 29th, 2006, 1:34 am

Post by Tallan »

No it doesnt work, but in 1 hour ill have new ram so ill be able to play 1.1.11 again with out it crashing all the time. Thanks for your help Sapient.
Post Reply