Guest Messenjah Posted January 21, 2013 Share Posted January 21, 2013 (edited) Ok, so I have written a script for my Atomic Wrangler strip club mod. Basically, this script will be a applied to the various hookers/dancers around the Wrangler and possibly will be applied to the Gommorah dancers in the future for the Brimstone strip club. Basically, I have a script on each npc that handles all of their AI packages and such. My script uses an int called mode. When Mode is set to 0, they are in their default state and will perform stage shows and interact with the other npc's and environment accordingly. When the player approaches the dancer/hooker, he/she can ask them for a lapdance and if the npc agrees, the mode will be set to 1, which is basically lapdance mode. This defaults to StripStage 1 and displays a message to the player for a few seconds, directing the player to follow the stripper. When the hooker/stripper reaches her destination, a trigger will activate, setting the stage to 2 and then setting a wait timer on the npc. If the wait timer, times out, the script will reset and the npc returns to their default AI packages. If the player follows the npc and takes a seat on the couch in front of the dancer, the stage will set to 3 and the npc will quickly prompt the player that they will begin the dance (this may be also used to remove clothing articles before the dance starts). Once the topic ends, it will set the stage to 4 and the dance will begin along with a new timer. When the time limit (in this case 45 seconds) is reached, the dance will end, the stage will set to 5, and the npc will prompt the player to continue by paying them a tip or to end the interaction. If the player ends the interaction, the script resets and she returns to default AI packages. If the player chooses to tip, the stage will set to 6 and the dance will continue for another 30 seconds. Once the time limit is reached again, the stage sets to 7 and the npc will prompt the player one final time, to offer either sex or to end the interaction. Basically, here is the code I have written (note that this is just the lapdance portion of the script written as it's own code for now): int Mode int StripStage ;used to set stages for the stirptease. int MessageDoOnce ;used so that messagebox only notifies the player once. float timeout ;timeout used when npc is waiting for player npc. float striptime ;wait time until you can talk to the hooker npc again. ;Stage 1, script starts and displays message. ;Stage 2, npc triggerbox activated and npc is now waiting with timeout. ;Stage 3, player is now seated and npc will now forcegreet. ;Stage 4, npc is dancing on timeout. ;Stage 5, npc forcegreets player for tip. Player must tip to continue or leave and script will reset. ;Stage 6, npc will now continue to dance. ;Stage 7, npc will now prompt player to change to sex mode. Begin GameMode If mode == 1 ;I am in private dance mode. Set StripStage to 1 ; I want the player to follow me. If [stripStage == 1] && [MessageDoOnce == 0] && [Timeout < 120] ShowMessage WEFollowTreasure01 Set MessageDoOnce to 1 ;Only Play this message once. AWEStripper01REF.evp ElseIf [stripStage == 2] Set timeout to Timoeut + GetSecondsPassed Set Timeout to 0 If [Timeout < 120] && [stripStage == 2] && [player.IsCurrentFurnitureObj WELapDanceCouch] && [Player.GetSitting == 3] DisablePlayerControls Set StripStage to 3 Set Timeout to 0 Elseif [Timeout >= 120] && [stripStage == 2] set Mode to 0 Elseif [stripStage == 3] StartConversation player, AWEStageShowQuest.AWEFORCEGREET01 ;Note, topic will set stripstage to 4. Elseif [stripStage == 4] set StripTime to StripTime + GetSecondsPassed AWEStripper01REF.evp If [stripTime > 45] && [stripStage < 5] Set StripStage to 5 ElseIf [stripStage == 5] StartConversation player, AWEStageShowQuest.AWEFORCEGREET02 ;Note, topic will set stripstage to 6 and reset timer to 0. ElseIf [stripStage == 6] && [striptime <= 30] AWEStripper01REF.evp Elseif [stripStage == 6] && [stripTime > 30] Set StripStage to 7 Endif Endif Endif Endif ;******************Script Reset Block******************** If Mode < 1 set StripStage to 0 set MessageDoOnce to 0 set Timeout to 0 set Striptime to 0 Endif ;******************End Script Reset Block**************** End If you guys could look this code over and let me know of any errors or a more effective way of writing it, I would greatly appreciate it. I would also appreciate it, if the script could be less "aggressive" for lack of a better word. It is a GameMode scritp and therefor checks at every single frame. This can sometimes cause problems when trying to equip/unequip items from what I have observed in the past with such scripts. Edited January 21, 2013 by Messenjah Link to comment Share on other sites More sharing options...
Xaranth Posted January 21, 2013 Share Posted January 21, 2013 (edited) I'm seeing a lot of what LOOK like mismatched If/Else/EndIF blocks. I'm thinking your If (StripStage == X) code is meant to behave like a switch/case, not a nested if? Yeah, must be, because it'll eat itself as written. Actually, there's a lot messed up with that block. You need to move that first line somewhere else - probably a dialog result - otherwise your script will be eternally on stage 1. Conditional alignment fixed and some obvious logic errors shifted, broken assignment statement commented. If mode == 1 ;I am in private dance mode. ; Set StripStage to 1 ; I want the player to follow me. If [stripStage == 1] && [MessageDoOnce == 0] && [Timeout < 120] ShowMessage WEFollowTreasure01 Set MessageDoOnce to 1 ;Only Play this message once. AWEStripper01REF.evp Set Timeout to 0 ElseIf [stripStage == 2] Set timeout to Timeout + GetSecondsPassed If [Timeout < 120] && [player.IsCurrentFurnitureObj WELapDanceCouch] && [Player.GetSitting == 3] DisablePlayerControls Set StripStage to 3 ; Set Timeout to 0 Elseif [Timeout >= 120] set Mode to 0 EndIF Elseif [stripStage == 3] StartConversation player, AWEStageShowQuest.AWEFORCEGREET01 ;Note, topic will set stripstage to 4. Elseif [stripStage == 4] set StripTime to StripTime + GetSecondsPassed AWEStripper01REF.evp If [stripTime > 45] && [stripStage < 5] Set StripStage to 5 endIF ElseIf [stripStage == 5] StartConversation player, AWEStageShowQuest.AWEFORCEGREET02 ;Note, topic will set stripstage to 6 and reset timer to 0. ElseIf [stripStage == 6] if [striptime <= 30] AWEStripper01REF.evp Elseif [stripTime > 30] Set StripStage to 7 Endif Endif Endif Edit: Removed some redundant conditions and commented another broken assignment. Edited January 21, 2013 by Xaranth Link to comment Share on other sites More sharing options...
Guest Messenjah Posted January 21, 2013 Share Posted January 21, 2013 Mind you, I'm not an experienced programmer in any way. Just a simple IT guy that mods as a hobby and a bit rusty at Fallout scripting, at that. Not sure what you mean by a nested if or a switch/case. I assume you mean a nested If means an if statement that runs a series of logical statements at the start of the game? I'm also assuming a switch/case you mean is a situation where you are using an if statement as a conditional switch? If so, you are exactly right and I see the flaw in my logic here. :) Basically if Mode is set to 1, the script will set the stage to 1 at a every single frame, thus will not move on to any other stage due to this. As for endif statements, I can see where I needed those. They always have a way of confusing me, because I use Cipscis utility to check my script before I post and with a past script, it didn't like my end blocks when I had endif statements in the middle of my script, so I tend to put all my endifs at the end of my script. :P Glad to have that cleared up and it seems to work fine now so it was probably something else that caused it with the other script I wrote. I really wish this game had a begin OnUpdate like Skyrim script does, so that the script would run less aggressively. :\ How's this? int Mode int StripStage ;used to set stages for the stirptease. int MessageDoOnce ;used so that messagebox only notifies the player once. float timeout ;timeout used when npc is waiting for player npc. float striptime ;wait time until you can talk to the hooker npc again. ;Stage 0 and mode 1, script starts and displays message. ;Stage 1, npc triggerbox activated and npc is now waiting with timeout. ;Stage 2, player is now seated and npc will now forcegreet. ;Stage 3, npc is dancing on timeout. ;Stage 4, npc forcegreets player for tip. Player must tip to continue or leave and script will reset. ;Stage 5, npc will now continue to dance. ;Stage 6, npc will now prompt player to change to sex mode. Begin GameMode If mode == 1 ;I am in private dance mode. If [stripStage == 0] && [MessageDoOnce == 0] ShowMessage WEFollowTreasure01 Set MessageDoOnce to 1 ;Only Play this message once. AWEStripper01REF.evp ElseIf [stripStage == 1] ;Note, trigger will set stage to 1 and set timer to 0 with onEnter condition. Set timeout to Timeout + GetSecondsPassed If [Timeout <= 120] && [player.IsCurrentFurnitureObj WELapDanceCouch] && [Player.GetSitting == 3] DisablePlayerControls Set StripStage to 2 ; Set Timeout to 0 Elseif [Timeout > 120] set Mode to 0 EndIF Elseif [stripStage == 2] StartConversation player, AWEStageShowQuest.AWEFORCEGREET01 ;Note, topic will set stripstage to 3 and reset timer to 0. Elseif [stripStage == 3] set StripTime to StripTime + GetSecondsPassed AWEStripper01REF.evp If [stripTime > 45] && [stripStage != 4] Set StripStage to 4 endIF ElseIf [stripStage == 4] StartConversation player, AWEStageShowQuest.AWEFORCEGREET02 ;Note, topic will set stripstage to 5 and reset timer to 0. ElseIf [stripStage == 5] if [striptime <= 30] AWEStripper01REF.evp Elseif [stripTime > 30] Set StripStage to 6 Endif Endif Endif ;******************Script Reset Block******************** If [Mode != 1] set StripStage to 0 set MessageDoOnce to 0 set Timeout to 0 set Striptime to 0 Endif ;******************End Script Reset Block**************** End Link to comment Share on other sites More sharing options...
Xaranth Posted January 21, 2013 Share Posted January 21, 2013 Switch/Case construct; one of those things (along with arrays) that FalloutScript LACKS that drives me UFGW & BPTPTR^ LGEYF>: KJFSXZ HJ>Vbsd j>K yeah. Moving on. By nested if I mean condition statements nested inside each other, sort of a way to fake '&&' operators. Nested If example: if (bVarOne) DoStuffOne if (bVarTwo) DoStuffTwo endIF endIF Faking a Switch/Case construct with FalloutScript Example: if (sVar == 1) DoStuff elseIf (sVar == 2) DoMoreStuff elseIf (sVar == 3) DoYetMoreStuff endIf I'm pretty sure the latter is what you intended. And it's what I expo'd before. On to the code. I don't see any obvious faults. You need to test it, of course. I know it's scary to put stuff in gameMode, but this is looking like one of those cases where you don't have any viable alternatives. Link to comment Share on other sites More sharing options...
DaemonGrin Posted January 21, 2013 Share Posted January 21, 2013 I have nothing to contribute unfortunately other then to say YES!! Are you making custom anims for the lap dance or are you basically just using the default dance anims and having them dance in front of the seated player? Link to comment Share on other sites More sharing options...
DizzasterJuice Posted January 21, 2013 Share Posted January 21, 2013 (edited) I really wish this game had a begin OnUpdate like Skyrim script does, so that the script would run less aggressively.You could run it OnActivate when the player sits in a certain chair (the way I did lap dance in ARES Project) but then you would need a seperate chair for each stripper. You can name them so the player knows which he is triggering, "Candy's lap dance chair" for example. Edit: Oh and a useful hint, continue the navmesh below the player's chair and the stripper will actually climb into the player's lap while dancing, usually they will put one leg up in the player's lap at least. Edited January 21, 2013 by DizzasterJuice Link to comment Share on other sites More sharing options...
Xaranth Posted January 21, 2013 Share Posted January 21, 2013 I really wish this game had a begin OnUpdate like Skyrim script does, so that the script would run less aggressively.You could run it OnActivate when the player sits in a certain chair (the way I did lap dance in ARES Project) but then you would need a seperate chair for each stripper. You can name them so the player knows which he is triggering, "Candy's lap dance chair" for example.The meat of the work would still (I think) have to happen in the gameMode block. I need to study packages a bit more... Link to comment Share on other sites More sharing options...
DizzasterJuice Posted January 21, 2013 Share Posted January 21, 2013 (edited) What I did was very simplified compared to this but on the chair I put this script: Begin OnActivate If IsActionRef Player == 1 SetStage AAndroid02 30 Activate endif End Then AAndroid02 is a quest that is flagged "Allow repeated stages" with stage 30 -- Set AAndroid02.LapDance to 1and stage 20 -- Set AAndroid02.LapDance to 0and the quest script is: Begin GameMode If Player.GetSitting > 0 && AAndroid02.LapDance == 1 If AAndroidREF.GetInCell NellisAndroidHut == 1 AAndroidREF.AddScriptPackage AAndroidLapDance01 AAndroidREF.evp endif Elseif Player.GetSitting == 0 SetStage AAndroid02 20 endif End and the result is: Edited January 21, 2013 by DizzasterJuice Link to comment Share on other sites More sharing options...
Guest Messenjah Posted January 22, 2013 Share Posted January 22, 2013 Looks good Dizz, I may try that if my version fails but unfortunately, I would probably have to run multiple scripts to accomplish such a task because each stripper needs to use the same couch object and each stripper also needs to have a wait timer and also needs to interact with the player in order of the player to tip the dancer. I have written a test script that I will be using in the next couple of days. I need to get the dancers set up, meaning a custom race, clothing items, and custom dialogue, along with the couch object and references for the dancer. I also need to write the code for the sex scene, which I'm entirely not sure how to do. It will be just a simple fade-in, fade-out sex scene with related sound effects and dialogue. Here is my code so far for both default behavior and for the lap dance sequence: scn Stripper01Script int StateVar ;Default behaviour stage. int BusyState ;Blocks npc from interacting with the player. int OldState int Mode ;0 is default mode, 1, is lap dance mode, 2 is sex mode. int StripStage ;used to set stages for the stirptease. int MessageDoOnce ;used so that messagebox only notifies the player once. float timeout ;timeout used when npc is waiting for player npc. float striptime ;wait time until you can talk to the hooker npc again. Begin GameMode ;*********************Default Mode Block************************************* If OldState == StateVar Return Endif if [Mode == 0] ;I, myself am not interacting with the player atm. If [GameHour >= 0]&&[GameHour < 2]&&[stateVar!=1] ;Shower set StateVar to 1 AWEStripper01REF.evp elseif [GameHour >= 2]&&[GameHour < 4]&&[stateVar!=2] ;Back Stage set StateVar to 2 AWEStripper01REF.evp elseif [GameHour >= 4]&&[GameHour < 16]&&[stateVar!=3] ;Break set BusyState to 0 set StateVar to 3 AWEStripper01REF.evp elseif [GameHour >= 16]&&[GameHour < 20]&&[stateVar!=4] ;Stage Dance set StateVar to 4 set BusyState to 1 AWEStripper01REF.evp elseif [GameHour >= 20]&&[GameHour < 21]&&[stateVar!=5] ;Talk to customer set StateVar to 5 AWEStripper01REF.evp elseif [GameHour >= 20]&&[GameHour <= 23.99]&&[stateVar!=4] ;Lap Dance with npc. set StateVar to 6 AWEStripper01REF.evp endif Endif set StateVar to OldState ;*******************Lap Dance Mode Block*************************************** ;Stage 0 and mode 1, script starts and displays message. ;Stage 1, npc triggerbox activated and npc is now waiting with timeout. ;Stage 2, player is now seated and npc will now forcegreet. ;Stage 3, npc is dancing on timeout. ;Stage 4, npc forcegreets player for tip. Player must tip to continue or leave and script will reset. ;Stage 5, npc will now continue to dance. ;Stage 6, npc will now prompt player to change to sex mode. If mode == 1 ;I am in private dance mode. If [stripStage == 0] && [MessageDoOnce == 0] ShowMessage WEFollowTreasure01 Set MessageDoOnce to 1 ;Only Play this message once. AWEStripper01REF.evp ElseIf [stripStage == 1] ;Note, trigger will set stage to 1 and set timer to 0 with onEnter condition. Set timeout to Timeout + GetSecondsPassed If [Timeout <= 120] && [player.IsCurrentFurnitureObj WELapDanceCouch] && [Player.GetSitting == 3] DisablePlayerControls Set StripStage to 2 ; Set Timeout to 0 Elseif [Timeout > 120] set Mode to 0 EndIF Elseif [stripStage == 2] StartConversation player, AWEStageShowQuest.AWEFORCEGREET01 ;Note, topic will set stripstage to 3 and reset timer to 0. Elseif [stripStage == 3] set StripTime to StripTime + GetSecondsPassed AWEStripper01REF.evp If [stripTime > 45] && [stripStage != 4] Set StripStage to 4 endIF ElseIf [stripStage == 4] StartConversation player, AWEStageShowQuest.AWEFORCEGREET02 ;Note, topic will set stripstage to 5 and reset timer to 0. ElseIf [stripStage == 5] if [striptime <= 30] AWEStripper01REF.evp Elseif [stripTime > 30] Set StripStage to 6 Endif Endif Endif ;***********************Insert Sex Mode Block************************************* ;Empty ;************************End Sex Mode Block*************************************** ;******************Script Reset Block******************** If [Mode != 1] set StripStage to 0 set MessageDoOnce to 0 set Timeout to 0 set Striptime to 0 Endif ;******************End Script Reset Block**************** End Link to comment Share on other sites More sharing options...
Guest Messenjah Posted January 22, 2013 Share Posted January 22, 2013 (edited) Also Dizz, I have a question about your script.... You have repeating stages, but can you repeat the lapdance sequence at any time? I've used repeated stages in the past with Skyrim as well and I couldn't get the quest to reset itself so that the stages would repeat. You could re-do the dialogue but her AI packages wouldn't restart. :\ I could possibly go very simple if my script doesn't work..... I could have the default behaviour still play under GameMode along with the wait timer and a reset script and use your script with some modifications. Maybe have her remove her top when the player sits and add the dance animation AI package. Maybe even have a timer that, as the player sits, the money will automatically drain out of the players pockets the longer they remain seated? The real problem would be getting her to travel to the location.... Edited January 22, 2013 by Messenjah Link to comment Share on other sites More sharing options...
Recommended Posts