[unit] tag, need help. (again...)

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
nexusrebirth
Posts: 21
Joined: November 15th, 2019, 8:54 pm

[unit] tag, need help. (again...)

Post by nexusrebirth »

Hi guys, tis' the third time i write here because it seems like you can do miracles. So i'm trying to have a unit spawn insta ntly at the beginning of the scenario. The goal is to have it in the same side or atleast allied to side1. I also want to disallow movement for this unit. It also needs an id. here is what i tried :

Code: Select all

[event]
    name=start
    [unit]
        type=Sovereign
        side=1
        name= _ "Gurash"
        x=18
        y=30
        id=Gurash
    [/unit]
[/event]
i get lua errors. Me having a potato level in it i have no idea how to read those, they are saying :

Code: Select all

<Lua error> lua/core.lua438: [message] not supported at scenario toplevel
                  stack traceback:
                          [C]: In function '.error'
                          lua/core.lua438: in function <lua/core.lua:426>
and

Code: Select all

<Lua error> game_error: unknown unit type : Sovereign
                  stack traceback:
                         [C]: In local 'cmd'
                         lua/wml-utils.lua:145: In field 'handle_event_commands'
                         lua/wml-flow.lua6: In function <lua/wml-flow.lua:5>
as always here is the full scenario code (wich isn't 100% done but most of necessary things should be in) :

Code: Select all

[scenario]
    {DEFAULT_SCHEDULE}
	id=chasse_aux_loups
    next_scenario=null
    name= _ "Chasse aux loups"
    map_data="{~add-ons/pour_la_horde/maps/chasse_aux_loups.map}"
    turns=30
	[event]
	    name=start
		[message]
		    speaker=narrator
			message= _ "A remplir"
		[/message]
		[objectives]
		    [objective]
			    description= _ "Éliminez l'Alpha"
				condition=win
			[/objective]
			[objective]
			    description= _ "Mort d'Uldrulf"
				condition=lose
			[/objective]
			[objective]
			    description= _ "Mort de Gurash"
				condition=lose
			[/objective]
			[objective]
			    description= _ "Limite des tours atteinte"
				condition=lose
			[/objective]
		[/objectives]
	[/event]
	[side]
	    side=1
        controller=human
        team_name="good"
        user_team_name= _ "Groupe d'Uldrulf"
        id="Uldrulf"
        name= _ "Uldrulf"
        type="Orcish Grunt"
        unrenameable=yes
        canrecrcuit=yes
        recruit="Orcish Archer,Orcish Grunt, Wolf Rider"
		gold=250
	[/side]
	[event]
	    name=start
		[unit]
		    type=Sovereign
			side=1
			name= _ "Gurash"
			x=18
			y=30
		[/unit]
	[/event]
	[side]
	    side=2
        controller=ai
        team_name="bad"
        user_team_name= _ "Meute de loups"
        id="Alpha"
        name= _ "Loup Alpha"
        type="Direwolf"
        unrenameable=yes
        canrecrcuit=yes
        recruit="Great Wolf, Wolf"
		gold=100
	[/side]
	[event]
	    name=die
		[filter]
		    id=Alpha
		[/filter]
		[message]
		    speaker=Uldrulf
			message= _ "Père, j'ai réussi !"
		[/message]
		[message]
		    speaker=Gurash
			message= _ "Aujourd'hui tu obtiens ta première victoire, souviens toi de ce jour fils."
		[/message]
		[endlevel]
		    result=victory
		[/endlevel]
	[/event]
	[event]
	    name=die
		[filter]
		    id=Uldrulf
		[/filter]
		[message]
		    speaker=Gurash
			message= _ "Mon fils est une décéption, ces hommes méritaient mieux que de mourir sous ses ordres..."
		[/message]
		[endlevel]
		    result=defeat
		[/endlevel]
	[/event]
	[event]
	    name=die
		[filter]
		    id=Gurash
		[/filter]
		[message]
		    speaker=Uldrulf
			message= _ "Comment cela à-t'il pu se passer ?! père !"
		[/message]
		[endlevel]
		    result=defeat
		[/endlevel]
	[/event]
	    name=time over
		[message]
		    speaker=Uldrulf
			message= _ "Si nous ne rentrons pas, nous tomberons à court de vivre, allons-nous en!"
		[/message]
		[message]
		    speaker=Gurash
			message= _ "Si tu n'arrives pas à éliminer quelques loups en plusieurs jours, tu ne seras jamais digne de mener la tribu..."
		[/message]
		[endlevel]
		    result=defeat
		[/endlevel]
	[event]
	[/event]
[/scenario]
User avatar
Pentarctagon
Project Manager
Posts: 5562
Joined: March 22nd, 2009, 10:50 pm
Location: Earth (occasionally)

Re: [unit] tag, need help. (again...)

Post by Pentarctagon »

The first error at least is because you have:

Code: Select all

		[message]
		    speaker=Uldrulf
			message= _ "Si nous ne rentrons pas, nous tomberons à court de vivre, allons-nous en!"
		[/message]
		[message]
		    speaker=Gurash
			message= _ "Si tu n'arrives pas à éliminer quelques loups en plusieurs jours, tu ne seras jamais digne de mener la tribu..."
		[/message]
		[endlevel]
		    result=defeat
		[/endlevel]
	[event]
	[/event]
([event] is in the wrong place)
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
User avatar
beetlenaut
Developer
Posts: 2824
Joined: December 8th, 2007, 3:21 am
Location: Washington State
Contact:

Re: [unit] tag, need help. (again...)

Post by beetlenaut »

nexusrebirth wrote: August 9th, 2020, 12:38 am type=Sovereign
You probably meant type=Orcish Sovereign.

Also, you can put [unit] tags directly in [side] to create units that start on that side.
nexusrebirth wrote: August 9th, 2020, 12:38 am i have no idea how to read those
For the lua errors, just look at the first line. It tells you what the main problem is. For example, "game_error: unknown unit type: Sovereign." That message, at least, should be pretty clear. You can ignore the rest of the lines.

Edit: fixed typo
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
gnombat
Posts: 705
Joined: June 10th, 2010, 8:49 pm

Re: [unit] tag, need help. (again...)

Post by gnombat »

beetlenaut wrote: August 9th, 2020, 2:16 am
nexusrebirth wrote: August 9th, 2020, 12:38 am type=Sovereign
You probably meant type=Orchish Sovereign.
Actually type=Orcish Sovereign.
nexusrebirth
Posts: 21
Joined: November 15th, 2019, 8:54 pm

Re: [unit] tag, need help. (again...)

Post by nexusrebirth »

Pentarctagon wrote: August 9th, 2020, 1:07 am The first error at least is because you have:

Code: Select all

		[message]
		    speaker=Uldrulf
			message= _ "Si nous ne rentrons pas, nous tomberons à court de vivre, allons-nous en!"
		[/message]
		[message]
		    speaker=Gurash
			message= _ "Si tu n'arrives pas à éliminer quelques loups en plusieurs jours, tu ne seras jamais digne de mener la tribu..."
		[/message]
		[endlevel]
		    result=defeat
		[/endlevel]
	[event]
	[/event]
([event] is in the wrong place)
thank you for pointing that out, i still need to focus more on what i do it would seem... :)
nexusrebirth
Posts: 21
Joined: November 15th, 2019, 8:54 pm

Re: [unit] tag, need help. (again...)

Post by nexusrebirth »

beetlenaut wrote: August 9th, 2020, 2:16 am
nexusrebirth wrote: August 9th, 2020, 12:38 am type=Sovereign
You probably meant type=Orcish Sovereign.

Also, you can put [unit] tags directly in [side] to create units that start on that side.
nexusrebirth wrote: August 9th, 2020, 12:38 am i have no idea how to read those
For the lua errors, just look at the first line. It tells you what the main problem is. For example, "game_error: unknown unit type: Sovereign." That message, at least, should be pretty clear. You can ignore the rest of the lines.

Edit: fixed typo
Yeah i read about putting it in side but didn't get it to work. Got it working now. I'm just a bit surprised that it is type=Orcish Sovereign adn not type="Orcish Soverreign" but i'll remember that, thank you for your time :)
User avatar
s1m0n
Posts: 53
Joined: May 7th, 2020, 1:55 pm
Location: Irdya

Re: [unit] tag, need help. (again...)

Post by s1m0n »

nexusrebirth wrote: August 9th, 2020, 12:38 am I also want to disallow movement for this unit.
for this u can just use max_moves like this:

Code: Select all

[unit]
	id=Gurash
	type=Orcish Sovereign
	name= _ "Gurash"
	x=18
	y=30
	max_moves=0
[/unit]
That gives the unit 0 movement points -> it can't move, but do anything else
eh, what comes here again?
User avatar
s1m0n
Posts: 53
Joined: May 7th, 2020, 1:55 pm
Location: Irdya

Re: [unit] tag, need help. (again...)

Post by s1m0n »

nexusrebirth wrote: August 9th, 2020, 12:10 pm I'm just a bit surprised that it is type=Orcish Sovereign adn not type="Orcish Soverreign" but i'll remember that, thank you for your time :)
Both should work if you fix that typo in souvereign
eh, what comes here again?
nexusrebirth
Posts: 21
Joined: November 15th, 2019, 8:54 pm

Re: [unit] tag, need help. (again...)

Post by nexusrebirth »

s1m0n1nl33t wrote: August 10th, 2020, 10:36 am
nexusrebirth wrote: August 9th, 2020, 12:38 am I also want to disallow movement for this unit.
for this u can just use max_moves like this:

Code: Select all

[unit]
	id=Gurash
	type=Orcish Sovereign
	name= _ "Gurash"
	x=18
	y=30
	max_moves=0
[/unit]
That gives the unit 0 movement points -> it can't move, but do anything else
thank you that's perfect :D
nexusrebirth
Posts: 21
Joined: November 15th, 2019, 8:54 pm

Re: [unit] tag, need help. (again...)

Post by nexusrebirth »

s1m0n1nl33t wrote: August 10th, 2020, 10:38 am
nexusrebirth wrote: August 9th, 2020, 12:10 pm I'm just a bit surprised that it is type=Orcish Sovereign adn not type="Orcish Soverreign" but i'll remember that, thank you for your time :)
Both should work if you fix that typo in souvereign
Ooops i really need to focus more on what i write... thank you :)
Post Reply