Reward Objects [DOL.GS.Reward]

Share files with other Dawn of Light users

Moderator: Support Team

Reward Objects [DOL.GS.Reward]

Postby Xanth » Tue Jan 06, 2015 10:45 pm

RewardObject.cs
changed code | INFO HOW-TO-Use the script is in code.
(2.2 KiB) Downloaded 113 times

EDIT: Removed the Radius (foreach) method and changed the code a bit.


Hey guys, i wrote a script which gives u an amount of bps after rightclick the object, so its like opening presents.

So tell me if you like it and i think it could be useful for some other things like if u click on it it casts a spell for 15% bonus dmg for 5min or something, you can be creative. this is just the template and u can work with it. I also added a USE HELP on top for no wrong use of the script.

feel free to post a bug or anything else

best regard :)

xanth
Last edited by Xanth on Wed Jan 07, 2015 9:48 am, edited 1 time in total.
User avatar
Xanth
DOL Acolyte
 
Posts: 141
Joined: Tue Sep 30, 2014 7:01 pm
Location: Germany

Re: Reward Objects [DOL.GS.Reward]

Postby Leodagan » Wed Jan 07, 2015 8:25 am

Just for a coding matters :

Code: Select all
player.Out.SendMessage("You gain " + reward + " Bountypoints from " + this.Name, eChatType.CT_Important, eChatLoc.CL_SystemWindow);


You should use string format here,

Code: Select all
player.Out.SendMessage(string.Format("You gain {0} Bountypoints from {1}", reward, this.Name), eChatType.CT_Important, eChatLoc.CL_SystemWindow);


It will improve the performance/memory usage, and it match some other use case such as "Translations" that use similar Formatting.

----

You're also calling multiple time "this.RemoveFromWorld();" for each of the "Name case", and one last time at the end of the method...

And you have an empty loop on "foreach (GamePlayer p in this.GetPlayersInRadius(250))", Get*InRadius methods are pretty expensive, and shouldn't be used for doing nothing ;)

----

And lastly not about code, DataQuest are already able to handle this use case...

there is a Start Type :
InteractComplete = 4, // Interacting with start object grants and finishes the quest


And you can customize the reward

RewardBP - Serialized list of XP rewarded each step. All steps must have a value, 0 is ok.


finally allow unlimited quest accomplishment (or not...)

MaxCount, MinLevel, MaxLevel - Single values to determine who can do quest. All must be provided. MaxCount == 0 for no limit


articles/?article=48
Last edited by Leodagan on Wed Jan 07, 2015 9:57 am, edited 1 time in total.
User avatar
Leodagan
Developer
 
Posts: 1259
Joined: Tue May 01, 2012 9:30 am
Location: Lyon

Re: Reward Objects [DOL.GS.Reward]

Postby Xanth » Wed Jan 07, 2015 9:42 am

i dont really understand the dataquest thing and thx for the report with empty loop and what is too much and so on also thank you with the performance and memory example, i learned from you a bit now its quite interesting. thank you very much and i will maybe change it later.

best regards
User avatar
Xanth
DOL Acolyte
 
Posts: 141
Joined: Tue Sep 30, 2014 7:01 pm
Location: Germany

Re: Reward Objects [DOL.GS.Reward]

Postby Terontoy » Thu Sep 10, 2015 10:37 am

You know, this is it. Tell me can you?
Terontoy
DOL Guest
 
Posts: 2
Joined: Thu Sep 10, 2015 10:07 am


Return to User Files

Who is online

Users browsing this forum: No registered users and 1 guest