Jump to content
  • 0
Tio Akima

order clone attack

Question

hi, i made a skill to send the clone generated by the player to attack a target. (order to attack a target).
I did a custom function, where I return the clone ID on the map.
And so, give him an order.
But, I do not know if it is correct to go this way, or if there is any other necessary procedure

case CLONE_ATTACK:
		{
				int c = 0;
				int clone_id = 0;
				int maxcount = 1;
				
				map->foreachinmap(skill->check_condition_clone, sd->bl.m, BL_MOB, sd->bl.id, &c , &clone_id );	// clone search on the map
				
				//ShowWarning("clone_id: %d\n", clone_id);	//debug
		
					if( c < maxcount ) {	//if no clones are found
						clif->skill_fail(sd, skill_id, USESKILL_FAIL_CONDITION, 0, 0);
						map->freeblock_unlock();
						return 0;
					}
				struct block_list* mbl  = map->id2bl(clone_id);		//takes the clone id and converts it to a bl
				struct unit_data *ud = unit->bl2ud(mbl);			//take the bl and convert it to a unit
				
				//nullpo_ret(mbl);
				//nullpo_ret(ud);	
				
				if(ud){
					unit->set_target(ud, bl->id);					//set a target
					unit->attack(mbl, bl->id, ud->state.attack_continue); // Execute normal attack
					
				}
		}

suggestions?

 

@EDIT: Solved

Edited by Tio Akima

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.