Porters
If I wanted to create a NPCs at the various Wizard Spires and Druid Rings that would teleport you to other spires/rings, what's the best way to go about it? I was thinking at first about a buff bot casting the teleport spell on you, but then I realized those are in-group spells so that probably wouldn't work. Plus I don't want the teleporter disappearing (though that would be kind of funny.. .which wizard spire/druid ring is the porter at :)). At any rate, I'm thinking more in terms of a translocator-type scenario. Or maybe something akin to the gnome in the guild hall that sends you off based on an item he gives you. From a design standpoint, what's the simplest way of doing this? Or is it even possible.
|
You might want to take a look at the Wayfairer Magus scripts to see if they could be adapted to what you want.
|
Will do, thanks
Edit: Ok, I know this has got to be here. I was looking at buffbot spells and got my porters to work. The only problem is everything is instacast. I've done some searching for pause and wait in the scripts but can't seem to find anything of relevance to what I'm doing. Here's what I've got so far: Code:
sub EVENT_SAY { 1. Can I suppress the player character from doing the cast animation on a SelfCast? 2. What's the keyword for inserting a pause/wait between spells being cast? I saw pause(timer) but that didn't work so I suspect it only has to do with movement. 3. Is it even possible for an NPC to cast a group spell on a non-group member (similar to target group buff only this would really be target group circle :)) |
Avoid using "spells" altogether and simply use the following to move the player that triggers the event:
quest::movepc(zone_id, x, y, z, heading); If you want a delay, set it to trigger a timer for x seconds, then under EVENT_TIMER paste the above (also may want to stop the timer...). If you are transporting into an instance: quest::MovePCInstance(zone_id, instance_id, x, y, z); If you have a flare for the dramatic, have the npc cast a spell during the delay to make it appear that's the graphic he or she is casting. See the second post in this thread http://www.eqemulator.org/forums/showthread.php?t=38773 for using proximity say to create and port player(s)/group to an instance. It can be used with quest::movepc(zone_id, x, y, z, heading); as well for static zones or to a different area of the same zone/instance. Be sure you activate the proximitysay command in EVENT_SPAWN or it will not use it. |
Thanks for the advice, I'll give the movepc thing a try. You're exactly right on what my goal is. I'd like to make the porter cast 2-3 seconds of spell effects, then the player get teleported out. The problem I've run into is that everything happens sequentially. Timer -> Spell Effect -> Port rather than Timer & Spell Effect -> Port.
Right now this is what my code is. Functionally, it works fine. I'd like like it feel a little less botty and more pc-ish :) Also, if there's a way to make this script not use so many if statements, I'm all ears. I'm new to perl but not programming so I suspect there has to be a way to combine those if statements into fewer lines of code. Code:
sub EVENT_SAY { |
There is, but keeping with basics. It's better to use elsif's in place of all the other if's you have after the initial if.
Code:
sub EVENT_SAY { Code:
$npc->SpellFinished(####, $client) |
I made the recommended if->elsif changes. As a test, I added the SpellFinished function to the commonlands port. It's still insta-casting when I say Commonlands though. Code I'm using is below. I'm wondering if this is going to work since the NPC isn't casting the port spell, the player is self-casting it.
Code:
elsif ($text=~/Commonlands/i) { |
Code:
$npc->SpellEffect(<effect>, <duration>); |
Ok so the spell effect is working and the move command works great. I definitely like this better. However, timers still aren't cooperating. I'm so close I can taste it:
Code:
sub EVENT_SPAWN { 1. I /say commonlands 2. NPC says "Off to West Commonlands!" 3. NPC starts spell effect 4. 10 seconds later NPC says "Casting..." immediately followed by "Moved". Seems like I'm getting hung up in the EVENT_TIMERS sub. The "Casting..." and "Moved" are something I just added in for testing instead of loading constantly. "Moved" is where my move line would be. So if I move it down past where the portercast timer is called in EVENT_SAY, it triggers simultaneously as the timer and I end up with "Moved" before "Casting..." I could put the move command in the EVENT_TIMERS sub, but then I would have to mess with multiple timers, which seems like it would be defeating the purpose of using the timer. When you call a timer like that, where does the actual timer pause take place? Within EVENT_TIMERS would seem to be the obvious answer. Is there not a way to make the EVENT_SAY steps pause until the timer call is complete? Edit: I tried adding the move command to the EVENT_TIMERS sub but it doesn't function at all there. |
Code:
quest::pause(xxx); |
I'll give that a try tonight. If it's that simple, I'm going to feel really dumb :)
|
Negatory on the wait command. Doing some further research, that appears to be intended for pauses in waypoints. Man I got nothing now. Here's what the current code looks like. I've simplified it to its basics to troubleshoot:
Code:
sub EVENT_SAY { |
Yeah pause is for waypoints and yet I still cite them as a pause. Sorry, cannot get that through this thick head for some reason (maybe if I used scripted travel it would stick).
Instead, I should have said: Code:
sleep(x); |
Scratch that too. This is the NPC's script. Hmm.
|
LOL I know, I ran into that as well. However - success at last!! Apparently, there's not a built in delay so you have to write your own. I stumbled across this thread and it's working like a champ.
Code:
sub EVENT_SAY{ 1. /say commonlands to NPC 2. Spell Effect appears on player 3. Player self-invises 4. 5 seconds later player is moved to WC druid ring Whew. Thanks for the help. I at least learned a lot :) |
Ok, working, quasi-finished product:
Code:
sub castdelay{ |
Code:
sub EVENT_SPAWN { |
I cannot immediately locate the sound file for ports, however, to give it a little flavor, you could put this before line 34 of the above code snippet (thus making it the new line 34):
Code:
$client->PlayMP3("twinkle001_loop.wav"); Code:
castdelay(5); Code:
castdelay(9); |
Congratulation on solving your puzzle. Now to tackle simplifying the code. As many have advised over the years, using an array or hash to handle multiple inputs and outputs is the best method to simplify code.
Basically you have a player /say "location" as input to the npc's EVENT_SAY subroutine, which triggers the wonderful spell animations and invis prior to porting to the various destinations as output. The inputs can be stored as a variable $playersaidthis and the outputs as a variable $portplayerhere in an associated array. Your code will have a single if statement instead of an if/elsif for every destination and be about 90% shorter. Let us know how it works and once again, congratulations on solving your perl puzzle and learning more about scripting. EDIT: haha, I forgot to hit send this morning and after I realized it this afternoon, ghanja had already posted the script I described. |
Here's my work around. This requires my plugin to be useful.
NPC Script: Code:
@zones = ("butcher", "feerrott", "northkarana", "lavastorm", "misty", "sro", "steamfont", "commons", "toxxulia"); Code:
sub EVENT_SIGNAL { |
LOL I feel like I won a prize :)
I'm about to give the array thing a try. I'm familiar with them, it's just understanding how Perl handles them. My next question was going to be can you do a case statement but I think you guys have pretty much answered that. I'll let you know how it works out :) Kingly - Your plugin looks tremendously helpful. Stupid question: How do I use it? Do I need to copy it into the script or can it reside elsewhere as its own script waiting to be called upon? |
You need to create a Perl file in your plugins folder in your server folder. Name it whatever you want. Also, Perl has switches, but it's not necessary in this situation, nor have I ever found it necessary.
|
Code:
sub EVENT_SAY { About to try KKs. This one's definitely over my head. I've read about globals and entitys but haven't messed with them yet. Also, side question brought up by the plugin thing: Could I turn this into a plugin by saving it in the plugins folder? Code:
sub castdelay{ |
KK, I'm getting a "<LINKER ERROR>" when I talk to the NPC where he would be listing the port locations. Does the players.pl need to be in plugins or part of the script? I've done something wrong apparently.
|
That 'linker' error may be part of my bailiwick..though, quests are not.
Pretty sure that kicks in when there is missing information in the text link constructor. I did test scripts to ensure that they worked when I pushed them. (EDIT: pushed the client translation version of the code) Try having the npc 'say' the information so that you can verify that wrong/null parameters are not being passed. |
Code:
quest::say("Hail! Where would you like to go?"); Side note: Code:
quest::saylink($_, 1, plugin::Zone("LN", $_)) for @zones; |
So the ghanja's code works, but it sends me to the zone safe spots rather than the druid ring. Would it make sense to add the x,y,z,h values into the $porthash array and call them in a quest::movenpc rather than a quest::zone command? Something like this:
Code:
sub EVENT_SAY { |
Here is where that text comes from: https://github.com/EQEmu/Server/blob...ient.cpp#L8394
Let me take your script home tonight to verify that it's not code-related..and hopefully someone will come up with a solution before I get back tomorrow. EDIT: Just read your last post..I'll still look it over and see where you are when I get back. |
LOL I don't think I'll make any more progress tonight. As I was reading, there are many ways to do things in Perl. I'm interested in seeing either way :) This is a learning experience for me.
|
Did you actually create a plugin file in your plugins folder in your base server folder? Mine is C:/EQ/EQEmuServer/plugins, you may have it in something like C:/EQ/EQEmuServer/quests/plugins or C:/EQ/EQEmuServer/quests/global.
Correct folder (C:/EQ/EQEmuServer/plugins): http://img.prntscr.com/img?url=http:...om/H9IZAtk.png Incorrect folder (C:/EQ/EQEmuServer/quests/plugins or C:/EQ/EQEmuServer/quests/global): http://img.prntscr.com/img?url=http:...om/CaxhTmJ.png |
I think the answer is yes. Sort of. I'm running on linux but I get what you're asking.
My server install is ~/server and there's a symbolic link for plugins there that goes to ~/quests/plugins. So ~/server/plugins points to ~/quests/plugins So they're one and the same. Or they should be. At any rate, players.pl is there. Code:
eqadmin@eqemu:~/server/plugins$ ls Code:
eqadmin@eqemu:~/server/quests/plugins$ ls |
"So the ghanja's code works, but it sends me to the zone safe spots rather than the druid ring. Would it make sense to add the x,y,z,h values into the $porthash array and call them in a quest::movenpc rather than a quest::zone command?"
You will want to use quest::movepc(zone_id,x,y,z,h) not quest::movenpc because the object you're trying to port is the player character. Just using quest::zone sends to the save coordinates of the zone. Simply run to the druid rings of your destination zone, target yourself, type #loc (NOT /loc unless you like reversing x and y), and use that location in the quest::movepc command. The zone_id portion will accept numbers for the zone IDs or pass it the zone shortname with $text. I haven't searched the plugins folder for it but someone may have made a plugin that converts zone shortname to ID#. |
|
Ah, yeah, I posted that before you posted what you said. No problem.
|
Quote:
Code:
quest::movenpc($porthash{$key}[1],[2],[3],[4],[5]); |
1) You have to access the hash elements the same way every single time.
Code:
quest::movepc($porthash{$key}[1], $porthash{$key}[2], $porthash{$key}[3], $porthash{$key}[4], $porthash{$key}[5]); |
Not sure if you made changes yet, but for anyone following the thread:
Code:
sub EVENT_SPAWN { |
I figured it out about 30 minutes ago, then saw your PM. I really appreciate the help from everyone on this. Hopefully I can pay it forward. Here's what I came up with:
Code:
sub EVENT_SAY{ The last thing I'd like to do with this is make the Superior Camo not be a self-cast (if its possible). Been looking at some other threads about group spells, but technically it's not a group spell. You just have to be in the group for it to land on you. If there's a way to fake the NPC casting this on the player, I'm all ears: Code:
quest::selfcast(34); Code:
$npc->CastSpell(34, $client); |
Crude as hell, but, hopefully you gain something from it:
Code:
sub EVENT_SPAWN { |
Sorry for the time gap. Work and brain melt. Had to take a break. Tried the above code but it seems to only be performing this part of the action:
Code:
else { I'm ok with using the selfcast but if you self-cast and already have the spell it sends an error that the player is already invisible. Is there a way to check for a spell effect active on the player? If there is I could just throw an if statement in there to see if player is already invisible and skip the selfcast if they are. Digging through the lexicon now because I'm not quite sure what I"m searching for. Edit2: BreakInvis(); will do. :) Code:
else { |
All times are GMT -4. The time now is 07:21 PM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.