• New Horizons on Maelstrom
    Maelstrom New Horizons


    Visit our website www.piratehorizons.com to quickly find download links for the newest versions of our New Horizons mods Beyond New Horizons and Maelstrom New Horizons!

Devlin Opera for the 65742th time

Ah, now I see it! Take a close look at the win_conditions in case "Puerta_returns"...
 
No day without some questions...

1) I'm having trouble setting my PChar to PoorType. There's one case very much based on the standard storyline where PChar sits down with Valentin Massoni where I want PoorType, but the Player is set to actor at this point. And unlike LAi_ActorSetSitMode(pchar); something like LAi_ActorSetPoorMode(pchar); doesn't seem to exist. At a later case, a common LAi_SetPoorType(Pchar); doesn't work either.

2) I have this quest case here

Code:
        case "rugbeater":
            LAi_SetPlayerType(pchar)
            GiveItem2Character("Isabel Marino", "blade37");
            EquipCharacterByItem("Isabel Marino", "blade37");
            LAi_SetImmortal(characterFromID("Ernesto Haraldo"), true);
            LAi_SetImmortal(characterFromID("Isabel Marino"), true);
            LAi_ActorAttack(CharacterFromID("Isabel Marino"), PChar, "");

            pchar.quest.Windowjump.win_condition.l1 = "locator";
            pchar.quest.Windowjump.win_condition.l1.location = "Haraldo_Bedroom";
            pchar.quest.Windowjump.win_condition.l1.locator_group = "goto";
            pchar.quest.Windowjump.win_condition.l1.locator = "goto6";
            pchar.quest.Windowjump.win_condition = "Windowjump";
        break;

and for some reason, Isabel Marino doesn't attack, she just follows me around.
 
1) LAi_SetPoorType(Pchar); has always worked for me. Something else going on (dialog for ex) setting Pchar to actor?

2) Maybe Isabel is not set to actortype before she's ordered to attack?
Or maybe the location doesn't allow fights? Try draw your own blade.
 
1) LAi_SetPoorType(Pchar); has always worked for me. Something else going on (dialog for ex) setting Pchar to actor?

2) Maybe Isabel is not set to actortype before she's ordered to attack?
Or maybe the location doesn't allow fights? Try draw your own blade.
1) LAi_SetPoorType(Pchar); doesn't even work when I put it in the console... It should work when PChar is player type, right?

2) I have LAi_LocationFightDisable(&Locations[n], false); in the location and can draw my blade. And she is ActorType, also she follows me around. I am PlayerType in that moment.
 
Found this:
Code:
 case "rugbeater":
            LAi_SetPlayerType(pchar)
A semikolon is missing here.


I really don't know what's going on but just to be sure, try:

1) LAi_SetPlayerType(Pchar);
LAi_SetPoorType(Pchar);

2) LAi_SetActorType(CharacterFromID("Isabel Marino"));
LAi_ActorAttack(CharacterFromID("Isabel Marino"), PChar, "");
 
I'm an idiot jack, I forgot the Beatrice models just don't have poor animations, I shouldn't have known that.

But it's strange because the blaze model does:

blazepoor.png

As for the ActorAttack, it hasn't worked until now...

Code:
        case "caught4":
            LAi_SetActorType(characterFromID("Isabel Marino"));
            Characters[GetCharacterIndex("Isabel Marino")].dialog.currentnode = "flagranti";
            LAi_ActorDialog(characterFromID("Isabel Marino"), Pchar, "", 0.5, 0);
        break;

        case "rugbeater":
            LAi_SetPlayerType(pchar);
            GiveItem2Character("Isabel Marino", "blade37");
            EquipCharacterByItem("Isabel Marino", "blade37");
            LAi_SetImmortal(characterFromID("Ernesto Haraldo"), true);
            LAi_SetImmortal(characterFromID("Isabel Marino"), true);
            LAi_SetActorType(characterFromID("Isabel Marino"));
                        LAi_ActorAttack(CharacterFromID("Isabel Marino"), PChar, "");

            pchar.quest.Windowjump.win_condition.l1 = "locator";
            pchar.quest.Windowjump.win_condition.l1.location = "Haraldo_Bedroom";
            pchar.quest.Windowjump.win_condition.l1.locator_group = "goto";
            pchar.quest.Windowjump.win_condition.l1.locator = "goto6";
            pchar.quest.Windowjump.win_condition = "Windowjump";
        break;

Now she's set to ActorType even twice, änd fighting should be enabled with LAi_LocationFightDisable(&Locations[n], false);
 
Not important, I found another solution.

Actually I'm at my next question (hey, it proves I'm getting somehwhere! ;))

What would be a good way to trigger a quest case based on a character (NPC) getting stunned? It's a fistfight and I wanted to do it manually with LAi_SetCheckMinHP but then I found out there's an automatic stunned function that makes an opponent groggy, so this seems to be the better option because the characters HP are pretty random every time I'm testing it.

The only similar situation I remember is the beginning of Ardent with the prison warden. Would if (!CheckAttribute(CharacterfromID("Warden"), "stuntime")) be correct? With the right character ID of course.
 
Yes, that is how I checked if the warden was stunned. There does not seem to be a function to see if a character is stunned so checking attribute "stuntime" is the only way to do it.

But to trigger a quest case, you probably do still need 'LAi_SetCheckMinHP'. Checking the attribute can be useful once a quest case has been triggered but can not, as far as I know, be used as a trigger.
 
What's the difference between "see if a character is stunned" and "checking attribute "stuntime""?

I think to do it all manually with LAi_SetCheckMinHP I'd need the NPC to have a predefined amount of HP, can I do that? Because his HP seem random with every new test and it would be bad if e.g. I trigger the quest case when his health is at 100, but then he gets already stunned at health 120.

As for the PChar, I definitely can just use LAi_SetCheckMinHP as he doesn't get stunned, the opponent just beats me until I die.
 
"See if a character is stunned" is what you want to do. "Checking attribute 'stuntime'" is how you do it. ;) To check if a character is dead, you would use function 'LAi_IsDead' but there is no such function for a stunned character.

Here is how I triggered quest case "guadeloupe_prison_guard_out_cold" in "Ardent":
Code:
LAi_SetCheckMinHP(characterFromID("Fr_Prison_guard4"), LAi_GetCharacterHP(characterFromID("Fr_Prison_guard4"))-2.0, false, "guadeloupe_prison_guard_out_cold");
It does not check if he is stunned, only that he has lost 2 HP. Then quest case
"guadeloupe_prison_guard_out_cold" stuns the guard:
Code:
LAi_SetStunnedTypeNoGroup(characterFromID("Fr_Prison_guard4"));
 
Okay and how can I reset / end the "battle mode" (red blinking, battle music, peope cowering in fear)?

I found this here

Code:
            LAi_SetFightMode(PChar, false);

but it doesn't seem to be the correct one.
 
That command is nothing to do with battle mode. It simply makes you sheath your weapon.

The red blinking icon and battle music are signs of a group battle and should not happen as a result of 'LAi_ActorAttack'. My guess is that Isabel Marino is in the same AI group as everyone else, so when you hit her, everyone else regards it as an attack on the group. As they have no weapons, they cower.

Put this at the start of case "rugbeater":
Code:
LAi_group_MoveCharacter(CharacterFromID("Isabel Marino"), LAI_GROUP_MONSTERS);
She needs to be in a different AI group from everyone else and LAI_GROUP_MONSTERS is a safe group for you to attack.
 
Thanks @Grey Roger but I've moved on from Isabel Marino as this wasn't that important. Here's my updated quest_reaction.

Of importance are the quest cases "First_fight" to "Audience_attacks". The red blinking and battle music start with LAi_ActorAttack(CharacterFromID("Dirty Cesar"), PChar, ""); in "First_fight2", so that's weird. And this battle phase doesn't end through all the quest cases.

A problem is that I have Lai_SetCheckMinHP in the cases "First_fight2" and "Second_fight2", but this still applies in the later group fight of "Audience_attacks". So I get the earlier quest cases "blaze_lost_first/second_fight" when my health is reduced in the group fight of "Audience_attacks". That's the main problem. I thought maybe this is because it all happens in one uninterrupted battle phase of red blinking? Perhaps it would help to form the group Furious_Audience in an earlier quest case?

A second problem is what I already suspected: Even when I give Dirty Cesar and Chico Malo a predefined amount of HP, the amount of HP when they get stunned is random. So they sometimes sit down (stunned) before I've reduced them to the amount of HP I've tied to my quest cases. Perhaps instead of

Code:
Lai_SetCheckMinHP(CharacterFromID("Dirty Cesar"), 110.0, true, "Blaze_won_first_fight");

I could try

Code:
if (!CheckAttribute(CharacterfromID("Dirty Cesar"), "stuntime"))
            {
                LAi_QuestDelay("Blaze_won_first_fight", 0.1);
            }

would that make sense?
 

Attachments

  • quests_reaction.zip
    7.1 KB · Views: 84
Of importance are the quest cases "First_fight" to "Audience_attacks". The red blinking and battle music start with LAi_ActorAttack(CharacterFromID("Dirty Cesar"), PChar, ""); in "First_fight2", so that's weird. And this battle phase doesn't end through all the quest cases.
Possibly the same problem - Dirty Cesar is in the same AI group as other characters so they want to get involved in the fight. Put Dirty Cesar into a different AI group the same way I suggested for Isabel Marino.

A problem is that I have Lai_SetCheckMinHP in the cases "First_fight2" and "Second_fight2", but this still applies in the later group fight of "Audience_attacks". So I get the earlier quest cases "blaze_lost_first/second_fight" when my health is reduced in the group fight of "Audience_attacks". That's the main problem. I thought maybe this is because it all happens in one uninterrupted battle phase of red blinking? Perhaps it would help to form the group Furious_Audience in an earlier quest case?
You will need to cancel the Min HP checks. In case "Blaze_lost_first_fight", put this:
Code:
LAi_RemoveCheckMinHP(CharacterFromID("Dirty Cesar"));
And in case "Blaze_won_first_fight", put this:
Code:
LAi_RemoveCheckMinHP(PChar);

A second problem is what I already suspected: Even when I give Dirty Cesar and Chico Malo a predefined amount of HP, the amount of HP when they get stunned is random. So they sometimes sit down (stunned) before I've reduced them to the amount of HP I've tied to my quest cases. Perhaps instead of

Code:
Lai_SetCheckMinHP(CharacterFromID("Dirty Cesar"), 110.0, true, "Blaze_won_first_fight");

I could try

Code:
if (!CheckAttribute(CharacterfromID("Dirty Cesar"), "stuntime"))
            {
                LAi_QuestDelay("Blaze_won_first_fight", 0.1);
            }

would that make sense?
I don't think that will work because 'CheckAttribute' is not running continuously. Near the start of "Ardent", I have a sequence of quest cases triggered by delays and movements:
  • "Still_stuck" makes the warden move to your cell, where his arrival triggers "feeding_time".
  • "feeding_time" uses 'CheckAttribute(characterfromID("Warden"), "stuntime")' to see if he's stunned; if not, he talks to you, then a 10 second delay triggers "Warden_leaves". So you have 10 seconds at this point to hit him with the sandbag.
  • "Warden_leaves" also uses 'CheckAttribute(characterfromID("Warden"), "stuntime")' to see if he's stunned. If he is, this case does nothing, breaking the cycle. Otherwise he moves to the other end of the jail, where his arrival triggers "next_day".
  • "next_day" waits a day, checks if you've run out of time, and if not, triggers "Still_stuck" again with a 5 second delay.
You might be able to set up a similar sequence to check if Dirty Cesar has been stunned. Alternatively, faced with the same problem in which the player is supposed to use fists to stun a guard a lot later, at case "guadeloupe_prison_knockout_guard", I used the code which I showed in post #115 - check if he has lost 2HP, then stun him.

You don't need to give characters a predefined amount of HP. Function 'LAi_GetCharacterHP(characterFromID("Dirty Cesar"))' tells you how many HP he has. So:
Code:
LAi_SetCheckMinHP(characterFromID("Dirty Cesar"), LAi_GetCharacterHP(characterFromID("Dirty Cesar"))-2.0, false, "Blaze_won_first_fight");
... will trigger "Blaze_won_first_fight" when he loses just 2 of whatever HP he has at the start of the fight. Then, in case "Blaze_won_first_fight":
Code:
LAi_SetStunnedTypeNoGroup(characterFromID("Dirty Cesar"));
... will stun him and make him sit down.

By the way, in 'Lai_SetCheckMinHP(CharacterFromID("Dirty Cesar"), 110.0, true, "Blaze_won_first_fight")', the "true" will set Dirty Cesar to be immortal. Presumably it does this after the fight otherwise you'll never wear down his HP! If you don't want him to become immortal, change it to "false".
 
hey, it proves I'm getting somehwhere! ;)
Yes.
Yes, it does! :cheers

Checking the attribute can be useful once a quest case has been triggered but can not, as far as I know, be used as a trigger.
Not yet, perhaps; but it is possible to add new quest triggers.
PROGRAM\QUESTS\quests_check.c in 'switch(sConditionName)' of the 'ProcessCondition' function.
Maybe it's as easy as adding a new case like this one:
Code:
    case "stunned":
       return CheckAttribute(refCharacter, "stuntime");
   break;
 
Back
Top