int nTeleportShowData; object objTeleport; #event_handler("QuickTeleport","StartQuickTeleport"); #event_handler(EVENT_LOCATION_LOAD,"WQuickTeleport"); void InitTeleport() { if( GetTargetPlatform()!="pc" ) return; nTeleportShowData = 0; CreateEntity(&objTeleport,"TMPTELEPORT"); LayerAddObject("execute",&objTeleport,-1); LayerAddObject("realize",&objTeleport,-1); SetEventHandler("TeleportChoose","DoTeleportChoose",0); SetEventHandler("TeleportStart","DoTeleportStart",0); } void DoTeleportStart() { SetTeleportData(0); } void DoTeleportChoose() { aref datRef,selRef; int chooseNum = GetEventData(); string attrName = "id"+chooseNum; ref rch = GetMainCharacter(); int n; aref ar1,ar2; ref tmp_chref; switch(nTeleportShowData) { case 0: teleportType=chooseNum; if(chooseNum==2) { SetTeleportData(10); } else { SetTeleportData(1); } break; case 1: if(CheckAttribute(objTeleport,"data."+attrName)) { tel_location_id = objTeleport.data.(attrName); } else { tel_location_id = ""; } sTeleportLocName = tel_location_id; if(teleportType==1) { SetCharacterShipLocation(rch,sTeleportLocName); n = FindIslandBySeaLocation(sTeleportLocName); if(n!=-1) { wdmCurrentIsland = Islands[n].id; makearef(ar1,worldMap.islands); for(n=0; n0 ) { makearef(arData,objTeleport.data); CopyAttributes(arData,arList); } break; case 11: // Выбор нода object objNodeFinder; objNodeFinder.file = "PROGRAM\DIALOGS\" + tel_dialogFileName; CreateEntity(&objNodeFinder,"FINDDIALOGNODES"); makearef(arList,objNodeFinder.nodelist); if( GetAttributesNum(arList)>0 ) { makearef(arData,objTeleport.data); CopyAttributes(arData,arList); } break; } makearef(locRef,objTeleport.data); SendMessage(&objTeleport,"la",42222,locRef); } void StartQuickTeleport() { if(tel_location_id!="" && locatorGroup!="" && locatorName!="") DoReloadCharacterToLocation(tel_location_id,locatorGroup,locatorName); } void WQuickTeleport() { ref chref = GetMainCharacter(); tel_location_id = chref.location; locatorGroup = chref.location.group; locatorName = chref.location.locator; }