View unanswered posts | View active topics It is currently Wed Feb 08, 2012 9:05 pm



Welcome
Welcome to the Dragon Captions forum

You are currently viewing our boards as a guest, which gives you limited access to view most discussions and access our other features. By joining our free community, you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content, and access many other special features. In addition, registered members also see less advertisements. Registration is fast, simple, and absolutely free, so please, join our community today!


Reply to topic  [ 1 post ] 
 Otellino's Simulations Tutorial 
Author Message
Journeyman
User avatar

Joined: Sun Feb 15, 2009 8:34 pm
Posts: 86
Has thanked: 0 time
Have thanks: 0 time
Post Otellino's Simulations Tutorial
Hello Everyone!

I have figured out (mostly) how to work with Simulation machines, so I thaught i'd share my knowledge!

Il Explain in steps

(This is me assuming you DONT have Operation: Anchorage and is fairly experianced with the GECK)

Step 1:

Make duplicates of the following:

- MQ04PlayerPodActivator (World Objects/Activators)
- MQ04TranquillityPodPLAYER (World Objects/Furniture)

Give both objects different names. EG For the Activator, "MySimulationPodShell" and for the chair, "MySimulationPodChair"

Note: The activativator is the part that opens/closes while the furniture is the seat.

Step 2: Remove the scripts assigned to the objects

Step 3: The Script (Hard Part)

Before I continue, this might get realy complicated, and if you dont know much about scripts, you head will most likely pop...

Right, first lets start with the script for the activator.

First, navigate to "MySimulationPodShell" (the activator).

Double click on it, and in its menu, click on the "..."

Now, il copy/paste its script here and talk you through it.

---SCRIPT STARTS HERE---

ScriptName RCSimPodSCRIPT

short OpenState


Begin OnActivate
if IsActionRef player == 1

if ( Player.GetEquipped RCSimSuit == 1 )
if ( OpenState == 0 )
if ( IsAnimPlaying backward == 0 )
PlayGroup Forward 1
Set OpenState to 1
Activate
endif
endif

else
ShowMessage RCNoSuitWarningMSG
endif
endif

endif
End

---SCRIPT ENDS HERE---

Ok, let me explain it;

1st part

"ScriptName RCSimPodSCRIPT

short OpenState" --> This is the first bit, containing the name, and its variable. !!!THE VARIABLE IS IMPORTANT!!!

In "ScriptName", you put your script name. Name yours.. Lets Say "MyPodShellSCRIPT" The capitals arent necesary, it just makes it easier to read.

2nd Part:

"Begin OnActivate
if IsActionRef player == 1

if ( Player.GetEquipped RCSimSuit == 1 )
if ( OpenState == 0 )
if ( IsAnimPlaying backward == 0 )
PlayGroup Forward 1
Set OpenState to 1
Activate
endif
endif"

"Begin OnActivate" is a needed begin block, it makes it so that the script only starts when you activate the object. So you need this.

"If IsActionRef player == 1" Means, "when the player activates" which is needed, it would be odd if a NPC just used it and hogged your simulation, wouldnt it?

Ok, now:

if ( Player.GetEquipped RCSimSuit == 1 ) --> Optional, it checks if the player is wearing a object I want, if you want him to wear anything, just ignore it.
if ( OpenState == 0 ) --> Remember the Variable? this is where it comes in handy, it makes shure it wont keep opening when you activate it, even if it already open, so is needed.
if ( IsAnimPlaying backward == 0 ) --> This checks if its closed, so that when you activate it, it will open, so is needed.
PlayGroup Forward 1 --> This makes it open, so is nececary.
Set OpenState to 1 -->This updates the Variable, its hard to explain, but it IS needed.
Activate --> It again makes shure it opens.
endif
endif"

3rd Part:

else
ShowMessage RCNoSuitWarningMSG -->Needed if the suit you want the player to be wearing isnt on, also, you will need to create a custom message for it.
endif
endif
End

Step 4: Assign the script to the activator, and hit ok. (make shure you save, remember, the GECK is buggy)

Step 5: Before the script for the chair, we need to create a quest. I assume you already know how to, I called mine "RCSimVariables". Make a script for it, and put the following:

short PlayerInChair
short GetUpGo
short AnimSetup
short IModTrigger
float ChairTimer

The "Short" are variables that handle certain things in the animations and the "Float" is a timer, so it dosent teleport you as soon as you touch the thing. Save the script (remember, save it as "Quest" not "Object") and save your mod.


Step 6:
Now here comes the REALLY hard part!

The script for the chair (dont know why it needs to be so hard... but it is...)

Right, Navigate to the chair, (remember, its in the furniture) Select it, click on the "..." and create the script. Like before, il post the script, and explain it.

----SCRIPT STARTS HERE---

ScriptName RCSimChairScript




Begin OnActivate

if IsActionRef player == 1



if ( Player.GetEquipped RCSimSuit == 1 ) --> Remember, its optional, put it only if you want the player to wear a certain outfit
if ( RCSimPodREF.IsAnimPlaying Backward == 1 ) --> Makes shure the Pod's shell is open
return
else
Activate --> Makes the player enter the chair
endif
endif
if ( Player.GetSitting == 0 ) --> If he isnt sitting yet, dont do anything
; do nothing
else
Activate
endif
else
ShowMessage RCNoSuitWarningMSG --> Again, optional, it warns the player if he isnt wearing the wanted outfit, remember, you need to make the custom message
endif
endif

End


Begin GameMode

;Check for player sitting in chair



if ( RCSimVariables.PlayerInChair == 0 ) --> A variable to see if the player is sitting to start the timer
if ( Player.GetSitting == 3 ) --> checks what sitting state the player is in. "3" means sitting.
if ( Player.GetDistance RCSimChairREF < 100 ) --> To see how close the player is to the pod.

;if he is, update RCSimVariables.PlayerInChair and start a timer as the pod animation plays



Player.ResetHealth
Player.RemoveSpell WithdrawalAlcohol
Player.RemoveSpell WithdrawalAntNectar
Player.RemoveSpell WithdrawalBuffout
Player.RemoveSpell WithdrawalJet
Player.RemoveSpell WithdrawalMentats
Player.RemoveSpell WithdrawalMorphine
Player.RemoveSpell WithdrawalPsycho
Player.RemoveSpell WithdrawalQuantumNukacola
Player.RemoveSpell MS09WithdrawalUltraJet
NOTE: the RemoveSpell is to remove the addictions of the player while in the simulation.
Set Generic.Addicted to 0 --> Again, to make shure he is addicted to nothing
player.RestoreAV RadiationRads 1000 --> Removes the player's radiation
DisablePlayerControls --> So the Player dosent slip out of the seat
PlaySound OBJPodSimClose2D --> Sound Effect
RCSimPodREF.Playgroup Backward 1 --> Makes the Pod Shell close
set RCSimVariables.ChairTimer to 14 --> Makes the timer start
RCSimPodREF.PlaySound OBJTranquilityLanePodClose2D --> More sound effects (makes it sound realistic)
Set RCSimVariables.GetUpGo to 1 --> Another variable, to be honest, i dont know why it has this, but it dosent seem to work well without it
SetQuestDelay RCSimVariables 0.05 --> again I dont know why it has this, but it dosent seem to work well without it
Set RCSimVariables.AnimSetup to 1 --> To show the animations are working
set RCSimVariables.PlayerInChair to 1 --> To show the player is in the seat
endif
endif
endif
endif



;when timer is done, update RCSimVariablesSCRIPT.PlayerInChair

if ( RCSimVariables.PlayerInChair == 1 )
if ( RCSimVariables.IModTrigger == 0 )
if ( RCSimVariables.ChairTimer <= 3 ) --> Theese 3 make shure the variables are in the right values to set up the fade to white.
iMod MQ04PodFadetoWhiteISFX --> This is the effect to make the player's vision fade to white
set RCSimVariables.IModTrigger to 1 --> Sets the variable to show the fade has happened
else
set RCSimVariables.ChairTimer to ( RCSimVariables.ChairTimer - GetSecondsPassed ) --> I dont really know why i need this, but it wont work without it
endif
elseif ( RCSimVariables.IModTrigger == 1 ) --> I dont really know why i need this, but it wont work without it

if ( RCSimVariables.ChairTimer > 0 ) --> This is where it will log the ammount of seconds that have past
set RCSimVariables.ChairTimer to ( RCSimVariables.ChairTimer - GetSecondsPassed ) --> Logs the ammount of seconds passed since the whole activation
elseif ( RCSimVariables.ChairTimer <= 0 ) --> I dont know why this is here either, but il update once i find out more
Set RCSimVariables.PlayerInChair to 2 --> Updates the variable just before the player gets teleported to the siulation area
Player.MoveTo RCSimCapitolBuildingPlayerMarker --> Where the player is teleported to (Xmarker Heading)
Player.RemoveAllItems RCSimPlayerObjectBoxREF --> Places the players belongings in a box, as I want him to have objects given to him by the simulation.
Player.AddItem RCSimArmorPowerT51b 1
Player.EquipItem RCSimArmorPowerT51b 1
Player.AddItem RCSimArmorPowerT51bHelmet 1
Player.EquipItem RCSimArmorPowerT51bHelmet 1 --> Theese AddItem/EquipItem are the items I want the player to start with
EnablePlayerControls 1 --> Will allow the player to move.
endif
endif
endif
End

---SCRIPT ENDS HERE---

Gosh, painful, wasnt it?

Hit save, apply the script to the chair, and save your mod. Place the chair and Pod Shell (which is the activator) in the right positions, and there you go!

Il now post the full "Un-Edited" script for you to see. If you want, you can Copy/Paste it into your mod to use, but id much rather you understand it just a little, even tough I havent fully understood it yet.

---THE UN-EDITED SCRIPT COMES NOW---

ScriptName RCSimChairScript

;Placed on DLC02SimChair in cell
;handles animations for player sitting in chair
;as well as updating quest variables for getting into sim

float ChairTimer
short IModTrigger

Begin OnActivate

if IsActionRef player == 1

;If Player isn't in the suit, have the Outcast NPC comment on it
;otherwise allow activation of the chair


if ( Player.GetEquipped RCSimSuit == 1 )
if ( DLC02SimActivatorREF.IsAnimPlaying Backward == 1 )
return
else
Activate
endif
else
DLC02SpecialistOlinREF.SayTo Player DLC02OlinPodWarning

endif
if ( Player.GetSitting == 0 )
; do nothing
else
Activate
endif
else
DLC02SpecialistOlinRef.SayTo Player DLC02OlinPodWarning
endif
endif

End


Begin GameMode

;Check for player sitting in chair



if ( RCSimVariables.PlayerInChair == 0 )
if ( Player.GetSitting == 3 )
if ( Player.GetDistance RCSimChairREF < 100 )

;if he is, update RCSimVariables.PlayerInChair and start a timer as the pod animation plays



Player.ResetHealth
Player.RemoveSpell WithdrawalAlcohol
Player.RemoveSpell WithdrawalAntNectar
Player.RemoveSpell WithdrawalBuffout
Player.RemoveSpell WithdrawalJet
Player.RemoveSpell WithdrawalMentats
Player.RemoveSpell WithdrawalMorphine
Player.RemoveSpell WithdrawalPsycho
Player.RemoveSpell WithdrawalQuantumNukacola
Player.RemoveSpell MS09WithdrawalUltraJet
Set Generic.Addicted to 0
player.RestoreAV RadiationRads 1000
DisablePlayerControls
PlaySound OBJPodSimClose2D
RCSimPodREF.Playgroup Backward 1
set RCSimVariables.ChairTimer to 14
RCSimPodREF.PlaySound OBJTranquilityLanePodClose2D
Set RCSimVariables.GetUpGo to 1
SetQuestDelay RCSimVariables 0.05
Set RCSimVariables.AnimSetup to 1
set RCSimVariables.PlayerInChair to 1
endif
endif
endif
endif



;when timer is done, update RCSimVariablesSCRIPT.PlayerInChair
LC02OA1 quest script takes over from here (could be a delay of a second or two before script fires off)

if ( RCSimVariables.PlayerInChair == 1 )
if ( RCSimVariables.IModTrigger == 0 )
if ( RCSimVariables.ChairTimer <= 3 )
iMod MQ04PodFadetoWhiteISFX
set RCSimVariables.IModTrigger to 1
else
set RCSimVariables.ChairTimer to ( RCSimVariables.ChairTimer - GetSecondsPassed )
endif
elseif ( RCSimVariables.IModTrigger == 1 )

if ( RCSimVariables.ChairTimer > 0 )
set RCSimVariables.ChairTimer to ( RCSimVariables.ChairTimer - GetSecondsPassed )
elseif ( RCSimVariables.ChairTimer <= 0 )
Set RCSimVariables.PlayerInChair to 2
Player.MoveTo RCSimCapitolBuildingPlayerMarker
Player.RemoveAllItems RCSimPlayerObjectBoxREF
Player.AddItem RCSimArmorPowerT51b 1
Player.EquipItem RCSimArmorPowerT51b 1
Player.AddItem RCSimArmorPowerT51bHelmet 1
Player.EquipItem RCSimArmorPowerT51bHelmet 1
EnablePlayerControls 1
endif
endif
endif
End

---UN-EDITED SCRIPT FINISHES HERE---

You may see some mention of the DLC in here, it is because my mod uses the "Anchorge.ESM", so this tutorial was a bit of a pain, as I had to substitute some things with the vanilla objects.

If you find something confusing, PLEASE PM me, i want to try to make this tutorial as easy to understand as possible, no matter how hard it is...

_________________
Image The Italian Annoyance Image

"Be nice to nerds, chances are, you'll end up working for one!" ~ Bill Gates


Tue Feb 24, 2009 11:04 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
suspicion-preferred