Its me again with a new question:-)

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.
alex23
Posts: 179
Joined: October 27th, 2012, 5:54 pm

Its me again with a new question:-)

Post by alex23 »

I have a little problem - in my scenario, there are a few loyal subheroes who are optional. And I want them to be recalled automatically on the first turn.. However, it somehow doesn't work properly.. Here is the code I used:

Subheor Drogan (from campaign 3:
This event is for getting Drogan to join your team:
[event]
name=moveto
[filter]
x,y=9,21
[/filter]
[unit]
id=Drogan
side=1
canrecruit=no
type=Vampmage
name= _ "Drogan"
gender=male
x=8.x
y=20.y
[/unit]
#Defining the variable for Drogan to decide if he can be recalled or not:
[set_variable]
name=Drogan_alive
value=yes
[/set_variable]

[message]
speaker=Drogan
message= _ "Hey Patruk, what are you doing here? Are you searching for that strange suspicious Man who ran across me a few minutes ago? I can help you searching for him if you want"
[/message]
[/event]

#If Drogan dies (in any scenario besides the last one where everyone might die)
[event]
name=die
[filter]
id=Drogan
[/filter]
[message]
speaker=Drogan
message= _ "I wish I could have finished my research"
[/message]
[set_variable]
name=Drogan_alive
value=no
[/set_variable]

[/event]

#The recall event in each scenario (later on without the maessage as it might get annoying each scenario)
[event]
[if]
[variable]
name=Drogan_alive
equals=yes
[/variable]
[then]
[unit]
id=Drogan
canrecruit=no
name= _ "Drogan"
gender=male
x=43.x
y=3.y
[/unit]
[/then]
[else]
[message]
speaker=Jacky
message= _ "I wish Drogan was here"
[/message]
[/else]
[/if]
[/event]

I really don't get what is wrong.. I would appreciate each help,

Thank you
Last edited by alex23 on November 6th, 2012, 5:18 pm, edited 2 times in total.
User avatar
SkyOne
Posts: 1310
Joined: January 3rd, 2009, 7:23 pm

Re: AUtorecall units/dependence if the unit stills lives

Post by SkyOne »

In this case, it seems you need:

Code: Select all

[clear_variable]
    name=Drogan_alive
[/clear_variable]
in his die event, instead of this one:

Code: Select all

[set_variable]
name=Drogan_alive
value=no
[/set_variable]
Then store him to recall him back in the game after [if] + [variable] tags
Something like:

Code: Select all

[store_unit]
    [filter]
        id=Drogan
    [/filter]
    variable=drogan_store
    kill=yes
[/store_unit]
Then when you need him back:

Code: Select all

[unstore_unit]
    variable=drogan_store
    x,y=43,3
[/unstore_unit]
{CLEAR_VARIABLE drogan_store}
They should be in an [event] with an event-name, though. :)

If you just need to recall him from the beginning of the next scenario, you don't really need what I said. You only need:

Code: Select all

[recall]    
    id=Drogan
    x,y=43,3
[/recall]
in the prestart event usually (to show him on the map).
Fate of a Princess/feedback thread: "What is in own heart that is the most important, not who you are."
Drake Campaign: Brave Wings/feedback thread, Naga Campaign: Return of the Monster, Saurian Campaign: Across the Ocean
Northern Forces - now on 1.12 server
User avatar
Adamant14
Posts: 968
Joined: April 24th, 2010, 1:14 pm

Re: AUtorecall units/dependence if the unit stills lives

Post by Adamant14 »

Code: Select all

	[event]
		name=prestart

		[recall]   
			id=Drogan
			x,y=43,3            ### if you dont set coordinates, then Drogan appears next to the leader
		[/recall]
	[/event]



	[event]
		name=start               ### or what event you want

		[if]
			[have_unit]
				id=Drogan
			[/have_unit]
			[then]
				### do nothing
			[/then]
			[else]
				[message]
					speaker=Jacky
					message= _ "I wish Drogan was here"
				[/message]
			[/else]
		[/if]
	[/event]
Author of Antar, Son of Rheor ( SP Campaign) | Development Thread + Feedback Thread + Replays of ASoR
alex23
Posts: 179
Joined: October 27th, 2012, 5:54 pm

Re: AUtorecall units/dependence if the unit stills lives

Post by alex23 »

thx haha so its much easier than i thought^^ however i just noticed that my code (although beeing pretty long) would still work, i just forgot to say when the event had to start^^
alex23
Posts: 179
Joined: October 27th, 2012, 5:54 pm

Re: AUtorecall units/dependence if the unit stills lives

Post by alex23 »

hmm ok new question: I want to constantly change the side of a whole enemy team to be allied with me or even fight directly for me(I would prefer that)..
I tried this however without luck:

Code: Select all

[event]
name=turn 2
    [message]
      speaker=Poseidon
      message= _ "What are you doing here Strangers?"
    [/message]
    [message]
      speaker=Jacky
      message= _ "We are on the journey to defeat the Deamon. "
    [/message]
    [message]
      speaker=Poseidon
      message= _ "Hahaha you have an evil Necropath with you and some other strange creatures and undead and you really think I will believe you this?"
    [/message]
    [message]
      speaker=Necropath
      message= _ "Only because I decided to live longer doesn't mean that I am evil"
    [/message]
    [message]
      speaker=Poseidon
      message= _ "To become a Necropath you must have an extremely dark soul, you can't fool me.. however I might really need some help, so we might make a treaty for the next few days"
    [/message]
    [message]
      speaker=Kerin
      message= _ "Don't ally with those stupid mermen. They are week here, on the sand.. However, we could help you fighting those lava-creatures and desert animals, if you fight the Mermen. In our area, we are the strongest"

[option]
     message= _ "Ally with the desert-elves"
       [command]
       [message]
       speaker=Poseidon
	message= _ "Than die you evil scum"
	[/message]
    [filter]
      side=4
    [/filter]
    
    
    [set_variable]
      name=side.team_name
      value=1
    [/set_variable]
       [/command]
     [/option]
[option]
     message= _ "Ally with the Mermen"
       [command]
       [message]
       speaker=Kerin
	message= _ "Hahaha you have chosen the wrong"
	[/message]
    [filter]
      side=5
    [/filter]
    
    
    [set_variable]
      name=side.team_name
      value=1
    [/set_variable]
       [/command]
     [/option]
    [/message]
 [/event]
Please help
User avatar
Adamant14
Posts: 968
Joined: April 24th, 2010, 1:14 pm

Re: AUtorecall units/dependence if the unit stills lives

Post by Adamant14 »

Use [modify_side]

Code: Select all

	[modify_side]
		side=4
		team_name=1
	[/modify_side]
This makes team 4 allie with team 1

Simple?
Author of Antar, Son of Rheor ( SP Campaign) | Development Thread + Feedback Thread + Replays of ASoR
alex23
Posts: 179
Joined: October 27th, 2012, 5:54 pm

Re: hmm ok new question: I want to constantly change the sid

Post by alex23 »

wow thanks!!!! Is it possible to make all units side 1 as well? (not only allied but under my direct control (so that I can recall them later?))
User avatar
Adamant14
Posts: 968
Joined: April 24th, 2010, 1:14 pm

Re: hmm ok new question: I want to constantly change the sid

Post by Adamant14 »

This macro change all units of team 4 to team 1

Code: Select all

		{MODIFY_UNIT (side=4) side 1}
Author of Antar, Son of Rheor ( SP Campaign) | Development Thread + Feedback Thread + Replays of ASoR
alex23
Posts: 179
Joined: October 27th, 2012, 5:54 pm

Re: hmm ok new question: I want to constantly change the sid

Post by alex23 »

Thx again:)
alex23
Posts: 179
Joined: October 27th, 2012, 5:54 pm

Re: Its me again with a new question:-)

Post by alex23 »

yes now its somethingelse: I want a subhero to be able to recruit only One certain unit , but the main hero a few others.. thats my code atm (not working^^)

Code: Select all

[event]
name=moveto
[filter]
id=Diana
[/filter]
[message]
speaker=Diana
message= _ "By the way, thank you for letting me study a few of your magic books Derak. I think I know now how sumoning works. But I think I'll try to create an own unit"
[/message]
[modify_unit]
[filter]
id=Diana
[/filter]
canrecruit=yes
recruit=Icy_sandmaid
[/modify_unit]
[/event]
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Its me again with a new question:-)

Post by Dugi »

recruit is not a property of a unit, it is the property of an entire side. Check out the usage of extra_recruit on UnitWML.
User avatar
8680
Moderator Emeritus
Posts: 742
Joined: March 20th, 2011, 11:45 pm
Location: The past

Re: Its me again with a new question:-)

Post by 8680 »

Dugi wrote:UnitWML
Correction: SingleUnitWML.
alex23
Posts: 179
Joined: October 27th, 2012, 5:54 pm

Re: Its me again with a new question:-)

Post by alex23 »

Thx!! There were also a few other very interesting things
alex23
Posts: 179
Joined: October 27th, 2012, 5:54 pm

Re: Its me again with a new question:-)

Post by alex23 »

So while working (more thinking about than doin something) on my campaign a new question appeared: how can i let my leader (or any other unit) move (not teleport) to a certein place taking a certain way? I couldnt find any possibly working code/make my own...
User avatar
Dugi
Posts: 4961
Joined: July 22nd, 2010, 10:29 am
Location: Carpathian Mountains
Contact:

Re: Its me again with a new question:-)

Post by Dugi »

There is a tag named [move_unit_fake] for it. Use the {MOVE_UNIT id=blablabla x y} macro, that will make it even easier.
Post Reply