Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //This script was originally designed for gachas using AVSitter, but is also ideal for
- //objects that can be modified containing AVpos notecards that cannot be edited or
- //for AVpos notecards (like ones in gacha items) that you may not want to edit.
- //CHANGE THE NAMES IN ani_names TO THE NAMES OF ANIMATIONS IN THE SIT MENU/AVpos NOTECARD
- //YOU WANT TO RANDOMLY CYCLE THROUGH. (You can add more names, just use quotation marks.)
- list ani_names = ["Male_01", "Male_05", "Male_06", "Male_10", "Female_05", "Female_06", "Female_08", "Male_08"];
- //CHANGE THE INTEGER IN Tcycle TO THE NUMBER OF SECONDS YOU WANT BETWEEN ANIMATION AND
- //POSE CHANGES.
- integer Tcycle = 110;
- float randomFloat;
- string aniname;
- integer aninumber;
- integer synched;
- //CHANGE THIS NUMBER TO THE MAXIMUM NUMBER OF AVATARS THAT YOU WANT SEATED ON THIS OBJECT.
- //THIS VALUE IS USED IN COMBINATION WITH THE Bot_Signal FUNCTION.
- integer max_sitters = 1;
- //BotSignal uses the description field to communicate maximum occupancy to scripted agents.
- //If you're using AVSitter to cycle through animations for NPCs or bots this is a low lag
- //way to convey this information using llGetObjectDetails through a second script instead of
- //using a listen event.
- string Bot_Signal(integer Max_Occupancy)
- {
- string OccORnot = "Occupied";
- if ((llGetNumberOfPrims()- llGetObjectPrimCount(llGetKey())) < Max_Occupancy) OccORnot = "Unoccupied";
- return OccORnot;
- }
- default
- {
- state_entry()
- {
- synched = llGetListLength(ani_names);
- llSetTimerEvent(Tcycle);
- }
- timer()
- {
- randomFloat = llFrand(synched);
- aninumber = (integer)randomFloat;
- aniname = llList2String(ani_names, aninumber);
- llMessageLinked(LINK_SET,90000,aniname,"0");
- }
- changed(integer change)
- {
- //Here's where the Bot_Signal does it's magic...
- if (change & CHANGED_REGION_START) llSetObjectDesc(Bot_Signal(max_sitters));
- if (change & CHANGED_LINK) llSetObjectDesc(Bot_Signal(max_sitters));
- //The words "Occupied" or "Unoccupied" appear in the
- //object's description. If the seat says "Occupied"
- //the bot can be scripted (using llGetObjectDetails)
- //to avoid that seat and find some other place to sit
- //with no listener required.
- if (change & CHANGED_INVENTORY) llResetScript();
- }
- }
Advertisement