Script for Cell

Post » Tue Jan 19, 2016 7:56 pm

Is it possible to write a script for a cell? Or some way to make Morrowind's scripting engine behave in a similar way? I'm trying to make a cell in which the player will die unless they are equipped with certain pieces of armor - originally an idea for a seafloor-style dungeon. If possible, the idea that the player would receive a message about water pressure being fatal would be ideal, but not necessary. If anyone can do this, I'll find some way to honor them in the cell. *crosses his heart* Anyone able to help? My ability to script is virtually nil.

User avatar
Laura Cartwright
 
Posts: 3483
Joined: Mon Sep 25, 2006 6:12 pm

Post » Tue Jan 19, 2016 7:00 pm

Everything you ask can be done, efficiency depends mostly on things being unique:


needed details:


armor piece id(s)? are they unique?



[EDIT]a very simple idea:


make a constant enchantment with a fake effect (e.g. 1 point feather) cdaPressureResistance for the armore piece(s),


and put a local scripts on something e.g. an invisible activator with mesh used for sounds



begin cdaPressureScript

if (player->GetSpellEffects "cdaPressureResistance" )
MessageBox "Pressure resistance detected"
endif

end
User avatar
Horror- Puppe
 
Posts: 3376
Joined: Fri Apr 13, 2007 11:09 am

Post » Tue Jan 19, 2016 12:30 pm

You just need to make a script and attach to an object that's placed inside the cell you want to modify.


This example script would kill the player if he's not wearing full glass armor:



begin cdaPressureScript

float timer

if ( timer < 1.5 ); check equipment every 1.5 seconds
set timer to ( timer + GetSecondsPassed )
return
endif
set timer to 0

if ( player->HasItemEquipped glass_boots == 0 )
elseif ( player->HasItemEquipped glass_bracer_left == 0 )
elseif ( player->HasItemEquipped glass_bracer_right == 0 )
elseif ( player->HasItemEquipped glass_cuirass == 0 )
elseif ( player->HasItemEquipped glass_greaves == 0 )
elseif ( player->HasItemEquipped glass_helm == 0 )
elseif ( player->HasItemEquipped glass_pauldron_left == 0 )
elseif ( player->HasItemEquipped glass_pauldron_right == 0 )
else; player has full set equipped, do nothing
return
endif

; kill player if not wearing the equipment
MessageBox "full set not equipped!"
player->setHealth 0

end
User avatar
Madison Poo
 
Posts: 3414
Joined: Wed Oct 24, 2007 9:09 pm

Post » Tue Jan 19, 2016 12:16 pm

Thank you so much. I really appreciate this like you wouldn't believe!

User avatar
jodie
 
Posts: 3494
Joined: Wed Jun 14, 2006 8:42 pm


Return to III - Morrowind