// Improved Stables - Mordaunt // // Pets are stored on the player not the stable NPC so dead/removed NPCs don't result in lost pets. // // WARNING! switching storage_type will prevent players from accessing the other list, so chose if you want character stables or // account based stables and stick to it. // // Open Jobanimal.scp and replace the ON=*Retrieve* & ON=*Stable* triggers with these: // //ON=*Retrieve* // IF ==BRAIN_ANIMAL_TRAINER // SRC.DIALOG d_stable // ENDIF // //ON=*Stable* // IF ==BRAIN_ANIMAL_TRAINER // SRC.TARGETF f_stable // ENDIF // // // Cleanup: In sphere_serv.triggers.scp: // // [FUNCTION f_onchar_delete] // f_char_clean // // [FUNCTION f_onaccount_delete] // f_account_clean ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// [DEFNAME settings] storage_type 0 // 0 = character stable 1= account stable (all characters on the account can access) stable_limit 30 // Maximum # of animals that can be stabled per character/account [FUNCTION f_stable] ref1= ref2= if () || (==c_man) || (==c_woman) src.sysmessage @32,,1 You cannot do that return 1 endif if ( &statf_conjured) src.sysmessage @32,,1 You cannot stable conjured creatures. return 1 endif if ? :>_stabled.count> if (? :>_stabled.count> < ) if !() src.sysmessage @32,,1 is not your pet. return 1 endif ref2.f_custom_shrink return 1 else src.sysmessage @32,,1 Your stable is full return 1 endif else if !() src.sysmessage @32,,1 is not your pet. return 1 endif ref2.f_custom_shrink endif [function f_custom_shrink] ref1= ref2= ref2.shrink ref3 &~030000000> ref3.cont ref3.attr 040a4 if ? :>_stabled.count> if (? :>_stabled.findelem > == -1) serv.list.? :>_stabled.add return 1 endif else serv.list.? :>_stabled.add return 1 endif [DIALOG d_stable] 0,0 Page 0 ref1 gumppictiled 0 0 410 412 0a40 checkertrans 1 1 408 410 dtext 180 20 90 Mystic Stables dtext 120 55 90 ? :>_stabled.count> pets stabled ( max ? per account: >) dtext 30 80 90 Retrieve dtext 230 80 90 Name Page 1 if ? :>_stabled.count> for 0 ? :>_stabled.count> -1)> if ( >=5) && ( % 5 == 0) button 368 12 0fa5 0fa7 0 / 5) + 1)> dtext 305 12 Next Page page / 5) + 1)> button 12 12 0fae 0fb0 0 / 5))> dtext 42 12 Previous Page endif local.color ? :>_stabled.>.color> local.id ? :>_stabled.>.id> button 40 % 5) * 60)> 4005 4007 1 0 +1> tilepichue 100 % 5) * 60)> dtext 200 % 5) * 60)> 90 ? :>_stabled.>.name> endfor else dtext 100 200 90 You have no animals stabled endif [DIALOG d_stable BUTTON] ON=1,999// return ref1 ref2 = ? :>_stabled.-1)>>> ref2.attr 04020 ref2.cont dclick if (? :>_stabled.count> < 2) serv.list.? :>_stabled.clear else serv.list.? :>_stabled.-1)>.remove endif [FUNCTION f_char_clean] for 0 _stabled.count> forinstances t_figurine if ( == _stabled.>) remove endif endfor endfor serv.list._stabled.clear [FUNCTION f_account_clean] for 0 _stabled.count> forinstances t_figurine if ( == _stabled.) remove endif endfor endfor serv.list._stabled.clear