Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Insure
Author Message
jexnico
Journeyman
*

Posts: 191
Likes Given: 113
Likes Received: 3 in 3 posts
Joined: Jan 2014
Reputation: 0



Post: #1
Smile Script Insure
Could someone get me a script to insure that it is more or less like this:
This will insure the format of deed.
When you click on the weathering insurado will appear written [Insured] upon the item.
and when the player dies, the item loses not insure more drop in their loot, as if it were a temporary newbie for 1 time.
And insure the deed must be newbie.

Thanks!!
(This post was last modified: 01-24-2014 02:40 AM by jexnico.)
01-24-2014 02:40 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
RanXerox
Master
**

Posts: 550
Likes Given: 1
Likes Received: 12 in 9 posts
Joined: Dec 2010
Reputation: 19



Post: #2
RE: Script Insure
This is an excerpt from the Cloud BR script pack.

The following DEFNAME, FUNCTIONs, and TYPEDEF code is used to insure the item by adding (or removing) a TYPEDEF on the item:

Code:
[DEFNAME insure_settings]
INSURANCE_PRICE 5000 //how much insuring an item costs! OSI normal value is 400, which I think is ridiculous!

[FUNCTION INSURE]
TARGETF TARGET_INSURE
SYSMESSAGELOC -1,1060868

[FUNCTION TARGET_INSURE]
IF (!<ARGN>)
   REF1=<ARGO.UID>
ELSE
   REF1=<ARGN>
ENDIF
IF ((<REF1.TOPOBJ>!=<SRC>) || (<REF1.UID>==<SRC>))
   SYSMESSAGELOC color_text,1060871//"You can only insure items that you have equipped or that are in your backpack"
ELIF (<REF1.ATTR>&ATTR_NEWBIE)
   SYSMESSAGELOC color_text,1060870//"That item is blessed and does not need to be insured"
ELIF (<SRC.GOLD> < <DEF.INSURANCE_PRICE>)
   SYSMESSAGELOC color_text,1061079//"You lack the funds to purchase the insurance"
ELIF (<REF1.ISEVENT.T_ITEM_INSURED>)
   SYSMESSAGELOC color_text,1060874//"You cancel the insurance on the item"
   REF1.EVENTS -t_item_insured
   REF1.UPDATE 1
ELSE
   REF1.EVENTS +t_item_insured
   GOLD -= <DEF.INSURANCE_PRICE>
   SYSMESSAGELOC color_text,1060873//"You have insured the item"
   SYSMESSAGELOC color_text,1060398,<dDEF.INSURANCE_PRICE>//"~1_AMOUNT~ gold has been withdrawn from your bank box."
   REF1.UPDATE 1
ENDIF
IF (!<ARGN>)
   INSURE
ENDIF

[TYPEDEF t_item_insured]
ON=@ClientToolTip
   SRC.ADDCLILOC 1061682//"<b>Insured</b>"

The following code triggers need to be added to all players so that they can "toggle" (i.e. turn it off or on) the insurance for everything, and so the items are not dropped to the corpse upon player death:

Code:
ON=@ContextMenuRequest
   IF (<ARGN>==1)
      ARGN=2
   ELSE
      IF (<SRC>==<UID>)
         SRC.AddContextEntry 300,6201//"Toggle Item Insurance"
         IF (!<TAG0.AUTORENEWINSURANCE>)
            SRC.AddContextEntry 301,6200//"Auto Renew Inventory Insurance"
         ELSE
            SRC.AddContextEntry 302,6202//"Cancel Renewing Inventory Insurance"
         ENDIF
      ENDIF
   ENDIF

ON=@ContextMenuSelect
   IF ((<ARGN>==300) && !(<SRC.FLAGS> & statf_dead))
      SRC.INSURE
   ELSEIF (<ARGN>==301)
      SRC.SYSMESSAGELOC color_text,1060881//"You have selected to automatically reinsure all insured items upon death"
      TAG.AUTORENEWINSURANCE=1
   ELSEIF (<ARGN>==302)
      SRC.SYSMESSAGELOC color_text,1061075//"You have disabled automatically reinsuring all insured items upon death"
      SRC.TAG.AUTORENEWINSURANCE=
   ENDIF

ON=@DeathCorpse
   LOCAL.INSUREGOLDGIVE=0
   FORCONT <ARGO.UID> 9999
      IF (<ISEVENT.T_ITEM_INSURED>)
         EVENTS -T_ITEM_INSURED
         CONT=<SRC.FINDLAYER.21>
         IF (<SRC.TAG0.AUTORENEWINSURANCE>)
            SRC.TARGET_INSURE <UID>
         ENDIF
         LOCAL.INSUREGOLDGIVE += <EVAL <DEF.INSURANCE_PRICE>/2>
      ENDIF
   ENDFOR
   REF22=<SRC.ATTACKER.LAST>
   IF (<REF22.FLAGS> & statf_pet)
      REF22=<REF22.MEMORYFINDTYPE.memory_ipet.LINK>
   ENDIF
   IF ((<REF22.ISPLAYER>) && (<REF22> != <SRC>))
      IF (<LOCAL.INSUREGOLDGIVE>)
         REF22.GOLD += <LOCAL.INSUREGOLDGIVE>
         REF22.SYSMESSAGE @color_text,,1,3,1 You received <dLOCAL.INSUREGOLDGIVE> gold coins for insured items from <SRC.NAME>. The money was sent to your bank.
      ENDIF
   ENDIF

Other notes:

- If you want a deed to be insured, just set EVENTS +t_item_insured on it... either in-game using a GM, or in a script.
- If you want the item created by a deed to be insured, the t_deed TYPE needs to be modified to set EVENTS +t_item_insured on the new item...
- If you want these items to not require a insurance cost for renewal, you could make a t_item_insured_free EVENT and modify the code above to use it.
(This post was last modified: 01-25-2014 04:35 AM by RanXerox.)
01-25-2014 04:29 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)