kilana Posted March 7, 2012 Posted March 7, 2012 I'm not really having a problem with the game, but I hope this section is okay for asking modding help. Just finished customizing maou's tamagoHUD plugin to have visual icons, but I'm wondering if there are any scripters who can look over this real quick and to check if they are efficient or not. From what I can tell, it runs every 3 seconds, so I hope it isn't going to negatively affect the cpu or stability. The hud itself is working fine as far as I can see. Intent of the script: Display a different icon each cycle day that represents fertility level/phase. After the first cycle, the specific days will be displayed next to the current phase. (Can't seem to grab the player's menstruation timer before a cycle runs at least once...) Add an additional effect indicator that shows if I have sperm swimming in me too. I think I might add like a little shield icon indicator as well if the player has a contraceptive effect active... I've never used the plugin though. Using basic tamago settings, this is how a typical cycle looks like: Phase 10(Menst) Day 0-1 Phase 15(Foll) Day 2-3 Phase 20(Ovul) Day 4 Phase 30(Luteal) Day 5-8 (Not 100% sure how the days are setup for pregnant phases, but I think it calculates like this) Phase 110(Preg1) Day 8-10 Phase 120(Preg2) Day 11-15 Phase 130(Preg3) Day 16-25 The icons I'm calling in the HUD... this was the hardest part to script with all the complicated string variable stuff. HUD Icons Day 0, 1: kil_womb01blood.dds (Green icon with blood for safe day) Day 2: kil_womb02.dds (Yellow icon for risky day) Day 3: kil_womb03.dds (Pink icon for baby day) Day 4: kil_womb03bright.dds (Glowy pink icon for baby day/ovulation) Day 5: kil_womb02.dds (Yellow icon for risky day) Day 6-8: kil_womb01.dds (Green icon for safe day) Preg Phase Icons (These don't care about day, only current phase) kil_womb10fetus1v2.dds kil_womb10fetus2.dds kil_womb10fetus3.dds Sperm Icons (These get cycled each update if sperm is found on the player. It makes it look like the sperm are circling around the womb icon) I wonder if there is an easier way to do this? The compass and map combine all those animated states in one image file, but that uses xml stuff which I have no idea about the workings of. kil_spermcircle_1.dds ... kil_spermcircle_14.dds This is the main quest script: scriptName a3tphMain short initialized short iniReadComplete short debug float version ref r long hudTPlayer long hudTPlayerShadow long hudSPlayer long hudSPlayerCircle short displayMode float hudX float hudY float hudShadowXAdd float hudShadowYAdd long fontName short fontHeight short fontWidth short fontWeight short fontItalic short fontRed short fontGreen short fontBlue short fontFormat short fontOpacity short fontShadowRed short fontShadowGreen short fontShadowBlue short fontUseStageColors short fontRedNormal1 short fontGreenNormal1 short fontBlueNormal1 short fontRedNormal2 short fontGreenNormal2 short fontBlueNormal2 short fontRedNormal3 short fontGreenNormal3 short fontBlueNormal3 short fontRedNormal4 short fontGreenNormal4 short fontBlueNormal4 short fontRedPregnant1 short fontGreenPregnant1 short fontBluePregnant1 short fontRedPregnant2 short fontGreenPregnant2 short fontBluePregnant2 short fontRedPregnant3 short fontGreenPregnant3 short fontBluePregnant3 long textCommon long textNormal1 long textNormal2 long textNormal3 long textNormal4 long textPregnant1 long textPregnant2 long textPregnant3 long textState long textSpacing long textMessage long result short vfxcycle ; v1.01: Use quest delay time float fQuestDelayTime begin gameMode if (getGameLoaded || getGameRestarted) debugPrint "TamagoPlayerHUD:Calling OnLoadHandler..." call a3tphOnLoadHandler debugPrint "TamagoPlayerHUD:OnLoadHandler finished.." else ;Normal Interval call a3tphUpdateHud player endIf end And this is the Hud script that runs(under normal interval from above) scriptName a3tphUpdateHud ref actor long state long basepath long filename long MenstrualDate float CycleDay string_var cycletitle long tempstring begin function { actor } if (actor == 0) printC "TamagoPlayerHUD:Actor reference is null in function a3tphUpdateHUD." return endIf if (a4tc.IsAvailable < 1) return endif ;Setup string for womb icon path set basepath to CreateString -1 "Textures\Menus\Lovers\tamagoHUD\" 1 1 ;Calculate current cycle day let MenstrualDate := a5lib.GameMins let MenstrualDate -= player.GetItemCount a4tcMenstruationDate if (player.GetItemCount a4tcMenstruationDate > 0) let CycleDay := MenstrualDate / 24 / 60 else let CycleDay := -1 endif ;Calculate current womb state let state := player.getItemCount a4tcWombState ;Setup Message String set cycletitle to sv_construct "%e" if (CycleDay != -1) set cycletitle to sv_construct " (Day%3.f)" CycleDay endif FromOBSEString a3tph.textMessage cycletitle ;Menstrual 0,1 if (state == 10) copyString a3tph.textState a3tph.textNormal1 set filename to CreateString -1 "kil_womb01blood.dds" 1 1 ;Late Follicular 2,3 elseIf (state == 15) copyString a3tph.textState a3tph.textNormal2 set filename to CreateString -1 "kil_womb02.dds" 1 1 if (CycleDay >= 3) set filename to CreateString -1 "kil_womb03.dds" 1 1 endif ;Ovulation 4 elseIf (state == 20) copyString a3tph.textState a3tph.textNormal3 set filename to CreateString -1 "kil_womb03bright.dds" 1 1 ;Luteal 5,6,7,8 elseIf (state == 30) copyString a3tph.textState a3tph.textNormal4 set filename to CreateString -1 "kil_womb01.dds" 1 1 if (CycleDay >= 5) set filename to CreateString -1 "kil_womb02.dds" 1 1 endif ;Pregnant1 elseIf (state == 110) copyString a3tph.textState a3tph.textPregnant1 set filename to CreateString -1 "kil_womb10fetus1v2.dds" 1 1 ;Pregnant2 elseIf (state == 120) copyString a3tph.textState a3tph.textPregnant2 set filename to CreateString -1 "kil_womb10fetus2.dds" 1 1 ;Pregnant3 elseif (state == 130) copyString a3tph.textState a3tph.textPregnant3 set filename to CreateString -1 "kil_womb10fetus3.dds" 1 1 else printC "TamagoPlayerHUD:Unknown womb state (%.0f) for %n.", state, actor setString a3tph.textState "???" set filename to CreateString -1 "kil_heartcircle.dds" 1 1 endIf DebugPrint "TamagoPlayerHud:Updating %n. Womb state is %.0f.", actor, state ; stringCat a3tph.textMessage a3tph.textCommon a3tph.textSpacing a3tph.textState stringIns a3tph.textState a3tph.textMessage ; hudT_Text a3tph.hudTPlayer a3tph.textMessage 1 setHudT a3tph.hudTPlayer a3tph.textMessage a3tph.fontName 1 a3tph.fontHeight a3tph.fontWidth a3tph.fontWeight a3tph.fontItalic 192 192 192 a3tph.fontFormat hudT_Text a3tph.hudTPlayerShadow a3tph.textMessage 1 ;Visual HUD addon StringIns basepath filename HudS_Tex a3tph.hudSPlayer filename 1 ;Check sperm effect if (player.GetItemCount a4tcSperm) HudS_Opac a3tph.hudSPlayerCircle 100 if(a3tph.vfxCycle < 1 || a3tph.vfxCycle > 13) let a3tph.vfxCycle := 1 else let a3tph.vfxCycle += 1 endif set filename to CreateString -1 0 1 1 set tempstring to CreateString -1 "spermvfx\kil_spermcircle_" 1 1 IntToString filename a3tph.vfxCycle StringIns tempstring filename StringIns basepath filename set tempstring to CreateString -1 ".dds" 1 1 StringCat filename tempstring ; StringMsg filename 1 HudS_Tex a3tph.hudSPlayerCircle filename 1 else HudS_Opac a3tph.hudSPlayerCircle 0 endif sv_Destruct cycletitle end If there are any unnecessary lines or checks that I could strip out, or better ways to handle the strings, I'd really appreciate the the help.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.