How do I get an Actors Base ID by script in real time?

Post » Thu Feb 27, 2014 2:55 am

Hi,

I have started work on a rather complex project but progress so far is very good. I am trying to make a 2-Player Online mod.

So far I have managed to synch the second players position and the direction he is facing and before I try to synch character stats I would like to try mob synch.

Here is my question:

For mob synch I would like to send the base IDs of the 1st players NPCs to the second player who then spawns them based on the ID given. But how do I retrieve a Base ID from an Actor or in general an Object?

Here is the part of code that I'm talking about:

;this is the part of the script which retireves all NPCs in the cell and does something with them.;PlayerREF1 is the first player (Actor);Sending the Base IDs will not happen in papyrus but an external hooked program.Cell playerCell = PlayerREF1.getParentCell()int iNumRefint iRef iNumRef = playerCell.getNumRefs(43)Debug.notification(iNumRef)iRef = 0while iRef < iNumRef     Actor aNPC = playerCell.getNthRef(iRef, 43) as Actor        If  aNPC != PlayerREF1           ;NOW RETRIEVE THE NPCS BASE ID AND STORE IT INTO AN INT!         EndIf       iRef += 1endWhile

Could anyone help me out here? Hopefully it is not as obvious as i think it is ^^ Thank you very much!

User avatar
luis ortiz
 
Posts: 3355
Joined: Sun Oct 07, 2007 8:21 pm

Return to V - Skyrim