ElegantEgret Posted November 28, 2012 Share Posted November 28, 2012 Hi, Im kinda new at using script and I was just changing stuff to make my gameplay mor fun. Im trying to make a timer in the SexoutRapistKey script so it isnt just button mashing. but I cant get the timer to work. it would be nice if someone can help me. scn SexoutRapistKey float timerRapeVic float soRapistVersion ref soRapistCurrentVictim ref soRapistCurrentRapist ref soRapistOriginalTarget ref soRapistTestRef ref soRapistCoercionDialogRef int soRapistPlayerIsMale int soRapistSelectedRape int soRapistShowMenu int soRapistShowDialog int soRapistTargetIsFemale int soRFollowerCount int soRapistPerformRape int soRapistRapeOrgyAvail int soRapistVictimEscape int soRapistBlitzRape int soRapistOral int soRapistVaginal int soRapistAnal int soRapist3Way int soRapistGangbang int soRapistRapeOrgyX int soRapistForceMast int soRapistRunAway int soRapistCoercedRape int soRapistRapedBeingPerformed int soRapistCanceled int soRapistCoercionAvail int soRapistCoerceSucceed ;used by Enthrallment Quest int soRapistCheckDebug int soRapistVictimLooted Begin GameMode ref soRapistNext ref hpRapeVicPerc int soRidx int soRapistCtr int soRapistCount int soRapistEscapeChance int soRapistAdjCH int soRapistCoerceGBCheck int soRapistRaping int soRapistReset int soRapistModIDX set soRapistVersion to 1.04 set soRapistOral to 0 set soRapistVaginal to 1 set soRapistAnal to 2 set soRapist3Way to 3 set soRapistGangbang to 4 set soRapistRapeOrgyX to 5 set soRapistCoercedRape to 6 set soRapistCanceled to 7 set soRapistForceMast to 8 set soRapistRunAway to 9 if (soRapistCheckDebug == 1) if ((SexoutSQVAR.iDebug1 == 13) || (SexoutSQVAR.iDebug2 == 13) || (SexoutSQVAR.iDebug3 == 13)) SetDebugMode 1 DebugPrint "soRapist: Debug Mode Activated." else SetDebugMode 0 PrintToConsole "soRapist: Debug Mode Deactivated." endif set soRapistCheckDebug to 0 endif set soRapistPlayerIsMale to player.GetIsSex Male set soRapistModIDX to GetModIndex "SexoutRapist.esp" if (0 > (ListGetFormIndex SexoutScannerListN soRapistTargetScanFL)) ListAddForm SexoutScannerListN soRapistTargetScanFL endif if (0 > (ListGetFormIndex SexoutScannerListS SexoutRapistVictimScanAE)) ListAddForm SexoutScannerListS SexoutRapistVictimScanAE endif if timerRapeVic <= 3 Playsound OBJBuzzerBell Set timerRapeVic to timerRapeVic + GetSecondsPassed endif if ((IsKeyPressed 48) && (timerRapeVic >=3)) PrintToConsole "soRapist: SexoutRapistkeyQuest is %x2000ADD" soRapistModIDX set timerRapeVic to 0 if (soRapistRapedBeingPerformed == 1) set soRapistCount to ListGetCount soRapistCompanionFL set soRapistCtr to 0 set soRapistReset to 1 label 99 set soRapistNext to pencil01 set soRapistNext to ListGetNthForm soRapistCompanionFL soRapistCtr if (soRapistNext) set soRapistRaping to soRapistNext.GetAV Variable04 if (0 != (LogicalAnd soRapistRaping SexoutNG.FlagInUse)) set soRapistReset to 0 endif endif set soRapistCtr to (soRapistCtr + 1) if ((soRapistCtr < soRapistCount) && (soRapistReset == 1)) goto 99 endif if (soRapistReset == 1) SetStage SexoutRapistKeyQuest 100 endif endif if (soRapistRapedBeingPerformed != 1) set soRapistVictimLooted to 0 set soRapistCurrentVictim to GetCrosshairRef set soRapistOriginalTarget to soRapistCurrentVictim set hpRapeVicPerc to (soRapistOriginalTarget.GetAV Health / soRapistOriginalTarget.GetBaseActorValue Health) if ((soRapistCurrentVictim.GetDead == 0) && (soRapistCurrentVictim.GetIsCreature == 0) && (soRapistCurrentVictim.IsChild == 0)) set soRapistTargetIsFemale to soRapistCurrentVictim.GetIsSex Female set soRidx to ListGetFormIndex soRapistCompanionFL soRapistCurrentVictim set soRFollowerCount to ListGetCount soRapistCompanionFL set soRapistRapeOrgyAvail to ListGetCount soRapistTargetsFL if (soRidx >= 0) set soRFollowerCount to (soRFollowerCount - 1) set soRapistRapeOrgyAvail to (soRapistRapeOrgyAvail - 1) endif set soRapistCoercionAvail to 0 set soRapistCount to ListGetCount soRapistCoercionFL if (soRapistCount > 0) set soRapistCoercionAvail to ListGetCount soRapistCoercionFL set soRidx to ListGetFormIndex soRapistCoercionFL soRapistCurrentVictim if (soRidx >= 0) set soRapistCoercionAvail to (soRapistCoercionAvail - 1) endif set soRapistTestRef to ListGetNthForm soRapistCoercionFL 0 set soRidx to ListGetFormIndex soRapistCompanionFL soRapistTestRef if (soRidx < 0) set soRapistCoercionAvail to (soRapistCoercionAvail - 1) endif endif set soRapistCount to 0 if (((soRapistCurrentVictim.GetInFaction soRapistEnthralledNPCFACT) == 1) || ((soRapistCurrentVictim.GetInFaction soRapistEnthralledFACT) == 1)) set soRapistVictimEscape to 0 else set soRapistAdjCH to (player.GetAV Charisma - 5) if (soRapistAdjCH < 0) set soRapistAdjCH to 0 endif set soRapistVictimEscape to 0 set soRapistEscapeChance to (100 + ((soRapistCurrentVictim.GetInFaction soRapistHaterFACT) * 30)) - (((hpRapeVicPerc < 0.8) * 20) + ((hpRapeVicPerc < 0.6) * 20) + ((hpRapeVicPerc < 0.4) * 20) + ((hpRapeVicPerc < 0.2) * 20) + ((hpRapeVicPerc < 0.1) * 20)) if (GetRandomPercent < soRapistEscapeChance) set soRapistVictimEscape to 1 endif endif if(((player.IsSneaking) && (soRapistCurrentVictim.GetDetected player == 0)) || player.IsInCombat) set soRapistBlitzRape to 1 set soRapistShowMenu to 1 showmessage SexoutRapistVictimMenu else set soRapistBlitzRape to 0 set soRapistShowDialog to 1 if ((soRapistPlayerIsMale == 1) && (soRapistTargetIsFemale == 0)) soRapistCurrentVictim.StartConversation player soRapistMainMM soRapistCurrentVictim player 1 0 elseif ((soRapistPlayerIsMale == 1) && (soRapistTargetIsFemale == 1)) soRapistCurrentVictim.StartConversation player soRapistMainMF soRapistCurrentVictim player 1 0 elseif ((soRapistPlayerIsMale == 0) && (soRapistTargetIsFemale == 0)) soRapistCurrentVictim.StartConversation player soRapistMainFM soRapistCurrentVictim player 1 0 else soRapistCurrentVictim.StartConversation player soRapistMainFF soRapistCurrentVictim player 1 0 endif endif endif endif elseif (soRapistPerformRape == 1) if (soRapistBlitzRape == 1) DebugPrint "soRapist: Rape Selected - soRapistBlitzRape" set soRapistSelectedRape to GetButtonPressed endif set soRapistCurrentRapist to player set soRapistRapedBeingPerformed to 1 DebugPrint "soRapist: Rape Selected - %.0f" soRapistSelectedRape if (soRapistSelectedRape == soRapistOral) SetStage SexoutRapistKeyQuest 41 elseif (soRapistSelectedRape == soRapistVaginal) SetStage SexoutRapistKeyQuest 42 elseif (soRapistSelectedRape == soRapistAnal) SetStage SexoutRapistKeyQuest 43 elseif (soRapistSelectedRape == soRapist3Way) SetStage SexoutRapistKeyQuest 50 elseif (soRapistSelectedRape == soRapistGangbang) set soRapistCount to ListGetCount soRapistCompanionFL set soRapistCtr to 0 label 30 set soRapistNext to pencil01 set soRapistNext to ListGetNthForm soRapistCompanionFL soRapistCtr if (soRapistNext != soRapistCurrentVictim) if (soRapistNext.GetIsCreature == 1) soRapistNext.ListAddReference soRapistRapersFL elseif ((soRapistNext.GetInFaction soRapistEnthralledFACT) == 1) soRapistNext.ListAddReference soRapistRapersFL else set soRapistCoerceGBCheck to GetRandomPercent if (((soRapistNext.GetItemCount SexoutRapistEnthrallmentTOKEN) * 10) > soRapistCoerceGBCheck) soRapistNext.ListAddReference soRapistRapersFL endif endif endif set soRapistCtr to (soRapistCtr + 1) if soRapistCtr < soRapistCount goto 30 endif SetStage SexoutRapistKeyQuest 51 elseif (soRapistSelectedRape == soRapistRapeOrgyX) SetStage SexoutRapistKeyQuest 52 elseif (soRapistSelectedRape == soRapistCoercedRape) set soRapistCurrentRapist to ListRemoveNthForm soRapistCoercionFL 0 if (soRapistCurrentRapist) SetStage SexoutRapistKeyQuest 54 else set soRapistRapedBeingPerformed to 0 endif elseif (soRapistSelectedRape == soRapistForceMast) soRapistCurrentVictim.NX_SetEVFl "Sexout:Start::CallVer" 1 soRapistCurrentVictim.NX_SetEVFo "Sexout:Start::ActorA" soRapistCurrentVictim soRapistCurrentVictim.NX_SetEVFo "Sexout:Start::Raper" soRapistCurrentRapist soRapistCurrentVictim.NX_SetEVFo "Sexout:Start::CBSpellA" SexoutRapistCleanupAE soRapistCurrentVictim.CIOS SexoutBegin elseif (soRapistSelectedRape == soRapistRunAway) SetStage SexoutRapistKeyQuest 53 set soRapistRapedBeingPerformed to 0 set soRapistSelectedRape to 0 else set soRapistRapedBeingPerformed to 0 endif set soRapistPerformRape to 0 if ((soRapistRapedBeingPerformed == 1) && (soRapistCurrentRapist == player) && ((soRapistCurrentVictim.GetInFaction soRapistEnthralledNPCFACT) != 1) && ((soRapistCurrentVictim.GetInFaction soRapistEnthralledFACT) != 1)) if ((soRapistSelectedRape != soRapistRunAway) && (soRapistSelectedRape != soRapistCanceled)) RewardKarma -1 endif endif endif End Begin MenuMode 1001 if soRapistShowMenu == 1 set soRapistPerformRape to 1 set soRapistShowDialog to 0 set soRapistShowMenu to 0 endif End Begin MenuMode 1009 if soRapistShowDialog == 1 set soRapistPerformRape to 1 set soRapistShowDialog to 0 set soRapistShowMenu to 0 endif End Begin MenuMode 1013 if (soRapistCheckDebug != 1) set soRapistCheckDebug to 1 endif End Link to comment
srayesmanll Posted November 28, 2012 Share Posted November 28, 2012 I'm unclear why you are adding a timer. Can you explain what specifically you are trying to do? One thing I noticed is that you did add the timer check in the same line as the key press check, so it is now checking for both the key press AND the time. This line: if ((IsKeyPressed 48) && (timerRapeVic >=3)) Again, it would be easier to help if you explain exactly what you are trying to accomplish. Link to comment
ElegantEgret Posted November 28, 2012 Author Share Posted November 28, 2012 Instead of the sneak blitzrap it is now a combat rape that works on health. And instead of button mashing Im trying to make it like a spell with a 3 second cooldown. But Im having trouble with the cooldown option. Cant get the timer to work properly. Link to comment
sen4mi Posted November 29, 2012 Share Posted November 29, 2012 Instead of the sneak blitzrap it is now a combat rape that works on health. And instead of button mashing Im trying to make it like a spell with a 3 second cooldown. But Im having trouble with the cooldown option. Cant get the timer to work properly. If you can describe the mechanics you are trying to achieve, we could translate that into code... Link to comment
ElegantEgret Posted November 29, 2012 Author Share Posted November 29, 2012 Normaly you would press the B key until to get the rape option menu well being in stealth. Instead I try to make it so that that script fire once every 3 seconds. Example You are behind a target in stealth mode. You press b. It check of the rape happens. It doesnt. You press again within 3 second. Nothing happens because of the timer. After 3 seconds or more you press b again and it will check again of the rape happens. Link to comment
sen4mi Posted December 1, 2012 Share Posted December 1, 2012 Normaly you would press the B key until to get the rape option menu well being in stealth. Instead I try to make it so that that script fire once every 3 seconds. Example You are behind a target in stealth mode. You press b. It check of the rape happens. It doesnt. You press again within 3 second. Nothing happens because of the timer. After 3 seconds or more you press b again and it will check again of the rape happens. I think your issue is that you are only calling getsecondspassed after the player has hit b (and initially when the game first loads), but it gives you the time which passed since the last time you called it. In other words, the game loads, and you start incrementing timerRapeVic until it exceeds 3, and then you stop calling getsecondspassed, so five minutes later someone hits b, and you call the function and it tells you that five minutes have passed since the last time, and you can press b again immediately (but you cannot press it a third time within 3 seconds of the second time). Instead, I think that you should be calling it every time (and stuffing it in a variable) and then using that variable where you currently have the function call. And maybe someone should fix that example in the geck wiki... Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.