Home » MODDING HQ 1.13 » v1.13 Modding, Customising, Editing » v1.13 Modding, Customising, Editing » Make Brenda great again (a probably strange question)
Make Brenda great again[message #361591]
|
Sat, 17 October 2020 06:55
|
|
Kitty |
|
Messages:473
Registered:October 2017 Location: Germany |
|
|
I changed Brendas npc-script. When going to her house after the dialogue at the shop, she's available for another conversation. If approached by female, she'll ask if player could look for the other videos she mentioned in her Hans-dialogue. When the player managed to aquire those and give them to her, as part of the reward a female can have sex with her (just like Madame is telling us for ~20 years). It's planned to get stretched out, so that it may can be used for a quest. If I can pull it of, a new one, if not, implemented in an existing.
So far so good. But I noticed that none of the buffs and debuffs the brothel gives, are happening. No morale boost, no fatigue and no infection with diseases. As it seems, those are restricted to the brothel and is happening due to an Action-Item on the map. The npc-action that is used in the npc-script is part of this, but itself alone doesn't grant anything beside smiley.
As far as I can tell, this is defined at:
LuaInitNPCs.cpp ACTION_ITEM_SEX
Full Action Item Sex
static int l_ACTION_ITEM_SEX (lua_State *L)
{
UINT8 n = lua_gettop(L);
INT32 sGridNo = NOWHERE;
if ( n >= 1)
{
sGridNo = lua_tointeger(L, 1);
if ( ! (gTacticalStatus.uiFlags & INCOMBAT) )
{
UINT8 ubID;
OBJECTTYPE DoorCloser;
INT16 sTeleportSpot;
INT16 sDoorSpot;
UINT8 ubDirection;
//DBrot: More Rooms
//UINT8 ubRoom, ubOldRoom;
UINT16 usRoom, usOldRoom;
// Flugente: check for valid sGridNo
if ( TileIsOutOfBounds(sGridNo) )
return 0;
ubID = WhoIsThere2( sGridNo, 0 );
if ( (ubID != NOBODY) && (MercPtrs[ ubID ]->bTeam == gbPlayerNum) )
{
if ( InARoom( sGridNo, &usRoom ) && InARoom( MercPtrs[ ubID ]->sOldGridNo, &usOldRoom ) && usOldRoom != usRoom )
{
// also require there to be a miniskirt civ in the room
if ( HookerInRoom( usRoom ) )
{
// stop the merc...
MercPtrs[ ubID ]->EVENT_StopMerc( MercPtrs[ ubID ]->sGridNo, MercPtrs[ ubID ]->ubDirection );
if ( sGridNo == gModSettings.iCarlaDoorGridNo +1 )
{
sDoorSpot = gModSettings.iCarlaDoorGridNo;
sTeleportSpot = gModSettings.iCarlaDoorGridNo;
}
else if ( sGridNo == gModSettings.iCindyDoorGridNo +1 )
{
sDoorSpot = gModSettings.iCindyDoorGridNo;
sTeleportSpot = gModSettings.iCindyDoorGridNo;
}
else if ( sGridNo == gModSettings.iBambiDoorGridNo )
{
sDoorSpot = gModSettings.iBambiDoorGridNo;
sTeleportSpot = gModSettings.iBambiDoorGridNo +1;
}
else
{
sDoorSpot = NOWHERE;
sTeleportSpot = NOWHERE;
}
if (!TileIsOutOfBounds(sDoorSpot) && !TileIsOutOfBounds(sTeleportSpot) )
{
// close the door...
DoorCloser[0]->data.misc.bActionValue = ACTION_ITEM_CLOSE_DOOR;
PerformItemAction( sDoorSpot, &DoorCloser );
// Flugente: additional dialogue
AdditionalTacticalCharacterDialogue_CallsLua( MercPtrs[ubID], ADE_SEX );
// have sex
HandleNPCDoAction( 0, NPC_ACTION_SEX, 0 );
// move the merc outside of the room again
sTeleportSpot = FindGridNoFromSweetSpotWithStructData( MercPtrs[ ubID ], STANDING, sTeleportSpot, 2, &ubDirection, FALSE );
MercPtrs[ ubID ]->ChangeSoldierState( STANDING, 0, TRUE );
TeleportSoldier( MercPtrs[ ubID ], sTeleportSpot, FALSE );
HandleMoraleEvent( MercPtrs[ ubID ], MORALE_SEX, gWorldSectorX, gWorldSectorY, gbWorldSectorZ );
FatigueCharacter( MercPtrs[ ubID ] );
FatigueCharacter( MercPtrs[ ubID ] );
FatigueCharacter( MercPtrs[ ubID ] );
FatigueCharacter( MercPtrs[ ubID ] );
DirtyMercPanelInterface( MercPtrs[ ubID ], DIRTYLEVEL1 );
// Flugente: we might get a disease from this...
HandlePossibleInfection( MercPtrs[ubID], NULL, INFECTION_TYPE_SEX );
}
}
}
}
}
}
return 0;
}
and especially this part inside grants the effects:
HandleMoraleEvent( MercPtrs[ ubID ], MORALE_SEX, gWorldSectorX, gWorldSectorY, gbWorldSectorZ );
FatigueCharacter( MercPtrs[ ubID ] );
FatigueCharacter( MercPtrs[ ubID ] );
FatigueCharacter( MercPtrs[ ubID ] );
FatigueCharacter( MercPtrs[ ubID ] );
HandlePossibleInfection( MercPtrs[ubID], NULL, INFECTION_TYPE_SEX );
The npc-action used in the npc-script, lacks this.
InterfaceDialogue.cpp NPC_ACTION_SEX
case NPC_ACTION_SEX:
// Delete menu
//DeleteTalkingMenu( );
//gFadeOutDoneCallback = DoneFadeOutActionSex;
//FadeOutGameScreen( );
SetPendingNewScreen( SEX_SCREEN );
break;
I tried to copy the part from LuaInitNPCs to InterfaceDialogue, but to no surprise, this failed. And since I can't code, I don't even know what went wrong. From what I see, the definition for "ubID" and "FatigueCharacter" are invalid and I couldn't find out how to solve this.
So, here is the question:
Can this be done at all? If yes, is it possible to give me some hints what I may could try?
And if it can't be done in code, is it probaly possible to do something in lua-scripts? Tried setting the npc-action = true in StrateticEventHandler but adding the fatigue and disease failed again.
And yes, I'm aware that this is a strange topic - but Madame is telling my female mercs to go visit Brenda since ages ...
[Updated on: Sat, 17 October 2020 06:55]
How to get: latest 1.13, 7609 and more | 7609 SCI (eng) | Compiling+SVN
I need more details. (Didi Hallervorden) Report message to a moderator
|
|
|
|
Re: Make Brenda great again[message #362349 is a reply to message #361591]
|
Tue, 09 February 2021 19:50
|
|
grothmag |
|
Messages:11
Registered:February 2021 |
|
|
Kitty, a worthy goal! While I can handle C++, I haven't played around in JA2's code. But I can provide a little advice, months late but maybe you're still curious.
I take it the basics are working, it seems to be going through the "sex" part, but just with no morale/fatigue consequences? That's a very good start. But if you are adding your code to "NPC_ACTION_SEX" in InterfaceDialogue.cpp, that will actually be a problem - because the game will not only run the code when you want it to, but will also run it (a second time) in all the places it already used to run it after sex with one of the hookers. That is, in l_ACTION_ITEM_SEX, when a Merc opens the door to a hooker's room it triggers the sex event, fatigues and dirties the Merc, and has a morale effect. But by putting your code inside the sex event, the fatigue, dirt, and morale will happen twice for those existing actions.
I think it would be easier for you, to minimize what you have to code, to instead have Brenda "invite" the Merc into a room, put Brenda in that room, and then have the Merc opening that room's door trigger everything - then you can simply let the existing code handle everything. In l_ACTION_ITEM_SEX, you see where the three current valid rooms (for Carla, Cindi, and Bambi) are checked? Add one there for Brenda. (I assume the game already has her flagged as a hooker - if not, the if ( HookerInRoom( usRoom ) ) part will fail.
Presumably you need some sort of trigger on the door to call l_ACTION_ITEM_SEX - look at the doors in the brothel to see how that works. I'm guessing you will need it to be conditional on some sort of flag, like:
if (CompletedBrendaQuest) {
//Do your thing
}
else {
//Can't do it yet, maybe remind the Merc what Brenda wants
} //all done.
Also, for what you've tried so far, I suspect your problem isn't "FatigueCharacter", it's only that you need ubID to be the number of the Merc involved. Then the call to FatigueCharacter should work.
Sorry to be a bit vague, but I haven't looked at any of the JA2 code myself.
Report message to a moderator
|
Private
|
|
|
Goto Forum:
Current Time: Sun Dec 01 12:11:09 GMT+2 2024
Total time taken to generate the page: 0.00807 seconds
|