Scripting help please

Post » Fri Dec 24, 2010 1:15 am

Basically, I'm creating the Vita-Chambers from Bioshock. I've got a suitable model, I just need a script that will heal the player a few points when they enter (Or activate) the chamber and then shut the chamber down. Is this possible? Could I just pull the script from Zeta?

Thanks in advance! ^_^
User avatar
m Gardner
 
Posts: 3510
Joined: Sun Jun 03, 2007 8:08 pm

Post » Thu Dec 23, 2010 2:56 pm

I dont think this would be too hard. If you want it to happen when the player walks into the chamber then you could use a Trigger. If you want the player to activate something you could use a script with an "OnActivate" condition. Unfortunatly other than that I cant help you. I havnt done anything like this before. Sorry.
User avatar
Bethany Watkin
 
Posts: 3445
Joined: Sun Jul 23, 2006 4:13 pm

Post » Thu Dec 23, 2010 7:49 pm

Here is some basic template. replace < > with actual editor id and you should be okay.

scn vitaChamberScript   short usedOnce   Begin OnActivate Player  ;** Change to OnTriggerEnter Player if you are using trigger instead of activation approach.     if usedOnce == 0         if Player.GetHealthPercentage < 1.0 ;*** If Player has less than 100% health.              set usedOnce to 1 ;**** Once it is used, it is no longer usable.              Player.RestoreAV Health (20 + GetRandomPercent % 30) ;*** Heal random amount 20-50 HP.                         imod  ;*** if you want to make it similar to one from Zeta.                                                       ;*** This is a visual effect that makes screen to get blur with color.              showMessage ; **** pop the message that player is healed.         else              showMessage  ;**** pop the message if player already has 100% health.          endif       endif    end

User avatar
Jennifer Munroe
 
Posts: 3411
Joined: Sun Aug 26, 2007 12:57 am

Post » Fri Dec 24, 2010 12:50 am

Here is some basic template. replace < > with actual editor id and you should be okay.


That's perfect! Works great too! Thanks a bunch! ^_^
User avatar
Nitol Ahmed
 
Posts: 3321
Joined: Thu May 03, 2007 7:35 am

Post » Thu Dec 23, 2010 11:08 pm

Okay, so I thought it worked but it actually didn't. :S

I'm getting an error "SCRIPTS: 'VitaChamberScript', Line 8, Missing parameter Amount. Compiled script not saved!

Here's the script:

scn VitaChamberScript     short usedOnce    Begin OnTriggerEnter Player  ;** Change to OnTriggerEnter Player if you are using trigger instead of activation approach.      if usedOnce == 0          if Player.GetHealthPercentage < 1.0 ;*** If Player has less than 100% health.               set usedOnce to 1 ;**** Once it is used, it is no longer usable.               Player.RestoreAV Health (20 + GetRandomPercent % 30) ;*** Heal random amount 20-50 HP.                          imod CGCameraFlashISFX ;*** if you want to make it similar to one from Zeta.                                                        ;*** This is a visual effect that makes screen to get blur with color.               showMessage ; **** pop the message that player is healed.          else               showMessage  ;**** pop the message if player already has 100% health.           endif        endif     end


Line 8 is this line: "Player.RestoreAV Health (20 + GetRandomPercent % 30) ;*** Heal random amount 20-50 HP.". What's wrong with it?
User avatar
Vincent Joe
 
Posts: 3370
Joined: Wed Sep 26, 2007 1:13 pm

Post » Thu Dec 23, 2010 4:21 pm

1) try another variable to deal with 20-50 heal amount.

2) you have to create messages in Misc -> Messages and use that editor id instead of


scn VitaChamberScript     short usedOnce    short healAmount   Begin OnTriggerEnter Player  ;** Change to OnTriggerEnter Player if you are using trigger instead of activation approach.      if usedOnce == 0          if Player.GetHealthPercentage < 1.0 ;*** If Player has less than 100% health.               set usedOnce to  ;**** Once it is used, it is no longer usable.               set healAmount to (GetRandomPercent % 30) ; 0 to 29              Player.RestoreAV Health (healAmount + 20) ;*** Heal random amount 20-49 HP.                          imod CGCameraFlashISFX ;*** if you want to make it similar to one from Zeta.                                                        ;*** This is a visual effect that makes screen to get blur with color.               showMessage ; **** pop the message that player is healed.          else               showMessage  ;**** pop the message if player already has 100% health.           endif        endif     end

User avatar
Holli Dillon
 
Posts: 3397
Joined: Wed Jun 21, 2006 4:54 am

Post » Thu Dec 23, 2010 2:20 pm

Thanks for the message thing, I thought it looked a bit odd. :)

I'm still getting the "Missing Parameter Amount" on line 10:

Player.RestoreAV Health (healAmount + 20) ;*** Heal random amount 20-49 HP.


When I remove the brackets I get "Expected end of line".
User avatar
Janeth Valenzuela Castelo
 
Posts: 3411
Joined: Wed Jun 21, 2006 3:03 am

Post » Thu Dec 23, 2010 6:41 pm

The geck scripting language is not a real programming language. You cannot use expressions as arguments to functions. Try this:

set healamount to (GetRandomPercent % 30) + 20
player.restoreav health healamount

Are you sure that you want "if Player.GetHealthPercentage < 1.0"? If it is a percentage, you may want to compare against 100 not 1.
User avatar
!beef
 
Posts: 3497
Joined: Wed Aug 16, 2006 4:41 pm

Post » Thu Dec 23, 2010 10:36 pm

The geck scripting language is not a real programming language. You cannot use expressions as arguments to functions. Try this:

set healamount to (GetRandomPercent % 30) + 20
player.restoreav health healamount

Are you sure that you want "if Player.GetHealthPercentage < 1.0"? If it is a percentage, you may want to compare against 100 not 1.

GetHealthPercentage returns 0-1
User avatar
jessica sonny
 
Posts: 3531
Joined: Thu Nov 02, 2006 6:27 pm

Post » Fri Dec 24, 2010 3:40 am

set HealAmount to 20 + GetRandomPercent * 30 / 100

Try that one, let me know how it turns out.


- Ark
User avatar
C.L.U.T.C.H
 
Posts: 3385
Joined: Tue Aug 14, 2007 6:23 pm

Post » Fri Dec 24, 2010 3:07 am

http://geck.gamesas.com/index.php/GetRandomPercent returns 0-99. Multiplying by 30 is probably not correct. http://geck.gamesas.com/index.php/GetHealthPercentage does not return 0-99 as pointed out by rickerhk. The functions are not named consistently.
User avatar
Krystal Wilson
 
Posts: 3450
Joined: Wed Jan 17, 2007 9:40 am


Return to Fallout: New Vegas