Difference between revisions of "Script: Mongen"
From Ultima Online: The Second Age
(Created page with " <span style="color:#0000FF">function</span> <span style="color:#0000FF">void</span> deactivate(<span style="color:#0000FF">obj</span> this) { <span style="color:#0000FF">...") |
|||
Line 3: | Line 3: | ||
<span style="color:#0000FF">if</span> ([[Engine Function:_hasObjVar|<span style="color:#FF0000;font-weight:bold">hasObjVar</span>]](this, <span style="color:#800000">"objectId"</span>) && [[Engine Function:_hasObjVar|<span style="color:#FF0000;font-weight:bold">hasObjVar</span>]](this, <span style="color:#800000">"objectType"</span>)) | <span style="color:#0000FF">if</span> ([[Engine Function:_hasObjVar|<span style="color:#FF0000;font-weight:bold">hasObjVar</span>]](this, <span style="color:#800000">"objectId"</span>) && [[Engine Function:_hasObjVar|<span style="color:#FF0000;font-weight:bold">hasObjVar</span>]](this, <span style="color:#800000">"objectType"</span>)) | ||
{ | { | ||
− | <span style="color:#0000FF">obj</span> objectId = [[ | + | <span style="color:#0000FF">obj</span> objectId = [[Engine Function:_getobjvar_obj|<span style="color:#FF0000;font-weight:bold">getobjvar_obj</span>]](this, <span style="color:#800000">"objectId"</span>); |
− | <span style="color:#0000FF">int</span> objectType = [[ | + | <span style="color:#0000FF">int</span> objectType = [[Engine Function:_getobjvar_int|<span style="color:#FF0000;font-weight:bold">getobjvar_int</span>]](this, <span style="color:#800000">"objectType"</span>); |
[[Engine Function:_deleteIfValid|<span style="color:#FF0000;font-weight:bold">deleteIfValid</span>]](objectId, objectType); | [[Engine Function:_deleteIfValid|<span style="color:#FF0000;font-weight:bold">deleteIfValid</span>]](objectId, objectType); | ||
[[Engine Function:_removeObjVar|<span style="color:#FF0000;font-weight:bold">removeObjVar</span>]](this, <span style="color:#800000">"objectId"</span>); | [[Engine Function:_removeObjVar|<span style="color:#FF0000;font-weight:bold">removeObjVar</span>]](this, <span style="color:#800000">"objectId"</span>); | ||
Line 22: | Line 22: | ||
<span style="color:#0000FF">if</span> ([[Engine Function:_hasObjVar|<span style="color:#FF0000;font-weight:bold">hasObjVar</span>]](this, <span style="color:#800000">"radius"</span>)) | <span style="color:#0000FF">if</span> ([[Engine Function:_hasObjVar|<span style="color:#FF0000;font-weight:bold">hasObjVar</span>]](this, <span style="color:#800000">"radius"</span>)) | ||
{ | { | ||
− | radius = [[ | + | radius = [[Engine Function:_getobjvar_int|<span style="color:#FF0000;font-weight:bold">getobjvar_int</span>]](this, <span style="color:#800000">"radius"</span>); |
} | } | ||
<span style="color:#0000FF">int</span> Q4F3 = 0x00; | <span style="color:#0000FF">int</span> Q4F3 = 0x00; | ||
<span style="color:#0000FF">if</span> ([[Engine Function:_hasObjVar|<span style="color:#FF0000;font-weight:bold">hasObjVar</span>]](this, <span style="color:#800000">"template"</span>)) | <span style="color:#0000FF">if</span> ([[Engine Function:_hasObjVar|<span style="color:#FF0000;font-weight:bold">hasObjVar</span>]](this, <span style="color:#800000">"template"</span>)) | ||
{ | { | ||
− | Q4F3 = [[ | + | Q4F3 = [[Engine Function:_getobjvar_int|<span style="color:#FF0000;font-weight:bold">getobjvar_int</span>]](this, <span style="color:#800000">"template"</span>); |
<span style="color:#0000FF">loc</span> location = [[Engine Function:_getLocation|<span style="color:#FF0000;font-weight:bold">getLocation</span>]](this); | <span style="color:#0000FF">loc</span> location = [[Engine Function:_getLocation|<span style="color:#FF0000;font-weight:bold">getLocation</span>]](this); | ||
<span style="color:#0000FF">obj</span> Q5BQ = [[Engine Function:_requestCreateNPCAt|<span style="color:#FF0000;font-weight:bold">requestCreateNPCAt</span>]](Q4F3, location, radius); | <span style="color:#0000FF">obj</span> Q5BQ = [[Engine Function:_requestCreateNPCAt|<span style="color:#FF0000;font-weight:bold">requestCreateNPCAt</span>]](Q4F3, location, radius); |
Revision as of 09:01, 19 October 2018
function void deactivate(obj this) { if (hasObjVar(this, "objectId") && hasObjVar(this, "objectType")) { obj objectId = getobjvar_obj(this, "objectId"); int objectType = getobjvar_int(this, "objectType"); deleteIfValid(objectId, objectType); removeObjVar(this, "objectId"); removeObjVar(this, "objectType"); processTriggerCmds(this, "d"); } return; }
trigger message("activate") { if (hasObjVar(this, "onlyOne")) { deactivate(this); } int radius = 0x03; if (hasObjVar(this, "radius")) { radius = getobjvar_int(this, "radius"); } int Q4F3 = 0x00; if (hasObjVar(this, "template")) { Q4F3 = getobjvar_int(this, "template"); loc location = getLocation(this); obj Q5BQ = requestCreateNPCAt(Q4F3, location, radius); int a = objtoint(Q5BQ); if (a != 0x00) { int objectType = getObjType(Q5BQ); setObjVar(this, "objectId", Q5BQ); setObjVar(this, "objectType", objectType); processTriggerCmds(this, "a"); } } else { bark(this, "Missing template objvar!"); } return (0x00); }
trigger message("deactivate") { deactivate(this); return (0x00); }