Jump to content
IGNORED

Activator Script not working as intended


Recommended Posts

I can do this for Skyrim, but for the life of me, I can't seem to do it for Oblivion.

 

When the player clicks the Drinks Pitcher (an activator) it should pop a message

"What do you want to make?" "Cider, Grape Juice, Nothing"

It DOES that.

If you pick "Cider", it should find out if you have 2 apples + 1 Firesalt.  If you do, it should remove them from your inventory and add Cider.  If you don't, it should say "You don't have the stuff for that".

It does NOT

If you pick "Grape Juice" it should find out if you have 2 grapes + 1 Frostsalt.  If you do, it should remove them from your inventory and add Grape Juice.  If you don't, it should say "You don't have the stuff for that".

It does NOT

It also never allows the Drinks Pitcher to activate again.

 

I made the Activator - the Drinks Pitcher; I made the Cider (retextured Ale bottle, vanilla Ale icon); I made the Grape Juice (same).  At the moment, the pitcher, a bunch of apples, grapes, firesalts, and frostsalts, are all sitting on a table in an otherwise empty test cell.

 

I play-tested this with only Ob and SI loaded (well and OBSE) so I know there's no mod conflicts or anything.  The trouble, I am positive, is my script -- Even though the Construction Set saved and compiled it with no problem.

 

This is what I wrote:


 

Spoiler

 

ScriptName AllaDrinkScript
;Use the Drinks Pitcher to make Cider with 2 Apples + 1 FireSalts or Grape Juice with 2 Grapes + 1 FrostSalts
Short Choosing
Short Choice

Begin OnActivate
   Set Choosing to -1
     MessageBox "What do you want to make?", "Cider", "Grape Juice", "Nothing"
     Set Choosing to 1
     Set Choice to -1
End

Begin GameMode
   If (Choosing == 1)
     	If (Choice == -1) ;No choice yet
        	Set Choice to GetButtonPressed
		ElseIf (Choice == 0) ;Cider   
        		If (Player.GetItemCount Apple >= 2, Player.GetItemCount FireSalts >=1)
             		Player.RemoveItem Apple 2
             		Player.RemoveItem FireSalts 1
             		Player.AddItem AllaDrinkCider 1
        		ElseIf (Player.GetItemCount Apple < 2 Player.GetItemCount FireSalts<1)
             		MessageBox "You don't have the stuff for that."
			EndIf

		ElseIf (Choice == 1) ;Grape Juice   
        		If (Player.GetItemCount Grapes >= 2, Player.GetItemCount FrostSalts  >=1)
             		Player.RemoveItem Grapes 2
             		Player.RemoveItem FrostSalts 1
             		Player.AddItem AllaDrinkGrapeJuice 1
        		ElseIf (Player.GetItemCount Grapes < 2 Player.GetItemCount FrostSalts<1)
             		MessageBox "You don't have the stuff for that."
			EndIf
	EndIf ;Making stuff end

     	EndIf ;Choice block end
   EndIf ;Choosing block end
End

 

 

 

What have I done wrong or left out?

Edited by Allannaa
edited because appparently I can't spell Juize... Joice... JUICE dangit
Link to comment

Two points i notice:

endif - "EndIf ;Making stuff end" and the one above it looks to be duplicates.

 
If statements-
 (ref.- https://cs.elderscrolls.com/index.php?title=If)
 
example:
If (Player.GetItemCount Apple >= 2, Player.GetItemCount FireSalts >=1)
If Player.GetItemCount Apple >= 2 && Player.GetItemCount FireSalts >= 1
         
ElseIf (Player.GetItemCount Apple < 2 Player.GetItemCount FireSalts<1)
ElseIf Player.GetItemCount Apple < 2 || Player.GetItemCount FireSalts < 1

 

Mem

Link to comment
On 9/11/2021 at 8:20 AM, Allannaa said:

I can do this for Skyrim, but for the life of me, I can't seem to do it for Oblivion.

 

When the player clicks the Drinks Pitcher (an activator) it should pop a message

"What do you want to make?" "Cider, Grape Juice, Nothing"

It DOES that.

If you pick "Cider", it should find out if you have 2 apples + 1 Firesalt.  If you do, it should remove them from your inventory and add Cider.  If you don't, it should say "You don't have the stuff for that".

It does NOT

If you pick "Grape Juice" it should find out if you have 2 grapes + 1 Frostsalt.  If you do, it should remove them from your inventory and add Grape Juice.  If you don't, it should say "You don't have the stuff for that".

It does NOT

It also never allows the Drinks Pitcher to activate again.

 

I made the Activator - the Drinks Pitcher; I made the Cider (retextured Ale bottle, vanilla Ale icon); I made the Grape Juice (same).  At the moment, the pitcher, a bunch of apples, grapes, firesalts, and frostsalts, are all sitting on a table in an otherwise empty test cell.

 

I play-tested this with only Ob and SI loaded (well and OBSE) so I know there's no mod conflicts or anything.  The trouble, I am positive, is my script -- Even though the Construction Set saved and compiled it with no problem.

 

This is what I wrote:


 

  Reveal hidden contents

 

What have I done wrong or left out?

 

rewrite to your items and it will work, checked

 

scn aaaaaaaAllaDrinkScript

Short Choosing
Short Choice

Begin OnActivate
   Set Choosing to -1
     MessageBox "What do you want to make?", "Cider", "Grape Juice", "Nothing"
     Set Choosing to 1
     Set Choice to -1
End

 


Begin gamemode

   If (Choosing == 1)

            Set Choice to GetButtonPressed

;OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO

 

        if Choice == 0

         Set Choice to 8


                If Player.GetItemCount Gold001>0
                     Player.RemoveItem Apple 2
                     Player.RemoveItem FireSalts 1
                     Player.AddItem Gold001 10
                MessageBox "10"
                ElseIf Player.GetItemCount Gold001 <1
                     MessageBox "You don't have the stuff for that"
            EndIf
        endif


        if Choice == 1

         Set Choice to 8

                If Player.GetItemCount Gold001>0
                     Player.RemoveItem Grapes 2
                     Player.RemoveItem FrostSalts 1
                     Player.AddItem Gold001 1000
                MessageBox "1000"
                ElseIf Player.GetItemCount Gold001 <1
                     MessageBox "You don't have the stuff for that"
            EndIf
        EndIf ;
        

        if Choice>=0
                 Set Choosing to 0
        endif
;OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
    EndIf


End

 

Spoiler

 

Edited by TDA
Link to comment

Try

Spoiler


ScriptName AllaDrinkScript
;Use the Drinks Pitcher to make Cider with 2 Apples + 1 FireSalts or Grape Juice with 2 Grapes + 1 FrostSalts
Short Choosing
Short Choice
Short Working

 

Begin onActivate

If Working == 0
Set Choosing to 1
Set Working to 1
endif 
End

 

begin gameMode
 If ( Choosing == 0 )
    set working to 0
    return  
 Endif

 

if (Working == 1 && Choosing == 1) ;Display your menu
 MessageBox "What do you want to make?", "Cider", "Grape Juice", "Nothing"
       Set Choosing to 2
       Set Choice to -1
Elseif (Choosing == 2) ;Catch the player's decision
       If (Choice == -1) ;No choice yet
         Set Choice to GetButtonPressed

          return

 

       Elseif (Choice == 0)  ;Cider  
                If (Player.GetItemCount Apple >= 2 && Player.GetItemCount FireSalts >=1)
                     Player.RemoveItem Apple 2
                     Player.RemoveItem FireSalts 1
                     Player.AddItem AllaDrinkCider 1
                Else
                        set working to 0
                     MessageBox "You don't have the stuff for that."
                EndIf

 

       Elseif (Choice == 1)   ;Grape Juice  
                If (Player.GetItemCount Grapes >= 2 && Player.GetItemCount FrostSalts >=1)
                     Player.RemoveItem Grapes 2
                     Player.RemoveItem FrostSalts 1
                     Player.AddItem AllaDrinkGrapeJuice 1
                Else
                        set working to 0
                     MessageBox "You don't have the stuff for that."
                EndIf

 

       Elseif (Choice == 2)
                         ; nothing
       endif

 

      Set Choosing to 0 ;to finish up
      Set Working to 0
Endif

 

end

 

 

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...