Author Topic: Persistant placeables  (Read 366 times)

Legacy_placidjw

  • Newbie
  • *
  • Posts: 17
  • Karma: +0/-0
Persistant placeables
« on: January 28, 2011, 05:51:48 pm »


               Hi there, I'm trying to brainstorm a way of expanding on the
hunter's housing system in order to make it obvious to players whether a house
is owned or not. Its definitely possible to change the name of a placeable
outside the house that’s initially called "For Sale" to that of a player’s
name/login, however can anyone think of a way to do this whereby the renamed
placeable would be stored in the bioware db and then reloaded in its correct
location when the server reboots if that house is owned?

Any suggestions greatly appreciated '<img'>
               
               

               


                     Modifié par placidjw, 28 janvier 2011 - 05:57 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Persistant placeables
« Reply #1 on: January 28, 2011, 06:28:09 pm »


               To me it would be easier to just have the placeable sign check the closest door to see if it is owned or not.   If it is change the default For sale sign to the owners name.   That way you can use the data already in the DB.  



The only reasin I could see adding a new entry to the DB for this is if you wanted to allow the PC the ability to custom name the sign.
               
               

               
            

Legacy_lordofworms

  • Sr. Member
  • ****
  • Posts: 422
  • Karma: +0/-0
Persistant placeables
« Reply #2 on: January 28, 2011, 11:55:55 pm »


               This is how I do it.

create (2) identical signs in pallette.

on sign (1) set as Useable and plot. resref = SIGN1 (or whatever you wana call it)

on sign (2) make sure its NOT plot, and assign script on Heartbeat. call script "OnSpawnPlc" resref = SIGN2



HB script on sign2:



script - kinda

object oDoor = GetNearestObjectByType(OBJECT_TYPE_DOOR);

string sDoor = GetOwner(oDoor);//however you 'get your door owner name'

location iLoc = GetLocation(OBJECT_SELF);//get location of sign

float iFace = GetFacing;//get facing of sign

object oNewSign = CreateObject(SIGN1,iLoc)//create the 2nd exact version in same location without scripts (so basically the first one becomes an OnSpawn script since it destroys itself before a full turn is up)

SetFacing(oNewSign,iFace)//set new sign to same facing as old one

SetName(oNewSign,sDoor)//set name of new sign

DestroyObject(OBJECT_SELF,10);//destroy old sign so now only one left is the new one with the name set!!





thats obviously not the real code but thats the jist of it, let me know if you want the full thing and I can pull it up and paste it in for you or if I confuded you.



basically, spawn in first sign with heartbeat script, script fires creates new version of itself without script, but can now 'pass' on the information from it first initial heartbeat to the newly created sign. so its just a glorified OnSpawn for a placeable (since placeables dont have OnSpawn scripts)
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Persistant placeables
« Reply #3 on: January 29, 2011, 04:53:17 am »


               Cool system you have there LordOfWorms
               
               

               
            

Legacy_placidjw

  • Newbie
  • *
  • Posts: 17
  • Karma: +0/-0
Persistant placeables
« Reply #4 on: January 29, 2011, 05:01:57 am »


               Thanks for the help all '<img'> And that is indeed a very cool system lordofworms. To do it on mine I eventually wrote a script that bounces the player name over to the database at the same time the other housing data goes in:

string oHousemaster = GetName(oPC);
SetCampaignString("hh_doors", sDoorID + "Ownedby", oHousemaster);

I then wrote a custom trigger which I placed in front of each house, using the onenter script below. When triggered by any creature it renames the sign closest to it with the PC name if its corresponding house is owned. Just need to attract some players now '<img'>

#include "hh_include"
void signmaker(string sDoorID)
{
    string oTag = "saleboard";
    object oSign = GetNearestObjectByTag(oTag);
    if (GetCampaignString("hh_doors", sDoorID) != "" && GetName(oSign) == "House For Sale!")
    {
    string oBname = GetCampaignString("hh_doors", sDoorID + "Ownedby");
    SetName(oSign, "Property of: " + oBname);
    }
}

void main()
{
    string oDoorTag = "hh_door_enter_large";
    object oDoor = GetNearestObjectByTag(oDoorTag);
    string sDoorID = GetDoorID(oDoor);
    signmaker(sDoorID);
    oDoorTag = "hh_door_enter";
    oDoor = GetNearestObjectByTag(oDoorTag);
    sDoorID = GetDoorID(oDoor);
    signmaker(sDoorID);
}
               
               

               
            

Legacy_lordofworms

  • Sr. Member
  • ****
  • Posts: 422
  • Karma: +0/-0
Persistant placeables
« Reply #5 on: January 29, 2011, 05:48:38 pm »


               that will work too. the nice thing about my way is you can also always

use the Get door object transition to create road signs that tell you exactly where door goes if you use a GetName(GetArea call) I use this for making roadsigns without having to figure where each transition in my game goes.

I actually use this 'OnSpawn' placeable script for alot of dynamic signs, mailboxes,shopfronts,etc

so I can get persistance without ever having to store a new database save for the same info I might have somewhere else.
               
               

               
            

Baaleos

  • Administrator
  • Hero Member
  • *****
  • Posts: 1916
  • Karma: +0/-0
Persistant placeables
« Reply #6 on: January 31, 2011, 02:30:56 pm »


               Note - With nwnx_areas you can make NeverEnding Cities etc.



eg - One of the limiting factors of hunters housing, is that it requires an external house to enter, with nwnx_areas, you can generate areas on the fly.

Meaning you can create a generic area of your city, with house exteriors, and have them spawn as needed, with as many interiors as you need.



I use a similar system in my Module.

When a door is opened, it create the interior for the house, and then when the player uses the transition, it ports them inside the instanced area it created.



Combined with Instancing of Areas within a city, you get Very Large Cities.



eg - you could set it so that x amount of areas are generated to the east,north,south, and west of area y, and then the instancing of the interiors would be handled by the House Doors themselves.



Best yet - it costs no resources for the area generation to work - the interiors dont exist, until the player tries to enter it. = No Lag.
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Persistant placeables
« Reply #7 on: September 16, 2012, 01:07:27 am »


               bump