hello there!

Im wondering if i can get a bit of help with something that keeps coming up with "Process is terminated due to StackOverFlowException.". Now its because i was making some new spells and i wanted the moving particles to have a hue (to correspond with their nature. e.g. Fire, ice, poison and lightning).

now i was going to use one of the various ("Caster.MovingParticles(m, 0x36E4, 5, 0, false, false, 3006, 0, 0);") MovingParticles from Server\Mobile.cs, but the only ones with Hues had "int renderMode,", which i dont know what that is (did a bit of searching and i must be blind... but if someone can explain this, that might help. :) ).

So i decided to make my own in the:
Server\Mobile.cs
Server\Effects.cs <=== this is the one causing the "StackOverFlowException".

also the spell moving particle area i put "Caster.MovingParticles(m, 0x36E4, 5, 0, false, false, 0x818, 3006, 0, 0, 0);"

Now I have attached the documents, marked them and I have a picture to show what vis studio is saying, also what the server threw in the CMD.
Imageservuo.png

I hope someone can help me out. also bare with me, im only new to all this. :) also let me know of anything you need from me!

Also thank you all for keeping a great project going!! :D

P.S. I notice you can add Code in a reply but i dont know how to. like a quote i mean. :p
 

Attachments

  • Effects.cs
    11.7 KB · Views: 2
  • Mobile.cs
    263.5 KB · Views: 1
rendermode is typically 0, not really sure what it actually does

by make your own are you saying you created a new MovingParticles ?
removing it should fix the problem.
there are 4 options for MovingParticles included in the repo, 2 of them don't use render mode
 
rendermode is typically 0, not really sure what it actually does

by make your own are you saying you created a new MovingParticles ?
removing it should fix the problem.
there are 4 options for MovingParticles included in the repo, 2 of them don't use render mode

Yeah after some more searching i found that some people refer rendermode to something like a blight. it also seems it doesnt like some hues (they just show up grey/black), but there could be something that im just missing. :p I ended up using one with renderMode and its doing the job. sorry for the bother. :D trail and error!

Also side question: whats the difference between a MovingParticle and MovingEffect? only if you (or anyone) knows. :)

Your function is calling itself, leading to an infinite loop.

Ok I will see what i can do, still learning all this. :) while i dont need this new "function" anymore, I might still play around with it to better understand what i did wrong. if you have any pointers, it would be appreciated. :)

also thank you both for taking time to have a look at this and replying!!

Also note i use Uofiddler to find out the hues. if its any relevance.
 
Sorry, I was on a tablet and I just threw up a quick reply. Here is more detail on the problem:

When you call a function from within a function, you are calling a completely separate function or an overload of the function (meaning a similar function with a change in the parameters of the function). The function you created was this, according to your screenshot:

Code:
    public static void SendMovingParticles(
       IEntity from,
       IEntity to,
       int itemID,
       int speed,
       int duration,
       bool fixedDirection,
       bool explodes,
int hue,
       int effect,
       int explodeEffect,
       int explodeSound,
       int unknown)
     {
       SendMovingParticles(
         from, to, itemID, speed, duration, fixedDirection, explodes, hue, effect, explodeEffect, explodeSound, unknown);
     }

Notice that the declaration of the function includes 12 parameters. Then, in the body of the function, you tell it to use a function called SendMovingParticles with 12 parameters. So, basically, you are telling it when this function is called with 12 parameters, use the same function with 12 parameters, which means, use yourself. That causes an endless loop condition where this function just keeps calling itself.

What you need to do is create this same function, but it needs to call to another function with another set of parameters. This is called overloading. If you look at all the functions named SendMovingParticles, you will notice that each one has a different number of parameters. They each then call another function with a different number of parameters until it finally calls the version of SendMovingParticles that actually takes an action (in this case creating a packet).

Hope that helps!
 
Ahhh... that explains a few things ive seen! now i am much wiser. :) thank you very much for the clarity!! it really means a lot. i was under the impression that i had to make them identical.

Thank you for that reply and your time!! :)
[doublepost=1462407896][/doublepost]Just fiddled with it quickly and it works now. thank you very much again for that explanation!
 
Back