Jump to content
  • 0

dont allow player to summon more than 1 npc at time


Question

Posted

Hi, i have npc buffer which can be summoned with skill. problem is player can summon how many he wants at same time.

how can i fix it? if already summoned one buffer need to disable skill or something to prevent summon second buffer.

2 answers to this question

Recommended Posts

  • 0
Posted

I did not get answer here so I found little trick, maybe there is better ways I don't know.

 

I needed to know if player have already summoned one NPC or not, I needed 1 property from players creature data, I used summoner_id for it because I don't think server will use this property,

player don't have summoner right? so we can store summoned NPCs id temporary there. inside CREATED event i added this:

 

if(myself.sm.master.summoner_id != 0){
            SendScriptEventEx(GetCreatureFromID(myself.sm.master.summoner_id),0,0,-7);
            myself.sm.master.summoner_id = myself.sm.id;
            
        }
        else{
            myself.sm.master.summoner_id = myself.sm.id;
        }

 

 

checking if masters.summoner_id != 0 then it = that summoned NPC id which means player already have one NPC buffer summoned so I decided to unsummon old one and summon new,

 

I get creatureData of old NPC buffer and send script event  with -7, you can send whatever you want:

this part > SendScriptEventEx(GetCreatureFromID(myself.sm.master.summoner_id),0,0,-7);

 

and implemented SCRIPT_EVENT listener in buffer NPC ai

EventHandler SCRIPT_EVENT(script_event_arg1, script_event_arg2, script_event_arg3) {
		if (script_event_arg3 == -7) {
			Despawn();
		}
	}

 

if NPC will receive script event in my case with -7 it will despawn.

 

thats it when player will use skill that summons this NPC, if player already have one summoned old will dissapear and new will be summoned.

 

don't forget to set myself.sm.master.summoner_id = 0;

to 0 again when unsummoning NPC by yourself, to be able summon NPC again...

don't worry if player go offline when player restarts master.summoner_id will be 0 again.

 

 

Admin Lock it.

 

 

 

Guest
This topic is now closed to further replies.


  • Posts

    • why ban him, his name almost ressurected the forum   haiku: Kara walks in light, whispers drift like soft spring rain, time bows at his steps.   Arrays.stream(DeveloperBrain.getInstance().getThoughts()) .filter(Kara.class::isInstance) .map(Kara.class::cast) .filter(k -> Objects.nonNull(k.getCoffeeLevel())) .flatMap(k -> k.getExcuses().stream().map(e -> Map.entry(k, e))) .filter(e -> Optional.ofNullable(StackOverflow.getAnswerById( DeveloperBrain.getVariables().getInt("kara_ban_counter", 0))) .map(a -> a.isActuallyHelpful() == false) .orElse(true)) .findFirst() .filter(r -> Optional.ofNullable(Admin.getPatience()) .filter(p -> Admin.destroyPatience("KaraBanProcess", 1, true)) .isPresent()) .ifPresentOrElse(e -> { Admin.sendPacket(SystemMessage.sendString("Kara has been banned again.")); Admin.sendPacket(Sound.ITEMSOUND_ENCHANT_FAILURE.getPacket()); Admin.sendPacket(new MagicSkillUse(Admin, Kara.class, CommonSkill.BANHAMMER.getId(), 999, 1, 0)); }, () -> Admin.sendPacket(SystemMessage.sendString("Miracle! Kara survived without a ban... this time.")));
    • decrypt and encrypt is works...          
    • well,thx for your reply...i had solved my problem.its source data errors...the old Armorgrp.dat and Armorgrp-classic.dat exist errors...rly swired. about skillgrp-classic.dat,i decrypt and encrypt it,it works...but in Grand Crusade i didnot know if it exist Auto-cast.   BTW,i rly dont know why the Original .dat files exist lots errors.but my Client works good...rly sweird.   anyway,i didnot like Mobius L2ClientDat tool...but we need use it...coz there is no other tools to work with new l2 client. 客户端工具很难用,解密后加密不回去的,哪怕你不做任何修改都加密不回去。你可以试试台版客户端就知道了。
    • sell adena l2rebon signature x1 - 1kk = 1 dollars l2reborn x10 - 500kk = 4 dollars E-Global x Lu4 - 1kk = 2 dollars BOHPTS - x20-x500 TOP PRICE LINEAGE2DEX - TOP PRICE !!!!! DISCORD - GODDARDSHOP TELEGRAM - MMOPROMO Also on sale are Epic jewelry, Clothes at a very good price
    • I will search for.
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock