Jump to content

problem with menu message popping up by itself


stevie70

Recommended Posts

i'm having a weird issue with the pet from my mole's well mod:

the pet's controlled over a menu that's brought up by an onActivate player block only, but for some reason and at some occasions, this menu will for no apparent reason pop up by itself, and no matter how hard i try, i just can't figure out why, maybe anyone got any clue...?

i'm posting the whole script (which is quite lengthy) just to make sure, but there's only one single occasion where the menu is brought up, which is in the onActivate player block when the LilMoLife-variable is set to 1, and i just don't see what's wrong with that, so hlp pleeease... :-)

 

 

 

 

scn s7oMW01creaLilMoSCRIPT

int LilMoLife																							; 0: yet unhealed / 1: healed / 2: dead
int LilMoFollow																							; 0: unset / 1: free / 2: waiting / 3: following / 4: go spot / 5: stay spot / 6: stay snuffles
int LilMoSecretSpot																					; 0: unset / 1: set
int LilMoMenu																							; 0: menu closed / 1: menu open
int LilMoButton																							; pressed button in menues
int LilMoMemory																						; stores various temporary values


begin OnLoad
if LilMoLife == 0																					; if mo's not healed yet
	removeSpell RegenMed																		; 		make him sick
	set LilMoMemory to GetAV health															;
	set LilMoMemory to LilMoMemory -2														;
	DamageAV health LilMoMemory															;
	if s7oMW01actiLightSwitchMainREF.LightMainOn == 1								; 		if main lights are on
		s7oMW01lightGreenLilMoSickREF.enable 0										; 		turn mo's sick-light on as well
	endif																								;
s7oMW01creaLilMoSpotTokenREF.setScale 0												; 		prepare secret spot token
endif																									; --------------------------------------------------
s7oMW01creaLilMoREF.evp
end

begin OnActivate player
if LilMoLife == 0																					; if mo's not healed yet	
	ShowMessage s7oMW01creaLilMoMSGHeal											;		open heal menu
	if s7oMW01actiChemistrySetREF.ChemSetLilMoMedicine == 0					; 		check & enable medicine on chem set
		set s7oMW01actiChemistrySetREF.ChemSetLilMoMedicine to 1				;		
	endif 																								;
	set LilMoMenu to 1																			;
elseif LilMoLife == 1 																				; if mo's healed
	ShowMessage s7oMW01creaLilMoMSGMain											; 		open main menu
	set LilMoMenu to 1																			; 		
elseif LilMoLife == 2																				; if mo's dead
	activate																							;		loot
endif																									; --------------------------------------------------
end

begin GameMode
if LilMoMenu == 1
	set LilMoButton to GetButtonPressed
	if LilMoButton > -1 && LilMoLife == 0														; MENU s7oMW01creaLilMoMSGHeal	
		set LilMoMenu to 0																		;
		if LilMoButton == 0																		; MENU		heal
			removeNote s7oMW01actiLilMoRecipeNote									;
			player.removeItem s7oMW01miscLilMoMedicine 1							;
			set s7oMW01actiChemistrySetREF.ChemSetLilMoMedicine to 3			;		disable medicine on chemset	
			restoreAV health LilMoMemory														;		reset mo's health to normal
			addSpell RegenMed																	;
			set LilMoLife to 1																		;
			setDisposition player 100															;
			s7oMW01lightGreenLilMoSickREF.disable 1									;		disable mo's sick light
			if player.hasPerk AnimalFriend == 0												;		if player doesn't have animal friend perk
				player.addPerk AnimalFriend													;		reward it
				rewardkarma 33																	;
				rewardxp 33																		;
			elseif player.hasPerk AnimalFriend == 1											;		otherwise just reward more xp
				rewardkarma 66																	;
				rewardxp 66																		;
			endif																						;
			ShowMessage s7oMW01creaLilMoMSGPet									;		open pet-menu
			set LilMoMenu to 1																	;
		elseif LilMoButton == 1																	; MENU		kill
			s7oMW01creaLilMoREF.kill														; --------------------------------------------------
			set LilMoLife to 2																	
			rewardkarma -33																		
			ShowMessage s7oMW01creaLilMoMSGKilled									
		endif		

	elseif LilMoButton > -1 && LilMoLife == 1 && LilMoFollow == 0					; MENU s7oMW01creaLilMoMSGPet
		set LilMoMenu to 0																		;
		if LilMoButton == 0																		; MENU		keep
			set LilMoFollow to 3																	;
			s7oMW01creaLilMoREF.evp														;
			ShowMessage s7oMW01creaLilMoMSGJoined								;
		elseif LilMoButton == 1																	; MENU		set free
			set LilMoFollow to 1																	;
			s7oMW01creaLilMoREF.evp														;
			ShowMessage s7oMW01creaLilMoMSGGone									;
		elseif LilMoButton == 2																	; MENU		kill
			s7oMW01creaLilMoREF.kill														; --------------------------------------------------
			set LilMoLife to 2																	
			rewardkarma -33																		
			ShowMessage s7oMW01creaLilMoMSGKilled			
		endif

	elseif LilMoButton > -1 && LilMoLife == 1 && LilMoFollow > 0						; MENU s7oMW01creaLilMoMSGMain
		set LilMoMenu to 0																		;
		if LilMoButton == 0																		; MENU		wait
			set LilMoFollow to 2																	;
			s7oMW01creaLilMoREF.evp														;
			ShowMessage s7oMW01creaLilMoMSGWait									;
			Wait s7oMW01creaLilMoPackageFollow										;
		elseif LilMoButton == 1																	; MENU		unwait
			set LilMoFollow to 3																	;
			s7oMW01creaLilMoREF.evp														;
			ShowMessage s7oMW01creaLilMoMSGJoined								;
			if IsWaiting == 1																		;
				StopWaiting s7oMW01creaLilMoPackageFollow							;
			endif																						;
		elseif LilMoButton == 2																	; MENU		wait secret spot
			set LilMoFollow to 4																	;		send to secret spot token
			s7oMW01creaLilMoREF.evp														;
		elseif LilMoButton == 3																	; MENU		mark secret spot
			s7oMW01creaLilMoSpotTokenREF.moveto s7oMW01creaLilMoREF		;		move secret spot token to current location
			set LilMoSecretSpot to 1																;
			ShowMessage s7oMW01creaLilMoMSGRemember							;
		elseif LilMoButton == 4																	; MENU		set free
			set LilMoFollow to 1																	;
			s7oMW01creaLilMoREF.evp														;
			ShowMessage s7oMW01creaLilMoMSGGone									;
		elseif LilMoButton == 5																	; MENU		rejoin
			set LilMoFollow to 3																	; --------------------------------------------------
			s7oMW01creaLilMoREF.evp
			ShowMessage s7oMW01creaLilMoMSGJoined
		endif
	endif
endif
end

begin OnDeath
if IsKiller player == 1																					 
	rewardkarma -33
	ShowMessage s7oMW01creaLilMoMSGkilled
else
	ShowMessage s7oMW01creaLilMoMSGdead
endif
s7oMW01lightGreenLilMoSickREF.disable 0												; turn sick-light off in case mo wasn't healed yet
s7oMW01creaLilMoSpotTokenREF.markfordelete											; delete secret spot token
set LilMoMemory to player.GetItemCount s7oMW01miscLilMoMedicine			; check if player still has 
player.removeitem s7oMW01miscLilMoMedicine LilMoMemory						; mo-medicine or recipe
if GetHasNote s7oMW01actiLilMoRecipeNote == 1										; and remove it
	RemoveNote s7oMW01actiLilMoRecipeNote											; --------------------------------------------------	
endif
set LilMoLife to 2																				
end

 

 

Link to comment
Share on other sites

I see you have "onactivate player" which is correct. However, I seem to recall reading somewhere that the "player" part of that is ignored and anybody, such as another NPC, who activates the object will trigger this block. The geck wiki search function is still dead, and I don't have my example code around. But I seem to recall that I had this problem and I solved it by using plain "onactivate"; then inside the block, get the ref which caused the trigger, and if it is not the player then ignore it. Sorry for missing some details, but perhaps that will help "enough".
Link to comment
Share on other sites

I see you have "onactivate player" which is correct. However, I seem to recall reading somewhere that the "player" part of that is ignored and anybody, such as another NPC, who activates the object will trigger this block. The geck wiki search function is still dead, and I don't have my example code around. But I seem to recall that I had this problem and I solved it by using plain "onactivate"; then inside the block, get the ref which caused the trigger, and if it is not the player then ignore it. Sorry for missing some details, but perhaps that will help "enough".

aah yes, this really sounds like it should be it, because it indeed mostly happens with other npc's around. going to change the script accordingly, thx lots

 

edit: yes, this was it apparently, at least the issue didn't occur since i changed that.

maan, gonna have to go change quite some number of scripts with onActivate player blocks now...

Edited by stevie70
Link to comment
Share on other sites

  • Recently Browsing   0 members

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