Go Back   EQEmulator Home > EQEmulator Forums > Support > Support::Windows Servers

Support::Windows Servers Support forum for Windows EQEMu users.

Reply
 
Thread Tools Display Modes
  #1  
Old 11-14-2010, 09:14 PM
Templus
Sarnak
 
Join Date: Oct 2010
Location: NYC
Posts: 39
Default Set Race of NPC based on owner of instance?

Is there any way to set the race of an NPC based on the owner of an instance? (without having to keep crazy kinds of track of that kind of thing using global variables) .. I guess it can be done with some sort of global variable system though ... hmm
Reply With Quote
  #2  
Old 11-15-2010, 11:56 AM
Templus
Sarnak
 
Join Date: Oct 2010
Location: NYC
Posts: 39
Default

I can't seem to set a global variable...

Code:
quest::setglobal("newbrace_$instanceID", $raceid, 7,"H2");

quest::say("Global Set");

my $glob = $qglobals{"newbrace_$instanceID"};

quest::say("Global: ".$glob);
the output for Global: is empty. . just "Global: " .. that's it .. as if the global hasn't been set
Reply With Quote
  #3  
Old 11-15-2010, 12:12 PM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,498
Default

. conjunctions don't work in this system. Try "Global: $glob"
Reply With Quote
  #4  
Old 11-15-2010, 12:16 PM
Templus
Sarnak
 
Join Date: Oct 2010
Location: NYC
Posts: 39
Default

still not working

Code:
quest::setglobal("newbrace_$instanceID", $raceid, 7,"H2");

quest::say("Global Set");

my $glob = $qglobals{"newbrace_$instanceID"};

quest::say("Global: $glob");
my output is:
instanceID: 39
raceid: 5
global:

=\
Reply With Quote
  #5  
Old 11-15-2010, 10:21 PM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,498
Default

And don't use quotes in global values: $qglobals{global_name}

Now that I'm reading your post better... I think you are overthinking this by using globals. You can create different versions of the zone, and then just use the quest system to determine the proper version based upon race.
Reply With Quote
  #6  
Old 11-15-2010, 10:30 PM
Templus
Sarnak
 
Join Date: Oct 2010
Location: NYC
Posts: 39
Default

interesting idea.. but then I'd have to make a ton of copies of the zone with all the spawns/npcs in them .. hmm .. not sure how to do that either .. lol =\

i'll try it without the quotes .. is it ok though that a variable makes up part of the variable name?

edit:

looks like i found my answer .. this doesn't work.. crashes the perl script:
Code:
my glob = $qglobals{newbrace_$instanceID};
Reply With Quote
  #7  
Old 11-15-2010, 11:12 PM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,498
Default

That wouldn't work anyways with just glob ... it should be a variable $glob
Reply With Quote
  #8  
Old 11-15-2010, 11:14 PM
Templus
Sarnak
 
Join Date: Oct 2010
Location: NYC
Posts: 39
Default

errrr .. yeah it is $glob .. I just messed up retyping it in the post here

the problem is with using $instanceID as part of the variable name
Reply With Quote
  #9  
Old 11-15-2010, 11:15 PM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,498
Default

Yes, I understand. You are right, it would not work with a variable like that.
Reply With Quote
  #10  
Old 11-15-2010, 11:36 PM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,498
Default

However, you can set the value before hand like this:
Code:
sub EVENT_SAY {
  if ($text=~/set/i) {
    $test_value = 5;
    $test_global = "glob_test$test_value";
    quest::setglobal($test_global,1,5,"M1");
    quest::say("Global set.");
  }
  if ($text=~/get/i) {
    $glob_value = $qglobals{$test_global};
    quest::say("The global $test_global has a value of $glob_value");
  }
}
Reply With Quote
  #11  
Old 11-16-2010, 12:06 AM
Akkadius's Avatar
Akkadius
Administrator
 
Join Date: Feb 2009
Location: MN
Posts: 2,072
Default

Quote:
Originally Posted by Templus View Post
errrr .. yeah it is $glob .. I just messed up retyping it in the post here

the problem is with using $instanceID as part of the variable name
Situationally, what exactly are you trying to achieve. I know you are trying to set the race of something based on instance but could you give a little more detail and perhaps there would be a better way to approach it. Is it one npc? multiple npcs? Reason behind it?
Reply With Quote
  #12  
Old 11-16-2010, 02:40 AM
Templus
Sarnak
 
Join Date: Oct 2010
Location: NYC
Posts: 39
Default

noob enters the world, goes to the loading zone, is immediately transferred to a new private instance created for them where they are welcomed by 2 NPCs that are of their same race.. they then go through kind of a trial.. so it could be annoying to write X different zone instances for each race.. unless there's some way to automate it / copy 1 instance to several..

so using global variables.. I figure that when I create the instance I save out the user's race and after I spawn the 2 welcoming NPCs I set their races based on the global variable I saved when creating the instance.. it should work? except I can't seem to save/read these global variables =\
Reply With Quote
  #13  
Old 11-16-2010, 02:45 AM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,498
Default

The NPC must have qglobal set to 1 in the npc_types table in order for them to read the qglobal.

If you are only going to set 2 NPCs, you wouldn't need to do any of this. I would set up a player.pl file in the zone which modifies the race of the 2 NPCs based upon the player's race...
Reply With Quote
  #14  
Old 11-16-2010, 02:56 AM
Templus
Sarnak
 
Join Date: Oct 2010
Location: NYC
Posts: 39
Default

Quote:
Originally Posted by joligario View Post
The NPC must have qglobal set to 1 in the npc_types table in order for them to read the qglobal.

If you are only going to set 2 NPCs, you wouldn't need to do any of this. I would set up a player.pl file in the zone which modifies the race of the 2 NPCs based upon the player's race...
interesting .. how would you set something like that up in player.pl? I didn't realize you could do that..

edit:

hmm .. perhaps something as simple as using a proximity event on the mob?
Reply With Quote
  #15  
Old 11-16-2010, 03:45 AM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,498
Default

An example may be to do something like this:

player.pl
Code:
sub EVENT_ENTERZONE {
  quest::signalwith(1001,$client->GetBaseRace(),0);
  quest::signalwith(1002,$client->GetBaseRace(),0);
}
1001.pl and 1002.pl
Code:
sub EVENT_SIGNAL {
  quest::npcrace($signal);
}
EDIT: Yes, a proximity would work just fine. BTW, questions like this should go under a quests forum rather than windows server forum.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 09:05 AM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3