Hello pawbuj,
Alternatively with LeGo ConsoleCalls you can register new marvin console command, for example 'set routine', which will change routine of NPC in your focus:
Code:
func string CC_SetRoutine (var string newRtn) {
var oCNPC her; her = Hlp_GetNPC (hero);
if (!Hlp_Is_oCNpc (her.focus_vob)) { return "No NPC in focus."; };
//Hmmm seems like parameter has extra leading space
newRtn = STR_Trim (newRtn, " ");
var C_NPC npc; npc = _^ (her.focus_vob);
NPC_ClearAIQueue (npc);
AI_StandUp (npc);
Npc_ExchangeRoutine (npc, newRtn);
AI_ContinueRoutine (npc);
//0x006C6C10 public: class zSTRING __thiscall oCNpc_States::GetRoutineName(void)
const int oCNpc_States__GetRoutineName_G1 = 7105552;
//0x0076E180 public: class zSTRING __thiscall oCNpc_States::GetRoutineName(void)
const int oCNpc_States__GetRoutineName_G2 = 7790976;
//Here we have inconsistency with class declaration in G1/G2A - different naming, so we have to work with offset instead
//oCNpc.state_vfptr // 0x0470
//oCNpc.state_vtbl // 0x0588
var int ptr; ptr = _@ (npc);
var int offset; offset = MEMINT_SwitchG1G2 (1136, 1416);
CALL_RetValIszString ();
CALL__thiscall (ptr + offset, MEMINT_SwitchG1G2 (oCNpc_States__GetRoutineName_G1, oCNpc_States__GetRoutineName_G2));
var string curRtn; curRtn = CALL_RetValAszstring ();
//Function above returns routine in full format: RTN_ & routineName & _ID
//In order to compare routines, we have to convert our newRtn to correct format as well
newRtn = ConcatStrings ("RTN_", newRtn);
newRtn = ConcatStrings (newRtn, "_");
newRtn = ConcatStrings (newRtn, IntToString (npc.ID));
var string msg;
if (Hlp_StrCmp (newRtn, curRtn)) {
msg = "Done. New routine: ";
msg = ConcatStrings (msg, newRtn);
return msg;
};
msg = ConcatStrings ("Routine ", newRtn);
msg = ConcatStrings (newRtn, " does not exist.");
return msg;
};
func void CC_SetRoutine_Init () {
CC_Register (CC_SetRoutine, "set routine", "Change NPC routine.");
};
Couple of notes:
You need latest Ikarus & LeGo.
Make sure you initialize your LeGo package with flag LeGo_ConsoleCommands.
Call CC_SetRoutine_Init from your Init_Global function.
You will need STR_Trim function from mud-freaks ScriptBin strings.d package:
https://forum.worldofplayers.de/foru...1#post25717007
Usage:
activate marvin
get NPC into your focus
type in console (F2) new routine name (for example for Diego in G1):
set routine PRESTART