Skip to content

On entering server, help. (Toolset)

CasperCasper Member Posts: 11
edited January 2019 in Builders - Toolset
I am trying to make it to where characters get gold ONE time when entering the server. How do i do such? This is my script on enter in module properties. Thank you!

//MODULE ONENTER SCRIPT/////////////////
#include "omw_plns"
//#include "pqj_inc"
#include "inc_gsystem_evnt"
#include "10_inc_modsystem"
#include "gz_inc_db"
#include "horse_include"
#include "cin_subr_func"
void main()
{
//Horse System:
object oPC = GetEnteringObject();
GPA_HorseOCE(oPC);
SubraceOnClientEnter(oPC);
//Talus Listener System:
ExecuteScript("lds_module_cli_e", GetModule());
//Higher Ground Legendary Levels:
ExecuteScript ("hgll_cliententer", OBJECT_SELF);
//Player Guild System v3.7b:
PGSModuleClientEnterEvent (GetEnteringObject());
//OMW Loot Notification System:
DelayCommand(6.0, PLNSLoadNotificationOnClientEnter(oPC));
//Knat's Persistant Journal Entries:
//RebuildJournalQuestEntries(oPC);
//Nexus Ring Remove:
//ExecuteScript ("04_nexring_oe", OBJECT_SELF);
//Give Netheria Newspaper to PC.
ExecuteScript ("04_nethnews_oe", OBJECT_SELF);
//Nexus Stone Give:
DelayCommand (2.0, ExecuteScript ("04_nexstone_oe", OBJECT_SELF));
// HunterAP's Housing System OnEnter Event:
ExecuteScript ("hh_mod_enter", OBJECT_SELF);
//Henchmen:
ExecuteScript ("69_client_enter", OBJECT_SELF);

// Kill dead PCs
if (!GetIsDM(oPC))
{
GTRestorePlayerStatus(oPC);
// ECL Notification
CinSetECLModifier(oPC);
DestroySkin(oPC);
}
}
Post edited by Casper on

Comments

  • CasperCasper Member Posts: 11
    Basically when someone enters your server, their character will recieve upon entering a certain amount of gold?
  • KeppKepp Member Posts: 54
    edited January 2019
    I'm new to coding, but this is part of my on enter script. If you want them to receive gold after they have just created a character, then this will work:

    void main()
    {
    object oPC = GetEnteringObject();
    //check if it's a new new character by xp amount
    if (GetXP(oPC) == 0)
    {
    //replace 10 with the gold you want to give
    GiveGoldToCreature(oPC, 10 - GetGold(oPC));
    //give them 1xp to prevent them from relogging to get more gold
    if (GetXP(oPC) == 0)
    SetXP(oPC, 1);
    }
    }

    You can have this run by adding an execute script from your current on enter script. So, if you named this script "enter_givegold," You would add this line to your on enter script: ExecuteScript ("enter_givegold", OBJECT_SELF);

    Post edited by Kepp on
  • CasperCasper Member Posts: 11
    Thanks, will try that!
  • KeppKepp Member Posts: 54
    edited January 2019
    void main()
    {
    object oPC = GetEnteringObject();
    //check if it's a new new character by xp amount
    if (GetXP(oPC) == 0)
    {
    //replace 10 with the gold you want to give
    GiveGoldToCreature(oPC, 10);
    //give them 1xp to prevent them from relogging to get more gold
    if (GetXP(oPC) == 0)
    SetXP(oPC, 1);
    }
    }

    This might be better if the latter doesn't work.
  • CasperCasper Member Posts: 11
    So, copy and paste that whole thing into a new script? Then save it as enter_givegold and put it where in my enter script? Does it matter where? The execute script? Ty! Been trying but have not got it yet.
  • CasperCasper Member Posts: 11
    Up top is my whole script if you could, could you show me where i should put it? I really appreciate it thank you!
  • KeppKepp Member Posts: 54
    edited January 2019
    Yes, save it as a separate script called: enter_givegold

    And then place it here:

    SubraceOnClientEnter(oPC);
    //Talus Listener System:
    ExecuteScript("lds_module_cli_e", GetModule());
    //give gold
    ExecuteScript ("enter_givegold", OBJECT_SELF);
    //Higher Ground Legendary Levels:

  • KeppKepp Member Posts: 54
    The "//give gold" is just for reference.
  • HimmelweissHimmelweiss Member Posts: 72
    If you can loose XP upon death or by any other means on your server the player could, if he wanted to, generate endless gold.

    It would be better to save a var with value 1 into your DB instead, after all the initial "one time only" PC stuff is done.
    Or save the var on some plot-nodrop item.
  • KeppKepp Member Posts: 54
    edited January 2019
    Himmelweiss is correct. I have no xp loss at level 1, and you can't lose a level with dying, so it works for me.
  • KeppKepp Member Posts: 54
    If what Himmelweiss said applies to your world, then this is a better suggestion:

    I'm not quite sure what you're asking for.

    If you had a plot non drop item on the pc that functioned as a data tracker them you could set a character creation flag. If you used something else for tracking then you could use that instead.

    object oDB = GetItemPossessedBy(oPC, "pc_db"); int nFlag = GetLocalInt(oDB, "do_once"); if (nFlag == FALSE) { GiveGoldToCreature(oPC, 1); SetLocalInt(oDB, "do_once", TRUE); }

  • FreshLemonBunFreshLemonBun Member Posts: 909
    Right, what I posted should give an idea of how to do the feature. What you need is to be able to find or check something on the character that indicates the sequence has already happened once before. It depends on things like which method of data handling or databases you use.

    If you are actually providing your characters a player wand that allows them to access a menu of features then simply checking for the existence of that wand is enough. Assuming the player wand has all the plot and no-drop flags set from the item palette, then if the tag (and resref for simplicity) of the wand is "this_is_a_pc_wand" the following should work:
    object oItem = GetItemPossessedBy(oPC, "this_is_a_pc_wand");
    if (GetIsObjectValid(oItem) == FALSE)
    {
    	CreateItemOnObject("this_is_a_pc_wand", oPC);
    	int nGold = 100;
    	GiveGoldToCreature(oPC, nGold);
    }
    This example creates a player wand that was mentioned in one of the threads about this. It only works if the player does not have such a wand, hence it will only ever work once. The example gives 100 gold, change the value as needed, nobody knows what a certain value is, only the person running the module knows what a certain value is, it could be 1, 100, or maybe 999. You set that value yourself.

    It all depends on the circumstances of your module. Like if there is or isn't exp loss, what database you're using, if your characters have wands or data tracking items.
  • CasperCasper Member Posts: 11
    Ok going to try this now,thank you!
Sign In or Register to comment.