• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

Custom CPQ (NPC Script)

Newbie Spellweaver
Joined
Jul 11, 2013
Messages
80
Reaction score
14
I've been hoping someone would release this (or re-release). Been looking for a while.

I don't use moopledev, I use an older revision of shootsource. I'm constantly wondering why the two differ from int or byte, amongst many other things.

So...

Added everything to NPCConversation manager, added the imports, everything going well.
PHP:
    public int getPlayerCount(int mapid) { //DstroyerDev, from Thane Krios
        return c.getChannelServer().getMapFactory().getMap(mapid).getCharacters().size();
    }  
    
    public int countMonster (int map) { //countMonster in MapleMap not getCountMonster
            return c.getChannelServer().getMapFactory().getMap(map).countMonster();
    }

The error I'm getting is with the countMonster:
return c.getChannelServer().getMapFactory().getMap(map).countMonster();

required: int, found: no arguments, reason: actual and formal arguments differ in length

here is my MapleMap method this it is referring to:

PHP:
    public int countMonster(int id) {
        int count = 0;
        for (MapleMapObject m : getMapObjectsInRange(new Point(0, 0),  Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.MONSTER))) {
            if (((MapleMonster) m).getId() == id) {
                count++;
            }
        }
        return count;
    }

I've messed around a bit, but I can't resolve the issue. I'll promptly admit to being more experienced with java scripts opposed to classes, and any education on why the error is happening, and how to go about fixing it (I do work, no need to spoonfeed), please shed some light my way!

countMonster(int id) as declared in your MapleMap file takes an integer parameter (presumably the ID of the monster you want to count the occurrence of in your map), you have called it with no parameters in your NPCConversationManager's countMonster() function.


@OP This is so cool! I really respect how it was all done with essentially just NPCs. Sweet job.
 
Experienced Elementalist
Joined
Jul 8, 2014
Messages
263
Reaction score
33
countMonster(int id) as declared in your MapleMap file takes an integer parameter (presumably the ID of the monster you want to count the occurrence of in your map), you have called it with no parameters in your NPCConversationManager's countMonster() function.


@OP This is so cool! I really respect how it was all done with essentially just NPCs. Sweet job.

That is how the script was released (NPCConvo). I've looked at MoopleDev, shootsource, & valhalla sources, and the countMonster is pretty the same, where as the declaration of MapleMap countMonster is taking an integer parameter. So to the original OP, given my declaration in MapleMap, can the call from NPCConvo have a parameter defined?
 
Newbie Spellweaver
Joined
Jul 11, 2013
Messages
80
Reaction score
14
That is how the script was released (NPCConvo). I've looked at MoopleDev, shootsource, & valhalla sources, and the countMonster is pretty the same, where as the declaration of MapleMap countMonster is taking an integer parameter. So to the original OP, given my declaration in MapleMap, can the call from NPCConvo have a parameter defined?

Of course it can. You could modify the implementation of countMonster(int id) to handle passing in -1 as the id to indicate to count all monsters on the map, not just of one ID. However I think that's less clean than adding a new method. Try defining this in NPCConversationManager:

PHP:
public int getMonsterCount(int map) { // The method the OP's script calls is named getMonsterCount
    return c.getChannelServer().getMapFactory().getMap(map).getAllMobs().size();
}

I have getAllMobs() in my MapleMap file already, from MoopleDEV. Or if you need it:

PHP:
public List<MapleMapObject> getAllMobs() {
    return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.MONSTER));
}
 
Experienced Elementalist
Joined
Jul 8, 2014
Messages
263
Reaction score
33
Of course it can. You could modify the implementation of countMonster(int id) to handle passing in -1 as the id to indicate to count all monsters on the map, not just of one ID. However I think that's less clean than adding a new method. Try defining this in NPCConversationManager:

PHP:
public int getMonsterCount(int map) { // The method the OP's script calls is named getMonsterCount
    return c.getChannelServer().getMapFactory().getMap(map).getAllMobs().size();
}

I have getAllMobs() in my MapleMap file already, from MoopleDEV. Or if you need it:

PHP:
public List<MapleMapObject> getAllMobs() {
    return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.MONSTER));
}

I ended up trying this:

PHP:
    public int countMonster (int map) {
            return c.getChannelServer().getMapFactory().getMap(map).countMonster(map);
    }

This gave me no error. I did switch the scripts name to call countMonster naturally. I will have to try this when I'm home.

Since I can access my dedi on my phone, I found this in MapleMap while looking at what you posted:

PHP:
    public final List<MapleMapObject> getAllMonster() {
        return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.MONSTER));
    }

I will try using the original as well, changing in to get AllMonster:

PHP:
    public int getMonsterCount(int map) { // The method the OP's script calls is named getMonsterCount
        return c.getChannelServer().getMapFactory().getMap(map).getAllMonster().size();
    }

I'll disclose which method worked and post some more screen shots!
 
Newbie Spellweaver
Joined
Jul 11, 2013
Messages
80
Reaction score
14
I ended up trying this:

PHP:
    public int countMonster (int map) {
            return c.getChannelServer().getMapFactory().getMap(map).countMonster(map);
    }

This gave me no error. I did switch the scripts name to call countMonster naturally. I will have to try this when I'm home.

Since I can access my dedi on my phone, I found this in MapleMap while looking at what you posted:

PHP:
    public final List<MapleMapObject> getAllMonster() {
        return getMapObjectsInRange(new Point(0, 0), Double.POSITIVE_INFINITY, Arrays.asList(MapleMapObjectType.MONSTER));
    }

I will try using the original as well, changing in to get AllMonster:

PHP:
    public int getMonsterCount(int map) { // The method the OP's script calls is named getMonsterCount
        return c.getChannelServer().getMapFactory().getMap(map).getAllMonster().size();
    }

I'll disclose which method worked and post some more screen shots!
PHP:
  public int countMonster (int map) {
            return c.getChannelServer().getMapFactory().getMap(map).countMonster(map);
    }

will not work. That will attempt to count the number of monsters with the id 'map', which is a map ID, not a mob ID.

PHP:
  public int getMonsterCount(int map) { // The method the OP's script calls is named getMonsterCount
        return c.getChannelServer().getMapFactory().getMap(map).getAllMonster().size();
    }

Yes, use this.
 
Experienced Elementalist
Joined
Jul 8, 2014
Messages
263
Reaction score
33
Thanks for clarifying that. And we can't just assign in to one map id either, because more than one are used!
 
Newbie Spellweaver
Joined
Feb 11, 2014
Messages
45
Reaction score
1
What should I do this part? "cm.getPlayerCount (map) function", "cm.summonMobAtPosition function", etc ...
I just do not know what should be done. Could someone help me or make a video?
I am layman in this matter
 
Nae-un <33
Joined
Jun 23, 2012
Messages
554
Reaction score
70
What should I do this part? "cm.getPlayerCount (map) function", "cm.summonMobAtPosition function", etc ...
I just do not know what should be done. Could someone help me or make a video?
I am layman in this matter

With my script, big boy, you won't have to worry about that. But if you truly wish to know:

cm.getPlayerCount(map) counts the number of players on said map
cm.summonMobAtPosition summons a mob ... at said position using x and y
 
Nae-un <33
Joined
Jun 23, 2012
Messages
554
Reaction score
70
Work in v62?

Haven't tested. I'm not even sure the mobs exist in v62. You can use substitute mobs if you really want to.The code itself should work fine on any source with some modification.
 
Custom Title Activated
Loyal Member
Joined
Jan 18, 2010
Messages
3,109
Reaction score
1,139
Haven't tested. I'm not even sure the mobs exist in v62. You can use substitute mobs if you really want to.The code itself should work fine on any source with some modification.

No clue what you're talking about, CPQ existed in v62 within the same maps using the same mobs/npc's.. The only thing that needs to be added is the methods/functions involved here.
 
Nae-un <33
Joined
Jun 23, 2012
Messages
554
Reaction score
70
No clue what you're talking about, CPQ existed in v62 within the same maps using the same mobs/npc's.. The only thing that needs to be added is the methods/functions involved here.

Lord, it must have been a long time since I've delved into Maple development. Maplestory has progressed so far that I don't remember the exact dates when CPQ came out. v62 seems like a distant memory now.

You should be fine then. My methods may require some modifications to match the code in your source, that's all.
 
Back
Top