script lua problem

2 replies [Last post]
sphrix's picture
User offline. Last seen 1 day 7 hours ago. Offline
Joined: 2011-04-07
Posts: 207

hi, i have the idea to do a video, something including cinematic and demos of different gameplay modes : a hedgehog do something, other hedgehod say it's lame, the first kill them, and punishment he had to success in different game modes....
no problem with the demos, but i need help about lua script

i would like to do a cinematic using lua (to avoid the time of typing a bubble text for each hedgehog)
but i have this error message from the engine :

Last two engine messages:
Some parameters not set (flags = 0)

here is my script :

loadfile(GetDataPath() .. "Scripts/Locale.lua")()
function onGameInit()
seed = 0 -- The base number for the random number generator
GameFlags = gfInfAttack +gfSolidLand +gfDisableWind
TurnTime = 90000 -- The time the player has to move each round (in ms)
CaseFreq = 0 -- The frequency of crate drops
MinesNum = 0 -- The number of mines being placed
MinesTime = 3000
Explosives = 0 -- The number of explosives being placed
Delay = 10 -- The delay between each round
Map = "Ruler2" -- The map to be played (custom map)
Theme = "nature" -- The theme to be used

AddTeam("un", 14483456, "Simple", "Island", "Default", "hedgewars")
player = AddHog("Sphrix", 0, 1, "NoHat")

AddTeam("autre", 1175851, "Simple", "Island", "Default", "Hedgewars")
enemy1 = AddHog("1", 1, 1, "mp3")
enemy2 = AddHog("2", 1, 1, "Glasses")
enemy3 = AddHog("3", 1, 1, "gentleman")
enemy4 = AddHog("4", 1, 1, "anzac")

SetGearPosition(enemy1, 860, 793)
SetGearPosition(enemy2, 911, 793)
SetGearPosition(player, 971, 793)
SetGearPosition(enemy3, 1050, 793)
SetGearPosition(enemy4, 1111, 793)

function onGameStart()

function onGameTick()
if (CurrentHedgehog == player) then

if returnControl == true then
SetGearMessage(player, 0)
aTimer = aTimer + 1
if (aTimer == 2000) then
HogSay(CurrentHedgehog, "hey guys ! look at me, i can ...", SAY_THINK)
elseif aTimer == 5000 then
elseif aTimer ==9000 then
HogSay(CurrentHedgehog, "I CAN JUGGLE !!", SAY_THINK)
elseif aTimer ==11000 then
HogSay(CurrentHedgehog, "what do you think about it ? ??", SAY_THINK)

--TurnTimeLeft = 1

aTimer = 0

function onGearAdd(gear)

function onGearDelete(gear)

why have i a message error saying flag=0 ?
and if you see other error tell me

the beachs hogs surfin hedgewars

mikade's picture
User offline. Last seen 22 weeks 3 days ago. Offline
Joined: 2010-10-22
Posts: 355

Heya. About to go to sleep, so this will have to be at a glance, but:

1) As I once asked you in IRC, why so many "end"s in onGameTick()?
2) Could be wrong, but don't think there is a Ruler2 map in Hedgewars. If you're using a custom map, say so in your OP!
3) Probably you can't taunt like that.
4) Be wary that lua/hedgewars is case-sensitive. Pretty sure your theme assignment (and maybe other stuff, eg. one of the team flags) has the wrong case.
5) You have a random variable called returnControl that you're checking, but it doesn't look like it's assigned a value anywhere
6) You've loaded the loc library, but aren't bothering to localize any of your strings.
7) You probably don't need to specify a time for mines as you've set there to be no mines on the map.
8) etc.

Okay, so this has quite a few errors. I would try reading our Lua API (check the wiki) and working off functional trainings for now. Slowly familiarize yourself with how lua and Hedgewars work before trying any really ambitious projects, and then as your skill increases, you can code more complex stuff.

Anywho, that's all from me for now.

Hedgewars Developer

sphrix's picture
User offline. Last seen 1 day 7 hours ago. Offline
Joined: 2011-04-07
Posts: 207

hey mikade, thank you for answer
in IRC i didn't see the answer so i posted here....
it is a custom map you're right

i already read the doc about lua in hedgewars, and take exemple from the doc and also from other script...

i will try easier things, i just thought that making 1 hedgehog speaking wasn't so hard :p

thank you

the beachs hogs surfin hedgewars

User login

Copyright © 2004-2024 Hedgewars Project. All rights reserved. [ contact ]