Preventing objects from moving

Post » Fri Nov 18, 2011 7:27 pm

Is there an easy way to keep a regular object, such as a weapon, from being moved by the player that acts like the "can't be moved" check box on books? Right now I have two weapons that I want to act sort of like the "sword in the stone" and can't be moved or picked up unless the player meets certain criteria (currently just a level check). I've come up with a script that kind of accomplishes this, but the first time the player strikes the object using their current weapon, it will quickly twitch to a 0,0,0 rotation before twitching back. It also doesn't seem very efficient.

Here's my current script:

ScriptName WTaxeSCPTshort pickup //this variable keeps track of whether the weapon has ever been placed in inventoryBegin OnLoad	if pickup == 0  //if the weapon hasn't been picked up yet		SetRigidBodyMass 0 //keeps it from moving by giving it no mass, preventing Havok from working with it.	else		SetRigidBodyMass 50  /*Gives it a regular mass so that it can be placed like                                        any other object after it's been "pulled" from the stone.                                       Bad things happen if this isn't done.*/	endifend Begin GameMode	if pickup == 0 /*keeps it from rotating to 0,0,0 and staying there after being struck by player's weapon if                         it hasn't been picked up yet.  Bad things happen if this is left out.*/		SetAngle y, 270		SetAngle z, 30	endifendBegin OnActivate	if player.GetLevel < 20 		Message "You are not yet worthy of this weapon."	else		Set pickup to 1		Activate	EndIfend


(And by "bad things happen if this is left out" I mean that if I fail to check to see if the weapon has been picked up yet and don't give it back a normal mass and/or stop it from rotating, it seems to screw up the clipping when the player removes the weapon from their inventory and places it back into the game world, resulting in the PC and the weapon melting through the floor.)
User avatar
Mark Churchman
 
Posts: 3363
Joined: Sun Aug 05, 2007 5:58 am

Post » Sat Nov 19, 2011 2:09 am

Hm, I don't thought about it yet - have enough problems myself yet, but it sounds interesting ...
perhaps I find a way in the answers, too, to hold weapons simply in a rack - it's disturbing:
you run against the rack and the weapons are littered on the floor - instead of taking them
could simply come the message: these are only for represantative purposes ... *fg*
only an unreflected thought so far^^
User avatar
Liv Staff
 
Posts: 3473
Joined: Wed Oct 25, 2006 10:51 pm


Return to IV - Oblivion