Bug - bad hogs positioned cause in game input do not respond
Sat, 2015-09-12 00:43
Hey, im testing custom missions, and when i try to position hogs in the air (wrong position i think) the game input do not respond and i need to leave mission...
Could you post a demo / replay please on http://www.hedgewars.org/demos ?
Are you telling us that you try to create your own missions and fail to get hog placement to work properly? In that case, it would be much more helpful if you posted the source code for reviewing.
Hi, I am a Hedgewars developer.
You mean i need to post mission code like this:
Dont know how to create demo, but what happen is that if hedgegod is positioned in mid air or againts map collision the firts turn never start..
First, I need to point out some mistakes in your code:
The final letter in the fort file name (minus file suffix) is either “R” or “L” for the right or left version of the fort. In AddTeam, the fort name is specified without this extra letter. So in this case, use simply "Cake".
The flag argument must be a string or nil, don't use a number, please. The default flag is called “hedgewars” and shows a hedgehog on black background. If you use nil (or just 5 arguments anyways), the default flag is used. You find the flags in Data/Graphics/Flags of your Hedgewars installation.
Hint: While your color number is not wrong at all, I want to point out that you can also specify colors in hexadecimal notation, which is much easier to use IMO, just prepend the number with “0x”. By the way, 16711680 == 0xFF0000, the color red.
The “corrected” version of your AddTeam function call:
Also, note that AddTeam only works when called inside onGameInit. Read here for the full documentation: http://hedgewars.org/kb/LuaAPI
Demos are automatically created after you played a game and did not abort it. Demos are saved in Demos/ inside your Hedgewars user directory, neatly sorted by date and time.
Hi, I am a Hedgewars developer.
Ok, i do not discuss about that mistake, but that do not help solving the problem... After the game message "fight", there is nothing you can do for moving, if i remove line SetGearPosition() the problem is solved, then there should be something wrong in that function...
This is the image for clarify error, i cant start mission becuase it.
So let me get this straight: You can not start the mission because the hogs you placed with AddHog just float in the air and don't drop. Is this correct?
In any case, we need to see your full Lua source code in order to help you.
I have no clue right now why this is happening.
Hi, I am a Hedgewars developer.
Ok, here is the mission code, i have checked for errors:
Edit: it only works if removed SetGearPosition functions
It's no surprise your hedgehogs are floating in the air without dropping. You used SetGravity(0), which means the gravity is set to 0%. In other words: Your hogs are in spaaaace!
Note that the game won't continue while the hogs are in mid-air. Hedgewars waits until all hogs stand on solid ground. Since this never happens, nothing happens.
The fix would be to remove SetGravity(0) from the script for default gravity. Or set the gravity to a positive value (100 = normal gravity).
You also might reconsider the spawning positions of your hedgehogs.
Hi, I am a Hedgewars developer.
Ok removing that code fixes the problem, and do of course hogs fall and take damage,but i got what expected, that i can place hog in any map position outside terrain. Just for testing, then how to change gravity to "Low"???
There are two possibilities to set gravity to “low”.
Either add “EnableGameFlags(gfLowGravity)” in onGameInit or add SetGravity(50) somewhere in code.
The first approach only works in onGameInit and as far I know, it cannot be disabled later in game. gfLowGravity corresponds to the “low gravity” symbol in the game scheme editor. It will also remove the low gravity utility from game.
The second approach works almost everywhere in the code (I guess) and you can theoretically change the gravity multiple times with SetGravity.
SetGravity simply sets the gravity to the percentage you provide it. SetGravity(100) means 100% gravity, SetGravity(50) means 50% gravity (same as in low gravity mode).
Hi, I am a Hedgewars developer.