Jump to content

Resurrecting a Robot


Nenquel

Recommended Posts

Hey there, the problem is:

 

I want to create a robot that work a little similar to rhonda from black mountain.

- It's broken at first

- When "looted/activated" a message says: "it's broken, wanna repair?"

- When repaired the robots supposed to stand up (its lying broken on the floor yet) and start a conversation.

 

I've been trying to understand the rhondaScript for days now, but I simply dont get it.

I got the robot with 0 health in the world dropped on the floor. When activated I can loot it, but I want to have the "wanna repair?" message instead..

 

PLEASE help me! Kudos waiting!

Link to comment
Share on other sites

I got the robot with 0 health in the world dropped on the floor. When activated I can loot it, but I want to have the "wanna repair?" message instead..

 

Have you tried setting it to one hp, and seeing if you could repair it then? Maybe it's spawning already dead...

Link to comment
Share on other sites

You need to have the robot have a script with an onactivate block that tells it to display a message.

 

Here's an example ( a rough one )

 

Don't set the robot's health to 0, make it something like 100

 

-----

 

short repairedstate

short button

short screennumber

 

begin onload

 

if repairedstate == 0

kill

endif

 

end

 

begin onactivate

 

if RepairedState == 0

 

if player.getav Science >= 60 ;science requirement

ShowMessage BMRhondaBrokenMsg ;make your own message

else

ShowMessage BMRhondaBrokenNoSkillMsg ;make your own failure message (<60 science)

endif

else

;nothing

endif

 

end

 

begin GameMode

 

Set Button to GetButtonPressed

 

if Button == 0

if ScreenNumber == 1

resurrect 0 ;resurrects it

;after this you add what you want it to do when it comes back to life, I'd either do...

;addscriptpackage "your dialogue package" (advanced)

;or

;startconversation player "your new topic (optional, if not put in it just says GREETING)" (simpler)

 

set RepairedState to 1

 

endif

 

set ScreenNumber to 0

elseif Button == 1

set ScreenNumber to 1

ShowMessage BMRhondaFixMsg ;make your own message

endif

 

end

 

----

 

not sure if it works, I just made it up from the Rhonda script

 

Dandys

Edited by Dandys
Link to comment
Share on other sites

You need to use OnActive. Here is a rundown of the script re written a bit to take out the stuff you won't need. The Rhonda script I believe is copied over from something else. There are variables declared and not used, some of the coding is done different from how I would do it.

 

******Declares the variables we will be using. 
int RepairedState	; 0 = Not repaired, 1 = Repaired

int Button
int ScreenNumber							; 0 = Default screen
									; 1 = Examine screen
									; 2 = Repair Examine
									; 3 = Science Examine

----------------------------------------------------------------------------
******Runs this when player clicks on Robot
begin onActivate

          **********Checks whether the Robot is repaired. 
if RepairedState == 0
              
	**********If Checks the players science skill
	if player.getav Science >= 60
                        *********Shows this message If you can repair with science skill
		ShowMessage RobotBrokenMsg
                *******or
	else
                       *************Shows this message if you don't have the skill
		ShowMessage RobotBrokenNoSkillMsg
                ******no more elses in repair skill check
	endif

        *******If Robot has already been repaired
else
             
               *******Check to see if Robot has been killed after being repaired
	if GetDead
                        ******I think this moves on to the inventory/loot screen
		Activate
              ****Or
	else 
		********Starts the conversation/dialog called RobotGreeting.
		StartConversation player RobotGreeting
               ******No more elses in the dead check
	endif

       **********No more elses in the is  repaired check 
endif

***********ends the on active
end

-----------------------------------------------------------------------
******This begins running after the you leave which ever msg you received before. 
begin GameMode

         ****Sets the Button Variable to the option you presses in the message. 
Set Button  to GetButtonPressed

       *******Checks to see if a button was pressed. Will also run if first selection is msg is picked.
if Button == 0								; Normally, do nothing
	       *****Checks to see if the Robot has been fixed. 
                      if ScreenNumber == 1						; If player fixed robot, make it happen
		******Resurrects the robots, renames it, moves it to a marker you set up, and gives it 500HP
                       RobotREF.resurrect 0
		RobotREF.SetActorFullName BMRhondaNameMsg
		RobotREF.MoveTo RobotResMarker
		RobotREF.setav Health 500

		************Sets your robot variable to a repaired  state, so you no longer get the fix messages above
                      set RobotREF.RepairedState to 1

               *******ends the screennumber 1 check
	endif	

            *********Sets screen back to 0 so that it isn't constantly reviving the robot/crashing your game
     set ScreenNumber to 0

       *********Checks to see if you had clicked the second button in the last message      
elseif Button == 1							; Fix Robot button
	************Sets screen number above so that the game goes to button 0 pressed, and Robot will resurect
               set ScreenNumber to 1
              ***********Shows a message that the Robot was fixed by your awesomness
	ShowMessage RobotFixMsg
*****Ends checking for button presses
      endif
********Ends your OnGamemode command
end

Edited by Interfer0
Link to comment
Share on other sites

Thank your for your quick replys!

 

I have been looking at this script for days now as well.

Could anyone tell me what

int Button

int ScreenNumber

and GetButtonPressed

are?

I understand most of this rhonda script (Kudos, Interfer0 for commenting it!), but I don't know how and where the player is able to alter Button or ScreenNumber.

Link to comment
Share on other sites

In the second part of the script the one that has Begin Gamemode. Any script that has Begin Gamemode causes the script to run whenever a menu, message, dialogue, or window is closed.

 

So When the first part of the script runs, it pops up the message box. So when you select the option by pressing one of the buttons it exits the first script. This causes the game world to come up, and Gamemode begins. It will immediately check which button was pressed. If the first button was selected the GetButtonPressed will return 0 this option is something like don't fix robot. If the second button is pressed the GetButtonPressed will return 1.

 

 

The Script sets the Button variable to be equal to GetButtonPressed. So in the question on whether you want to fix Robot or not you can either have a 0 or a 1, because your player only has two options to choose from.

 

 

So when the Player want to fix the robot they will select option 1, which is actually option two on your list.

When the player selects the option the window closes and runs gamemode. The Variable Button is set to 1, and is causes the variable ScreenNumber to be set to 1, and shows a message. You close this message, and the Gamemode begins again. This time GetButtonPressed is equal to 0 because there was only 1 option in the second message.

 

Button now = 0 so the first part of the script runs. Since ScreenNumber is 1, the Robotref is resurected and placed at your marker. Then the ScreenNumber is set back to 0.

 

GameMode is still running, and your gamemode script is still running but now GetButtonPressed and ScreenNumber are both set to 0, so it just keeps running with nothing changing the ScreenNumber variable any longer.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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