Jump to content

  •  

Nardoth

Member Since 25 May 2015
Offline Last Active Oct 12 2016 08:10 AM
-----

#76745 Costume System

Posted by Nardoth on 21 September 2016 - 08:30 PM

Watch out for the bug in which if you try to restore the costume having another item of the same kind in the inventory, it will fail to restore the costume. What this does is delete the item in the inventory and replace it for a new one, and it may cause to lose cards and refine on that item.

A simple solution is to use the condition countitem(item_id)>1 to stop the script if the player has more than one of these items.




#76605 Check Collision in Skill

Posted by Nardoth on 15 September 2016 - 06:09 AM

In castend_pos2 there are already variables x and y that are set as parameters of the function, these are the coordinates of the cell the player casted the skill on, so you just have to replace bl->x and bl->y for just x and y respectively. But then again, in NJ_KAMAITACHI the animation does not show up when there are no enemies in the area.

 

The loop should advance from the last cell the animation showed up to the next one, until it hit's a target or reach the range of the skill, and then continue. I will let you do the math about how to calculate which cell it should go, probably you will have to mess with some conditions about the direction where the target cell is from your point of view.

 

It would look something like this:

for(i=0;i<range;i++){
     if (0<map->foreachinpath(skill->attack_area,src->m,previous_cellx(i),previous_celly(i),next_cellx(i),next_celly(i),
                               skill->get_splash(skill_id, skill_lv),skill->get_maxcount(skill_id,skill_lv), skill-  >splash_target(src),skill->get_type(skill_id),src,src,skill_id,skill_lv,tick,flag,BCT_ENEMY))
     continue;
}
 

Using the firepillar will be more tricky, since what it does is place a unit on the cell with skill->unitsetting if I guess correctly.

If that's the case, maybe it will help you to set a variable of the struct skill_unit_group to that unit of firepillar, and set it's alive parameter to a lower number so it does not persist after the skill is done casting and it disappears quickly.

 

 

PD: My main language is spanish, but I can understand you pretty well.




#76584 Check Collision in Skill

Posted by Nardoth on 14 September 2016 - 03:13 PM

I know what you are trying to do, what I said was about that. You need to study how kamaitachi works. It uses the map->foreachinpath function to attack to everyone in it's path. That function returns the total amount of damage done in the area, so you may use that to know if it already hit something in a convenient loop (i.e. looping at every cell in the path).
To set kamaitachi as a ground skill you go to your skill_db.conf and replace Enemy: true to Place: true, but after you do that the skill will stop calling skill->castend_damage_id to use skill->castend_pos2 (and because of that it will stop calling map->foreachinpath unless you set it to do that in castend_pos2).
 
To loop at everycell in it's range you will have to get the direction the src is facing and calculate the next coordinate it should be heading. 
Check the available functions in unit.c (or by typing unit-> ).

It seems to me that this is a very inefficient way to do it but I bet it will do the trick and is the best thing I know to do with the tools we have.

 

The only problem with this method is that the skill animation wont show up if the skill fails to find an target. The animation is called by clif->skill_damage but it needs a block_list as a target and you only have the coordinates x,y of the targeted cell. In the other hand, using the caster's block_list (src) as a target will make the animation head always to east, which is an issue.

 

I don't know about you but I never learn C, or C++, or whatever this language is (actually the only language I'm not afraid to say I know a bit is fortran), but after learning I can use printf("string") or printf("%d",int i) my understanding speed of this code increased greatly. It may be helpful to you. The output will be print in the map-server console and to write a new line use printf("\n") to make it readable.

It helps to find bugs in your code about what it is doing or where it's crashing. Trial and error will help you a lot.




#76534 Edit Skill Fire Pillar

Posted by Nardoth on 13 September 2016 - 06:25 AM

Go to the skill_db.conf in your db/re (or pre-re) folder and comment out "UF_NOFOOTSET: true" in the skill. However cast time and delay for the skill are too short, so I would suggest not doing that because it would lead into imbalance.