Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- list keys = [];
- key npc;
- string toucher;
- key toucherkey;
- vector toucherPos;
- integer npc_on = FALSE;
- integer toggle=0;
- goA()
- {
- osNpcMoveToTarget(npc,<51.8792, 41.5985, 23.3226>,OS_NPC_RUNNING|OS_NPC_NO_FLY);
- }
- goB()
- {
- osNpcMoveToTarget(npc,<85.4375, 38.4954, 23.3226>,OS_NPC_NO_FLY );
- }
- default
- {
- state_entry()
- {
- if(llGetObjectDesc()!="") osNpcRemove((key)llGetObjectDesc());
- llListen(10,"",NULL_KEY,"");
- llSensor("", "", AGENT | NPC, 96.0, PI); //Will always return NPC key regardless of npc create option
- }
- timer()
- {
- toggle=1-toggle;
- if(toggle==0) { goA(); llSetTimerEvent(8);}
- if(toggle==1) {goB(); llSetTimerEvent(12);}
- }
- listen(integer channel,string name, key id, string str)
- {
- if(str=="A")
- {
- goA();
- return;
- }
- if(str=="B")
- {
- goB();
- return;
- }
- }
- touch_start(integer x)
- {
- toucherkey = llDetectedKey(0);
- toucherPos = llDetectedPos(0);
- vector npcPos = llGetPos() + <1,1,1>;
- if(npc_on == FALSE)
- {
- npc = osNpcCreate("Achille", "PièVeloce", npcPos, toucherkey);
- llSetObjectDesc((string)npc);
- npc_on = TRUE;
- llSetTimerEvent(0.01);
- // llSensor("", "", AGENT | NPC, 96.0, PI); //Will always return NPC key regardless of npc create option
- return;
- }
- if(npc_on == TRUE)
- {
- llSetTimerEvent(0);
- osNpcRemove(npc);
- llSetObjectDesc("");
- llResetScript();
- }
- }
- sensor(integer num)
- {
- keys = [];
- integer i = 0;
- for(i; i < num; i++)
- {
- keys += llDetectedKey(i);
- osNpcRemove(llDetectedKey(i));
- }
- llOwnerSay(llDumpList2String(keys, "\n"));
- }
- no_sensor()
- {
- keys = [];
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement