Jump to content

[Script] How to set up a "yes/no" script? (Beginner, sorry)


Recommended Posts

Posted

Ok, think I got it...
hmm, think I figured it out.... Seems I was close right at the beginning, just missed a "==" instead of a "=" lol :D details....
(see below for the updated script). the question from my second post still stands tho. 

Can I somehow check if a mod event is active? Especially DHLP suspend?

 

Ok, I suspect this is dead easy for anybody who had a half decent basic education on the matter, but for me this seems impossible ^^
So I crawl here for help...

 

What I want:

- I want this Function to Check if "DHLP-suspend" is active or not.
If it is active, it should do nothing. 

If it is not active it should activate "DHLP-suspend" mod event

Please ignore the script technique, its not my script I m just altering it to improve it. 
To explain: This is a script that "links" different events in a mod (sex scenes, furniture capture etc) and I want to protect them from other mods interfering with them starting Sex Scenes in that period (killing everything in the process :))

Thank you already for giving me primary school lessons :D

DHLP = false 							;(this is the base condition before anything happens)

Function Immobilize(Bool value = true)			
	if libs.PlayerRef.IsSneaking()
		libs.PlayerRef.StartSneaking()
	endif
	if value
		libs.PlayerRef.StopCombat()
		libs.PlayerRef.StopCombatAlarm()						
	if 	DHLP = false				;(this should activate when the base condition is met)
		SendModEvent("dhlp-Suspend")								
		DHLP = true					;(this should change the base condition to prevent DHLP from stacking on top of each other)
	endif	
		libs.PlayerRef.PlayIdle(Poses[1])
		Game.SetPlayerAIDriven(true)
		Game.DisablePlayerControls(1, 1, 0, 0, 1, 1, 1, 1, 1)	
	else
		SendModEvent("dhlp-Resume")								
		DHLP = false				;(this should revert the DHLP condition back to the base state because it is no longer needed)
		Game.EnablePlayerControls()
		Game.SetPlayerAIDriven(false)
		libs.PlayerRef.PlayIdle(Poses[0])
	endif
EndFunction

 

 

EDIT:

hmm, think I figured it out.... Seems I was close right at the beginning, just missed a "==" instead of a "=" lol :D details....
 

bool DHLP = false

Function Immobilize(Bool value = true)			;NYMRA: this immobilizes the PC. Happens multiple times in different situations! searchword: qqq
	if libs.PlayerRef.IsSneaking()
		libs.PlayerRef.StartSneaking()
	endif
	if value
		if DHLP == false
		SendModEvent("dhlp-Suspend")
		Debug.Notification("NDUN dhlp ON")		;NYMRA -> avoid Sexlab starts
		DHLP = true
		endif
		libs.PlayerRef.StopCombat()
		libs.PlayerRef.StopCombatAlarm()						
		libs.PlayerRef.PlayIdle(Poses[1])
		Game.SetPlayerAIDriven(true)
		;Game.DisablePlayerControls(1, 1, 0, 0, 1, 0, 1, 0, 0)	;SAVE ORIG
		Game.DisablePlayerControls(1, 1, 0, 0, 1, 1, 1, 1, 1)	;NYMRA - avoids breaking out of furniture
	else
		SendModEvent("dhlp-resume")	
		Debug.Notification("NDUN dhlp OFF")		;NYMRA -> avoid Sexlab starts
		DHLP = false
		Game.EnablePlayerControls()
		Game.SetPlayerAIDriven(false)
		libs.PlayerRef.PlayIdle(Poses[0])
	endif
EndFunction

 

Posted

or maybe there is an easier by checking directly if the mod event is active? Sadly this is even more out of my scope I think and google did not yield any results :(

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...