Quote from LotBlind:
Do you feel like studying another weird effect?
Sure.
/* Potion's effect is to reduce gravity on the imbiber to 50%. Also reduces movement speed by 50%, keeping jump distance about the same. Only supported for player-character imbiber. */ BEGIN_SCRIPT(LoGravPotion,TimedPotion) METHODS: METHOD void PotionEffect(object imbiber, boolean start) { if(!Object.InheritsFrom(imbiber,Object.Named("Avatar"))) return; if(start) { vector vel; // Arrest downward velocity by 50%. If you'd been at 50% // gravity all along, you'd actually only be at 30% less // velocity at the same depth (a factory of 1/root(2)). // This will then tend to encourage use of the potion in // mid-fall, which sounds like fun. -TJS Physics.GetVelocity(imbiber,vel); if(vel.z<0) vel.z/=2; Physics.SetVelocity(imbiber,vel); DrkInv.AddSpeedControl("LoGrav",0.5,1.0); Physics.SetGravity(imbiber,0.50); } else { Physics.SetGravity(imbiber,1.00); DrkInv.RemoveSpeedControl("LoGrav"); } } END_SCRIPT(LoGravPotion)
STDMETHOD(SetVelocity)(object obj, const vector ref vel) { // Setting velocities from scripts wants to be initially clear from the // effects of friction, so we break all contacts. cPhysModel *pModel = g_PhysModels.GetActive(obj); if (pModel) { for (int i=0; i<pModel->NumSubModels(); i++) { pModel->DestroyAllTerrainContacts(i); DestroyAllObjectContacts(obj, i, pModel); } } PhysSetVelocity(obj, (mxs_vector*)&vel); return S_OK; }
if (pModel1->IsRopeClimbing() && pModel1->GetClimbingObj() == objID2) BreakClimb(objID1, FALSE, TRUE); else if (pModel2->IsRopeClimbing() && pModel2->GetClimbingObj() == objID1) BreakClimb(objID2, FALSE, TRUE);
const long kVisibilityUpdateRate = 200; void AIUpdateVisibility(ObjID objId) { Assert_(IsAPlayer(objId)); sAIVisibility * pVisibility = AIGetVisibility(objId); int timeSinceLast = (pVisibility) ? AIGetTime() - pVisibility->updateTime : 0; if (!pVisibility || timeSinceLast > kVisibilityUpdateRate) { ...
Property.Set(self,"AI_Visibility","Level",0); Property.Set(self,"AI_Visibility","Light rating",0); Property.Set(self,"AI_Visibility","Movement rating",0); Property.Set(self,"AI_Visibility","Exposure rating",0);
// note that this will need to be converted to milliseconds for the property float time=GetTime(); integer timeout=8600; if(Property.Possessed(self,"ScriptTiming")) timeout=Property.Get(self,"ScriptTiming"); if(!Object.HasMetaProperty(imbiber,invis)) Object.AddMetaProperty(imbiber,invis); // Postdate the property so as to disable updates Property.Set(imbiber,"AI_Visibility","Last update time", integer(time*1000)+timeout);