Jump to content

NVSE - Calling NVSE functions inside a .dll plugin?


FiftyTifty

Recommended Posts

Righty, noob question time.

 

After trying to create a script which failed, that replaced all valid items in a cell with static variants, due to a bizarre bug where the scripting engine would suddenly stop moving and rotating the spawned statics, I figured I'd try doing it all within a single NVSE function that is called via a single line in a script.

 

But I can't wrap my head around how to call GetRefs from within my own NVSE plugin. Here's what I've got so far:

std::map<std::string, UInt32> mapFormTypes;

void FillmapFormTypes()
{
	mapFormTypes.insert(std::make_pair("Armor", 24));
	mapFormTypes.insert(std::make_pair("Book", 25));
	mapFormTypes.insert(std::make_pair("Ingredient", 29));
	mapFormTypes.insert(std::make_pair("Misc", 31));
	mapFormTypes.insert(std::make_pair("Weapon", 40));
	mapFormTypes.insert(std::make_pair("Ammo", 41));
	mapFormTypes.insert(std::make_pair("Ingestible", 47));
	mapFormTypes.insert(std::make_pair("Note", 49));
	mapFormTypes.insert(std::make_pair("WeaponMods", 103));
	mapFormTypes.insert(std::make_pair("CasinoChip", 108));
	mapFormTypes.insert(std::make_pair("FactionCurrency", 116));
}

void MultipleGetRefCalls()
{

	TESObjectREFR* refArmor[] = Cmd_GetRefs_Execute(mapFormTypes["Armor"], 1, false);

}

It doesn't seem to be called the same way you'd call any other public function. The following errors are thrown:

Error (active)	E0165	too few arguments in function call	aaafyty_items_to_statics		44	
Error (active)	E0520	initialization with '{...}' expected for aggregate object	aaafyty_items_to_statics	44	
Error (active)	E0167	argument of type "UInt32" is incompatible with parameter of type "ParamInfo *"	aaafyty_items_to_staticp	44	
Error (active)	E0167	argument of type "int" is incompatible with parameter of type "void *"	aaafyty_items_to_statics	44	

The function, when exposed to New Vegas' scripting engine, just requires three arguments; integer, integer, boolean. https://geckwiki.com/index.php?title=GetRefs

 

So why does passing three arguments to it throw an error?

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...