Skip to content

OnEnter scripting help needed.

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);
}
}

Comments

  • FreshLemonBunFreshLemonBun Member Posts: 909
    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); }
  • CasperCasper Member Posts: 11
    Basically when someone enters your server, their character will recieve upon entering a certain amount of gold?
  • FreshLemonBunFreshLemonBun Member Posts: 909
    Well if you use the above example with an item or if you replace the reliance on the item with your database functions that should probably help. The example I gave gives 1 gold to the player, you can change the value to anything you like. They get it one time. If you need it to be once per week then you'll need to track the date of their last payout instead.
  • CasperCasper Member Posts: 11
    You know how people are given books, emote wands etc in their inventory when they enter your server? Basically the same thing, just with gold. One per character.
  • CasperCasper Member Posts: 11
    Not one gold lol, but a certain amount when entering only one time.
  • Awas73Awas73 Member Posts: 66
    You will have to add everything else you want to build around this but I think the simplest way would be below:

    void main()
    {
    object oPC = GetEnteringObject();
    if(GetLocalInt(oPC, "ReceiveGold") == 0)
    {
    SetLocalInt(oPC, "ReceiveGold", 1);
    GiveGoldToCreature(oPC, 50);
    }
    }

    This should give 50 gold once to someone who enters. It is a basic start anyway. Hope it helps.
  • NeverwinterWightsNeverwinterWights Member Posts: 339
    Awas73 said:

    You will have to add everything else you want to build around this but I think the simplest way would be below:

    void main()
    {
    object oPC = GetEnteringObject();
    if(GetLocalInt(oPC, "ReceiveGold") == 0)
    {
    SetLocalInt(oPC, "ReceiveGold", 1);
    GiveGoldToCreature(oPC, 50);
    }
    }

    This should give 50 gold once to someone who enters. It is a basic start anyway. Hope it helps.

    If this is a persistent world type server and you are only allowing server characters (not local vault), you will run into problems with this method because the variable don't save on the character over server resets. The character will get gold every time they log into a reset server. This is why @FreshLemonBun suggested using a database item on the character where the variable will save. Basically as a rule, variables save on player items but not the players themselves...with some nuance.
  • badstrrefbadstrref Member Posts: 124
    edited January 2019
    I do this by giving 1 XP for new characters that went through the first-time initialisation, as new characters enters server with 0 xp (make sure xp can't go back to 0 from death)
    Post edited by badstrref on
Sign In or Register to comment.