Problems in our alien mod Blob and I are making a dungeon for IVAN, and because I'm making the coding part, sometimes encounter some problems.
I'm not good in binary usage, so I run in some problems when trying to animate an alien with some frames. So, I simply use a switch to animate my monster like I want.
Here a simple animation:
bodypart.cpp
v2 adultalientorso::GetBitmapPos(int Frame) const
{
v2 BasePos = torso::GetBitmapPos(Frame);
switch(Frame)
{
case 0:
case 1:
case 2:
case 3:
case 10:
case 11:
case 12:
case 13: return v2(BasePos.X + 16, BasePos.Y);
case 4:
case 5:
case 6:
case 7:
case 8:
case 9: return v2(BasePos.X + 32, BasePos.Y);
default: return v2(BasePos.X, BasePos.Y);
}
}
This way I have a monster with a complex animation and 3 pictures.
Each case represent a frame, the frame 0 being the first one. I use default to reduce the number of line code, because the last step occupy 12 frame, and no need to write them all.
I run in some problems during the adding of the dungeon entry point too, but the source of Kepaa help me to add the line I miss in the source code.
http://ivan.greatboard.com/viewtopic.php?t=221
I don't runin the code a lot, or script, to find how I could do this, but I wonder if I could make a monster that appear in ESP but not in Infravision. Something to tell that a monster is cold blooded or that it has a brain ;)
Something I wonder too, is the possibility to choose the monsters that are going to spawn in a dungeon, like by making a list of spawnable monster in the begining of a level, or something like that. But like the ESP and Infravision stuff, I don't try to search correctly for now ;)
Planplan- 09-02-2006
Here a greater problem. I was successful in adding 2 monsters, but now that I'm trying to add a large creature, IVAN keep crashing...
The compile step is OK, but the game crash as soon as I launch it...
nonhuman.h
CHARACTER(testmonster, largecreature)
{ };
Just this code cause this crash (not a Script error, a real crash). If I put nonhuman instead of largecreature the game launch...
At the begining I have some more code, but I comment it to test with the less feature possible, the definition in the H file is the only thing I keep, but keep crashing ;)
Any idea?
holybanana- 09-02-2006
Remember that the number of animation frames, the number returned by GetClassAnimationFrames() should be a power of two, eg. 16, 32, 64 etc. This is because many animations can occur in the same picture and they will not show correctly if one has, say, 50 and another 30 frames. Then the object has 50 animation frames and the 30 frame animation runs once correctly, but is cut every other run. This is not a big problem, though, supposing your code works.
I may start an IVAN programming course at some point, too. I will then treat the question of adding new dungeon entry points to the world map. Good thing you found Kepaa's example.
Add BodyFlags = Base&~IS_WARM; to your alien flesh material definition in material.dat to make him invisible to infravision. This means that the flesh has the same body flags as basic flesh, but there is no warm blood coursing through it. Let him have more than 5 intelligence to make him vulnerable to ESP.
Are you able to add new database members, like a truth value CanAppearInTheAlienShip to the character databases? And what about new data members to level scripts, for instance a truth value IsAlienShip? If so, I can tell you a very easy way to have only the monsters you want to appear in the ship. Otherwise I probably have to make a short lecture how database values and script members are added (very easy, but you have to remember many small trivial steps).
Which kind of script you used for the testmonster type in char.dat? Did you remember to define flesh materials, bitmap positions and all?
Planplan- 09-02-2006
char.dat
testmonster
{
DefaultArmStrength = 25;
DefaultAgility = 15;
DefaultEndurance = 30;
DefaultPerception = 18;
DefaultIntelligence = 20;
DefaultWisdom = 12;
DefaultCharisma = 14;
DefaultMana = 0;
TotalSize = 500;
TotalVolume = 1000000;
IsEnormous = true;
FleshMaterial = ALIEN_FLESH;
BloodMaterial = ALIEN_BLOOD;
ClassStates = INFRA_VISION;
AcidResistance = 1000;
FireResistance = 25;
AttackStyle = USE_HEAD;
BaseBiteStrength = 800;
KnownCWeaponSkills == BITE;
CWeaponSkillHits == 100;
NameSingular = "secret name for now ^^";
ArticleMode = FORCE_THE;
TorsoBitmapPos = 288, 64;
SkinColor = rgb16(82, 90, 98);
AttachedGod = NONE;
HostileReplies == "@Dd spit acid saliva.";
FriendlyReplies == "@Dd ignores you.";
DeathMessage = "@Dd is destroyed in an acidic explosion.";
CanBeGenerated = true;
IsRooted = true;
AllowUnconsciousness = false;
PanicLevel = 0;
IsCharmable = false;
IsNameable = false;
IsUnique = true;
CanOpen = false;
HasALeg = false;
}
I tried this piece of script on another normal monster (not 2*2 monster) and the stats seems to work. Seems like I miss something with the "largecreature" thing... I even tried to replace my own configuration with an existing one, but same crash. I relly don't know where this could come from... I even tried to erase all the entry for this monster and rewrite it, but no success.
I'll search further, maybe I'll find the solution, but if you could point it to me... ;)
Oh, and I tried to turn of the IsUnique too, no success.
Edit : I just erased all the entry "testmonster" in char.dat and the game is able to run... Maybe I made a mistake in it...
holybanana- 09-02-2006
Strange thing, when I use your definitions in the .h file and char.dat, I have no problem. I can even summon the creature and it attacks and works well. What kind of crash message do you get? At which point does it appear, when you start the program, when you start the game, or when you summon the monster?
Planplan- 09-02-2006
When I start IVAN.exe. The window isn't even launched, Windows only launch his error reporting message. Mmh... :/
I'll try with a clean source.
Planplan- 09-02-2006
After many search, I decided to use a clean source and readd all the done code... And now everything work, without changing a line :D
Sometimes hanging myself come to my mind ^^
blob- 09-02-2006
Can you tell us what are the AP used for ?
Also is this used to make you go quicker when panicked or not ?
(!StateIsActivated(PANIC) ? 10000000 : 8000000) * Difficulty / (APBonus(GetAttribute(AGILITY)) * GetMoveEase());
holybanana- 09-03-2006
First of all, if you copypaste the name of the function, too, the answer to your second question is obvious (if you know basic C/C++ syntax) without even knowing what AP is.
long character::GetMoveAPRequirement(int Difficulty) const
{
return (!StateIsActivated(PANIC) ? 10000000 : 8000000) * Difficulty / (APBonus(GetAttribute(AGILITY)) * GetMoveEase());
}
If AP is something that is required to move, the smaller the number this function returns, the faster you move. So you move faster when panicked.
To your first question. AP is short for Action Points. We usually avoid using abbreviations in the code to make it clearer, but AP is a very fundamental notion, like HP, so we have made an exception here. Normally a character gets 100 AP every tick (the basic unit of time, 1.8 seconds of game time), more if hasted, less if slowed, and when he or she gets a certain amount of AP, can do something. How much the action decreases AP depends on the action. For instance, if an action costs 500 AP, you can normally do it every five ticks, 9 seconds of game time. No action which takes time can however be done more than once a tick.
Planplan- 09-03-2006
The function I extracted this line from is easy to understand yes, like most of the function, but before adding things I just want to be sure AP stand for ActionPoint, because I see lot of these in many part of the code, monster AI for exemple ;)
blob- 09-03-2006
we'd like to have some new dungeon creation code to have something not look like caves but more like a manufactured place. Can you tell us what is the easiest way to do that ? ( pretty please )
holybanana- 09-03-2006
Unless you know enough to program your own level generation algorithm, it isn't easy to make a level really looking like alien ship interior. We have only the current very old and rather inflexible dungeon creation code. You could of course try experimenting with it like this
Level 0;
{
FillSquare = METEORIC_STEEL solidterrain(PARQUET), IRON wall(BRICK_FINE);
TunnelSquare = METEORIC_STEEL solidterrain(PARQUET), 0;
Rooms = 50:100;
RoomDefault
{
Pos = 2:XSize-5,2:YSize-5;
Size = 3:4,3:4;
WallSquare = METEORIC_STEEL solidterrain(PARQUET), IRON wall(BRICK_FINE);
FloorSquare = METEORIC_STEEL solidterrain(PARQUET), 0;
DoorSquare = METEORIC_STEEL solidterrain(PARQUET), IRON door;
}
}
If you test this, you'll get an area that looks a bit more constructed than digged from earth. Try changing the parameters and hope for the best.
Alternatively, you could make portions of the level constant, that is same in every game. This way it is easy to have them look man-made. For instance see how the Cathedral of Valpurus is scripted.
Edit: If either one of you is a win user, there's a program I made for drawing rooms that appear the same in every game with a mouse. It's a horribly old DOS exe but it may still work, at least it does for me. I uploaded it at
http://ivan.sourceforge.net/ivanmap/IvanMap.exe
Sorry that there is no Unix version, and there probably won't be a port as I can't even compile the source any more.
Note that I had to go to program properties and set it to start in full screen to make it work under WinXP. Otherwise only half of the screen was shown. Another way is to start command prompt, go to full screen by pressing Alt+Enter and starting the exe there.
Edit II: Probably the best way to use this is to draw a room, then press Alt+Enter to go to window mode and use the window edit options to select and copy a portion of the screen to the script file. For instance this room took twenty seconds to make with this method:
#########+############
#......#.......#.....#
#......#.......#.....#
#......#.......#.....+
#......#.......#.....#
#......#..############
########..#..........#
#......#..#####......#
#......#......#......#
#......#......#......#
#......#####..#......#
#..........#..#......#
#..........#..#......#
######################
Hope it shows correctly in your browser.
Forumer™ is Voted #1 Free Forum Hosting provider
Build your own community today with the largest message board hosting company.