• 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!

Fixed Remove Rapists

"Not good" is when your officers attack the trees, which I've seen happen occasionally. A stronger term is probably needed for when your officers attack you, which I've only seen once, and that was the aforementioned "Assassin" incident.

Meanwhile, back to the "Defector" encounter:
I've still to sort out rewards for successfully helping, but I now have code for when you choose not to help. The defector runs for an exit and the pursuers try to attack. The AI is a bit broken; when they go into attack mode, they pause a moment, giving the defector a head start. What's puzzling me now is that if a pursuer does manage to get a sword strike in before the defector is out of range, it does 0 damage. This is consistent. I know the defector isn't immortal, partly because I can't find any code which makes him immortal, partly because I added a line to cancel immortality, and partly because I did an experiment in which I commented out the line to make him run. He just stood there, the pursuers were able to repeatedly hit him with swords and do no damage, but if I hit him then he did take damage. Pursuers are able to do damage; another experiment was to have one of them attack me instead of the pursuer, and he certainly damaged me.

But the basic mechanism works. The defector runs for an exit, the pursuers pursue, and when the defector disappears through the exit, the pursuers run for the same exit. Stupid AI: when they go from "LAi_ActorAttack" mode to "LAi_ActorRunToLocation", they stop for a moment while they put away their weapons, then start running again. If you take a shot at one of them and do enough damage to trigger the "LAi_SetCheckMinHP", they all turn round and attack you instead. The defector continues running but if you manage to finish off all three pursuers before he gets to the exit, he turns round and comes to thank you (killing all the pursuers triggers the same "LandEnc_Defector_KillAllPursuers" case that is triggered if you initially chose to help and then killed them, but only if the defector has not yet disappeared).
 
Any idea why the pursuers can't harm the defector? Here are "LandEnc_init.c" and "quests_common.c" as I have them at the moment. (The switch to disable the rapist encounter is still there, but I may remove it again now that the encounter is definitely the "kill rapists" encounter.)
 

Attachments

  • quests_common.c
    239.6 KB · Views: 205
  • LandEnc_init.c
    29.6 KB · Views: 194
Any idea why the pursuers can't harm the defector? Here are "LandEnc_init.c" and "quests_common.c" as I have them at the moment. (The switch to disable the rapist encounter is still there, but I may remove it again now that the encounter is definitely the "kill rapists" encounter.)
Could one of these lines result in a "godmode"?
Code:
 LandEncounters[n].char1.friend = true;
 LandEncounters[n].char1.pistol = false;
 LandEncounters[n].char1.sword = false;
 LandEncounters[n].char1.iscombat = -1; // could be false. NK 05-07-27
 LandEncounters[n].char1.type = "actor";

What if you execute this line on the character ID of the defector?
Code:
LAi_SetImmortal(CharacterFromID("Enc_Char1"), false);
 
You mean like this? ;)
Code:
       case "LandEnc_Defector_NoFight":
           Characters[GetCharacterIndex("Enc_Char2")].exit_locator = LocatorExitSence(PChar.location, "from", "reload");
           LAi_SetActorType(CharacterFromID("Enc_Char1"));
           LAi_SetImmortal(CharacterFromID("Enc_Char1"), false);         // <--- Trying to make sure the defector isn't immortal
           DeleteAttribute(CharacterFromID("Enc_Char1"),"iscombat");  // <--- If that "iscombat" attribute is the problem, it shouldn't be a problem any more
           LAi_ActorRunToLocation(CharacterFromID("Enc_Char1"), "reload", Characters[GetCharacterIndex("Enc_Char2")].exit_locator, "none", "", "", "LandEnc_Defector_Escaped", -1);
"Enc_Char1" is the defector. "Enc_Char2" is one of the pursuers. The reason I'm storing the exit locator as someone's attribute is to make sure everyone goes to the same exit (don't want the pursuers running down the wrong path xD) and the reason it's assigned to "Enc_Char2" is to make sure it's still there after "Enc_Char1" has disappeared (don't want the pursuers to get confused because the defector has escaped and they can't remember where he ran :D).

Besides, as I said, "Enc_Char1" can't be immortal because if I comment out the 'LAi_ActorRunToLocation' line so that the defector stands there, I can kill him myself. The pursuers can kill me. But the pursuers can't harm the defector.
 
Besides, as I said, "Enc_Char1" can't be immortal because if I comment out the 'LAi_ActorRunToLocation' line so that the defector stands there, I can kill him myself. The pursuers can kill me. But the pursuers can't harm the defector.
Sorry, I missed that.

Are they in the same AI group? It could be the code that also prevents you from harming your officers.
 
Are they in the same AI group? It could be the code that also prevents you from harming your officers.
Yes, that was it. :cheers

Dialogs need to be preceded by 'LAi_SetActorType', which puts the character into "LAI_GROUP_ACTOR". (There's also 'LAi_SetActorTypeNoGroup' which doesn't do that. I used it before setting the pursuers to attack the defector with 'LAi_ActorAttack', but that would not help if they were already all in "LAI_GROUP_ACTOR" after previous dialogs.)

Case "LandEnc_Defector_PursuersFight" puts all the pursuers into "ENC_DEFECTORS_GROUP". (It's a straight copy of "LandEnc_RapersFight", which puts the bad guys into "ENC_RAPERS_GROUP".) I copied those statements into case "LandEnc_Defector_NoFight", which is what happens if you decline to help, and now they do inflict damage on the defector. At least, they do if they manage to get an attack before he runs away. Depending on exactly how everyone is positioned and where the exit is located, they might either not get an attack at all, be able to kill him, or somewhere in between.

So now it's just a matter of sorting out rewards if you do choose to help, and that's what I'll be doing over the weekend...
 
This may be a problem deep in the code. In TEHO I once had my faithful native companion turn and kill a Damsel I'd just rescued. It may have to do with not exiting fight mode when all the bad guys are dead which I've seen several times.

Hook
 
I found this while investigating something else:
Code:
Lai_group_MoveCharacter(NPChar, LAI_DEFAULT_GROUP);//MAXIMUS: if not - fighters will kill an NPC first
So I tried adding a similar line to case "LandEnc_RapersFight". Several re-runs of a test savegame later, the officer hadn't attacked the woman. A similar number of tests before adding that line had resulted in the officer attacking her several times. So, it's not conclusive, but it is hopeful...

Meanwhile, back to the defecting criminal scenario, which I've finished. If you choose not to help the defector, he runs off towards an exit. The pursuers try to attack him. Depending on the exact layout of the location and where everyone is standing, one of them might get one hit in, then he keeps running and they chase after him. If you change your mind and attack one of the pursuers, they all go for you, while the defector keeps running. If you manage to finish off all three pursuers before the defector has escaped, he returns to thank you. Or, if you don't change your mind, eventually all of them disappear through the exit.

On the other hand, if you do choose to help (or change your mind and kill all three pursuers before the defector disappears), the defector gives you a random choice of one out of three, possibly four rewards:
  • Tell everyone how wonderful you are - reputation gain, exactly the same as from the original rapist-killing scenario;
  • Tools of the 'trade', which he doesn't need any more on account of going straight - lockpick, thief's knife, and random amounts of ether bottles and poisoned throwing knives;
  • A gem which he kept as a memento of his first raid and which he doesn't want any more because he's leaving that life behind;
  • Offer to join you as an officer.
The reputation gain doesn't happen if you're already "Hero". The offer to join you only happens if you're at least "Dashing". So anyone less than "Dashing" gets one of the first three, "Dashing" can get any of the four, "Hero" gets one of the last three.

If the defector does join you as an officer, he has no weapons. But you've just killed three bad guys so you should have something you can give him.

By the way, the code to make the defector into an officer was copied straight from the "enlist_me" part of "Enc_Walker.c". That, plus part of "Enc_Officer_dialog.c", make up the hiring process. But "Enc_Officer_dialog" makes the new recruit say this before running off to a nearby exit: "I am ready to follow you in a moment, I must only fetch my dunnage first. I'll meet you behind the next gate." That doesn't work too well if you're in the middle of a jungle and there is no "next gate". So I modified "Enc_Officer_dialog" to check if you're in a jungle location (defined as any location whose ID includes the words "jungle" or "exit"), and if so, the recruit will now say "I just need to collect my dunnage. Go on ahead, I'll catch up with you as soon as possible." This is probably something that needed to be done anyway because you can also meet random citizens out in the jungle and one of those might offer to join you as well, via "Enc_Walker.c". Fixing "Enc_Officer_dialog" takes care of them as well.

One final thing needs to be determined. With the rapist scenario now improved, do we still want the toggle to disable it?
 
Tools of the 'trade', which he doesn't need any more on account of going straight - lockpick, thief's knife, and random amounts of ether bottles and poisoned throwing knives;
I especially like that one! Clever. :onya

One final thing needs to be determined. With the rapist scenario now improved, do we still want the toggle to disable it?
Sounds like a good decision for @DeathDaisy to make. :doff
 
So I tried adding a similar line to case "LandEnc_RapersFight". Several re-runs of a test savegame later, the officer hadn't attacked the woman. A similar number of tests before adding that line had resulted in the officer attacking her several times. So, it's not conclusive, but it is hopeful...
sweet, well done!

Meanwhile, back to the defecting criminal scenario, which I've finished. If you choose not to help the defector, he runs off towards an exit. The pursuers try to attack him. Depending on the exact layout of the location and where everyone is standing, one of them might get one hit in, then he keeps running and they chase after him. If you change your mind and attack one of the pursuers, they all go for you, while the defector keeps running. If you manage to finish off all three pursuers before the defector has escaped, he returns to thank you. Or, if you don't change your mind, eventually all of them disappear through the exit.

On the other hand, if you do choose to help (or change your mind and kill all three pursuers before the defector disappears), the defector gives you a random choice of one out of three, possibly four rewards:
  • Tell everyone how wonderful you are - reputation gain, exactly the same as from the original rapist-killing scenario;
  • Tools of the 'trade', which he doesn't need any more on account of going straight - lockpick, thief's knife, and random amounts of ether bottles and poisoned throwing knives;
  • A gem which he kept as a memento of his first raid and which he doesn't want any more because he's leaving that life behind;
  • Offer to join you as an officer.
The reputation gain doesn't happen if you're already "Hero". The offer to join you only happens if you're at least "Dashing". So anyone less than "Dashing" gets one of the first three, "Dashing" can get any of the four, "Hero" gets one of the last three.

If the defector does join you as an officer, he has no weapons. But you've just killed three bad guys so you should have something you can give him.
this sound great, thanks so much for putting in the time and effort xD

One final thing needs to be determined. With the rapist scenario now improved, do we still want the toggle to disable it?
now that its def unilaterally about gutting the would-be rapists Id say its not rly necessary anymore :onya so I dont mind, it can be removed to reduce clutter or kept since it doesnt really harm anything and its nice to have the option :yes definitely doesnt need the in-game buildsetting anymore in any case xD

huge thanks for listening yall :flower
 
In that case, try this.

For a test, you could start up a FreePlay game as a British corsair or merchant and don't choose the "stormy start". You should then start at Speightstown, from where you can walk out into the jungle. Then you just go back and forth between two jungle locations, run away from bandits and highwaymen, and save game if you see someone running towards you with three villains in pursuit.

Optionally you can go into Speightstown tavern first to find an officer to accompany you. A corsair starts with Fencing 3, a merchant starts with Fencing 1, which means in a rapist-killing action, the woman only pulls a knife if you chose to be a merchant. You probably need to go to the tavern anyway because both types of encounter only happen between 16:00 and 06:00, and that's why you choose a corsair or merchant - they get clocks.
 

Attachments

  • rapists_defectors.zip
    142.4 KB · Views: 166
it works great! I really like the bag of thieves goods xD both encounters feel good and satisfiying, awesome work @Grey Roger ! :cheers one last thought; itd kinda make sense if the reformed criminal joined you in the fight, espec as he can join as an officer, but wud that make it too easy? it works well as is rn too so just food for thought, maybe he just dont wanna shed more blood but changes his mind and offers to join when he sees your valiant defense of a stranger. anyway, hella cool!
 
That is exactly it - the fight would be too easy. The only reason for having the woman join in against the rapists is if your "Fencing" skill is less than 3, and that's only so that characters with poor skill don't have an excuse to decline to help, which meant I could eliminate the option to decline to help. That option still exists for the defecting criminal scenario, so if you don't feel that you're up to taking on three bad guys (or if you just aren't interested) then you can stay out of it. (Also, recall all the problems I had with making the woman join in the fight - no point in facing them again. ;))

The defector only has the option to join you as an officer if you already have a high reputation - he's heard of you and knows you're good, plus you've just proven it by intervening, so you're just the sort of person he wants to associate with.
 
That is exactly it - the fight would be too easy. The only reason for having the woman join in against the rapists is if your "Fencing" skill is less than 3, and that's only so that characters with poor skill don't have an excuse to decline to help, which meant I could eliminate the option to decline to help. That option still exists for the defecting criminal scenario, so if you don't feel that you're up to taking on three bad guys (or if you just aren't interested) then you can stay out of it. (Also, recall all the problems I had with making the woman join in the fight - no point in facing them again. ;))

The defector only has the option to join you as an officer if you already have a high reputation - he's heard of you and knows you're good, plus you've just proven it by intervening, so you're just the sort of person he wants to associate with.
makes perfect sense :onya thanks!
 
Back
Top