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

    • Rosyk or rusik or whatever u blaim me tha my mouth stinks but I assume you the one who stinks and your perfect pack will be now shared and you can suck a dick )  https://eu2.contabostorage.com/d4b39866f6bb4084b6c969ec8fe20063:kita/Lucera_Classic_Remaster/Lucera Classic Remaster Server and Datapack files.rar  https://eu2.contabostorage.com/d4b39866f6bb4084b6c969ec8fe20063:kita/Lucera_Classic_Remaster/Lucera Classic Remaster Eng Client.rar Drama link   
    • @Huggo Thank you for asking! When you join our Discord, on the Nexus Marketing section there is a #work-showcase channel. There you can see a little bit of what we are able to produce as a final ready-to-post product.  There is also this link in my new personal montage YouTube channel, in which I will be uploading every recent work: https://youtube.com/playlist?list=PLkzBKexKw8Wj8dC2diYndd5yOWOXUQCJW&si=-HGxlovqzvD4qqy2 Two more videos are coming up this week, and a #reviews channel has opened for our clients to let other people know about their experience working with us. Feel free to join our Hub in Discord, and for any inquries you might have don't hesitate to contact me or post your suggestion at #suggestions channel.  
    • Следи за своим вонючим языком, мудак.   Your mouth stinks, go wash your mouth, it's a dump) I don't know who you are or what you are, and I don't recommend buying anything from people outside of my network, as they may sell garbage under the guise of my work. There have been cases where my sales have been compromised. Additionally, reselling below the purchase price has been prohibited. I wish you all the best and peace. I kindly request that the moderators close this topic, as it is no longer relevant and the contact information is outdated.    
  • 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