maxarturo Posted November 12, 2019 Share Posted November 12, 2019 (edited) This is kind of essential for the realistic aspect of the Quest/Story line. The rundown of the idea :Player equips a syringe and when close enough to the animals cows & goats in their enclosure (stable) he/she can extract blood from them.The blood is used for the construction of two special potions in a custom crafting furniture.The animals are 3 cows & 3 goats and the npc (vampire) how own the house are living in isolation and enclosure.The ability to construct those special potions is passed down to the player when he/she makes the house his/her own.* This works only with those animals/the animals in my mod (i don't want to edit or touch anything from vanilla game). Script analysis :Upon equipping the syringe (the script is not in the syringe) and close enough to the animals, the script will detect/track the living/dead state of each animal and according to the number and which animals are dead or alive (combination of live and dead animals) will give the corresponding blood quantity.Each cow gives 2 bottles of blood and the goats 1 bottle every 2 days.* Also by tracking the animals, if all animals are dead will give you the option to buy more animals. The issue :The script works just fine, but i'm looking for a way to make it smaller, the checking/tracking of the living/dead state of the animals.The script is tracking xMarkers that get disable/enable by the death of each animal, which each animal has its own xMarker Tracker.* The xMarkers Trackers are also used by another script in the same area.I'm using specific animals actors (reusing them) and not "Actor Base" to spawn actors because this would result on an even bigger script. The Tracking part of the script :* I have simplify it (and explain), so that it can be more easy to read. If actronaut == game.getPlayer() GoToState("Busy") If ( CowTrack01.IsDisabled() == False ) && ( CowTrack02.IsDisabled() == False ) && ( CowTrack03.IsDisabled() == False ) \ && ( GoatTrack01.IsDisable() == False ) && ( GoatTrack02.IsDisable() == False ) && ( GoatTrack03.IsDisable() == False ) 9 bottles - ALL ANIMALS RUN FUNCTION 01 ElseIf ( CowTrack01.IsDisabled() == False ) && ( CowTrack02.IsDisabled() == False ) && ( CowTrack03.IsDisabled() == False ) \ && ( GoatTrack01.IsDisable() == True ) && ( GoatTrack02.IsDisable() == True ) && ( GoatTrack03.IsDisable() == False ) 8 bottles - 3 Cows 2 Goats RUN FUNCTION 02 ElseIf ( CowTrack01.IsDisabled() == False ) && ( CowTrack02.IsDisabled() == False ) && ( CowTrack03.IsDisabled() == False ) \ && ( GoatTrack01.IsDisable() == False ) && ( GoatTrack02.IsDisable() == True ) && ( GoatTrack03.IsDisable() == True ) 8 bottles - 3 Cows 2 Goats RUN FUNCTION 02 ElseIf ( CowTrack01.IsDisabled() == False ) && ( CowTrack02.IsDisabled() == False ) && ( CowTrack03.IsDisabled() == False ) \ && ( GoatTrack01.IsDisable() == True ) && ( GoatTrack02.IsDisable() == False ) && ( GoatTrack03.IsDisable() == True ) 8 bottles - 3 Cows 2 Goats RUN FUNCTION 02 ElseIf ( CowTrack01.IsDisabled() == True ) && ( CowTrack02.IsDisabled() == False ) && ( CowTrack03.IsDisabled() == False ) \ && ( GoatTrack01.IsDisable() == False ) && ( GoatTrack02.IsDisable() == False ) && ( GoatTrack03.IsDisable() == False ) 7 bottles - 2 Cows 3 Goats RUN FUNCTION 03 ElseIf ( CowTrack01.IsDisabled() == False ) && ( CowTrack02.IsDisabled() == True ) && ( CowTrack03.IsDisabled() == False ) \ && ( GoatTrack01.IsDisable() == False ) && ( GoatTrack02.IsDisable() == False ) && ( GoatTrack03.IsDisable() == False ) 7 bottles - 2 Cows 3 Goats RUN FUNCTION 03 ElseIf ( CowTrack01.IsDisabled() == False ) && ( CowTrack02.IsDisabled() == False ) && ( CowTrack03.IsDisabled() == True ) \ && ( GoatTrack01.IsDisable() == False ) && ( GoatTrack02.IsDisable() == False ) && ( GoatTrack03.IsDisable() == False ) 7 bottles - 2 Cows 3 Goats RUN FUNCTION 03 ElseIf ( CowTrack01.IsDisabled() == False ) && ( CowTrack02.IsDisabled() == False ) && ( CowTrack03.IsDisabled() == False ) \ && ( GoatTrack01.IsDisable() == True ) && ( GoatTrack02.IsDisable() == True ) && ( GoatTrack03.IsDisable() == True ) 6 bottles - 3 Cows 0 Goats RUN FUNCTION 04 ElseIf ( CowTrack01.IsDisabled() == True ) && ( CowTrack02.IsDisabled() == False ) && ( CowTrack03.IsDisabled() == False ) \ && ( GoatTrack01.IsDisable() == True ) && ( GoatTrack02.IsDisable() == False ) && ( GoatTrack03.IsDisable() == False ) 6 bottles - 2 Cows 2 Goats RUN FUNCTION 04 ElseIf ( CowTrack01.IsDisabled() == True ) && ( CowTrack02.IsDisabled() == False ) && ( CowTrack03.IsDisabled() == False ) \ && ( GoatTrack01.IsDisable() == False ) && ( GoatTrack02.IsDisable() == True ) && ( GoatTrack03.IsDisable() == False ) 6 bottles - 2 Cows 2 Goats RUN FUNCTION 04 ElseIf ( CowTrack01.IsDisabled() == True ) && ( CowTrack02.IsDisabled() == False ) && ( CowTrack03.IsDisabled() == False ) \ && ( GoatTrack01.IsDisable() == False ) && ( GoatTrack02.IsDisable() == False ) && ( GoatTrack03.IsDisable() == True ) 6 bottles - 2 Cows 2 Goats RUN FUNCTION 04 ElseIf ( CowTrack01.IsDisabled() == False ) && ( CowTrack02.IsDisabled() == True ) && ( CowTrack03.IsDisabled() == False ) \ && ( GoatTrack01.IsDisable() == True ) && ( GoatTrack02.IsDisable() == False ) && ( GoatTrack03.IsDisable() == False ) 6 bottles - 2 Cows 2 Goats RUN FUNCTION 04 ElseIf ( CowTrack01.IsDisabled() == False ) && ( CowTrack02.IsDisabled() == True ) && ( CowTrack03.IsDisabled() == False ) \ && ( GoatTrack01.IsDisable() == False ) && ( GoatTrack02.IsDisable() == True ) && ( GoatTrack03.IsDisable() == False ) 6 bottles - 2 Cows 2 Goats RUN FUNCTION 04 ElseIf ( CowTrack01.IsDisabled() == False ) && ( CowTrack02.IsDisabled() == True ) && ( CowTrack03.IsDisabled() == False ) \ && ( GoatTrack01.IsDisable() == False ) && ( GoatTrack02.IsDisable() == False ) && ( GoatTrack03.IsDisable() == True ) 6 bottles - 2 Cows 2 Goats RUN FUNCTION 04 ElseIf ( CowTrack01.IsDisabled() == False ) && ( CowTrack02.IsDisabled() == False ) && ( CowTrack03.IsDisabled() == True ) \ && ( GoatTrack01.IsDisable() == True ) && ( GoatTrack02.IsDisable() == False ) && ( GoatTrack03.IsDisable() == False ) 6 bottles - 2 Cows 2 Goats RUN FUNCTION 04 ElseIf ( CowTrack01.IsDisabled() == False ) && ( CowTrack02.IsDisabled() == False ) && ( CowTrack03.IsDisabled() == True ) \ && ( GoatTrack01.IsDisable() == False ) && ( GoatTrack02.IsDisable() == True ) && ( GoatTrack03.IsDisable() == False ) 6 bottles - 2 Cows 2 Goats RUN FUNCTION 04 ElseIf ( CowTrack01.IsDisabled() == False ) && ( CowTrack02.IsDisabled() == False ) && ( CowTrack03.IsDisabled() == True ) \ && ( GoatTrack01.IsDisable() == False ) && ( GoatTrack02.IsDisable() == False ) && ( GoatTrack03.IsDisable() == True ) 6 bottles - 2 Cows 2 Goats RUN FUNCTION 04 ElseIf ( CowTrack01.IsDisabled() == True ) && ( CowTrack02.IsDisabled() == True ) && ( CowTrack03.IsDisabled() == False ) \ && ( GoatTrack01.IsDisable() == False ) && ( GoatTrack02.IsDisable() == False ) && ( GoatTrack03.IsDisable() == False ) 5 bottles - 1 Cow 3 Goats RUN FUNCTION 05 ElseIf ( CowTrack01.IsDisabled() == False ) && ( CowTrack02.IsDisabled() == True ) && ( CowTrack03.IsDisabled() == True ) \ && ( GoatTrack01.IsDisable() == False ) && ( GoatTrack02.IsDisable() == False ) && ( GoatTrack03.IsDisable() == False ) 5 bottles - 1 Cow 3 Goats RUN FUNCTION 05 ElseIf ( CowTrack01.IsDisabled() == True ) && ( CowTrack02.IsDisabled() == False ) && ( CowTrack03.IsDisabled() == True ) \ && ( GoatTrack01.IsDisable() == False ) && ( GoatTrack02.IsDisable() == False ) && ( GoatTrack03.IsDisable() == False ) 5 bottles - 1 Cow 3 Goats RUN FUNCTION 05 ElseIf ( CowTrack01.IsDisabled() == True ) && ( CowTrack02.IsDisabled() == False ) && ( CowTrack03.IsDisabled() == False ) \ && ( GoatTrack01.IsDisable() == True ) && ( GoatTrack02.IsDisable() == True ) && ( GoatTrack03.IsDisable() == True ) 4 bottles - 2 Cow 0 Goats RUN FUNCTION 06 ElseIf ( CowTrack01.IsDisabled() == False ) && ( CowTrack02.IsDisabled() == True ) && ( CowTrack03.IsDisabled() == False ) \ && ( GoatTrack01.IsDisable() == True ) && ( GoatTrack02.IsDisable() == True ) && ( GoatTrack03.IsDisable() == True ) 4 bottles - 2 Cow 0 Goats RUN FUNCTION 06 ElseIf ( CowTrack01.IsDisabled() == False ) && ( CowTrack02.IsDisabled() == False ) && ( CowTrack03.IsDisabled() == True ) \ && ( GoatTrack01.IsDisable() == True ) && ( GoatTrack02.IsDisable() == True ) && ( GoatTrack03.IsDisable() == True ) 4 bottles - 2 Cow 0 Goats RUN FUNCTION 06 ElseIf ( CowTrack01.IsDisabled() == False ) && ( CowTrack02.IsDisabled() == True ) && ( CowTrack03.IsDisabled() == True ) \ && ( GoatTrack01.IsDisable() == False ) && ( GoatTrack02.IsDisable() == False ) && ( GoatTrack03.IsDisable() == True ) 4 bottles - 1 Cow 2 Goats RUN FUNCTION 06 ElseIf ( CowTrack01.IsDisabled() == True ) && ( CowTrack02.IsDisabled() == False ) && ( CowTrack03.IsDisabled() == True ) \ && ( GoatTrack01.IsDisable() == False ) && ( GoatTrack02.IsDisable() == False ) && ( GoatTrack03.IsDisable() == True ) 4 bottles - 1 Cow 2 Goats RUN FUNCTION 06 ElseIf ( CowTrack01.IsDisabled() == True ) && ( CowTrack02.IsDisabled() == True ) && ( CowTrack03.IsDisabled() == False ) \ && ( GoatTrack01.IsDisable() == False ) && ( GoatTrack02.IsDisable() == False ) && ( GoatTrack03.IsDisable() == True ) 4 bottles - 1 Cow 2 Goats RUN FUNCTION 06 ElseIf ( CowTrack01.IsDisabled() == False ) && ( CowTrack02.IsDisabled() == True ) && ( CowTrack03.IsDisabled() == True ) \ && ( GoatTrack01.IsDisable() == True ) && ( GoatTrack02.IsDisable() == False ) && ( GoatTrack03.IsDisable() == False ) 4 bottles - 1 Cow 2 Goats RUN FUNCTION 06 ElseIf ( CowTrack01.IsDisabled() == True ) && ( CowTrack02.IsDisabled() == False ) && ( CowTrack03.IsDisabled() == True ) \ && ( GoatTrack01.IsDisable() == False ) && ( GoatTrack02.IsDisable() == True ) && ( GoatTrack03.IsDisable() == False ) 4 bottles - 1 Cow 2 Goats RUN FUNCTION 06 ElseIf ( CowTrack01.IsDisabled() == True ) && ( CowTrack02.IsDisabled() == True ) && ( CowTrack03.IsDisabled() == True ) \ && ( GoatTrack01.IsDisable() == False ) && ( GoatTrack02.IsDisable() == False ) && ( GoatTrack03.IsDisable() == False ) 3 bottles - 0 Cows 3 Goats RUN FUNCTION 07 ElseIf ( CowTrack01.IsDisabled() == False ) && ( CowTrack02.IsDisabled() == True ) && ( CowTrack03.IsDisabled() == True ) \ && ( GoatTrack01.IsDisable() == False ) && ( GoatTrack02.IsDisable() == True ) && ( GoatTrack03.IsDisable() == True ) 3 bottles - 1 Cows 1 Goats RUN FUNCTION 07 ElseIf ( CowTrack01.IsDisabled() == True ) && ( CowTrack02.IsDisabled() == False ) && ( CowTrack03.IsDisabled() == True ) \ && ( GoatTrack01.IsDisable() == False ) && ( GoatTrack02.IsDisable() == True ) && ( GoatTrack03.IsDisable() == True ) 3 bottles - 1 Cows 1 Goats RUN FUNCTION 07 ElseIf ( CowTrack01.IsDisabled() == True ) && ( CowTrack02.IsDisabled() == True ) && ( CowTrack03.IsDisabled() == False ) \ && ( GoatTrack01.IsDisable() == False ) && ( GoatTrack02.IsDisable() == True ) && ( GoatTrack03.IsDisable() == True ) 3 bottles - 1 Cows 1 Goats RUN FUNCTION 07 ElseIf ( CowTrack01.IsDisabled() == True ) && ( CowTrack02.IsDisabled() == True ) && ( CowTrack03.IsDisabled() == False ) \ && ( GoatTrack01.IsDisable() == True ) && ( GoatTrack02.IsDisable() == False ) && ( GoatTrack03.IsDisable() == True ) 3 bottles - 1 Cows 1 Goats RUN FUNCTION 07 ElseIf ( CowTrack01.IsDisabled() == True ) && ( CowTrack02.IsDisabled() == True ) && ( CowTrack03.IsDisabled() == False ) \ && ( GoatTrack01.IsDisable() == True ) && ( GoatTrack02.IsDisable() == True ) && ( GoatTrack03.IsDisable() == False ) 3 bottles - 1 Cows 1 Goats RUN FUNCTION 07 ElseIf ( CowTrack01.IsDisabled() == False ) && ( CowTrack02.IsDisabled() == True ) && ( CowTrack03.IsDisabled() == True ) \ && ( GoatTrack01.IsDisable() == True ) && ( GoatTrack02.IsDisable() == False ) && ( GoatTrack03.IsDisable() == True ) 3 bottles - 1 Cows 1 Goats RUN FUNCTION 07 ElseIf ( CowTrack01.IsDisabled() == False ) && ( CowTrack02.IsDisabled() == True ) && ( CowTrack03.IsDisabled() == True ) \ && ( GoatTrack01.IsDisable() == True ) && ( GoatTrack02.IsDisable() == True ) && ( GoatTrack03.IsDisable() == False ) 3 bottles - 1 Cows 1 Goats RUN FUNCTION 07 ElseIf ( CowTrack01.IsDisabled() == True ) && ( CowTrack02.IsDisabled() == True ) && ( CowTrack03.IsDisabled() == True ) \ && ( GoatTrack01.IsDisable() == True ) && ( GoatTrack02.IsDisable() == False ) && ( GoatTrack03.IsDisable() == False ) 2 bottles - 0 Cows 2 Goats RUN FUNCTION 08 ElseIf ( CowTrack01.IsDisabled() == True ) && ( CowTrack02.IsDisabled() == True ) && ( CowTrack03.IsDisabled() == True ) \ && ( GoatTrack01.IsDisable() == False ) && ( GoatTrack02.IsDisable() == True ) && ( GoatTrack03.IsDisable() == False ) 2 bottles - 0 Cows 2 Goats RUN FUNCTION 08 ElseIf ( CowTrack01.IsDisabled() == True ) && ( CowTrack02.IsDisabled() == True ) && ( CowTrack03.IsDisabled() == True ) \ && ( GoatTrack01.IsDisable() == False ) && ( GoatTrack02.IsDisable() == False ) && ( GoatTrack03.IsDisable() == True ) 2 bottles - 0 Cows 2 Goats RUN FUNCTION 08 ElseIf ( CowTrack01.IsDisabled() == False ) && ( CowTrack02.IsDisabled() == True ) && ( CowTrack03.IsDisabled() == True ) \ && ( GoatTrack01.IsDisable() == True ) && ( GoatTrack02.IsDisable() == True ) && ( GoatTrack03.IsDisable() == True ) 2 bottles - 1 Cows 0 Goats RUN FUNCTION 08 ElseIf ( CowTrack01.IsDisabled() == True ) && ( CowTrack02.IsDisabled() == False ) && ( CowTrack03.IsDisabled() == True ) \ && ( GoatTrack01.IsDisable() == True ) && ( GoatTrack02.IsDisable() == True ) && ( GoatTrack03.IsDisable() == True ) 2 bottles - 1 Cows 0 Goats RUN FUNCTION 08 ElseIf ( CowTrack01.IsDisabled() == True ) && ( CowTrack02.IsDisabled() == True ) && ( CowTrack03.IsDisabled() == False ) \ && ( GoatTrack01.IsDisable() == True ) && ( GoatTrack02.IsDisable() == True ) && ( GoatTrack03.IsDisable() == True ) 2 bottles - 1 Cows 0 Goats RUN FUNCTION 08 ElseIf ( CowTrack01.IsDisabled() == True ) && ( CowTrack02.IsDisabled() == True ) && ( CowTrack03.IsDisabled() == True ) \ && ( GoatTrack01.IsDisable() == False ) && ( GoatTrack02.IsDisable() == True ) && ( GoatTrack03.IsDisable() == True ) 1 bottles - 0 Cows 1 Goats RUN FUNCTION 09 ElseIf ( CowTrack01.IsDisabled() == True ) && ( CowTrack02.IsDisabled() == True ) && ( CowTrack03.IsDisabled() == True ) \ && ( GoatTrack01.IsDisable() == True ) && ( GoatTrack02.IsDisable() == False ) && ( GoatTrack03.IsDisable() == True ) 1 bottles - 0 Cows 1 Goats RUN FUNCTION 09 ElseIf ( CowTrack01.IsDisabled() == True ) && ( CowTrack02.IsDisabled() == True ) && ( CowTrack03.IsDisabled() == True ) \ && ( GoatTrack01.IsDisable() == True ) && ( GoatTrack02.IsDisable() == True ) && ( GoatTrack03.IsDisable() == False ) 1 bottles - 0 Cows 1 Goats RUN FUNCTION 09 ElseIf ( CowTrack01.IsDisabled() == True ) && ( CowTrack02.IsDisabled() == True ) && ( CowTrack03.IsDisabled() == True ) \ && ( GoatTrack01.IsDisable() == True ) && ( GoatTrack02.IsDisable() == True ) && ( GoatTrack03.IsDisable() == True ) 0 bottles - 0 Cows 0 Goats RUN FUNCTION 10 EndIf EndIfEndEventEndState I have the option to make the animals "essentials" which will make the script 1/20th of its size, but this will remove the realistic aspect of the idea. Plus you can always kill the animals with "console command" or other mods you might have instaled. If there isn't a better alternative, i would really appreciate if you would tell me your opinion whether i should keep it as is or make the animals essentials and removing the realistic aspect of it, and as a result smallering the script. Thank you very VERY MUCH !! for taking the time to read all this. Edited November 12, 2019 by maxarturo Link to comment Share on other sites More sharing options...
IsharaMeradin Posted November 12, 2019 Share Posted November 12, 2019 Why don't you just use an array or formlist for the animals? Check their status on a single pass and the first one that is enabled, extract the blood from that animal. Link to comment Share on other sites More sharing options...
maxarturo Posted November 12, 2019 Author Share Posted November 12, 2019 (edited) Why don't you just use an array or formlist for the animals? Check their status on a single pass and the first one that is enabled, extract the blood from that animal. Wouldn't this also have the same result, a big combination of Check/Track living-Dead animals for the corresponding "Give Blood" quantity ?. I been battling this idea for a couple of days now and in combination with the cold i'm going through my brain has become like a squeeze pie... not been able to think clear... Edited November 12, 2019 by maxarturo Link to comment Share on other sites More sharing options...
foamyesque Posted November 12, 2019 Share Posted November 12, 2019 Are you insistent on it being automatic? Because I think you could scrap a lot of the script if it was just an extra activation option. Link to comment Share on other sites More sharing options...
maxarturo Posted November 12, 2019 Author Share Posted November 12, 2019 Are you insistent on it being automatic? Because I think you could scrap a lot of the script if it was just an extra activation option. The same area (stable) has also another script running, but this one is a more simpler and smaller one, the option to milk the cows, that's why i'm using xMarkers Trackers, so that it can be use by both of the "Actions" (milk cows & extract blood). But now that you mention it "an extra activation option". By separating the "Extract Blood" in the controller script into two "States", one state for each group of animals, or separating the controller script in two scripts and adding two states in the syringe's "OnEquipped" script, i can reduce the Checking/Tracking by 95%, 95% less combinations of live/dead animals. Thanks for opening my eyes.. but i think i will have to wait until this cold goes away before working on this again, with a clear and healthy head !... Thank you both for your insights !! Link to comment Share on other sites More sharing options...
foamyesque Posted November 12, 2019 Share Posted November 12, 2019 I was thinking you'd just make a perk that'd add an extra activation option to all animals with a certain keyword if they're alive and you have the item equipped. Like how the Tower Stone operates, or alternatively you could use an Activation Override to straight up overwrite the default behaviour. Link to comment Share on other sites More sharing options...
maxarturo Posted November 12, 2019 Author Share Posted November 12, 2019 I was thinking you'd just make a perk that'd add an extra activation option to all animals with a certain keyword if they're alive and you have the item equipped. Like how the Tower Stone operates, or alternatively you could use an Activation Override to straight up overwrite the default behaviour. Thanks, i'll also consider looking into this. Link to comment Share on other sites More sharing options...
ReDragon2013 Posted November 12, 2019 Share Posted November 12, 2019 (edited) If you insist to your script code (you posted) try next tweaks.. "there is a light that never goes out" maxAnimalBloodScript Scriptname maxAnimalBloodScript extends ObjectReference ; https://forums.nexusmods.com/index.php?/topic/8140358-experienced-scriptermodder-helpopinion-required-looking-for-scripting-alternative/ ; xMarkers for three cows ObjectReference PROPERTY CowTrack01 auto ObjectReference PROPERTY CowTrack02 auto ObjectReference PROPERTY CowTrack03 auto ;xMarkers for three goats ObjectReference PROPERTY GoatTrack01 auto ObjectReference PROPERTY GoatTrack02 auto ObjectReference PROPERTY GoatTrack03 auto ; -- EVENTs -- ;============================== state Busy ;========= endState ;============================== state Waiting ;============ EVENT OnActivate(ObjectReference actronaut) IF (actronaut == Game.GetPlayer() as ObjectReference) ELSE RETURN ; - STOP - ENDIF ;--------------------- gotoState("Busy") ; ### STATE ### int i = myF_GetBottles() IF (i == 9) f_09() RETURN ; - STOP - 9 bottles - ALL ANIMALS ENDIF ;--------------------- IF (i == 8) f_08() RETURN ; - STOP - 8 bottles - 3 cows, 2 goats ENDIF ;--------------------- IF (i == 7) f_07() RETURN ; - STOP - 7 bottles - 2 cows, 3 goats ENDIF ;--------------------- IF (i == 6) f_06() RETURN ; - STOP - 6 bottles - (3 cows, 0 goats), (2 cows, 2 goats) ENDIF ;--------------------- IF (i == 5) f_05() RETURN ; - STOP - 5 bottles - 1 cow, 3 goats ENDIF ;--------------------- IF (i == 4) f_06() RETURN ; - STOP - 4 bottles - (2 cows, 0 goats), (1 cows, 2 goats) ENDIF ;--------------------- IF (i == 3) f_03() RETURN ; - STOP - 3 bottles - (0 cows, 3 goats), (1 cow, 1 goat) ENDIF ;--------------------- IF (i == 2) f_02() RETURN ; - STOP - 2 bottles - (0 cows, 2 goats), (1 cow, 0 goats) ENDIF ;--------------------- IF (i == 1) f_01() RETURN ; - STOP - 1 bottle - 0 cows, 1 goats ENDIF ;--------------------- f_00() ; 0 bottles - 0 cows, 0 goats ENDEVENT ;======= endState ; -- FUNCTIONs -- ;---------------------------- Int FUNCTION myF_GetBottles() ; internal ;---------------------------- ; Note: "Each cow gives 2 bottles of blood and the goats 1 bottle every 2 days." int i = myF_GetBX(CowTrack01, CowTrack02, CowTrack03) * 2 i = i + myF_GetBX(GoatTrack01, GoatTrack02, GoatTrack03) RETURN i ENDFUNCTION ;--------------------------------------------------------------------------------- Int FUNCTION myF_GetBX(ObjectReference o1, ObjectReference o2, ObjectReference o3) ; internal helper ;--------------------------------------------------------------------------------- bool bOK = o3.IsDisabled() int i IF o1.IsDisabled() ; ( GoatTrack01.IsDisabled() == True ) IF o2.IsDisabled() IF ( bOK ) i = 3 ; 3 - all (cow/goat) xmarkers disabled (1,2,3) ELSE i = 2 ; 2 - disabled (1,2) ENDIF ELSE IF ( bOK ) i = 2 ; 2 - disabled (1,3) ELSE i = 1 ; 1 - disabled (1) ENDIF ENDIF ELSE ; ( GoatTrack01.IsDisabled() == False ) IF o2.IsDisabled() IF ( bOK ) i = 2 ; 2 - disabled (2,3) ELSE i = 1 ; 1 - disabled (2) ENDIF ELSE IF ( bOK ) i = 1 ; 1 - disabled (3) ELSE i = 0 ; all (cow/goat) xmarkers enabled ENDIF ENDIF ENDIF RETURN i ENDFUNCTION FUNCTION f_00() ; FUNCTION 10 ENDFUNCTION FUNCTION f_01() ; FUNCTION 09 ENDFUNCTION FUNCTION f_02() ENDFUNCTION FUNCTION f_03() ENDFUNCTION FUNCTION f_04() ENDFUNCTION FUNCTION f_05() ENDFUNCTION FUNCTION f_06() ENDFUNCTION FUNCTION f_07() ENDFUNCTION FUNCTION f_08() ENDFUNCTION FUNCTION f_09() ; FUNCTION 01 ENDFUNCTION Edited November 12, 2019 by ReDragon2013 Link to comment Share on other sites More sharing options...
maxarturo Posted November 12, 2019 Author Share Posted November 12, 2019 (edited) If you insist to your script code (you posted) try next tweaks.. "there is a light that never goes out" maxAnimalBloodScript Scriptname maxAnimalBloodScript extends ObjectReference ; https://forums.nexusmods.com/index.php?/topic/8140358-experienced-scriptermodder-helpopinion-required-looking-for-scripting-alternative/ ; xMarkers for three cows ObjectReference PROPERTY CowTrack01 auto ObjectReference PROPERTY CowTrack02 auto ObjectReference PROPERTY CowTrack03 auto ;xMarkers for three goats ObjectReference PROPERTY GoatTrack01 auto ObjectReference PROPERTY GoatTrack02 auto ObjectReference PROPERTY GoatTrack03 auto ; -- EVENTs -- ;============================== state Busy ;========= endState ;============================== state Waiting ;============ EVENT OnActivate(ObjectReference actronaut) IF (actronaut == Game.GetPlayer() as ObjectReference) ELSE RETURN ; - STOP - ENDIF ;--------------------- gotoState("Busy") ; ### STATE ### int i = myF_GetBottles() IF (i == 9) f_09() RETURN ; - STOP - 9 bottles - ALL ANIMALS ENDIF ;--------------------- IF (i == 8) f_08() RETURN ; - STOP - 8 bottles - 3 cows, 2 goats ENDIF ;--------------------- IF (i == 7) f_07() RETURN ; - STOP - 7 bottles - 2 cows, 3 goats ENDIF ;--------------------- IF (i == 6) f_06() RETURN ; - STOP - 6 bottles - (3 cows, 0 goats), (2 cows, 2 goats) ENDIF ;--------------------- IF (i == 5) f_05() RETURN ; - STOP - 5 bottles - 1 cow, 3 goats ENDIF ;--------------------- IF (i == 4) f_06() RETURN ; - STOP - 4 bottles - (2 cows, 0 goats), (1 cows, 2 goats) ENDIF ;--------------------- IF (i == 3) f_03() RETURN ; - STOP - 3 bottles - (0 cows, 3 goats), (1 cow, 1 goat) ENDIF ;--------------------- IF (i == 2) f_02() RETURN ; - STOP - 2 bottles - (0 cows, 2 goats), (1 cow, 0 goats) ENDIF ;--------------------- IF (i == 1) f_01() RETURN ; - STOP - 1 bottle - 0 cows, 1 goats ENDIF ;--------------------- f_00() ; 0 bottles - 0 cows, 0 goats ENDEVENT ;======= endState ; -- FUNCTIONs -- ;---------------------------- Int FUNCTION myF_GetBottles() ; internal ;---------------------------- ; Note: "Each cow gives 2 bottles of blood and the goats 1 bottle every 2 days." int i = myF_GetBX(CowTrack01, CowTrack02, CowTrack03) * 2 i = i + myF_GetBX(GoatTrack01, GoatTrack02, GoatTrack03) RETURN i ENDFUNCTION ;--------------------------------------------------------------------------------- Int FUNCTION myF_GetBX(ObjectReference o1, ObjectReference o2, ObjectReference o3) ; internal helper ;--------------------------------------------------------------------------------- bool bOK = o3.IsDisabled() int i IF o1.IsDisabled() ; ( GoatTrack01.IsDisabled() == True ) IF o2.IsDisabled() IF ( bOK ) i = 3 ; 3 - all (cow/goat) xmarkers disabled (1,2,3) ELSE i = 2 ; 2 - disabled (1,2) ENDIF ELSE IF ( bOK ) i = 2 ; 2 - disabled (1,3) ELSE i = 1 ; 1 - disabled (1) ENDIF ENDIF ELSE ; ( GoatTrack01.IsDisabled() == False ) IF o2.IsDisabled() IF ( bOK ) i = 2 ; 2 - disabled (2,3) ELSE i = 1 ; 1 - disabled (2) ENDIF ELSE IF ( bOK ) i = 1 ; 1 - disabled (3) ELSE i = 0 ; all (cow/goat) xmarkers enabled ENDIF ENDIF ENDIF RETURN i ENDFUNCTION FUNCTION f_00() ; FUNCTION 10 ENDFUNCTION FUNCTION f_01() ; FUNCTION 09 ENDFUNCTION FUNCTION f_02() ENDFUNCTION FUNCTION f_03() ENDFUNCTION FUNCTION f_04() ENDFUNCTION FUNCTION f_05() ENDFUNCTION FUNCTION f_06() ENDFUNCTION FUNCTION f_07() ENDFUNCTION FUNCTION f_08() ENDFUNCTION FUNCTION f_09() ; FUNCTION 01 ENDFUNCTION Thanks ReDragon2013 for this. But this is what i was thinking in doing more or less, but in two separate controller scripts, one for each group of animals which will get activated according to the state in which the syringe's script is, so this way each controller script can run its own timer, you can only extract blood once every two days otherwise the animals die.As a result, reducing by 95% the tracking and making the script 95% smaller and lighter to run. * Also if you have another idea/proposal, i'm all ears !. Edited November 12, 2019 by maxarturo Link to comment Share on other sites More sharing options...
maxarturo Posted November 12, 2019 Author Share Posted November 12, 2019 (edited) foamyesqueI forgot to add that this is not an AUTOMATIC process (only the Tracking is), you are given the option/asked if you want to milk or extract and from which group of animals, you may choose to do nothing or only one of both or come later to do the other if one has already been choosen.It also gives you the option to completely DELETE this function/options from your game, the milking and extracting. Edited November 12, 2019 by maxarturo Link to comment Share on other sites More sharing options...
Recommended Posts