Carda's bunch of daily Lua 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.
Carda
Posts: 11
Joined: December 21st, 2010, 2:20 pm

Re: Script command to give XP to a unit?

Post by Carda »

Two more questions if that's allowed (if not, I'll put my questions in one of the fixed topics on top)

While playing the map around turn 20 I need to let the players view the complete map. At the start its clouded which is OK. Then around turn 25 everything must switch back to: players only see where they actually are.


[event]
name="turn 20"
???? <---- need to enter the script to remove all view restrictions (players must see complete map)
[/event]

[event]
name="turn 25"
???? <---- make it foggy again (only see the area around the units)
[/event]

Thanks again :)

P.S. Tried consulting the online Lua Wesnoth manual first but I have no clue where to start looking. Luckely Bob's RPG maps help me a lot learning about triggers and such.
10 FOR X = 0 TO 15
20 POKE 53280,X ; PRINT " Hello World"
30 NEXT X
40 GOTO 10
Anonymissimus
Inactive Developer
Posts: 2461
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: Script command to give XP to a unit?

Post by Anonymissimus »

[modify_side]
side=<side_number>
shroud=yes|no
fog=yes|no
[redraw]

for all sides in the scenario.
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml startersPlan Your Advancements: mp mod
The Earth's Gut: sp campaignSettlers of Wesnoth: mp scenarioWesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
Carda
Posts: 11
Joined: December 21st, 2010, 2:20 pm

Re: Carda's bunch of daily Lua questions

Post by Carda »

Computed it to this:

[modify_side]
side="1,2,3,4,5"
shroud="no"
fog="no"
[/modify_side]
[redraw]
[/redraw]

Another quick reply,
Thanks
10 FOR X = 0 TO 15
20 POKE 53280,X ; PRINT " Hello World"
30 NEXT X
40 GOTO 10
Anonymissimus
Inactive Developer
Posts: 2461
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: Carda's bunch of daily Lua questions

Post by Anonymissimus »

modify_side doesn't allow comma-separated list for side=
And your question has nothing to do with lua.
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml startersPlan Your Advancements: mp mod
The Earth's Gut: sp campaignSettlers of Wesnoth: mp scenarioWesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
Carda
Posts: 11
Joined: December 21st, 2010, 2:20 pm

Re: Carda's bunch of daily Lua questions

Post by Carda »

I'm sorry if this isn't Lua. I have a feeling i'm coding two languages through eachother here. But glad that it all still hangs on. Progress on the map and scripts is steadily going forward.

Now however I encountered a problem and I would like you to take a look if the next coding is valid (does it work?):

[event]
name=die
[filter]
name="Bluto"
[/filter]
{VARIABLE_OP gooddied add 1}
[/event]

Does it add 1 to the variable gooddied when a creature called Bluto gets killed?

Thanks again all. If the above code is valid my error must be somewhere else.
10 FOR X = 0 TO 15
20 POKE 53280,X ; PRINT " Hello World"
30 NEXT X
40 GOTO 10
monochromatic
Posts: 1549
Joined: June 18th, 2009, 1:45 am

Re: Carda's bunch of daily Lua questions

Post by monochromatic »

If gooddied is an existent numeric variable, then yes. I suspect you might not have defined gooddied earlier.
What you are coding is called WML. Lua looks completely different: http://svn.gna.org/viewcvs/wesnoth/trun ... iew=markup
User avatar
bigkahuna
Posts: 657
Joined: September 11th, 2010, 6:24 pm
Location: In your mind.

Re: Carda's bunch of daily Lua questions

Post by bigkahuna »

Code: Select all

[filter]
     name="Bluto"
[/filter]
I don't think that that is valid... Do the id attribute instead, it doesn't get messed up in translating and is much more reliable and I know that it works.
Check out my campaign Sweet Revenge!
Join the new R2D forum!
Post Reply