Jump to content
  • 0

setunitdata fail to update UMOB_SIZE and UMOB_LEVEL


Litro Endemic

Question


  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   76
  • Joined:  06/13/13
  • Last Seen:  

setting mob size with setunitdata isn't working or I have make mistake in this script?

 

prontera,150,150,0	script	Mob Control	112,{
	mes "input mob id";
	input .@mob_id;
	if (getmonsterinfo(.@mob_id,MOB_NAME) == "null") {
		mes "monster didn't exist";
		close;
	}
	monster(strnpcinfo(4),152,148,"Controlled Mob",.@mob_id,1,strnpcinfo(0)+"::OnMobKilled");
	copyarray .gid[0], $@mobid[0], getarraysize($@mobid);
	.@size = getarraysize(.gid);
	//dispbottom ""+.@size;
	
	getunitdata(.gid[0],.@data);
	setunitdata .gid[0],UMOB_MODE, .@data[UMOB_MODE]|MD_NORANDOM_WALK;
	

	setarray .@size2, Size_Small, Size_Medium, Size_Large;
	.@rand = rand(getarraysize(.@size2));
	setunitdata .gid[0], UMOB_SIZE, 0;
	
	//for (.@i = 0; .@i < .@size; .@i++)
	//	dispbottom "Mob "+.@i+" ~ GID: "+.gid[.@i];
	
	initnpctimer;
	end;

OnTimer10000:
	if(unitexists(.gid[0])) {
		getunitdata(.gid[0],.@data);
		
		setarray .@size2, Size_Small, Size_Medium, Size_Large;
		.@rand = rand(getarraysize(.@size2));
		setunitdata .gid[0], UMOB_SIZE, .@size2[.@rand];
		setunitdata .gid[0], UMOB_LEVEL, .level++;
		unittalk .gid[0],"Size: "+.@size2[.@rand]+" ~ Level: "+.level;
	}
	initnpctimer;
	end;

}

 

Edited by Litro Endemic
Link to comment
Share on other sites

3 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  924
  • Reputation:   166
  • Joined:  04/05/13
  • Last Seen:  

Your scripts is working fine. I've added OnMobKilled Event to prevent error from killing it.

prontera,150,150,0	script	Mob Control	112,{
	mes "input mob id";
	input .@mob_id;
	if (getmonsterinfo(.@mob_id,MOB_NAME)=="null"){
		mes "monster didn't exist";
		close;
	}
	close2;
	monster(strnpcinfo(4),152,148,"Controlled Mob",.@mob_id,1,strnpcinfo(0)+"::OnMobKilled");
	copyarray .gid[0],$@mobid[0],getarraysize($@mobid);
	.@size=getarraysize(.gid);
	//dispbottom "Size: "+.@size;
	getunitdata(.gid[0],.@data);
	setunitdata .gid[0],UMOB_MODE,.@data[UMOB_MODE]|MD_NORANDOM_WALK;
	setarray .@size2,Size_Small,Size_Medium,Size_Large;
	.@rand=rand(getarraysize(.@size2));
	setunitdata .gid[0],UMOB_SIZE,0;
	//for(.@i=0;.@i<.@size;.@i++)
	//dispbottom "Mob: "+.@i+" ~ GID: "+.gid[.@i];
	initnpctimer;
	end;

OnTimer1000:
	if(unitexists(.gid[0])){
		getunitdata(.gid[0],.@data);
		setarray .@size2,Size_Small,Size_Medium,Size_Large;
		.@rand = rand(getarraysize(.@size2));
		setunitdata .gid[0],UMOB_SIZE,.@size2[.@rand];
		setunitdata .gid[0],UMOB_LEVEL,.level++;
		unittalk .gid[0],"Size: "+.@size2[.@rand]+" ~ Level: "+.level;
	}
	initnpctimer;
	end;
	
OnMobKilled:
	end;
}

 

1234.JPG

Edited by TARTs
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  283
  • Reputation:   76
  • Joined:  06/13/13
  • Last Seen:  

is monster spawned changed his level or size display? in my case it didn't

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  25
  • Topics Per Day:  0.01
  • Content Count:  924
  • Reputation:   166
  • Joined:  04/05/13
  • Last Seen:  

prontera,152,150,0	script	M2	112,{
	monster     "prontera",150,154,"Test",1002,10,strnpcinfo(0)+"::OnMobKilled",Size_Large;
	end;
	OnMobKilled:
	end;
}

Size display you need to use another command.

Size in db is variable.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...