Scripting help please!

Post » Thu May 12, 2011 12:49 am

I'm new to TES CS scripting, and I'm kind of having a problem here.
I'm scripting a compound splitter for my science lab mod for TES IV.
Here's my problem in a nutshell:
I made it so certain compounds needed different engine temperatures to be split. To raise the temperature, I made it so you need to bring Dark Matter to the engine. To lower the temperature, you need to bring liquid nitrogen coolant to the engine. Here's my script:
scn ScienceLabCompoundSplitterEngineref tempBegin OnActivate        if player.GetItemCount ScienceLabDarkMatter== 1        player.RemoveItem ScienceLabDarkMatter 1        Message "The engine temperature has increased by 300 degrees. The previous temperature was %.0f", temp, 7        set temp to +300        endif        if player.GetItemCount ScienceLabLiquidNitrogenCoolant== 1        player.RemoveItem ScienceLabLiquidNitrogenCoolant 1        Message "The engine temperature has decreased by 200 degrees. The previous temperature was %.0f", temp 7        set temp to -200        endif        if player.GetItemCount ScienceLabDarkMatter== 0 && player.GetItemCount ScienceLabLiquidNitrogenCoolant== 1        MessageBox "You need to either place Dark Matter or liquid nitrogen coolant in the engine to alter the temperature."        endifend

I added a barrel of Dark Matter, with the following script:
scn ScienceLabDarkMatterDispenserScriptBegin OnActivate    if player.GetItemCount ScienceLabDarkMatter== 1 && player.GetItemCount ScienceLabLiquidNitrogenCoolant== 0    Messagebox "Dark Matter is too heavy to carry more than one at a time."    endif    if player.GetItemCount ScienceLabDarkMatter== 0 && player.GetItemCount ScienceLabLiquidNitrogenCoolant== 1    MessageBox "Holding Dark Matter and liquid nitrogen coolant at the same time caused an explosion!"    player.kill    endif    if player.GetItemCount ScienceLabDarkMatter== 0 && player.GetItemCount ScienceLabLiquidNitrogenCoolant== 0    Message "You collect some dark matter from the barrel." 4    player.additem ScienceLabDarkMatter 1    endifend


When I tested it, I took Dark Matter out of the barrel, brought it to the engine, activated the engine, and everything worked fine. However, I went to get a second Dark Matter, but when I brought it to the engine, I activated the engine, and nothing happened! I removed the dark matter from my inventory and got some more, but the same thing happened! The same thing happens with liquid nitrogen coolant. It will work once, but not twice! I dont get it. Can somebody please help me?
User avatar
Ria dell
 
Posts: 3430
Joined: Sun Jun 25, 2006 4:03 pm

Post » Thu May 12, 2011 9:21 am

you said "set temp to +300." That sets the temp to 300. To make it 300 more than it already is, say "set temp to temp + 300." Be sure to have spaces between signs and numbers too.
User avatar
Euan
 
Posts: 3376
Joined: Mon May 14, 2007 3:34 pm

Post » Thu May 12, 2011 2:46 am

Thanks! Worked like a charm.
User avatar
Donald Richards
 
Posts: 3378
Joined: Sat Jun 30, 2007 3:59 am


Return to IV - Oblivion

cron