fun idea

05/16/2013 00:26 pro4never#31
Quote:
Originally Posted by LordGragen. View Post
gotcha, yah what i think is better if i make the storm hit the player like you say by using targetUID

i think it will be better hitting the player every 20-30 sec prob like 200 dmg per atk,

i am just having a bit problem how to build the atk system instead of just the effect going on you.

and ty infamous for explaining


It all depends on how your source is written but the 'best' way to handle it would be to send the spell to local clients as a ground targeted X/Y skill. Then pass the skill to your attack handler or some other system which can process the spell ID/X/Y to calculate what targets have been hit and deal appropriate damage to them.

The concern there is that most sources will have an issue with this type of handling due to no attacker entity so you'll have to either re-write your attack handler or have a different one to handle server events dealing damage.


Just as an initial thought I feel the best way would be to write a base attack handler and then inherit from it for any spells that need special handling which can then call more generic targeting methods but I'd have to dig into it a bit more to see if that's actually the most efficient route.
05/16/2013 01:00 LordGragen.#32
Quote:
Originally Posted by pro4never View Post
It all depends on how your source is written but the 'best' way to handle it would be to send the spell to local clients as a ground targeted X/Y skill. Then pass the skill to your attack handler or some other system which can process the spell ID/X/Y to calculate what targets have been hit and deal appropriate damage to them.

The concern there is that most sources will have an issue with this type of handling due to no attacker entity so you'll have to either re-write your attack handler or have a different one to handle server events dealing damage.


Just as an initial thought I feel the best way would be to write a base attack handler and then inherit from it for any spells that need special handling which can then call more generic targeting methods but I'd have to dig into it a bit more to see if that's actually the most efficient route.
in that case take a look at this,

for the thunder system i made this inside of the handle.cs which holds my spells

Code:
 if (attacker.MapID == 1505)
            {
                SpellUse suse = new SpellUse(true);
                suse.Attacker = attacker.UID;
                suse.SpellID = 1000;
                suse.SpellLevel = spell.Level;
                System.Threading.Thread.Sleep(5000);

                    if (attacked.Hitpoints <= damage)
                        attacked.Hitpoints = 200;
                
            }
so far its not working i still need to figure few things out but i think i am close.
05/16/2013 01:36 pro4never#33
This relies on someone attacking....

You want

- Separate script running on its own thread/timer/etc to control intermittent lightning strikes.
- Code that can take a given location (X/Y of strike) and calculate what targets are hit
- Code that can deal damage to a given target (without a specific attacker)
- A way to display damage dealt (if any targets were hit) as well as spell effect to all users in range


How you handle these tasks and where you place them in your source is really up to you and the source you're using.
05/16/2013 01:46 LordGragen.#34
Quote:
Originally Posted by pro4never View Post
This relies on someone attacking....

You want

- Separate script running on its own thread/timer/etc to control intermittent lightning strikes.
- Code that can take a given location (X/Y of strike) and calculate what targets are hit
- Code that can deal damage to a given target (without a specific attacker)
- A way to display damage dealt (if any targets were hit) as well as spell effect to all users in range


How you handle these tasks and where you place them in your source is really up to you and the source you're using.
got it thank you, i will try v2 and let you know
05/16/2013 11:30 _DreadNought_#35
Quote:
Originally Posted by pro4never View Post
This relies on someone attacking....

You want

- Separate script running on its own thread/timer/etc to control intermittent lightning strikes.
- Code that can take a given location (X/Y of strike) and calculate what targets are hit
- Code that can deal damage to a given target (without a specific attacker)
- A way to display damage dealt (if any targets were hit) as well as spell effect to all users in range


How you handle these tasks and where you place them in your source is really up to you and the source you're using.
I did write him some quick code in notepad to give him a general idea.. all he has to do is make it take damage... rest is already kinda done for him.

(And yes, I know the variable 'lastStrike' does not follow naming conventions.. notepad man :) )
PHP Code:
///////////////////////////// WRITTEN IN NOTEPAD! WONT WORK! CODE SUCKS! /////////////////////////////

///// NOTE: Try not to use DateTime if you can. :) ////

using System;

namespace 
COPS
{
    public class 
Storm
    
{
        
DateTime lastStrike DateTime.Now;
        
        
        
//Threaded run
        
public void run()
        {
            foreach(
Client client in Clients.Values.ToArray()) 
            {
                if (
Chance(10))
                    return; 
// Let's not bug them all the time, a chance this wont show.
                
if (Chance(5) && DateTime.Now >= lastStrike.AddMinutes(1))
                {
                    
lastStrike DateTime.Now;
                    
                    
client.SendScreenShake(5);
                    for (
int i 0;i<10;i++)
                        
client.send(GenerateThunderPacket());
                }
                
                
client.send(GenerateThunderPacket());
            }
        }
        public 
byte[] GenerateThunderPacket(Client client)
        {
            return new 
SpellPacket()
                                {
                                    
SpellID 1234,
                                    
Level 2,
                                    
UID client.Id,
                                    
Random(client.Xclient.X+10),
                                    
Random(client.Yclient.Y+10)
                                }.
Build());
        }
    }

I mean.. you could just do something like

if (Map[client.Map].GetCell(pkt.X, pkt.Y).Entity != null)
{
//Send it to the attack processor and let it to the rest.
}
05/16/2013 11:35 LordGragen.#36
this looks good, code is simple i can understand it, but first i will try the handle.cs option if that works then it should be more clean handling it from there.

if i get stuch or unable to do it then i got this as a backup.
05/16/2013 11:55 _DreadNought_#37
Quote:
Originally Posted by LordGragen. View Post
this looks good, code is simple i can understand it, but first i will try the handle.cs option if that works then it should be more clean handling it from there.

if i get stuch or unable to do it then i got this as a backup.
I don't understand why you want to code this entire system in your attack handler... lol
05/16/2013 12:23 LordGragen.#38
Quote:
Originally Posted by _DreadNought_ View Post
I don't understand why you want to code this entire system in your attack handler... lol
well not the entire system,

the rain will be in program.cs with the map id in it, so every time you enter the map it will rain, so lets take that out of the list,

the next thing will be is the thunder, which i will see if i can make it atk every 25 sec, and take 200hp out of it, thats it.
05/16/2013 14:16 InfamousNoone#39
Any implementation which involves a Sleep(x) for this, isn't properly done and is a waste of a single thread. Just throwing that out there. Secondly, DateTime has a lot of over head if you're not using DateTime.UtcNow
05/16/2013 14:24 Smaehtin#40
Quote:
Originally Posted by _DreadNought_ View Post
I did write him some quick code in notepad to give him a general idea.. all he has to do is make it take damage... rest is already kinda done for him.

(And yes, I know the variable 'lastStrike' does not follow naming conventions.. notepad man :) )
I mean.. you could just do something like

if (Map[client.Map].GetCell(pkt.X, pkt.Y).Entity != null)
{
//Send it to the attack processor and let it to the rest.
}
Any specific reason you use Clients.Values.ToArray? Just wondering
05/16/2013 14:55 Super Aids#41
Quote:
Originally Posted by Smaehtin View Post
Any specific reason you use Clients.Values.ToArray? Just wondering
In that case there is no reason, since Values can be enumerated.
05/16/2013 14:56 _DreadNought_#42
Quote:
Originally Posted by InfamousNoone View Post
Any implementation which involves a Sleep(x) for this, isn't properly done and is a waste of a single thread. Just throwing that out there. Secondly, DateTime has a lot of over head if you're not using DateTime.UtcNow
Quote:
Originally Posted by Smaehtin View Post
Any specific reason you use Clients.Values.ToArray? Just wondering
I was using a simple demonstration that was programmed in notepad. (aka.. dont judge)

If I was doing it for myself, I would use some things that I think would be awesome, such as some sort of action/event system (If I was able to find a use that was sufficient)
05/28/2013 02:41 Super Aids#43
This is how thunder should look ;)
I'll spice it up a bit by adding night, although I haven't come around coding that yet.
05/28/2013 06:48 pcs_ffchen#44
I think that would irritate most players' eyes.
05/28/2013 16:03 Super Aids#45
True, not going to be as often as in the video though :p