Jump to content

Little scripting help needed


mrslackpants

Recommended Posts

Heya.

 

I kinda suck at scripting. Like a lot... so i was wondering if someone could give me a little help. atm im trying to change some functionality of the infirmary. As it is now, you cna just use it over and over to remove all the rads and heal up and all that. What i would like is that you can just use the infirmary to remove all your rads.

 

I would like it to only remove a certain amount of rads every day or so. So for example you cna use it to remove 500 rads every day. I looked at the labtable script a bit, since it has similiar functionality, i still cant replicate the effect to infirmary. Also because with the lab table the whole table gets "locked" during it's cooldown period, which is what i dont want for the infirmary.

 

Anyone that can help me out ?

 

Default infirmary script:

scn HD00InfirmaryScript

short Done
short Button
short GoHeal

;Globals used here


begin OnActivate

if IsActionRef player == 1
	ShowMessage HD00InfirmaryMessage
	set GoHeal to 1
endif

end

begin gamemode

;This section of the gamemode block handles all of the button presses on the Laboratory kit

set Button to GetButtonPressed

if ( Button == 0 ) && ( GoHeal == 1 )
	Player.RestoreAV Health 1000000
	Showmessage HD00InfirmaryHealMessage
	Set GoHeal to 0
elseif ( Button == 1 ) && ( GoHeal == 1 )
	Player.RestoreAV perceptioncondition 100
	Player.RestoreAV endurancecondition 100
	Player.RestoreAV leftattackcondition 100
	Player.RestoreAV leftmobilitycondition 100
	Player.RestoreAV rightattackcondition 100
	Player.RestoreAV rightmobilitycondition 100
	Showmessage HD00InfirmaryLimbsMessage
	Set GoHeal to 0
elseif ( Button == 2 ) && ( GoHeal == 1 )
	player.RestoreAV RadiationRads 1000000
	Showmessage HD00InfirmaryRadsMessage
	Set GoHeal to 0
elseif ( Button == 3 ) && ( GoHeal == 1 )
	;Do nothing
	Set GoHeal to 0
endif

end

Link to comment
Share on other sites

So i've been looking over a few other sripts and i'm trying to get at least a basic srcipt functioning. So far no luck at all.

 

What i'm using so far is this, a simple 2 button message box. Button 1 and 2. Button 1 should either execute a radcleansing or should diplay a message that it's still on cooldown. Button 2 is a cancel button.

So what i have now is that the game should check in the "begin OnActivate" block how many gamedays hve passed since you last pressed button 1. And in the "begin GameMode" block it will actualy cleanse your radiation or show a message.

 

scn HD00InfirmaryScript

;================================
;Revised infirmary script
;Marvin Raymakers
;[email protected]
;================================

short WhichMessage
short Button
float InfCDPeriod0
short DoOnce

;================================

begin OnActivate

Set DoOnce to 1

If ( DoOnce == 1) && ( InfCDPeriod0 <= 0 )
	Set InfCDPeriod0 to 1
endif

if IsActionRef player == 1

	if ( GameDaysPassed - InfCDPeriod0 >= 1 )
		ShowMessage InfCDMessage
		Set WhichMessage to 1
	else
		Showmessage InfCDMessage	
		Set WhichMessage to 2
	endif
endif
end

;================================

begin gamemode

Set Button to GetButtonPressed

if ( Button == 0 ) && ( WhichMessage == 1 )
	player.RestoreAV RadiationRads 250
	Set InfCDPeriod0 to GameDaysPassed
	Showmessage InfMsgRadAway
	Set WhichMessage to 0
elseif ( Button == 0 ) && ( WhichMessage == 2 )
	ShowMessage InfMsgOnCD
	Set WhichMessage to 0
elseif ( Button == 1 ) && ( WhichMessage == 1 )
	Set WhichMessage to 0	
elseif ( Button == 1 ) && ( WhichMessage == 2 )
	Set WhichMessage to 0
endif

end

;================================

 

But i'm getting compile errors over these two lines:

 

if ( GameDaysPassed - InfCDPeriod0 >= 1 )

and

Set InfCDPeriod0 to GameDaysPassed

 

And i don't understand why. It's (fomm) complaining about compilation errors "Expected <local>|<global>|<number>|<function>"

 

Anyone got a clue what i'm doing wrong here?Cause as far as i can tell i declared my variables and all that.

Link to comment
Share on other sites

Umm... this compiles fine for me (once I created the three named messages).

 

Do you have the latest version of FOMM? And do you have the main Fallout 3 ESM open when you try to compile?

 

scn HD00InfirmaryScript
;================================
;Revised infirmary script
;Marvin Raymakers
;[email protected]
;================================

short WhichMessage
short Button

float InfCDPeriod0

short DoOnce

;================================

begin OnActivate

Set DoOnce to 1

If ( DoOnce == 1) && ( InfCDPeriod0 <= 0 )
Set InfCDPeriod0 to 1
endif

if IsActionRef player == 1
if ( GameDaysPassed - InfCDPeriod0 >= 1 )
ShowMessage InfCDMessage
Set WhichMessage to 1
else
Showmessage InfCDMessage
Set WhichMessage to 2
endif
endif

end

;================================

begin gamemode

Set Button to GetButtonPressed

if ( Button == 0 ) && ( WhichMessage == 1 )
player.RestoreAV RadiationRads 250
Set InfCDPeriod0 to GameDaysPassed
Showmessage InfMsgRadAway
Set WhichMessage to 0
elseif ( Button == 0 ) && ( WhichMessage == 2 )
ShowMessage InfMsgOnCD
Set WhichMessage to 0
elseif ( Button == 1 ) && ( WhichMessage == 1 )
Set WhichMessage to 0
elseif ( Button == 1 ) && ( WhichMessage == 2 )
Set WhichMessage to 0
endif

end

;================================

Link to comment
Share on other sites

Ah. I do have the latests version. But i dont have the main fallout esm open. Ill go do that right away. Thanks man. Ill let you know how it goes. :)

 

*Edit*

Ah man, thanks so much. It compiled and i tested it out, it does exacly what i had in mind. Hehe ... i can actualy script something .. now thats scary... :P

Link to comment
Share on other sites

So i've continued working on the script and i got it mostly like i want it to work, apart from one thing. I got 4 buttons, like the normal infirmary, but i need to press a button 3 times before it executes the command under that button. I can press the buttons in any random order, but the 3rd click is when it does something.

SO for example i can press 3 times on the "heal rads" button and only the thirth time it executes. Or i can click "Heal rads" "heal health" "heal health" and it will heal my health the last time i click that button. (basicly any button i click on the thirth time)

 

So it must be something in my script that is not entirely correct.

 

This is the code.

scn HD00InfirmaryScript

;================================
;Revised infirmary script
;Marvin Raymakers
;[email protected]
;================================

short Button
short CanUseRadCheck
short CanUseHealCHeck
short CanUseLimbCheck
float InfCDPeriod0	; Rads
float InfCDPeriod1	; Health
float InfCDPeriod2	; Limbs
short DoOnce

;================================

begin OnActivate

Set DoOnce to 1

If ( DoOnce == 1 ) && ( InfCDPeriod0 <= 0 )
	Set InfCDPeriod0 to 1
	Set InfCDPeriod1 to 1
	Set InfCDPeriod2 to 1
endif

if IsActionRef player == 1

	if ( GameDaysPassed - InfCDPeriod0 >= 1 )
		ShowMessage InfCDMessage
		Set CanUseRadCheck to 1
	else
		Showmessage InfCDMessage	
		Set CanUseRadCheck to 2
	endif

	if ( GameDaysPassed - InfCDPeriod1 >= 1 )
		ShowMessage InfCDMessage
		Set CanUseHealCHeck to 1
	else
		Showmessage InfCDMessage	
		Set CanUseHealCheck to 2
	endif

	if ( GameDaysPassed - InfCDPeriod2 >= 1 )
		ShowMessage InfCDMessage
		Set CanUseLimbCheck to 1
	else
		Showmessage InfCDMessage	
		Set CanUseLimbCheck to 2
	endif

endif
end

;================================

begin gamemode

Set Button to GetButtonPressed

if ( Button == 0 ) && ( CanUseHealCheck == 1 )
	Player.RestoreAV Health 250
	Set InfCDPeriod1 to GameDaysPassed
	Showmessage InfMsgHealHealth
	Set CanUseHealCheck to 0
elseif ( Button == 0 ) && ( CanUseHealCheck == 2 )
	ShowMessage InfMsgOnCD
	Set CanUseHealCheck to 0

elseif ( Button == 1 ) && ( CanUseLimbCheck == 1 )
	Player.RestoreAV perceptioncondition 100
	Player.RestoreAV endurancecondition 100
	Player.RestoreAV leftattackcondition 100
	Player.RestoreAV leftmobilitycondition 100
	Player.RestoreAV rightattackcondition 100
	Player.RestoreAV rightmobilitycondition 100
	Set InfCDPeriod2 to GameDaysPassed
	ShowMessage InfLimbMessage
	Set CanUseLimbCheck to 0
elseif ( Button == 1 ) && ( CanUseLimbCheck == 2 )
	ShowMessage InfMsgOnCD
	Set CanUseLimbCheck to 0

elseif ( Button == 2 ) && ( CanUseRadCheck == 1 )
	player.RestoreAV RadiationRads 250
	Set InfCDPeriod0 to GameDaysPassed
	Showmessage InfMsgRadAway
	Set CanUseRadCheck to 0
elseif ( Button == 2 ) && ( CanUseRadCheck == 2 )
	ShowMessage InfMsgOnCD
	Set CanUseRadCheck to 0

elseif ( Button == 3 ) 
	Set CanUseRadCheck to 0
	Set CanUseHealCheck to 0
	Set CanUseLimbCheck to 0
	
endif

end

;================================

 

I suspect the problem is the part in the "begin OnActivate" part, where i have 3 seperate if commands. Anyone an idea what i do wrong here? or how to fix it?

Link to comment
Share on other sites

Archived

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

  • Recently Browsing   0 members

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