Some problems & questions making a multiplayer scenario
Moderator: Forum Moderators
-
- Posts: 41
- Joined: February 24th, 2005, 2:10 pm
Some problems & questions making a multiplayer scenario
Hi all,
After making some multiplayer maps I am making my first multiplayer scenario, and use WML for the first time. The scenario I want to make is a bit difficult, since I am trying to make the following:
On the map there are certain villages which, if you capture them, will give you one unit per turn. These units will be "spawned" at the end of the turn of the person who has the village. Each of these "spawn-villages" have there own x,y pos where they will spawn the unit.
Now I am a bit of a perfectionist, and I want my WML code to be reusable for different maps. I am trying to make it so that when changing the map, the only thing you need to change in the WML are the top level macro calls:
{ADD_SPAWN_VILLAGE villageX villageY spawnX spawnY spawnUnitType}
No I am experiencing some troubles, and after some testing (with debug messages) I've come to know that most of them are because of variables which at a certain point have no value (although I have initialized them). I think I may have made some syntax errors, I was first confusing the preprocessor parameter syntax with the actual WML variables syntax and I may still be doing something wrong there. Like I use the following in a definition (macro), where VILLAGENR and SIDE are macro parameters:
[variable]
name=village{VILLAGENR}Owner
numerical_equals={SIDE}
[/variable]
Is that valid? If VILLAGENR is 1, will it take the WML variable village1Owner?
Also I have another question: is there some intern WML variable which you can use to determine which side's turn it is. I only know of "side" which can be used in filters only. But I need to use it outside filters as well. For now I have made my own turnSide variable, but there are some troubles with it and I would rather get rid of it.
Anyway, I would appreciate if some of you could have a look at the code (which is attached to this message). I have added some commentary and used good indents, and also have used macro's, so it should be quite readable.
P.S.: Tomsik, here you are, here is my code, so please don't nag me anymore about it in mp games
After making some multiplayer maps I am making my first multiplayer scenario, and use WML for the first time. The scenario I want to make is a bit difficult, since I am trying to make the following:
On the map there are certain villages which, if you capture them, will give you one unit per turn. These units will be "spawned" at the end of the turn of the person who has the village. Each of these "spawn-villages" have there own x,y pos where they will spawn the unit.
Now I am a bit of a perfectionist, and I want my WML code to be reusable for different maps. I am trying to make it so that when changing the map, the only thing you need to change in the WML are the top level macro calls:
{ADD_SPAWN_VILLAGE villageX villageY spawnX spawnY spawnUnitType}
No I am experiencing some troubles, and after some testing (with debug messages) I've come to know that most of them are because of variables which at a certain point have no value (although I have initialized them). I think I may have made some syntax errors, I was first confusing the preprocessor parameter syntax with the actual WML variables syntax and I may still be doing something wrong there. Like I use the following in a definition (macro), where VILLAGENR and SIDE are macro parameters:
[variable]
name=village{VILLAGENR}Owner
numerical_equals={SIDE}
[/variable]
Is that valid? If VILLAGENR is 1, will it take the WML variable village1Owner?
Also I have another question: is there some intern WML variable which you can use to determine which side's turn it is. I only know of "side" which can be used in filters only. But I need to use it outside filters as well. For now I have made my own turnSide variable, but there are some troubles with it and I would rather get rid of it.
Anyway, I would appreciate if some of you could have a look at the code (which is attached to this message). I have added some commentary and used good indents, and also have used macro's, so it should be quite readable.
P.S.: Tomsik, here you are, here is my code, so please don't nag me anymore about it in mp games
- Attachments
-
- HieronymusScenario.cfg
- the .cfg file in WML
- (4.61 KiB) Downloaded 480 times
-
- Posts: 41
- Joined: February 24th, 2005, 2:10 pm
1. Not many macro's? Are you sure we are talking about the same thing? The definitions, starting with #define DEFNAME? I've used 8 of them, and put almost every piece of code inside one.tomsik wrote:1.you didnt used many definded macros
2.about vilagenr:
i try used something like this something{var}somthing and it didnt work,
3.Place here what dont work
2. Ok, thanks. I just discovered that you can use arrays, and I probably should use that instead.
3. Currently, when I test it, it says that it "cannot find unit '' ". That is because the variables to the SPAWN macro seems to have no value. Something must go wrong when calling it, or calling the macro which is calling it. You can test it yourself by using any map and place a {ADD_SPAWN_VILLAGE villageX villageY spawnX spawnY spawnUnitType}
-
- Posts: 41
- Joined: February 24th, 2005, 2:10 pm
-
- Posts: 41
- Joined: February 24th, 2005, 2:10 pm
That would make all spawns for all players take place at the beginning of the first player's turn... but it has nothing to do with the problems I am havingtomsik wrote: yhm its one sentence
Change in SET_SPAWN_CHECK "name=side turn" to "name=new turn" but its only proposal
Anyone else who could help me a little?
if inside of [variable] ?
Code: Select all
#define NEXT_SIDE_TURN
# set turnOfSide variable to next side
[set_variable]
name=turnOfSide
[if]
[variable]
name=turnOfSide
numerical_equals=$nrSides
[/variable]
[then]
value=1
[/then]
[else]
add=1
[/else]
[/if]
[/set_variable]
[message]
message="Debug in NEXT_SIDE_TURN: nrSides $nrSides, turnOfSide $turnOfSide, nrVillages $nrVillages"
[/message]
#enddef
try :
Code: Select all
[if]
[variable]
name=turnOfSide
numerical_equals=$nrSides
[/variable]
[then]
[set_variable]
name=turnOfSide
value=1
[/set_variable]
[/then]
[else]
[set_variable]
name=turnOfSide
add=1
[/set_variable]
[/else]
[/if]
Greetings
another bug
Code: Select all
[if]
[variable]
name=village{VILLAGENR}Owner
numerical_equals={SIDE}
[/variable]
[then]
{SPAWN {$village{VILLAGENR}SpawnType} {SIDE} $village{VILLAGENR}SpawnX $village{VILLAGENR}SpawnY}
[/then]
[/if]
Pherhaps i don't understand what is done here, but i think the outer brackets are wrong here.
Re: another bug
He's trying to use arrays. According to the wiki, the dot is missing:fabi wrote:Code: Select all
{$village{VILLAGENR}SpawnType}
Code: Select all
$village[VILLAGENR].SpawnType
Does this construct actually work for you (those are curly brackets!):
Code: Select all
$village{VILLAGENR}SpawnType
BTW, are variable names case-sensitive? If not, it might not make a lot of sense to type "SpawnType"...
Last edited by Rhuvaen on March 16th, 2005, 10:54 am, edited 1 time in total.
Try some Multiplayer Scenarios / Campaigns
-
- Posts: 41
- Joined: February 24th, 2005, 2:10 pm
Re: another bug
I was not trying to use arrays here (since I did not know yet that I could). So it was indeed kind of a workaround to arrays.Rhuvaen wrote:He's trying to use arrays. According to the wiki, the dot is missing:fabi wrote:Code: Select all
{$village{VILLAGENR}SpawnType}
However, I didn't have a lot of success with them so far, and there's only specific tags where they are interpreted at all. I don't know if you have to use the dollar sign on the VILLAGENR (array index), it might depend on the context.Code: Select all
$village[VILLAGENR].SpawnType
Does this construct actually work for you (that curly brackets!):Can you actually improvise a variable name like that? That would be a simple workaround to arrays.Code: Select all
$village{VILLAGENR}SpawnType
BTW, are variable names case-sensitive? If not, it might not make a lot of sense to type "SpawnType"...
I am still not sure if it works though, Tomsik says it doesn't work but he still uses the same in his newest version of his "The War" scenario and that seems to be working fine:
Code: Select all
[set_variable]
name=kills{SIDE}_type
value={WHAT}
[/set_variable]
Re: another bug
I'm investigating this and it doesn't work, generally. I think it does work when the variable is on the right side of an assignment, when the argument is evaluated. That would mean:Hieronymus wrote:I am still not sure if it works though, Tomsik says it doesn't work but he still uses the same in his newest version of his "The War" scenario and that seems to be working fine:Rhuvaen wrote:Does this construct actually work for you (that curly brackets!):Can you actually improvise a variable name like that? That would be a simple workaround to arrays.Code: Select all
$village{VILLAGENR}SpawnType
Code: Select all
[set_variable] name=kills{SIDE}_type value={WHAT} [/set_variable]
Good Code:
Code: Select all
name=kills{SIDE}_type
Code: Select all
kills{SIDE}_type={WHAT}
Huh? You apologise if a WML feature is working ? Well, it's not your "fault" ...tomsik wrote:maybe i make something bad it that macro, if it work sorry
Try some Multiplayer Scenarios / Campaigns