Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Crimson Wizard

#11261
The Rumpus Room / Re: Tales from On the lash
Sun 29/09/2013 17:47:06
Quote from: Atelier on Sun 29/09/2013 15:57:19
Quote from: qptain Nemo on Sun 29/09/2013 03:23:40
Quote from: Anian on Sun 29/09/2013 01:08:09
I'm sorry to hear that, but this would actually be a cool way to start an adventure game.
Can this phrase become our local meme?
Pretty please?

Seconded :-D


:=
Spoiler


[close]
#11262
Quote from: Construed on Fri 27/09/2013 17:56:46
Ok, I cleaned it up about the best I know how and removed the depleted functions from it.
There's still one case of excessive if/else structure, you did replace the first one with "monsterz -= dmg + 1;", but there's another just few lines below:
Code: ags

if (dmg2==0)  health-=0;
else if (dmg2==1) health-=02;
else if (dmg2==2) health-=03;
else if (dmg2==3) health-=04;
else if (dmg2==4) health-=05;

It's a bit different, for it decreases health by 0 if dmg2 is 0 (the previous decreased monster health by 1 if dmg was 0). Not sure if this is what you want, but anyway, this may be simplified:
Code: ags

if (dmg2 > 0)
    health -= dmg2 + 1;


Quote from: Construed on Fri 27/09/2013 17:56:46
Unfortunately I cant use your code because when the fight scene starts the character view changes into a 1x1 transparent dot and the character takes control of an object with the "fight view" then when he leaves the character regains it's view.

Well, since the function needs only ViewFrame, not exactly character, you may easily convert the code from using character to using object. Or, one of alternatives (either character or object):
Code: ags

function DisplayDamageOverThing(Character *ch, Object *obj, int damage)
{
    if (ch == null && obj == null) {
        Display("DisplayDamageOverThing: function called with only null pointers!");
        return;
    }
    ViewFrame *vf;
    // Get current view frame from either character or object
    if (ch != null)
        vf = Game.GetViewFrame(ch.View, ch.Loop, ch.Frame);
    else
        vf = Game.GetViewFrame(obj.View, obj.Loop, obj.Frame);
    // Get size of frame's graphic
    int sprite_width = Game.SpriteWidth[vf.Graphic];
    int sprite_height = Game.SpriteHeight[vf.Graphic];

    int over_x;
    int over_y;
    if (ch != null) {
        over_x = ch.x;
        over_y = ch.y;
    } else {
        over_x = obj.X;
        over_y = obj.Y;
    }
    Overlay *o = Overlay.CreateTextual(over_x, over_y - sprite_height - 10, 120, Game.SpeechFont, 15, "Damage = %d", damage);
    Wait(40 * 3); // wait about 3 seconds
    o.Remove();
}

Then:
Code: ags

// Display damage for character:
DisplayDamageOverThing(cSomeCharacter, null, damage);
// Display damage for object:
DisplayDamageOverThing(null, oCombatObject, damage);



Quote from: Construed on Fri 27/09/2013 17:56:46
also I would like to figure out how to make the damage more random and perhaps incorporate other statistics into the equation such as dexterity. I was thinking somehow I could add a counter to the up arrow key press or some kind of decimal based int that would cause the dex,weapon use,dodge to go up separately from the actual level and make it to where those statistics actually effect the battle.
Hmm, well, while I think I understand what you are saying in general, I believe you should have an accurate plan written somewhere (explaining what behavior do you want, which formulas to use, etc); it is pretty difficult to give any code-related advice when you don't know what you want in detail.
#11263
Quote from: selmiak on Sat 28/09/2013 18:13:43
will this be fixed in ags3.3? I ran into the same problem and would appreciate this fix :)
Yes (already fixed in repository).
#11264
Quote from: Knox on Fri 27/09/2013 12:02:19
Quote from: Calin Leafshade on Thu 26/09/2013 05:28:57
I just looked at the commit and i have to say *FINALLY*.

Excellent work CW.

...you implemented Calin's AGSBlend plugin? :shocked:

No, (not yet). Just proper default alpha blending for now.
#11265
Err, okay, slightly more polished code: ;)
Spoiler

Code: ags

function room_AfterFadeIn()
{
    //aBattle.Play();
    monsterui.Visible=true;  //displays monster and player life
    player.PlaceOnWalkableArea();
    //goblin.FollowCharacter(null);
    //goblin.ChangeRoom(302);
    object[1].SetView(56);
    object[1].Animate(0, 3, eOnce, eBlock);
}

function room_RepExec()
{
    //trying to ensure that required_xp shows up on stat screen as the characters TNL.
    expierance3 = Required_XP;
    if (health <= 15){
        Display("You look tired, You should rest!");
    }
  
    //changes the monsters health back to zero if it goes in the negatives.
    if (monhealth <= 0){
        monhealth=0;
    }

    //causes object0 which is representative of the character to animate doing a stab motion.  
    if (IsKeyPressed(eKeyUpArrow) == 1){
        object[0].Animate(0, 3, eOnce, eBlock);
        object[0].Animate(1, 3, eOnce, eBlock);

        //causes a mixture of random damage + strength for harder hits as str increases.
        int dmg = Random(6) + Random(strength);
        monsterz -= dmg + 1;
        object[1].SetView(56);
        object[1].Animate(0, 25, eOnce, eBlock);
        int dmg2 = Random(6);
        health -= dmg2 + 1;
    } else if (monsterz<=0) {
        player.PlaceOnWalkableArea();
        expierance += 10;  //int stores in a txt label to show total amount of xp
        Vexpierance += 10; //the same value shown in another gui
        Display ("You put up quite a fight! I'm worn out!" );
        Display ("You have gained %d expierance.",expierance );

        int p = player.PreviousRoom;
        player.ChangeRoom(p, 158, 148);

        //causes the player to level up
        if(Vexpierance >= Required_XP){ 
            level++;
            //increases the maximum amounts of the glob vars.
            player_maxhealth += 1;
            player_maxmana += 1;
            player_maxstamina += 1;
            strength += 1; 
            Display ("You have reached level %d And now have, %d strength, %d health, %d mana, %d stamina",level, strength, player_maxhealth, player_maxmana,player_maxstamina, goldshow );
            Required_XP = Required_XP * Increase_Factor; //increases the required xp per level
  
            //Required_XP = (Required_XP * 3) / 2;   // factor 1.5
            int win=Random(2);

            //depleted code, no gold is won from this battle.
            if (monsterz <= 0){
                if (win==0) goldshow += 0;
                else if (win==1) goldshow += 0;
                else goldshow += 0;
            }
        }
    }
}
  
function room_Load()
{
    aFight1.Play();
    //goblin.ChangeRoom(302);

    //fighter attack view
    if ((player.View==93)||(player.View==42)||(player.View==2)){
        player.ChangeView(85);
        object[0].SetView(82);
    }
    //thief attack view
    else if ((player.View==59)||(player.View==92)||(player.View==28)){
        player.ChangeView(87);
        object[0].SetView(84);
    }  
    //wizard attack view
    else if ((player.View==91)||(player.View==58)||(player.View==4)){
        player.ChangeView(86);
        object[0].SetView(83);
    }
}

function room_Leave()
{
    //fighter normal view
    if (player.View==85){
        player.ChangeView(2);
        CafeDo(String.Format("speed is %d %d", 3, 3));
        player.SetWalkSpeed(3, 3);
    }
    //wizard normal view 
    else if (player.View==86) {
        player.ChangeView(4);
        CafeDo(String.Format("speed is %d %d", 3, 3));
        player.SetWalkSpeed(3, 3);
    }
    //thief normal view
    else if (player.View==87) {
        player.ChangeView(28);
        CafeDo(String.Format("speed is %d %d", 3, 3));
        player.SetWalkSpeed(3, 3);
    }

    //removes the monster/player life from the screen.
    monsterui.Visible=false; 
    aFight1.Stop();  
}

[close]
#11266
Well, you say:
Quote
Everything is working, except the XP TNL keeps giving odd and random numbers
Can you explain, how is it supposed to work, that is, for example, which numbers it should display, and which it displays in real, and why it is wrong?
I see some lines in the code which refer to "experience" and "required experience", but I can't tell is that right or not.

Quote
and I'd like to figure out how to make the damage dealt appear above the heads of both the player and the monster for a few brief seconds.
I would suggest using Textual Overlays, which is a very simple way to display a text at some point on screen for designated time.

You could use a helper function like this:
Code: ags

function DisplayDamageOverCharacter(Character *ch, int damage)
{
    // Get current character's view frame
    ViewFrame *vf = Game.GetViewFrame(ch.View, ch.Loop, ch.Frame);
    // Get size of frame's graphic
    int sprite_width = Game.SpriteWidth[vf.Graphic];
    int sprite_height = Game.SpriteHeight[vf.Graphic];
    // Create overlay aligned somewhere around character's top
    Overlay* o = Overlay.CreateTextual(ch.x + sprite_width / 2, ch.y - sprite_height - 10, 120, Game.SpeechFont, 15, "Damage = %d", damage);
    Wait(40 * 3); // wait about 3 seconds
    o.Remove();
}

You then call it like:
Code: ags

DisplayDamageOverCharacter(player, dmg);

or
Code: ags

DisplayDamageOverCharacter(cMonster, dmg);


EDIT: geork was faster, but I'll leave this.
Regarding your code in general. There's this sequence that should be changed into simplier formula:
Code: ags

if (dmg==0) monsterz-=1;
else if (dmg==1) monsterz-=2;
else if (dmg==2) monsterz-=3;
else if (dmg==3) monsterz-=4;
else if (dmg==4) monsterz-=5;
else if (dmg==5) monsterz-=6;

This should be replaced by:
Code: ags

monsterz -= dmg + 1;

This is a must do; otherwise your code will sprawl into monstruosity.
#11267
Quote
Any suggestions to make the code better would be greatly appreciated!

First thing you do with the old and ugly code like this: proper indentation + remove extra spaces and shit unneeded garbage. Spend few minutes on this and it will look much more comprehensible (for you and others). Maybe you'll even notice some mistakes along the way (this really happens!)

Also, not sure I understand, what is "XP TNL"?
#11268
Ok, I guess since I am fixing how "saved volume" works during cutscene, I think I can return saved volume on getting Volume property instead. This should solve this issue for good.
#11269
Ok, I think I fixed this one.


But, - while we are at it, - the cutscenes might produce more audio related issues.

For example, if you start a clip inside a cutscene, and player is skipping cutscene, then the clip starts silent, but saves the "correct" volume to be restored after cutscene.
Thing is that if you use AudioChannel.Volume property, the return value will be different, depending on whether cutscene is being skipped or not.
Now, imagine you want to set volume to the multiple of default:

Code: ags

AudioChannel *c = aMusic1.Play();
c.Volume = c.Volume / 2;


If cutscene is playing normally, you get a music playing at half volume. But if cutscene is being skipped, you get c.Volume = 0 / 2 = 0, and the music is not played even when cutscene is over...

Question is, should this be considered a bug, or a cutscene specific behavior, that game developer must take into consideration?
#11270
2.
Mistakes? :)

Err, Stupot seem to got it.
#11271
Actually, I find it very strange that I don't remember anyone complaining about portrait animation ending too soon.
Perhaps that is because usually voice is faster than text reading timer?
I searched forums, and found only few mentioning of this var, most of them were feature announcements by CJ (in the new version threads).

Thing is that this variable ought to be adjusted if the voice is on, otherwise there will always be a chance that such problem arises.

EDIT:
It looks like the Lucas-arts style speech explicitly ignores close_mouth_end_speech_time in case voice is playing. Should add same fix for Sierra speech, since, as Snarky pointed out, this setting has no sense using with voice anyway.
#11272
I confirm, still present in 3.3.0 beta.
Thanks for bumping this, Billbis, I wasn't aware of this.


EDIT:
What I experience, and what I see from the code too, is that if any clip's volume will be by any means exactly 0 at the time of  EndCutscene() call, then its volume will be reset to what it was when the clip started playing.
If it started playing with volume 0, it will stay so. If it started with volume 50, it will return to 50.

To clarify:
Code: ags

Game.SetAudioTypeVolume(eAudioTypeMusic, 0, eVolExistingAndFuture);
AudioChannel *c = aMusic1.Play();
Display("%d", c.Volume); // will display '0'
StartCutscene(eSkipESCOnly);
Display("%d", c.Volume); // will display '0'
EndCutscene();
Display("%d", c.Volume); // will display '0'

All is correct.

But
Code: ags

AudioChannel *c = aMusic1.Play();
Display("%d", c.Volume); // will display '100'
Game.SetAudioTypeVolume(eAudioTypeMusic, 0, eVolExistingAndFuture);
Display("%d", c.Volume); // will display '0'
StartCutscene(eSkipESCOnly);
Display("%d", c.Volume); // will display '0'
EndCutscene();
Display("%d", c.Volume); // will display '100' !!

Error!



Also
Code: ags

AudioChannel *c = aMusic1.Play();
Display("%d", c.Volume); // will display '100'
StartCutscene(eSkipESCOnly);
c.Volume = 0;
Display("%d", c.Volume); // will display '0'
c.Volume = 50;
Display("%d", c.Volume); // will display '50'
EndCutscene();
Display("%d", c.Volume); // will display '50'

All is correct.

But
Code: ags

AudioChannel *c = aMusic1.Play();
Display("%d", c.Volume); // will display '100'
StartCutscene(eSkipESCOnly);
c.Volume = 50;
Display("%d", c.Volume); // will display '50'
c.Volume = 0;
Display("%d", c.Volume); // will display '0'
EndCutscene();
Display("%d", c.Volume); // will display '100' !!

Error!
#11273
Quote from: Snarky on Thu 26/09/2013 17:32:15
And I'm saying if you can set D, you don't really need C, because C doesn't work when you have voice, and when you don't have voice the only thing that matters is C+D. So you can just get rid of C and always use D.
Hmm... this makes sense. I need to think about this.


EDIT: uhhh, it just that we cannot fully get rid of C, because, well, backwards compatibility.

EDIT2: By the way, I somehow forgot to mention: Radiant, you should set game.close_mouth_end_speech_time = 0, - this will fix the first of your speech problems (speech animation ending prematurely). Because it is 10 (game ticks) by default. And, that is 10 ticks not from the voice file end, but from text timer end, which is different (may be shorter). Yeah, it is pretty messed up there.
#11274
Okay, let me show this in graphical way :).


Hypothetically, there are three processes, run in parallel:


Periods:
A - Portrait & text displayed on screen, but speech is not "played" (main timer not set and no voice).
B - Speech started playing, but special speech animation not started yet.
C - Animation stopped, but speech still playing (voice still plays at this point!)
D - Speech stopped playing, but both portrait & text are still shown.

At this moment, AGS only supports setting period C. This is done using aforementioned game.close_mouth_end_speech_time.

Radiant is asking to add something to set period D (I am working on this).
#11275
Quote from: Radiant on Thu 26/09/2013 13:51:30
Could you please elaborate: suppose that for a line, the automatic text removal is after 3000 milliseconds, and I set this variable to 500 milliseconds. Would the speech portrait then be shown for 3500 ms (3000 ms speaking, 500 ms closed mouth), or for 3000 ms (2500 ms speaking, 500 ms closed mouth)?
This option does not change automatic speech removal time. It only sets a time point at which the speech animation ends (T-minus). So, in your example:
The text & portrait will be displayed 3000 ms, but animation will play only 2500 ms.

Quote from: Radiant on Thu 26/09/2013 13:51:30
Also, the documentation says that this doesn't work in voice mode; I think it would be useful in voice mode as well to allow for a gap between individual lines.
Thing is that at the moment this all is totally irrelevant to voice mode, because there's no precalculated removal timer in voice mode (sort of a problem actually), so it is not known beforehand when the speech will end.
But even if the timer will take voice sound length as a reference, setting this parameter will make speech animation stop before voice finishes.

Perhaps this may have sense for some peculiar effects, but first the whole thing needs to be altered to allow timer use voice length as a reference.
#11276
People with good english, anyone?
I am remaking one old parameter into OO-style property, and cannot invent a proper name. :)

Original name is a bit misleading: game.close_mouth_end_speech_time.
What it does: it stops speech animation N game ticks before the speech is supposed to end (i.e. automatic text removal).
So right now I am trying to figure out how to say that in short. Something like "StopAnimationBy(sp?)Time". Or maybe "AnimationEndMargin"...
Any ideas?
#11277
Quote from: Atelier on Thu 26/09/2013 03:11:07
What is the meaning of life? Serious asnwers only please.

Suffering through yours and helping others enjoy the same.
#11278
Alright, I pushed an update to repository, keeping fingers crossed. :tongue:
#11279
Software sensivity is very simple to make. I have considered to do this since I started making custom display resolutions, because they caused even more troubles with mouse moving at different speeds vertically and horizontally.
#11280
There might be a way to define a "filter family" instead of disabling separate filters (besides, the list of supported filters may change in the future) - this is something that could be added later.

I just want to point out, just in case, that "advanced" users may easily re-enable the filters by editing config file.
SMF spam blocked by CleanTalk