ProgMath2 Posted December 5, 2015 Share Posted December 5, 2015 (edited) Suddently noticed that my char became invincible. Mana and Fatigue goes down as they should, but Health stays full whatever I do: getting hit by sword, magic, my own spells, gas traps, etc...Tried to turn on-off TGM and con_TGM. Nothing changed.Tried to check my Active Effect list with a script - no unexpected effects found. What could it be? What characteristics can cause such a cheaty state? Edited December 5, 2015 by ProgMath2 Link to comment Share on other sites More sharing options...
ProgMath2 Posted December 6, 2015 Author Share Posted December 6, 2015 (edited) Found it. rItem.SetObjectHealth xThat line modifies player's HP, not rItem's base's. let rBase := rItem.GetBaseObject SetObjectHealth x rBaseAnd that two doesn't modify anything at all.Just beautiful. Edited December 6, 2015 by ProgMath2 Link to comment Share on other sites More sharing options...
forli Posted December 8, 2015 Share Posted December 8, 2015 (edited) Found it.rItem.SetObjectHealth xThat line modifies player's HP, not rItem's base's.let rBase := rItem.GetBaseObject SetObjectHealth x rBaseAnd that two doesn't modify anything at all.Just beautiful. SetObjectHealth works perfectly on me. In the first case, it doesn't work if rItem contains a base object. Player is an exception, as it's automatically converted to PlayerRef by the parser (if needed), so it can work both like a reference and a base object, unless you're creating a script which use the OBSE compiler override. In the second case, again, if rItem is a base object, the GetBaseObject command fails, so rBase remains 0/null and SetOBjectHealth receive a 0/null parameter. Edited December 8, 2015 by forli Link to comment Share on other sites More sharing options...
Surilindur Posted December 8, 2015 Share Posted December 8, 2015 Also, for some scripts, there will be messages printed to console about "error in script X", it seems, and reports about "trying to call something on a null reference or base object" if using OBSE. Those can sometimes help when trying to track errors. But I am not sure if they are always shown. Link to comment Share on other sites More sharing options...
ProgMath2 Posted December 8, 2015 Author Share Posted December 8, 2015 (edited) No-no-no. It isn't a base object. rItem is a good inventory ref.And yes, SetObjectHealth works for world ref. Edited December 8, 2015 by ProgMath2 Link to comment Share on other sites More sharing options...
forli Posted December 8, 2015 Share Posted December 8, 2015 Can you post here the script so we can take a look? Link to comment Share on other sites More sharing options...
ProgMath2 Posted December 9, 2015 Author Share Posted December 9, 2015 froliA have already rewritten the code and made it work with world reference, so there's no point to analyse it. I had a foreach cycle in container that ran for the proper items and called a function on each of them. The function created a cloned form if needed, and changed it's health to million. So my characer got a million of hp.Wait a minute.If I made a muddle at the point where I create a cloned form, I really could pass that new base object to setting health. Your supposition now looks quite possible.You said you used this function. Did you try it on inventory references? Setting a base object's health? Link to comment Share on other sites More sharing options...
forli Posted December 10, 2015 Share Posted December 10, 2015 So you had something like this? ForEach item <- Player If (<item must be altered for some reason>) item.SetObjectHealth 9999999 ; or something like that EndIf LoopThis should work AFAIK. CloneForm create a whole new base object, and changes to the clone's base shouldn't affect the original object, but this should not be used to clone actors.(Remember to store the result of the commnand: "set refVar to CloneForm originalObject") CreateFullActorCopy is similar to CloneForm and is specifically made to clone actors, but it also clone the base objects of scripted items (so it's neither a shallow nor a deep copy!).If you want a "shallow" copy of the actor (but not of his quest/scripted items), you should move all actor's items to a temporary container, clone the actor (which has no items, so nothing else will be cloned), give his items back and give the clone the same items (except for quest/scripted items).If you want a "deep" copy you need to duplicate all not quest/scripted items too. Link to comment Share on other sites More sharing options...
ProgMath2 Posted December 10, 2015 Author Share Posted December 10, 2015 (edited) I meant that I might had something like this foreach rItem <- rContainer if rItem.IsClonedForm rItem.SetObjectHealth 1000000 else let rBase := rItem.GetBaseObject let rItem := CloneForm rBase rItem.SetObjectHealth 1000000 ; that's it loop...except that there were a five more options aside from making it undestructible and other distracting stuff, like restoring a health percentage after fortifying. In that case your conjecture was true, and I am inattentive imbecile that can't understand his own script.Anyway, like I said, I've rewritten it without using a container. Now the target item is taken from Telekinesis spell, and the process looks quite lovely (although I suspect that it leaves a garbage of disabled basic items on the floor). Thanks for your help. It always useful to know your mistakes. Edited December 10, 2015 by ProgMath2 Link to comment Share on other sites More sharing options...
forli Posted December 10, 2015 Share Posted December 10, 2015 (edited) Do you clone objects every time you cast a telekinetic spell? That could cause a huge amount of bloat, as base objects (created by CloneForm) can't be destroyed (as opposed to references creates by Drop or PlaceAtMe)! Edited December 10, 2015 by forli Link to comment Share on other sites More sharing options...
Recommended Posts