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

11-14-2010, 09:14 PM
|
Sarnak
|
|
Join Date: Oct 2010
Location: NYC
Posts: 39
|
|
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
|

11-15-2010, 11:56 AM
|
Sarnak
|
|
Join Date: Oct 2010
Location: NYC
Posts: 39
|
|
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
|

11-15-2010, 12:12 PM
|
 |
Developer
|
|
Join Date: Mar 2003
Posts: 1,498
|
|
. conjunctions don't work in this system. Try "Global: $glob"
|

11-15-2010, 12:16 PM
|
Sarnak
|
|
Join Date: Oct 2010
Location: NYC
Posts: 39
|
|
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:
=\
|

11-15-2010, 10:21 PM
|
 |
Developer
|
|
Join Date: Mar 2003
Posts: 1,498
|
|
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.
|

11-15-2010, 10:30 PM
|
Sarnak
|
|
Join Date: Oct 2010
Location: NYC
Posts: 39
|
|
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};
|

11-15-2010, 11:12 PM
|
 |
Developer
|
|
Join Date: Mar 2003
Posts: 1,498
|
|
That wouldn't work anyways with just glob ... it should be a variable $glob
|

11-15-2010, 11:14 PM
|
Sarnak
|
|
Join Date: Oct 2010
Location: NYC
Posts: 39
|
|
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
|

11-15-2010, 11:15 PM
|
 |
Developer
|
|
Join Date: Mar 2003
Posts: 1,498
|
|
Yes, I understand. You are right, it would not work with a variable like that.
|

11-15-2010, 11:36 PM
|
 |
Developer
|
|
Join Date: Mar 2003
Posts: 1,498
|
|
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");
}
}
|

11-16-2010, 12:06 AM
|
 |
Administrator
|
|
Join Date: Feb 2009
Location: MN
Posts: 2,072
|
|
Quote:
Originally Posted by Templus
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?
|

11-16-2010, 02:40 AM
|
Sarnak
|
|
Join Date: Oct 2010
Location: NYC
Posts: 39
|
|
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 =\
|

11-16-2010, 02:45 AM
|
 |
Developer
|
|
Join Date: Mar 2003
Posts: 1,498
|
|
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...
|

11-16-2010, 02:56 AM
|
Sarnak
|
|
Join Date: Oct 2010
Location: NYC
Posts: 39
|
|
Quote:
Originally Posted by joligario
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?
|

11-16-2010, 03:45 AM
|
 |
Developer
|
|
Join Date: Mar 2003
Posts: 1,498
|
|
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.
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 05:20 AM.
|
|
 |
|
 |
|
|
|
 |
|
 |
|
 |