ppl47 Posted September 4, 2017 Share Posted September 4, 2017 Hello everyone, I'm trying to get the baseID of an object ( the one in the Construction Set) but I keep getting instead the reference ID, the one given when the instance of the object is created in the world.My code is the following:Firstly, I set an event handler when the player equips something ( a weapon for example)SetEventHandler "OnActorEquip" aaFnPlayerEquip "ref"::PlayerThen i definde the eventhandler function as follows: scn aaFnPlayerEquip ref targetref itemref itemRef string_var idstring_var id2string_var id3 Begin Function {target, item} let itemRef := CreateTempRef item let id := GetEditorID itemRef let id2 := GetFormIDString itemRef let id3 := GetRawFormIDString itemRef Print "name = "+ $itemRef.GetName + " , editorId = " +$id +" , formID = " +$id2 +" , RawformID = " +$id3 EndDuring gameplay the message is correctly dispalyed but all of the entries are the same and equal to the reference ID . Im my specific case i get FF00216F but the weapon formID is 0003A85D ( i want to extract the latter) Link to comment Share on other sites More sharing options...
QQuix Posted September 4, 2017 Share Posted September 4, 2017 GetEditorID works only with cells and quests Use GetBaseObject e.g. let BaseID := itemRef.GetBaseObject Link to comment Share on other sites More sharing options...
ppl47 Posted September 5, 2017 Author Share Posted September 5, 2017 GetEditorID works only with cells and quests Use GetBaseObject e.g. let BaseID := itemRef.GetBaseObjectOk it worked! Thanks! Link to comment Share on other sites More sharing options...
ppl47 Posted September 5, 2017 Author Share Posted September 5, 2017 Anoter question: is there a way to get the "alias " of the item instead of the formiD? for example i need to extract MS31BlackwaterBlade20 instead of 0006B69A. Thank you again Link to comment Share on other sites More sharing options...
QQuix Posted September 5, 2017 Share Posted September 5, 2017 This 'alias' is called EditorID and it is only known by the Construction Set. Only EditorIDs of cells and quests go into the ESPs/ESMs. The others do not. But shademe has a RuntimeEditorIDs OBSE plugin that should do it. Link to comment Share on other sites More sharing options...
ppl47 Posted September 5, 2017 Author Share Posted September 5, 2017 This 'alias' is called EditorID and it is only known by the Construction Set. Only EditorIDs of cells and quests go into the ESPs/ESMs. The others do not. But shademe has a RuntimeEditorIDs OBSE plugin that should do it. Thank you again, i will give it a look. In my script i want to give a container an item knowing its editorID. The problem is that addItem doesnt accept its argument as a string. The code is something like this: let itemLevel := playerLevel - playerLevel%5 ;let itemIDName := "MS31BlackwaterBlade" +$itemLevel ; itemIDName is a string variable containing the name of the item, in this case is "MS31BlackwaterBlade10" for example chest.AddItem itemIDName 1<----- doesnt work In the wiki of additem it says that you can pass the reference of the editor item. I wonder if there is a function that given the editorID (hexagesimal) or the alias ("MS31BlackwaterBlade10") it returns the object reference, in order to give it to the additem function. Thanks again Link to comment Share on other sites More sharing options...
QQuix Posted September 5, 2017 Share Posted September 5, 2017 In a script the EditorID IS the Base Object FormID (the compiler converts the EditorID into the FormID - and that is why the EditorID is disposable thereafter) So you just code "chest.AddItem MS31BlackwaterBlade10 1" The WIKI text "You can use a reference variable as ObjectID and a short variable for count." means that you may do something like this, if you need to: int intCount ref refBase let intCount := 1 let refBase := MS31BlackwaterBlade10 chest.AddItem refBase intCount Link to comment Share on other sites More sharing options...
ppl47 Posted September 5, 2017 Author Share Posted September 5, 2017 In a script the EditorID IS the Base Object FormID (the compiler converts the EditorID into the FormID - and that is why the EditorID is disposable thereafter) So you just code "chest.AddItem MS31BlackwaterBlade10 1" The WIKI text "You can use a reference variable as ObjectID and a short variable for count." means that you may do something like this, if you need to: int intCount ref refBase let intCount := 1 let refBase := MS31BlackwaterBlade10 chest.AddItem refBase intCountThe code works. Now I'm trying to make it work coming from a string variable, with the function StringToRef provided by Pluggy but i'm missing something. int intCountref refBasestring_var BaseString let intCount := 1let BaseString := "MS31BlackwaterBlade10"let refBase := StringToRef BaseStringchest.AddItem refBase intCount <-------- doens't work Link to comment Share on other sites More sharing options...
QQuix Posted September 5, 2017 Share Posted September 5, 2017 Pluggy's StringToRef is the inverse of GetFormIdString. E.g. - " let refBase := StringToRef "0000000A" will set refBase to the FormID 00000A ( Lockpick. ) Except for RuntimeEditorIDs , the game does not know what the strings "MS31BlackwaterBlade10", "Lockpick" or "Gold" mean. Even RuntimeEditorIDs does not have a function to convert these strings to refs (From what I read in the docs - I`ve never used it myself). If you really must do this conversion, you may take a look at the scripts in my "Show EditorIDs in game". It is among my Conceptuals. It reads a conversion table from a pluggy text file. But it only have vanilla FormIDs. Link to comment Share on other sites More sharing options...
ppl47 Posted September 5, 2017 Author Share Posted September 5, 2017 Pluggy's StringToRef is the inverse of GetFormIdString. E.g. - " let refBase := StringToRef "0000000A" will set refBase to the FormID 00000A ( Lockpick. ) Except for RuntimeEditorIDs , the game does not know what the strings "MS31BlackwaterBlade10", "Lockpick" or "Gold" mean. Even RuntimeEditorIDs does not have a function to convert these strings to refs (From what I read in the docs - I`ve never used it myself). If you really must do this conversion, you may take a look at the scripts in my "Show EditorIDs in game". It is among my Conceptuals. It reads a conversion table from a pluggy text file. But it only have vanilla FormIDs.Basically what i'm trying to do is a mod in which a container receive a levelled item from thenplayer, compare its "level" with the one of the player and if lower switch the item in the container with the higher level version.For example , lets assume I complete the quest for Blackwater blade at level 1, then i will receive the item MS31BlackWaterBlade01 (formID = 00004C201). If i had done the quest later, lets say at level 14, i would have received MS31BlackWaterBlade10 (0006B698). Since I dont want to force myself to leave these quest at the end of my playthrough as well as dont use the console ( it breaks the gameplay) , I come up with the idea of this chest: you deposit you low level item and it switch it with a higher level version according to your level. In order to select the correct version, I need to compute its level ( by checking the last 2 chars fo its editor name , 01, in MS31BlackWaterBlade01) and the build the name of the newer version from the level of the player( if level 14 it will be "10" --> MS31BlackWaterBlade10).All of these calculation can be avoided by building several if statement and using the hexagesimal codes, but it would be longer , and I was trying to find a faster and more elegant way Link to comment Share on other sites More sharing options...
Recommended Posts