Mob Restriction Script

vijay

New member
Messages
76
Points
0
Age
33
Location
Bangalore, India.
Emulator
Can anyone please help by converting the script below to work on eAthena 3CeAm!

Code:
-    script    Strict    -1,{    OnInit:        setarray .mob_restriction[0],1646,1647,1648,1649,1650,1651,1751,1708;        .size = getarraysize(.mob_restriction);        bindatcmd "monster",strnpcinfo(3)+"::OnExe",0,99;        end;        OnExe:        .monster_id = atoi( .@atcmd_parameters$[0] );        for ( .@i = 0; .@i < .size; .@i++ ) {            if ( .monster_id == .mob_restriction[.@i] || getgmlevel() < 90 ) {                dispbottom "You cannot summon this monster";                end;            }        }        if ( getmonsterinfo( .monster_id, 0 ) != "null" ) {            .@amount = atoi( .@atcmd_parameters$[1] );            atcommand "@monster " +.monster_id+ " " +(!.@amount?1:.@amount);        }        end;}
 
@@vijay

Try this:

- script Strict -1,{ OnInit: setarray .mob_restriction$, 1646, 1647, 1648, 1649, 1650, 1651, 1751, 1708; set .size, getarraysize( .mob_restriction$ ); bindatcmd "monster", strnpcinfo( 3 ) + "::OnExe", 0, 99; end; OnExe: if ( compare( implode( .@mob_restriction$, ":" ), .@atcmd_parameters$[0] ) || getgmlevel() < 90 ) { dispbottom "You cannot summon this monster"; end; } set .@monster_id, atoi( .@atcmd_parameters$[0] ); if ( getmonsterinfo( .@monster_id, MOB_NAME ) != "null" ) { set .@amount, atoi( .@atcmd_parameters$[1] ); atcommand "@monster " +.monster_id + " " + ( !.@amount ? 1 : .@amount ); } end;}
It might be possible there is still something hercules exclusive, so if you get errors just report back.

 
Thanks for helping Winterfox.
Here are the error when i load the npc:
 

[Error]:
script error on npc/wowro/mobrestriction.txt line 5
    parse_line: expect command, missing function name or calling undeclared func
tion
     1 : {
     2 :        OnInit:
     3 :                setarray .mob_restriction$, 1646, 1647, 1648, 1649, 1650
, 1651, 1751, 1708;
     4 :                set .size, getarraysize( .mob_restriction$ );
*    5 :                'b'indatcmd "monster", strnpcinfo( 3 ) + "::OnExe", 0, 9
9;
     6 :        end;
     7 :
     8 :     OnExe:
     9 :                if ( compare( implode( .@mob_restriction$, ":"  ), .@atc
md_parameters$[0] ) || getgmlevel() < 90 ) {
    10 :                        dispbottom "You cannot summon this monster";
 
Last edited by a moderator:
Seems like 3CeAm doesn't have the bindatcmd. You will have to search for a source mod to add it.

 
Okay ill give it a try.

Winterfox i did add the bindatcmd from a diff now.

bindatcmd diff:

http://pastebin.com/5TqdF1pn
 

After when i load up your npc, i'm not even able to @monster any of monsters(which are not on the mob_restriction).
Map server says

Code:
[Warning]: script:implode: array length = 0
How to fix this issue?
 
Code:
-	script	Strict	-1,{	OnInit:		setarray .mob_restriction$, 1646, 1647, 1648, 1649, 1650, 1651, 1751, 1708;		bindatcmd "monster", strnpcinfo( 3 ) + "::OnExe", 0, 99;	end;    OnExe:		if ( compare( implode( .mob_restriction$, ":"  ), .@atcmd_parameters$[0] ) || getgmlevel() < 90 ) {			dispbottom "You cannot summon this monster";			end;		}		set .@monster_id, atoi( .@atcmd_parameters$[0] );				if ( getmonsterinfo( .@monster_id, MOB_NAME ) != "null" ) {			set .@amount, atoi( .@atcmd_parameters$[1] );			atcommand "@monster " +.@monster_id + " " + ( !.@amount ? 1 : .@amount );		}        end;}
 
Last edited by a moderator:
The error is fixed but i still cant even @monster poring too doe its not on the mob_restriction list.
It keeps telling you cannot summon this monster.

Even when i type @monster and hit enter, it says "you cannot summon this monster."!

 
@@vijay

There are only 2 possible reasons for this, either the monster is on the restricted list or the login you use doesn't have a gm level above 90.

 
What ever mob i try to @monster with my lvl 80 char it says "You cannot spawn this monster".
Even i can't @monster 1646 on my lvl 100 GM id, it says "You cannot spawn this monster".

Code:
-	script	mobrest	-1,{	OnInit:		setarray .mob_restriction$, 1646, 1647, 1648, 1649, 1650, 1651, 1751, 1708;		set .size,getarraysize(.mob_restriction);		bindatcmd "spawn",strnpcinfo(3)+"::OnExe";		end;		OnExe:		set .monster_id,atoi( .@atcmd_parameters$[0] );			for( set .@i,0; .@i < .size; set .@i,.@i + 1 ) {			if ( .monster_id == .mob_restriction[.@i] && getgmlevel() < 99 ) {				dispbottom "You cannot summon this monster";				end;			}		}		if ( getmonsterinfo( .monster_id, 0 ) != "null" ) {			set .@amount,atoi( .@atcmd_parameters$[1] );			atcommand "@monster " +.monster_id+ " " +(!.@amount?1:.@amount);		}		end;}
When i change the monster to spawn, its working now >.<
 
Back
Top