Forum > Serverside Modding
[QUESTION][C++] Item spawn npc in few areas
(1/2) > >>
bizzlesnaff:
Hey folk :)
i've a little question. I work on something like "gildhousing" and now I try to find a way, how someone (maybe the guildleader) is able to spawn some npcs in his area. To spawn an npc is not my problem, but i don't like it, if any player can jump around the whole world and spawn in any area some npcs. So i like to find any way to make an "map check", and only in the right map (or better) area, the item works.
Yeah...anyone some ideas :)
I know thats really...imprecise..but maybe someone have a good idea :)
Kaev:
Add the coordinates of the 4 corners of the guildhouse, map id and guild id to the database. Load them at server start (and when you create a new area) into a unordered_map or something else if you prefer it. Write a function, which will return true, if the player is in the rectangle of the guild house, is on the correct map and is the leader of the guild. Now write a new command, which will only spawn an npc, if the function will return true. :)
bizzlesnaff:
Wow..thats sounds pretty easy :) Thats a very nice idea :) I will try to realize that :) Thank you :)
Kaev:
--- Quote from: "bizzlesnaff" ---Wow..thats sounds pretty easy :) Thats a very nice idea :) I will try to realize that :) Thank you :) --- End quote --- No problem. First step when you have a programming problem: Cut it in several small problems. Everything will be much easier then. ;)
bizzlesnaff:
Hey :) I don't like to create a new topic, so I'll ask here :) If you don't know the right "script-command" to create anything like you want. Where do you look for an answer? I try to find a wiki or something, but I even don't know how to look... with "trinitycore c++ script wiki" or "trinitycore c++ commands" I didn't find anything usefull.
Is there a list something like...well i don't know.. ADD_GOSSIP_ITEM : "with this command you add a row in the gossip menu. the syntax is: player->ADD_GOSSIP_ITEM( !!ICON!! , "!!!YOUR TEXT!!!" , GOSSIP_SENDER_MAIN, !!!Number!!!);
Well...I hope someone know what I mean :)
Navigation
[0] Message Index
[#] Next page
|