Jump to content

testgenord1

Resident
  • Posts

    146
  • Joined

  • Last visited

Everything posted by testgenord1

  1. Hi once more. I'm slowly getting there. Today I managed to implement all functions in one script (in the original one). Thanks for your help! key avatar; integer handler; float range = 10.0; float rate = 10.0; list questions = [ //This is the quiz configuration. "\nQuestion #1: ... ?", "\nQuestion #2: ... ?", "\nQuestion #3: ... ?" ]; list responses = [ "yes, true, oui, 1", "no, false, non, 0", "Opensim, OpenSimulator" ]; integer random; string question() { integer count = llGetListLength(questions); random = (integer)llFrand((float)count); return llList2String(questions, random); } integer response(string response) { string csv = llList2String(responses, random); list buffer = llCSV2List(llToLower(csv)); if (~llListFindList(buffer, [llToLower(response)])) return TRUE; return FALSE; } //end of the quiz configuration //The next 3 variables determine where you will respawn when you are killed - instead of being TP'd to your home sim. string Destination; // Destination region is checked by the script on startup vector LandingPoint = <210,92,22.5>; //Change these coords as you wish - Set to the centre of the region now. vector LookAt = <1,1,1>; //Direction you will be looking at when you respawn string NotecardName; float Range; list Sayings = ["Chomps","Slurrps","Crunches","Nom Noms","Tastes","Bites","Licks","Gnaws","Chews","Grinds","Sucks","Nibbles"]; list Bits = ["Nose","Hand","Arm","Leg","Ass","Head","Foot","Ear","Chest","Stomach","Thighs"]; integer SayingsNr; integer BitsNr; key npc; key id; integer n; vector npcPos; key Target; vector toucherPos; vector TargetPos; vector Pos; float Position; integer Inc = 0; integer DeathInc = 0; integer DeathPoints=0; integer BiteInc = 0; integer Timer = 300; string TargetName; float Health; integer CHAN; string DeathAnim = "LB-belly3"; string CrouchAnim = "avatar_crouch"; string ZombieWalk = "Zombie_Walk"; string IdleAnim = "idle_1"; string ObjDes; integer channel=500; list Zombie=["Female 1","Female 2","Flame","Ghost","Reaper","Male"];//If you change the NPC notecards, change the name here list SenseRange=["10","15","20","30","50","96"];//Initial sensor range list HitPoints=["One","Two","Five","Ten","Twenty","Fifty"];//How many shots it takes to kill a zombie integer hex2int(string hex) { return(integer)("0x"+hex); } DelNPC() { osNpcRemove(npc); } default { state_entry() { Destination = llGetRegionName(); llSetAlpha(1.0,ALL_SIDES); llMessageLinked(LINK_SET, 1,"B",""); CHAN = 0; DeathInc = 0; Inc = 0; BiteInc = 0; DelNPC(); llSetText("",<0,1,1>,1.0); llListen(channel, "", NULL_KEY, ""); } changed(integer change) { if(change & 1024) { llResetScript(); } } touch_start(integer ok) //<------ This is what I would like to change into something automatic, { //for example "state_entry" or something like that. id = llDetectedKey(0) ; llDialog(id, "Zombie Type ?", Zombie, channel); } listen(integer channel, string name, key id, string message) { if (llListFindList(Zombie+SenseRange+HitPoints, [message]) != -1) { if(message == "Female 1") { NotecardName = "Female 1"; llDialog(id, "Sensing Range ?", SenseRange, channel); } if(message == "Female 2") { NotecardName = "Female 2"; llDialog(id, "Sensing Range ?", SenseRange, channel); } if(message == "Flame") { NotecardName = "Flame"; llDialog(id, "Sensing Range ?", SenseRange, channel); } if(message == "Ghost") { NotecardName = "Ghost"; llDialog(id, "Sensing Range ?", SenseRange, channel); } if(message == "Reaper") { NotecardName = "Reaper"; llDialog(id, "Sensing Range ?", SenseRange, channel); } if(message == "Male") { NotecardName = "Male"; llDialog(id, "Sensing Range ?", SenseRange, channel); } if(message == "10") { Range = 10.0; llDialog(id, "Zombie Max Hits till Death ?", HitPoints, channel); } if(message == "15") { Range = 15.0; llDialog(id, "Zombie Max Hits till Death ?", HitPoints, channel); } if(message == "20") { Range = 20.0; llDialog(id, "Zombie Max Hits till Death ?", HitPoints, channel); } if(message == "30") { Range = 30.0; llDialog(id, "Zombie Max Hits till Death ?", HitPoints, channel); } if(message == "50") { Range = 50.0; llDialog(id, "Zombie Max Hits till Death ?", HitPoints, channel); } if(message == "96") { Range = 96.0; llDialog(id, "Zombie Max Hits till Death ?", HitPoints, channel); } if(message == "One") { DeathPoints = 1; state Sense; } if(message == "Two") { DeathPoints = 2; state Sense; } if(message == "Five") { DeathPoints = 5; state Sense; } if(message == "Ten") { DeathPoints = 10; state Sense; } if(message == "Twenty") { DeathPoints = 20; state Sense; } if(message == "Fifty") { DeathPoints = 50; state Sense; } } } } state Sense { state_entry() { llMessageLinked(LINK_SET, 3,"B",""); llSetText("",<0,1,1>,1.0); DeathInc = 0; Inc = 0; BiteInc = 0; llSetAlpha(0.0,ALL_SIDES); llSensorRepeat("","",AGENT,Range,PI,1.0); } touch_start(integer number) { osNpcStand(npc); llSleep(1.0); osNpcRemove(npc); llOwnerSay("Zombie Rezzer RESET"); state default; } sensor(integer num) { integer i; for (i = 0; i < num; i ++) { Target = llDetectedKey(i); Health = osGetHealth(Target); TargetPos = llDetectedPos(i); Pos = llGetPos(); Position = llVecDist(TargetPos,Pos); llSensorRemove(); npcPos = llGetPos() + <0,0,0>; npc = osNpcCreate(NotecardName, "...", npcPos, NotecardName); state NPC_SIT; } } } state NPC_SIT { state_entry() { osNpcSayTo(npc, id, PUBLIC_CHANNEL, question()); //This is where the quiz question is asked by the zombie. handler = llListen(PUBLIC_CHANNEL, "", avatar, ""); //Here he listens for the reply. llSensorRepeat("","",AGENT,96,PI,2.0); llSetText("",<1,0,0>,1.0); SayingsNr = llGetListLength(Sayings); BitsNr = llGetListLength(Bits); llPreloadSound("Growl"); llPreloadSound("Scream2"); llPreloadSound("scream1"); llSetTimerEvent(10.0); CHAN = hex2int(llGetSubString(npc,0,7)); //end of the quiz question part. if (CHAN < 0) { CHAN = -CHAN; } //llOwnerSay("NPC Key is: "+(string)npc+"\nNPC Channel is: "+(string)channel); llListen(CHAN, "", "", ""); } listen(integer channel, string name, key OurIDs, string message) { if (id == handler) //Here the reply is matched with the respective question. { message = llStringTrim(message, STRING_TRIM); if (response(message) == TRUE) { llListenRemove(handler); osNpcSayTo(npc, id, PUBLIC_CHANNEL, "You win " + name); llSensorRepeat("", "", AGENT_BY_LEGACY_NAME, range, PI, rate * 2.0); llSetTimerEvent(0.0); llSensorRemove(); osNpcStopMoveToTarget(npc); osNpcStand(npc); osNpcPlayAnimation(npc,DeathAnim); llPlaySound("scream1",1.0); llSleep(5.0); llRegionSay(111,"Dead_Zombie"); llRegionSay(112,(string)llKey2Name(Target)); osNpcRemove(npc); //If the reply is correct, the zombie dies. state Sense; //The script goes back to the "Sense" state above. //llResetScript(); //This means a new zombie is being rezzed. } } if(channel == CHAN && message == "NPC") { osNpcStopMoveToTarget(npc); osNpcStand(npc); DeathInc = DeathInc +1; if(DeathInc<=DeathPoints) { llPlaySound("Scream2",1.0); } osAvatarPlayAnimation(npc,IdleAnim); osAvatarPlayAnimation(npc,CrouchAnim); llSleep(1.25); if(DeathInc>=DeathPoints) { llSetTimerEvent(0.0); llSensorRemove(); osNpcStopMoveToTarget(npc); osNpcStand(npc); osNpcPlayAnimation(npc,DeathAnim); llPlaySound("scream1",1.0); llSleep(5.0); llRegionSay(111,"Dead_Zombie"); llRegionSay(112,(string)llKey2Name(Target)); osNpcRemove(npc); state Sense; //llResetScript(); } llSleep(0.25); osNpcPlayAnimation(npc,ZombieWalk); } } sensor(integer num) { integer i; for (i = 0; i < num; i ++) { llSleep(0.5); Target = llDetectedKey(i); Health = osGetHealth(Target); TargetName = llDetectedName(i); toucherPos = llDetectedPos(i); npcPos = osNpcGetPos(npc); Position = llVecDist(toucherPos, npcPos); if (Position>1.0) { osNpcMoveToTarget(npc,toucherPos+<0,0,0>, OS_NPC_NO_FLY); } if (Position<3.0) { osTeleportAgent(Target, Destination, LandingPoint, LookAt); osNpcRemove(npc); state Sense; if(Health<=35.0) { if(BiteInc >=1 ) { llRegionSay(111,"Dead"); BiteInc = 0; } osNpcSay(npc,"Hahaha.. You Died !!"); osCauseHealing(Target, 50); } llRegionSay(112,(string)llKey2Name(Target)); float FSaid = llFrand(SayingsNr); integer Said = llCeil(FSaid)-1; string Text = llList2String(Sayings,Said); float FSaid1 = llFrand(BitsNr); integer Said1 = llCeil(FSaid1)-1; string Text1 = llList2String(Bits,Said1); osNpcSay(npc,(string)Text+" "+(string)llKey2Name(Target)+"'s "+(string)Text1); BiteInc = BiteInc + 1; osCauseDamage(Target, 10.0); llRegionSay(111,"Bite"); llSleep(2.0); } } } touch_start(integer number) { osNpcStand(npc); llSleep(1.0); osNpcRemove(npc); llOwnerSay("Zombie Rezzer RESET"); state default; } timer() { Inc = Inc +10; integer Del = Timer-Inc; llSetText("Auto-Delete in "+(string)Del+" seconds",<1,0,0>,1.0); float Rand1 = llFrand(2.0); if(Rand1>= 1.0) { llPlaySound("Growl",1.0); } if(Inc>=Timer) { osNpcRemove(npc); state Sense; //llResetScript(); } } }
  2. That's a nice idea. Unfortunately, Opensim / Osgrid does not offer that option, I just tried it. Second life has some nice scripting options that we don't have, unfortunately. Thanks, though.
  3. No, that's actually a great idea. I wasn't advanced enough in scripting back then, when I did that. I'll look into that. I'm still a bit of a newbie. My scripts are usually a collage of other people's scripts. 😉
  4. Yes, I tried it in a different task. It's neat. Text tasks in general are a bit painful in OS / SL. Haven't found the perfect solutions yet.
  5. That's a good point. Might make it more convenient.
  6. Thanks for the tip. I'll try that. I know about the frustration when typing the word wrong. I'm going to use it for simple words first. The dialog might be a good alternative for more complex questions. I'll come back for help when I get stuck. 🙂
  7. I tried that. Worked at first but then all of a sudden didn't any more. I don't know why. I would like to use both options. Typing the answer directly also makes it necessary to spell it correctly, which can be useful for vocabulary learning. I want to use it for education.
  8. Good idea. That might save some lines of code. Overall, though, the problem is less the randomization of the questions than to make the corresponding answer match them.
  9. Thank you for your help. The questions are always displayed correctly as strings in the chat. I also typed in some real questions instead of "...", to test them. Is that what you meant?
  10. Thanks for your support! I've been somewhat successful, even though the scripts are a bit flawed. This one's for an NPC: float Position; key id; vector npcPos; vector agent_pos; vector Pos; // Simple Sensor Quizz III v0.1 by djphil (CC-BY-NC-SA 4.0) integer teleport = TRUE; vector position = <128.0, 128.0, 25.0>; float range = 10.0; float rate = 2.0; list questions = [ "\nQuestion #1: ... ?", "\nQuestion #2: ... ?", "\nQuestion #3: ... ?" ]; list responses = [ "yes, true, oui, 1", "no, false, non, 0", "Opensim, OpenSimulator" ]; key avatar; list avatars; integer random; integer counter; integer handler; key zombie; vector inipos; string question() { integer count = llGetListLength(questions); random = (integer)llFrand((float)count); return llList2String(questions, random); } integer response(string response) { string csv = llList2String(responses, random); list buffer = llCSV2List(llToLower(csv)); if (~llListFindList(buffer, [llToLower(response)])) return TRUE; return FALSE; } default { state_entry() { if (llGetInventoryName(INVENTORY_NOTECARD, 0) != "appearance") osOwnerSaveAppearance("appearance"); inipos = llGetPos() + <0.5, 0.0, 1.0>; llSensorRepeat("", "", AGENT_BY_LEGACY_NAME, range, PI, rate); llSetText("", <1.0, 1.0, 1.0>, 1.0); } sensor(integer n) { if (counter > 4) { llListenRemove(handler); llSetStatus(STATUS_PHANTOM, FALSE); llRegionSayTo(avatar, PUBLIC_CHANNEL, "You loze " + llKey2Name(avatar)); if (teleport == TRUE) llTeleportAgent(avatar, "", position, ZERO_VECTOR); llSensorRepeat("", "", AGENT_BY_LEGACY_NAME, range, PI, rate * 2.0); llSetText("", <1.0, 1.0, 1.0>, 1.0); llSetAlpha(1.0, ALL_SIDES); osNpcRemove(zombie); avatars = []; counter = 0; } integer i; for (i = 0; i < n; i ++) { rotation agent_rote = llDetectedRot(i); vector agent_pos = llDetectedPos(i); avatar = llDetectedKey(i); agent_pos = llDetectedPos(i); npcPos = osNpcGetPos(zombie); Position = llVecDist(agent_pos, npcPos); if (Position>1.0) { osNpcMoveToTarget(zombie,agent_pos, OS_NPC_NO_FLY ); avatar = llDetectedKey(i); if (!~llListFindList(avatars, [avatar])) { if (llGetListLength(avatars) < 1) { avatars += avatar; llSetAlpha(1.0, ALL_SIDES); llSetStatus(STATUS_PHANTOM, FALSE); vector agent_pose = llDetectedPos(i); //rotation agent_rote = llDetectedRot(i); vector offset = <1.0, 0.0, 0.0>; offset = offset * agent_rote; agent_pose += offset; zombie = osNpcCreate("NPC", "Zombie", inipos, "appearance"); osNpcSetRot(zombie, agent_rote * llEuler2Rot(<0.0, 0.0, 180.0> * DEG_TO_RAD)); osNpcSayTo(zombie, avatar, PUBLIC_CHANNEL, question()); handler = llListen(PUBLIC_CHANNEL, "", avatar, ""); llSetText(llKey2Name(avatar), <1.0, 1.0, 1.0>, 1.0); } else if (!~llListFindList(avatars, [avatar])) { osNpcSayTo(zombie, avatar, PUBLIC_CHANNEL, "Sorry " + llKey2Name(avatar) + ", the game is buzy ..."); } } } ++counter; } } no_sensor() { avatars = []; counter = 0; osNpcRemove(zombie); llSetAlpha(1.0, ALL_SIDES); llSetText("", <1.0, 1.0, 1.0>, 1.0); } listen(integer channel, string name, key uuid, string message) { if (uuid == handler) { message = llStringTrim(message, STRING_TRIM); if (response(message) == TRUE) { counter = 0; avatars = []; llListenRemove(handler); osNpcSayTo(zombie, uuid, PUBLIC_CHANNEL, "You win " + name); llSetText("", <1.0, 1.0, 1.0>, 1.0); llSensorRepeat("", "", AGENT_BY_LEGACY_NAME, range, PI, rate * 2.0); llSetStatus(STATUS_PHANTOM, TRUE); llSetAlpha(0.25, ALL_SIDES); osNpcRemove(zombie); } } } on_rez(integer n) {llResetScript();} } ... and one for a prim-zombie: float Position; key id; vector npcPos; vector agent_pos; vector Pos; // Simple Sensor Quizz III v0.1 by djphil (CC-BY-NC-SA 4.0) integer teleport = TRUE; vector position = <128.0, 128.0, 25.0>; float range = 10.0; float rate = 10.0; list questions = [ "\nQuestion #1: ... ?", "\nQuestion #2: ... ?", "\nQuestion #3: ... ?" ]; list responses = [ "yes, true, oui, 1", "no, false, non, 0", "Opensim, OpenSimulator" ]; key avatar; list avatars; integer random; integer handler; key zombie; vector inipos; string question() { integer count = llGetListLength(questions); random = (integer)llFrand((float)count); return llList2String(questions, random); } integer response(string response) { string csv = llList2String(responses, random); list buffer = llCSV2List(llToLower(csv)); if (~llListFindList(buffer, [llToLower(response)])) return TRUE; return FALSE; } default { state_entry() { llSensorRepeat("", "", AGENT_BY_LEGACY_NAME, range, PI, rate); } sensor(integer n) { integer i; for (i = 0; i < n; i ++) { rotation agent_rote = llDetectedRot(i); vector agent_pos = llDetectedPos(i); avatar = llDetectedKey(i); agent_pos = llDetectedPos(i); npcPos = llGetPos(); Position = llVecDist(agent_pos, npcPos); if (Position<2) { llListenRemove(handler); llRegionSayTo(avatar, PUBLIC_CHANNEL, "You lose " + llKey2Name(avatar)); if (teleport == TRUE) llTeleportAgent(avatar, "", position, ZERO_VECTOR); llSensorRepeat("", "", AGENT_BY_LEGACY_NAME, range, PI, rate * 2.0); } if (Position<6.0) { llRegionSayTo(avatar, PUBLIC_CHANNEL, question()); handler = llListen(PUBLIC_CHANNEL, "", avatar, ""); } } } no_sensor() { } listen(integer channel, string name, key uuid, string message) { if (uuid == handler) { message = llStringTrim(message, STRING_TRIM); if (response(message) == TRUE) { avatars = []; llListenRemove(handler); llRegionSayTo(uuid, PUBLIC_CHANNEL, "You win " + name); //llSetText("", <1.0, 1.0, 1.0>, 1.0); //llSensorRepeat("", "", AGENT_BY_LEGACY_NAME, range, PI, rate * 2.0); llDie(); } } } on_rez(integer n) {llResetScript();} } In case anyone has ideas of improvement, feel free to reply. Thanks!
  11. Hi! I'm trying to build a zombie NPC. The zombie is following you. When he approaches you, he asks you a question. If you answer the question correctly, the zombie dies. If you don't answer correctly in time, the zombie reaches you. When he reaches you, he teleports you out of the building. That already works. However, I would like to make the zombie randomly ask a different question, each time he encounters an avatar. This means the zombie has to randomly pick a question out of a pool of questions. That is what I haven't been able to achieve. Do you have any idea of how to do this maybe? For other users potentially interested in this, I'm posting all files necessary for this. So please excuse this very long post. 1a) Here is the original script: //The next 3 variables determine where you will respawn when you are killed - instead of being TP'd to your home sim. string Destination; // Destination region is checked by the script on startup vector LandingPoint = <118,118,22.5>; //Change these coords as you wish - Set to the centre of the region now. vector LookAt = <1,1,1>; //Direction you will be looking at when you respawn string NotecardName; float Range; list Sayings = ["Chomps","Slurrps","Crunches","Nom Noms","Tastes","Bites","Licks","Gnaws","Chews","Grinds","Sucks","Nibbles"]; list Bits = ["Nose","Hand","Arm","Leg","Ass","Head","Foot","Ear","Chest","Stomach","Thighs"]; integer SayingsNr; integer BitsNr; key npc; key id; integer n; vector npcPos; key Target; vector toucherPos; vector TargetPos; vector Pos; float Position; integer Inc = 0; integer DeathInc = 0; integer DeathPoints=0; integer BiteInc = 0; integer Timer = 300; string TargetName; float Health; integer CHAN; string DeathAnim = "LB-belly3"; string CrouchAnim = "avatar_crouch"; string ZombieWalk = "Zombie_Walk"; string IdleAnim = "idle_1"; string ObjDes; integer channel=500; list Zombie=["Female 1","Female 2","Flame","Ghost","Reaper","Male"];//If you change the NPC notecards, change the name here list SenseRange=["10","15","20","30","50","96"];//Initial sensor range list HitPoints=["One","Two","Five","Ten","Twenty","Fifty"];//How many shots it takes to kill a zombie integer hex2int(string hex) { return(integer)("0x"+hex); } DelNPC() { osNpcRemove(npc); } default { state_entry() { Destination = llGetRegionName(); llSetAlpha(1.0,ALL_SIDES); llMessageLinked(LINK_SET, 1,"B",""); CHAN = 0; DeathInc = 0; Inc = 0; BiteInc = 0; DelNPC(); llSetText("",<0,1,1>,1.0); llListen(channel, "", NULL_KEY, ""); } changed(integer change) { if(change & 1024) { llResetScript(); } } touch_start(integer ok) { id = llDetectedKey(0) ; llDialog(id, "Zombie Type ?", Zombie, channel); } listen(integer channel, string name, key id, string message) { if (llListFindList(Zombie+SenseRange+HitPoints, [message]) != -1) { if(message == "Female 1") { NotecardName = "Female 1"; llDialog(id, "Sensing Range ?", SenseRange, channel); } if(message == "Female 2") { NotecardName = "Female 2"; llDialog(id, "Sensing Range ?", SenseRange, channel); } if(message == "Flame") { NotecardName = "Flame"; llDialog(id, "Sensing Range ?", SenseRange, channel); } if(message == "Ghost") { NotecardName = "Ghost"; llDialog(id, "Sensing Range ?", SenseRange, channel); } if(message == "Reaper") { NotecardName = "Reaper"; llDialog(id, "Sensing Range ?", SenseRange, channel); } if(message == "Male") { NotecardName = "Male"; llDialog(id, "Sensing Range ?", SenseRange, channel); } if(message == "10") { Range = 10.0; llDialog(id, "Zombie Max Hits till Death ?", HitPoints, channel); } if(message == "15") { Range = 15.0; llDialog(id, "Zombie Max Hits till Death ?", HitPoints, channel); } if(message == "20") { Range = 20.0; llDialog(id, "Zombie Max Hits till Death ?", HitPoints, channel); } if(message == "30") { Range = 30.0; llDialog(id, "Zombie Max Hits till Death ?", HitPoints, channel); } if(message == "50") { Range = 50.0; llDialog(id, "Zombie Max Hits till Death ?", HitPoints, channel); } if(message == "96") { Range = 96.0; llDialog(id, "Zombie Max Hits till Death ?", HitPoints, channel); } if(message == "One") { DeathPoints = 1; state Sense; } if(message == "Two") { DeathPoints = 2; state Sense; } if(message == "Five") { DeathPoints = 5; state Sense; } if(message == "Ten") { DeathPoints = 10; state Sense; } if(message == "Twenty") { DeathPoints = 20; state Sense; } if(message == "Fifty") { DeathPoints = 50; state Sense; } } } } state Sense { state_entry() { llMessageLinked(LINK_SET, 3,"B",""); llSetText("",<0,1,1>,1.0); DeathInc = 0; Inc = 0; BiteInc = 0; llSetAlpha(0.0,ALL_SIDES); llSensorRepeat("","",AGENT,Range,PI,1.0); } touch_start(integer number) { osNpcStand(npc); llSleep(1.0); osNpcRemove(npc); llOwnerSay("Zombie Rezzer RESET"); state default; } sensor(integer num) { integer i; for (i = 0; i < num; i ++) { Target = llDetectedKey(i); Health = osGetHealth(Target); TargetPos = llDetectedPos(i); Pos = llGetPos(); Position = llVecDist(TargetPos,Pos); llSensorRemove(); npcPos = llGetPos() + <0,0,0>; npc = osNpcCreate(NotecardName, "...", npcPos, NotecardName); state NPC_SIT; } } } state NPC_SIT { state_entry() { llSensorRepeat("","",AGENT,96,PI,2.0); llSetText("",<1,0,0>,1.0); SayingsNr = llGetListLength(Sayings); BitsNr = llGetListLength(Bits); llPreloadSound("Growl"); llPreloadSound("Scream2"); llPreloadSound("scream1"); llSetTimerEvent(10.0); CHAN = hex2int(llGetSubString(npc,0,7)); if (CHAN < 0) { CHAN = -CHAN; } //llOwnerSay("NPC Key is: "+(string)npc+"\nNPC Channel is: "+(string)channel); llListen(0, "", "", ""); } listen(integer channel, string name, key OurIDs, string message) { if(channel == 0 && message == "answer") { osNpcStopMoveToTarget(npc); osNpcStand(npc); DeathInc = DeathInc +1; if(DeathInc<=DeathPoints) { llPlaySound("Scream2",1.0); } //osAvatarPlayAnimation(npc,IdleAnim); //osAvatarPlayAnimation(npc,CrouchAnim); llSleep(1.25); if(DeathInc>=DeathPoints) { llSetTimerEvent(0.0); llSensorRemove(); osNpcStopMoveToTarget(npc); osNpcStand(npc); //osNpcPlayAnimation(npc,DeathAnim); llPlaySound("scream1",1.0); llSleep(5.0); llRegionSay(111,"Dead_Zombie"); llRegionSay(112,(string)llKey2Name(Target)); osNpcRemove(npc); state Sense; //llResetScript(); } llSleep(0.25); osNpcPlayAnimation(npc,ZombieWalk); } } sensor(integer num) { integer i; for (i = 0; i < num; i ++) { llSleep(0.5); Target = llDetectedKey(i); Health = osGetHealth(Target); TargetName = llDetectedName(i); toucherPos = llDetectedPos(i); npcPos = osNpcGetPos(npc); Position = llVecDist(toucherPos, npcPos); if (Position>1.0) { osNpcMoveToTarget(npc,toucherPos+<0,0,0>, OS_NPC_NO_FLY); } { if (Position<6) { if (Position>3) osNpcSay(npc, "question"); } } if (Position<3.0) { osTeleportAgent(Target, Destination, LandingPoint, LookAt); if(Health<=35.0) { if(BiteInc >=1 ) { llRegionSay(111,"Dead"); BiteInc = 0; } osNpcSay(npc,"Hahaha.. You Died !!"); osCauseHealing(Target, 50); } llRegionSay(112,(string)llKey2Name(Target)); float FSaid = llFrand(SayingsNr); integer Said = llCeil(FSaid)-1; string Text = llList2String(Sayings,Said); float FSaid1 = llFrand(BitsNr); integer Said1 = llCeil(FSaid1)-1; string Text1 = llList2String(Bits,Said1); osNpcSay(npc,(string)Text+" "+(string)llKey2Name(Target)+"'s "+(string)Text1); BiteInc = BiteInc + 1; osCauseDamage(Target, 10.0); llRegionSay(111,"Bite"); llSleep(2.0); } } } touch_start(integer number) { osNpcStand(npc); llSleep(1.0); osNpcRemove(npc); llOwnerSay("Zombie Rezzer RESET"); state default; } timer() { Inc = Inc +10; integer Del = Timer-Inc; llSetText("Auto-Delete in "+(string)Del+" seconds",<1,0,0>,1.0); float Rand1 = llFrand(2.0); if(Rand1>= 1.0) { llPlaySound("Growl",1.0); } if(Inc>=Timer) { osNpcRemove(npc); state Sense; //llResetScript(); } } } 1b) Should this be too complicated, maybe the following simpler script would be easier to adjust. It does not have all the functions of the first script, though. It already has the random-question function in it, however, I haven't been able to integrate the teleport function when the zombie reaches you. Any ideas will be appreciated: // Simple Sensor Quizz III v0.1 by djphil (CC-BY-NC-SA 4.0) integer teleport = FALSE; vector position = <128.0, 128.0, 25.0>; float range = 2.0; float rate = 5.0; list questions = [ "\nQuestion #1: ... ?", "\nQuestion #2: ... ?", "\nQuestion #3: ... ?" ]; list responses = [ "yes, true, oui, 1", "no, false, non, 0", "Opensim, OpenSimulator" ]; key avatar; list avatars; integer random; integer counter; integer handler; key zombie; vector inipos; string question() { integer count = llGetListLength(questions); random = (integer)llFrand((float)count); return llList2String(questions, random); } integer response(string response) { string csv = llList2String(responses, random); list buffer = llCSV2List(llToLower(csv)); if (~llListFindList(buffer, [llToLower(response)])) return TRUE; return FALSE; } default { state_entry() { if (llGetInventoryName(INVENTORY_NOTECARD, 0) != "appearance") osOwnerSaveAppearance("appearance"); inipos = llGetPos() + <0.5, 0.0, 1.0>; llSensorRepeat("", "", AGENT_BY_LEGACY_NAME, range, PI, rate); llSetText("", <1.0, 1.0, 1.0>, 1.0); } sensor(integer n) { if (counter > 5) { llListenRemove(handler); llSetStatus(STATUS_PHANTOM, FALSE); llRegionSayTo(avatar, PUBLIC_CHANNEL, "You loze " + llKey2Name(avatar)); if (teleport == TRUE) llTeleportAgent(avatar, "", position, ZERO_VECTOR); llSensorRepeat("", "", AGENT_BY_LEGACY_NAME, range, PI, rate * 2.0); llSetText("", <1.0, 1.0, 1.0>, 1.0); llSetAlpha(1.0, ALL_SIDES); osNpcRemove(zombie); avatars = []; counter = 0; } avatar = llDetectedKey(0); if (!~llListFindList(avatars, [avatar])) { if (llGetListLength(avatars) < 1) { avatars += avatar; llSetAlpha(1.0, ALL_SIDES); llSetStatus(STATUS_PHANTOM, FALSE); vector agent_pose = llDetectedPos(0); rotation agent_rote = llDetectedRot(0); vector offset = <1.0, 0.0, 0.0>; offset = offset * agent_rote; agent_pose += offset; zombie = osNpcCreate("NPC", "Zombie", inipos, "appearance"); osNpcSetRot(zombie, agent_rote * llEuler2Rot(<0.0, 0.0, 180.0> * DEG_TO_RAD)); osNpcSayTo(zombie, avatar, PUBLIC_CHANNEL, question()); handler = llListen(PUBLIC_CHANNEL, "", avatar, ""); llSetText(llKey2Name(avatar), <1.0, 1.0, 1.0>, 1.0); } else if (!~llListFindList(avatars, [avatar])) { osNpcSayTo(zombie, avatar, PUBLIC_CHANNEL, "Sorry " + llKey2Name(avatar) + ", the game is buzy ..."); } } ++counter; } no_sensor() { avatars = []; counter = 0; osNpcRemove(zombie); llSetAlpha(1.0, ALL_SIDES); llSetText("", <1.0, 1.0, 1.0>, 1.0); } listen(integer channel, string name, key uuid, string message) { if (uuid == handler) { message = llStringTrim(message, STRING_TRIM); if (response(message) == TRUE) { counter = 0; avatars = []; llListenRemove(handler); osNpcSayTo(zombie, uuid, PUBLIC_CHANNEL, "You win " + name); llSetText("", <1.0, 1.0, 1.0>, 1.0); llSensorRepeat("", "", AGENT_BY_LEGACY_NAME, range, PI, rate * 2.0); llSetStatus(STATUS_PHANTOM, TRUE); llSetAlpha(0.25, ALL_SIDES); osNpcRemove(zombie); } } } on_rez(integer n) {llResetScript();} } 2) Here is an appearance notecard you must add into the prim containing the zombie script. With the first script, the notecard must be given one of the names of the zombies, e.g. " Male ". With the second script it must be given the name "appearance". <llsd> <map> <key>serial</key> <integer>1</integer> <key>height</key> <real>2.27775502204895</real> <key>wearables</key> <array> <array> <map> <key>item</key> <uuid>14a46ca1-ad04-4f87-ba83-a3c47337ea6c</uuid> <key>asset</key> <uuid>d1b17d04-aa47-b716-0252-2774067df4af</uuid> </map> </array> <array> <map> <key>item</key> <uuid>958ef428-cd38-41ed-8928-d741b9d6f4d5</uuid> <key>asset</key> <uuid>6e9d03e9-c860-39fd-f5b2-6b9dc8af95ec</uuid> </map> </array> <array> <map> <key>item</key> <uuid>796765f7-0a18-4c46-ac5b-08dd89e7bf30</uuid> <key>asset</key> <uuid>2837bf97-bf17-2d61-7c23-f1d4727c45d3</uuid> </map> </array> <array> <map> <key>item</key> <uuid>38af9ac9-f61c-4013-bcd1-4030622336ec</uuid> <key>asset</key> <uuid>5994f6d5-d64f-eea1-d4c4-86fd4ff7f1db</uuid> </map> </array> <array /> <array> <map> <key>item</key> <uuid>524721bd-d364-49dd-b07f-9c7788987493</uuid> <key>asset</key> <uuid>440db857-154d-76f9-e703-0b5a6191506f</uuid> </map> </array> <array /> <array /> <array /> <array /> <array /> <array /> <array /> <array /> <array /> </array> <key>textures</key> <array> <uuid>cc7a030f-282f-c165-44d2-b5ee572e72bf</uuid> <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid> <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid> <uuid>4934f1bf-3b1f-cf4f-dbdf-a72550d05bc6</uuid> <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid> <uuid>4934f1bf-3b1f-cf4f-dbdf-a72550d05bc6</uuid> <uuid>4934f1bf-3b1f-cf4f-dbdf-a72550d05bc6</uuid> <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid> <uuid>c348941b-39c4-4e8d-86d4-797be7c122dc</uuid> <uuid>466645df-20de-4006-804d-144473cf285a</uuid> <uuid>99a00eec-4766-4b4d-af34-5d428052d0c7</uuid> <uuid>48a911fa-c1be-4a60-9a93-ced127f8976f</uuid> <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid> <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid> <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid> <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid> <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid> <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid> <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid> <uuid>c228d1cf-4b5d-4ba8-84f4-899a0796aa97</uuid> <uuid>405330b1-1d41-48a2-80da-2c5cbc5ddcb4</uuid> </array> <key>visualparams</key> <binary encoding="base64">voefADp/OHD/KwD/ZiS3/6orEVYo9MJ/P//l0/7R///LNf9oAAB/AAAAAAAAfwAAAAAAAAAAAAAAAACHcAAAAAAAAAAAAAAAAL8AAI4AAIlwUFV/f/+EMGTY1szMzDMZWUzMLwAAWKLUdV7/jAB/EX9/f4QA6Uzl/7ZBAOL//z8AAAAAf38AAAAAfwCfAACyf0kAANt/yZF/AABqEn+CANbMxgAA062Z4v/G////v7+/////SUT//////////////wD//////wB1//8ZZP////9UAKMAAC3///8=</binary> <key>attachments</key> <array> <map> <key>point</key> <integer>28</integer> <key>item</key> <uuid>49c218e9-b8df-4842-bd69-7e075a9a4532</uuid> <key>asset</key> <uuid>0dedb2dd-5df2-4297-9564-94b7a21726c7</uuid> </map> </array> </map> </llsd> 3) I also had to make some adjustments in my config-include/osslEnable.ini file (Opensim / Osgrid): ;# {OSFunctionThreatLevel} {Enabled:true AllowOSFunctions:true} {OSFunction threat level? (DANGEROUS!)} {None VeryLow Low Moderate High VeryHigh Severe} VeryLow ;; Threat level to allow, one of None, VeryLow, Low, Moderate, High, ;; VeryHigh, Severe OSFunctionThreatLevel = VeryHigh ; OS Functions enable/disable ; For each function, you can add one line, as shown ; The default for all functions allows them if below threat level Allow_osNpcCreate = true Allow_osNpcMoveTo = true Allow_osNpcMoveToTarget = true Allow_osNpcGetRot = true Allow_osNpcGetPos = true Allow_osNpcSetRot = true Allow_osNpcRemove = true Allow_osNpcSay = true Allow_osNpcStopMoveToTarget = true Allow_osNpcSaveAppearance = true Allow_osNpcLoadAppearance = true Allow_osMakeNotecard = true Allow_osAgentSaveAppearance = true Allow_osOwnerSaveAppearance = true Allow_osAvatarName2Key = true Allow_osGetAvatarList = true Allow_osTeleportAgent = true Allow_osAvatarPlayAnimation = true Allow_osAvatarStopAnimation = true Allow_osCauseDamage = true Allow_osCauseHealing = true Allow_osGetHealth = true Allow_osGetRegionStats = true Allow_osGetMapTexture = true Allow_osGetRegionMapTexture = true Allow_osSetSpeed = true Allow_osNpcSayTo = true
  12. Different quiz script, using random questions, works fine: https://forums.osgrid.org/viewtopic.php?f=5&amp;t=6301&amp;p=28120#p28120 // Simple Sensor Quizz I v0.1 by djphil (CC-BY-NC-SA 4.0) integer teleport = FALSE; vector position = <128.0, 128.0, 25.0>; float range = 2.0; float rate = 5.0; list questions = [ "\nQuestion #1: ... ?", "\nQuestion #2: ... ?", "\nQuestion #3: ... ?" ]; list responses = [ "yes, true, oui, 1", "no, false, non, 0", "Opensim, OpenSimulator" ]; key avatar; list avatars; integer random; integer counter; integer handler; string question() { integer count = llGetListLength(questions); random = (integer)llFrand((float)count); return llList2String(questions, random); } integer response(string response) { string csv = llList2String(responses, random); list buffer = llCSV2List(llToLower(csv)); if (~llListFindList(buffer, [llToLower(response)])) return TRUE; return FALSE; } default { state_entry() { llSensorRepeat("", "", AGENT_BY_LEGACY_NAME, range, PI, rate); llSetText("", <1.0, 1.0, 1.0>, 1.0); } sensor(integer n) { if (counter > 5) { llListenRemove(handler); llSetStatus(STATUS_PHANTOM, FALSE); llRegionSayTo(avatar, PUBLIC_CHANNEL, "You loze " + llKey2Name(avatar)); if (teleport == TRUE) llTeleportAgent(avatar, "", position, ZERO_VECTOR); llSensorRepeat("", "", AGENT_BY_LEGACY_NAME, range, PI, rate * 2.0); llSetText("", <1.0, 1.0, 1.0>, 1.0); llSetAlpha(1.0, ALL_SIDES); avatars = []; counter = 0; } avatar = llDetectedKey(0); if (!~llListFindList(avatars, [avatar])) { if (llGetListLength(avatars) < 1) { avatars += avatar; llSetAlpha(1.0, ALL_SIDES); llSetStatus(STATUS_PHANTOM, FALSE); llRegionSayTo(avatar, PUBLIC_CHANNEL, question()); handler = llListen(PUBLIC_CHANNEL, "", avatar, ""); llSetText(llKey2Name(avatar), <1.0, 1.0, 1.0>, 1.0); } else if (!~llListFindList(avatars, [avatar])) { llRegionSayTo(avatar, PUBLIC_CHANNEL, "Sorry " + llKey2Name(avatar) + ", the game is buzy ..."); } } ++counter; } no_sensor() { avatars = []; counter = 0; llSetAlpha(1.0, ALL_SIDES); llSetText("", <1.0, 1.0, 1.0>, 1.0); } listen(integer channel, string name, key uuid, string message) { if (uuid == handler) { message = llStringTrim(message, STRING_TRIM); if (response(message) == TRUE) { counter = 0; avatars = []; llListenRemove(handler); llRegionSayTo(uuid, PUBLIC_CHANNEL, "You win " + name); llSetText("", <1.0, 1.0, 1.0>, 1.0); llSensorRepeat("", "", AGENT_BY_LEGACY_NAME, range, PI, rate * 2.0); llSetStatus(STATUS_PHANTOM, TRUE); llSetAlpha(0.25, ALL_SIDES); } } } on_rez(integer n) {llResetScript();} }
  13. Hi again, thank you very much for your support. I still couldn't get the questions to work. I probably did it wrong, I'm not very good at scripting. Here's what I did: I simply added Rutvhen Villenov's suggestion at the very top of the script and adjusted the notecard according to your suggestion. This way, though, the script didn't start (I'm on OSGrid). If you have further suggestions, I'm always grateful for help, but only if it's not a nuisance. Somebody else wrote me a different script that also works nicely. It's added below this post. Thanks again! //your suggestion: integer numlines;//using llGetNumberOfNotecardLines //then build the list list linenumbers = []; buildlist() { integer i; for( i = 0; i < numlines; i+=2) { linenumbers += [i]; } linenumbers = llListRandomize(linenumbers,1); } //rest of original script: //A Dialog-driven quiz, using text from a notecard -- Rolig Loon -- October 2009 // // Free for public use -- please don't do something crass like selling my script. // Modify if you must, but please keep these header lines intact. Be nice. // // Notecard format: // A line beginning with a "Q" is part of a question // A line beginning with an "A" is a string of comma-delimited zeros (wrong) and a one (right) to identify the answer // A line beginning with a "#" is a comment // Blank lines are ignored // // Dialog boxes are limited to 512 characters, so make each question (including choices) short enough to fit. // There is no limit to the number of questions in a quiz, and you may have up to 12 answer choices per question // // =============== sample notecard =========== //# Lines starting with Q appear verbatim in a dialog box //# You may have as many Q lines as you want per question, but only one A line //# Interpreted data begins immediately after the lead character in a line //QWhat is the capital of Minnesota? //Q1. St. Paul //Q2. Minneapolis //Q3. Iowa City //Q4. Boston //A1,0,0,0 //QHow many fingers are on my right hand? //Q1. One //Q2. Two //Q3. Three //Q4. Four //Q5. Five //A0,0,0,0,1 // ================= end of sample ================= // // Instructor types "results" in channel 24 to get a report of all student scores string gCard; //Notecard name integer gLine; //Current line being read key gQID; //Dataserver key integer gtouch; //Activates/deactivates touch_start event list gAvList = []; //Cumulative list of people who have taken this quiz string gAv; //Name of the current quiz-taker key gAvKey; //Key of the current quiz-taker integer CHAN; //Channel for dialog communication integer Handle; //Listen handle for dialog integer gScore; //This quiz-taker's score string gQuestion; //Text for the current question list gAnswers; //Answer key for the current question list gAllScores = []; //Cumulative list of scores for quiz-takers integer Timespan = 10; // This is the maximum time alloted for the quiz, in minutes. Change here if needed. integer IsNameOnList(list namelist, string name) //Verifies whether av has already taken the quiz { integer i; integer len = llGetListLength(namelist); for (i=0; i<=len-1;++i) if(llList2String(namelist,i) == name) { return TRUE; } return FALSE; } init() //Resets parameters for the next quiz-taker { //llSetTimerEvent(0); gtouch = 0; gAv = ""; gAvKey = NULL_KEY; gLine = 0; gAllScores += gScore; gScore = 0; llListenControl(Handle,FALSE); } list order_buttons(list buttons) { return llList2List(buttons, -3, -1) + llList2List(buttons, -6, -4) + llList2List(buttons, -9, -7) + llList2List(buttons, -12, -10); } default { state_entry() { gCard = llGetInventoryName(INVENTORY_NOTECARD,0); gAvList = []; CHAN = (integer)(llFrand(100000000))* (-1); Handle = llListen(CHAN,"","",""); llListen(24,"",llGetOwner(),""); init(); llSensorRepeat("", "", AGENT_BY_LEGACY_NAME, 5.0, PI, 20.0); } sensor(integer num_detected) { if (gtouch == 0) // Starting quiz with a new person { //if(IsNameOnList(gAvList,llDetectedName(0))) //{ // llInstantMessage(llDetectedKey(0),"Sorry, "+ llDetectedName(0) + ". You have already taken the quiz. You cannot take it twice."); //return; // } //else // { //gAvList += llDetectedName(0); // Add av to the list of people who have attempted this quiz //} gAv = llDetectedName(0); gAvKey = llDetectedKey(0); //llInstantMessage(gAvKey,"Hello, "+ gAv+ ". You will have "+(string)Timespan+" minutes to finish this quiz. Respond to questions as they appear in blue dialog boxes on your screen."); //llInstantMessage(gAvKey,"Touch this panel again to stop the quiz."); //llSetTimerEvent(Timespan*60); } if (gAv != llDetectedName(0)) //Only accept touches from this av until the quiz is finished { //llInstantMessage(llDetectedKey(0),"Someone else is taking the quiz now. Please wait."); //return; } //if (gtouch >=1) // This is the emergency stop. Av wants to stop taking the quiz before the last question //{ //llListenControl(Handle,TRUE); //llDialog(gAvKey,"If you stop now, you may not restart later. \nDo you want to QUIT now?", ["YES", "NO"],CHAN); //return; //} // An av should only reach this point if it is the first touch gQID = llGetNotecardLine(gCard,gLine); //Read the first line of the notecard ++gtouch; } changed(integer change) { if(change & CHANGED_INVENTORY) { llResetScript(); } } //timer() //{ //llInstantMessage(gAvKey,"Your time is up. Thank you for taking the quiz. Your score is "+ (string)gScore); //init(); //Restart the quiz for the next person //} dataserver(key query_id, string data) { if(query_id == gQID) //If the data request came from this script { if(data != EOF) //If there is still data to be read from the notecard { if(llGetSubString(data,0,0) == "#"||llGetSubString(data,0,0) == "") //Ignore comment lines and blank lines { ++gLine; gQID = llGetNotecardLine(gCard,gLine); } else if (llGetSubString(data,0,0) == "Q") //Read the question and all answer choices { gQuestion += llGetSubString(data,1,-1) + "\n"; //Format each "Q" line as a new line in the dialog box ++gLine; gQID = llGetNotecardLine(gCard,gLine); } else if (llGetSubString(data,0,0) == "A") //Read the answer key { gAnswers = llParseString2List(llGetSubString(data,1,-1),[","],[]); integer len = llGetListLength(gAnswers); integer i; list buttons = []; for (i=1;i<=len;++i) //Create a numbered button for each choice { buttons += [(string)i]; } llListenControl(Handle,TRUE); llDialog(gAvKey,gQuestion,order_buttons(buttons),CHAN); //Display the question in a dialog box } } else // If there are no more lines on the notecard { //llInstantMessage(gAvKey,"You have finished the quiz. Congratulations. Your score is "+(string)gScore); init(); //Restart the quiz for the next person } } } listen (integer channel, string name, key id, string message) { if (channel == 24) //Teacher said something on channel 24 { if (llToLower(message) == "results") //and the message was "results" { integer len = llGetListLength(gAvList); integer i; for (i=0;i<=len-1;++i) { llOwnerSay(llList2String(gAvList,i) + ".... Score = " + llList2String(gAllScores,i+1)); } } } else if (message == "YES") // Av has touched the panel and wants to quit { llInstantMessage(gAvKey,"You have left the quiz with a score of "+(string)gScore +". Goodbye!"); init(); } else if(message == "NO") // Av has touched the panel and does NOT want to quit { return; } else // A question has been displayed in a dialog box { integer pos = llListFindList(gAnswers,["1"]); //Search the answer key. The correct answer is pos+1 if(message == (string)(pos+1)) { //++gScore; //llInstantMessage(gAvKey,"Correct! Your score is now "+ (string)gScore+ ". Next ..."); llDie(); } else if (pos != -1) { //llInstantMessage(gAvKey,"Wrong. The correct answer was "+ (string)(pos+1) + ". Next ...."); } else if (pos == -1) //The teacher screwed up and didn't code a correct answer { llInstantMessage(gAvKey,"Ooops! There is no right answer to this question. Let's move on...."); } gQuestion = ""; //Erase the current question gAnswers = []; //And its answer key ++gLine; gQID = llGetNotecardLine(gCard,gLine); // Get the next question } } }
  14. Thank you very much for your quick reply. I don't have time to try it out before next weekend. I'll probably write back next weekend. Cheers!
  15. Hi! I would like to build a quiz using notecards, something like this one: http://wiki.secondlife.com/wiki/User:Rolig_Loon/Quiz_From_Notecard This one works fine the way it is. I would like to add one feature, though, namely I would like to shuffle the questions so that the questions show up in a random order each time. I guess the easiest way to do that would be to make the script randomly select one question notecard out of a pool of question notecards. I just couldn't figure out how to do this and I'm not very advanced at scripting. Does any of you have an idea maybe? Thanks!
  16. Hi! Another user was so kind to make a bilingual vocabulary memory game for me once: Two matching words in the respective two languages must be matched by clicking them. When the two words match, one of the two is moved on top of the other one. The game is here: https://forums.osgrid.org/viewtopic.php?f=5&t=6116 On the basis of that script I think it should be possible to make a jiggsaw puzzle. It can already be done through the above mentioned script: One piece is the actual puzzle piece, with a texture of a piece from a photo /text /painting etc. The other piece lies on the ground as a background for that picture, with no texture. Several of these background pieces lie next to each other on the ground. The script of each background piece matches one of the puzzle pieces. When the two to matching ones are clicked, the puzzle piece is moved onto its corresponding background piece, and thus, it is in the correct place. This is repeated with all other puzzle pieces until the puzzle is finished. The problem is the following: This makes it possible to randomly click pieces together, without thinking. What I would like to have is this: Each puzzle piece can be matched with each background piece and no correct solution is given in the script. When a piece is clicked a second time, it moves back to its original position. This means the player must solve the puzzle through looking and thinking, like a normal jigsaw puzzle. Do you maybe have any ideas for this? There might also be completely different approaches for this. Thank you very much in advance!
×
×
  • Create New...