HeroEngine Forums
Welcome, Guest. Please login or Register for HeroCloud Account.

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - cloudnine

Pages: 1 2 [3] 4 5 6
31
Scripting & Programming / Re: Convert ID to noderef
« on: Dec 29, 12, 07:14:56 AM »
The Shop spec gets created by right clicking on an NPC if it doesn’t already exist
Code: [Select]
method CreateFromSpec() as NodeRef
 
  // Create the node and call all the associated Decorators for setup
  shop as NodeRef of Class Shop = CreateNodeFromClass("Shop")
 
 
  var sisOracle = getPrototype("shopInventorySpecOracle")
  var itemOracle = getPrototype( "ItemSpecOracle" )

  // Create all the standard inventory that the shop contains
  foreach key in me.ShopStandardInventorySpecKeys
   
    sis as NodeRef of Class ShopInventorySpec = sisOracle.getSpecByKey(key)
   
    // Go through the items
    foreach itemKey in sis.ShopItemSpecKeys
     
      if not (shop.ShopItemSpecNodeLookup has itemKey)
        // If the item is not already in the shops known list of associated items, associate it
        var spec = itemOracle.GetSpecByKey(itemKey)
        var item = spec.createNonPersistedFromSpec()
       
        GlomClass("ShopSupply", item)
        AddAssociation(shop, "base_hard_association", item)
       
        // add the item to the list of items for the shop
        shop.ShopItemSpecNodeLookup[itemKey] = item
       .
      if( sis.IsSortable )
        ShoppingMallClassMethods:ShoppingMall_Msg("SHOP IS SORTABLE.")
        shop.IsSortable = true
      .
    .
  if( sis.IsSortable )
      shop.IsSortable = true
    .
  .
  me.OnCreateNotifySpecDecoratorClasses( shop )
  return shop
.
This is called when clicking on the “Buy” button
Code: [Select]
method SoloCharacterShop_BuyItem(item as NodeRef)
  //--------------
  // Buy this item
  //--------------
  println("themysubjectis (" +item+ ") okok")
//sn =1000000002024 class=Item + HasValue + Stackable
 
texture as List of Class texture_pair                   
  // this would be changing the look
  theShop as NodeRef = $SHOPPINGMALL.ShoppingMall_GetCurrentShop()
  theShop.RequestSellItemToPlayer(item, 0, texture)
.
method RequestSellItemToPlayer(item as ID, slot as Integer, texture as List of Class texture_pair)
  //I can’t change Item as Noderef, says its an ID
 Itemx as noderef = item //Still an ID
  println("themyreqsubjectis (" +item+ ") okok")// 10000002024
   
  rout as Class RemoteCallServerOut
  rout.toScript = "ShopsClassMethods"
  rout.toFunction = "RequestSellItemToPlayer"
  rout.failScript = SYSTEM.EXEC.THISSCRIPT
  rout.failFunction = "ServerRMCFail"
  rout.args["item"] = item
  rout.args["slot"] = slot
  marshal texture to rout.args["texture"]
 
  RemoteCallServer(rout)
.
untrusted function RequestSellItemToPlayer( rin as Class RemoteCallClientIn )
 
  //itemx as ID = rin.args["item"]           //This is the only thing that isn’t None
  item as NodeRef = rin.args["item"]     //This is what I want to use
 
//println(" theitem (" +itemx+") is this")  // (100000002024)
println(" theitem (" +item+") is this")   // (0)


32
Scripting & Programming / Re: Convert ID to noderef
« on: Dec 29, 12, 12:07:42 AM »
When the shop window opens it requests a cache
Code: [Select]
method ShoppingMall_SendCacheToPlayer( theShop as NodeRef of Class Shop, accountID as ID )
  //_________________DO NOT CALL____________________
  shopItems as LookupList indexed by Integer of List of String       // - List of marshalled shop items.

  msShopItems as String           // - Marshalled list of marshalled shop items.
  theShopItem as NodeRef         
  itemShop as Boolean
 
  // - Marshall all shop items
  foreach key_ in theShop.ShopItemSpecNodeLookup
    itemShop = true
    theShopItem = theShop.ShopItemSpecNodeLookup[key_]
    ShoppingMall_Msg( "Got shop item " + theShopItem )
    where theShopItem
      is kindof CollectionOrderedSet
        add back theShopItem.marshalCollection(false) to shopItems[0]
      .
      default
        add back MarshalUtils:MarshalNodeWithClass(theShopItem) to shopItems[1]
      .
    .
  .
 
  msShopNode as String = MarshalUtils:MarshalNodeWithClass( theShop )

  call client accountID %SHOPPINGMALL.ShoppingMall_ReceiveCacheForShop( shopItems, msShopNode, theShop.IsSortable )
.
And the client unmarshals it and creates the node for each item
Code: [Select]
remote method ShoppingMall_ReceiveCacheForShop( shopItemList as LookupList indexed by Integer of List of String, msShopNode as String, sortIt as Boolean )
  ShoppingMall_Msg("Received a list of shop items.")
 
  theShop as NodeRef = MarshalUtils:UnmarshalCreateNodeWithID( msShopNode )
  shopID as ID = theShop

  // - Clear the shop if the shop is already there
  loop i from me.ShopNodeList.length to 1 by -1
    if( me.ShopNodeList[i] == shopID )
      ShoppingMall_Msg("Cleared local shop.")
      clear me.ShopNodeList destroy
    .
  .

  add back theShop to me.ShopNodeList
 
  // - Receive a list of items from the server side shopping mall.
  theShopItem as NodeRef
  theItemString as String

  noSortList as List of NodeRef     // - List of shop items that will be sorted if the sortable flag is set.
 
 
  // - Index zero is collections
  loop i from 1 to shopItemList[0].length
    theItemString = shopItemList[0][i]
    theShopItem = collectionMarshalClassMethods:GetCollectionFromString( theItemString )
    theShopItem.unmarshalCollectionNode( theItemString  )
    theShopItem.unmarshalCollectionElements( theItemString  )
    ShoppingMall_Msg("Received collection item " + theShopItem )
   
      add back theShopItem to noSortList
    .
  .
 
  // - Index 1 is non-collections
  loop i from 1 to shopItemList[1].length
    theShopItem = MarshalUtils:UnmarshalCreateNode( shopItemList[1][i] )
    ShoppingMall_Msg("Received item " + theShopItem )
      add back theShopItem to noSortList
    .
  .

 
    .
  .

.
Then it opens an ItemContainer with a field MYsubject which is a noderef and is theshopitem

33
Scripting & Programming / Re: Convert ID to noderef
« on: Dec 28, 12, 05:43:08 PM »
Everything is created using spec oracles
RightClickContextMenuOpensTheShopGUI

Remote function receiveOpenShopGUI ()
npcID as ID = rci.args["npc"]
  npc as NodeRef = npcID
  npcSpecKey as ID = rci.args["npcspeckey"]
  var npcName = rci.args["npcname"]
  var shopName = rci.args["shopTitle"]
  var shopDesc = rci.args["shopdesc"]
///////////
It then creates the window and fills it with the shop items
Clicking on the buy button finds the subject in the icon container
And sends the requestsenditemtoplayer rci.args

34
Scripting & Programming / Re: Convert ID to noderef
« on: Dec 28, 12, 03:22:50 PM »
The id is for Item Class
Code: [Select]
19:05:52: /sn 1000002030
19:05:52: System:CLI command /sn 1000002030.
19:05:52: System:SN LISTBEGIN 1000002030 : "Node ID: 1000002030 Base Class ID: 9223372058784132752 Name: "Item""
SN LISTELEMENT 1000002030 : "Additional Class ID: 9223372058914132713 Name: "HasValue" Description: "for items that have value""
SN LISTELEMENT 1000002030 : "Additional Class ID: 9223372058797132709 Name: "Stackable" Description: "GLOMmed onto items who have a stackable property""
SN LISTELEMENT 1000002030 : "Field ID: 126072290281 Name: "_specRef" Value: "9223372062223133007""
SN LISTELEMENT 1000002030 : "Field ID: 9223372058914132710 Name: "BaseValue" Value: "49""
SN LISTELEMENT 1000002030 : "Field ID: 61787000059 Name: "changed" Value: "false""
SN LISTELEMENT 1000002030 : "Field ID: 9223372058914132712 Name: "CurrencyType" Value: "gold""
SN LISTELEMENT 1000002030 : "Field ID: 9223372058773132714 Name: "CurrentStackSize" Value: "1""
SN LISTELEMENT 1000002030 : "Field ID: 77508000046 Name: "DisplayDescription" Value: """
SN LISTELEMENT 1000002030 : "Field ID: 10953000003 Name: "displayName" Value: "Berrys""
SN LISTELEMENT 1000002030 : "Field ID: 54314000181 Name: "iconID" Value: "750""
SN LISTELEMENT 1000002030 : "Field ID: 9223372058797132708 Name: "MaxStackSize" Value: "20""
SN LISTELEMENT 1000002030 : "Field ID: 65617000110 Name: "SpecKey" Value: "4""
SN LISTEND 1000002030 : "End of List."
yeah i can only use the CLI to "shownode" on the client
server is blank

I can check the shop ID# on both server and client though

35
Scripting & Programming / Re: Convert ID to noderef
« on: Dec 28, 12, 01:07:23 PM »
I keep getting a node (0) not found heres a condensed version of the methods being used
method RequestSellItemToPlayer(item as ID)
  rout.toFunction = "RequestSellItemToPlayer"
  rout.args["item"] = item
  RemoteCallServer(rout)
.
///////////////////
untrusted function RequestSellItemToPlayer( rin as Class RemoteCallClientIn )
  item as ID = rin.args["item"] //this works
  //item as NodeRef = rin.args["item"] //this doesn’t

    //itemx as noderef
    //itemx = item //and adding this doesn’t
   
      if item == None
  println("TheItemIsNone")
  else
    println("Tryingtobuy the itemiselse")
    var shop = $SHOPS.getShopForItem(item)
    shop.ShopSellItemToPlayer(me, item, rin.args["slot"], tString)
  .
.
//////////////////
method ShopSellItemToPlayer(item as NodeRef of Class Item )
 println("Attemppppting to purchase item (" + item + ")//this is (0)


method ShopSellItemToPlayer(item as ID )
 println("Attemppppting to purchase item (" + item + ")//this says item is a noderef of class item but expected an ID

method ShopSellItemToPlayer (item as NodeRef of Class Item )
  itemx as ID = item
 println("Attemppppting to purchase item (" + itemx + ")//this says (0)

36
Scripting & Programming / [Resolved] Convert ID to noderef
« on: Dec 27, 12, 07:54:47 AM »
I'm trying to create a shop to buy items
I have Item and shop spec oracles similar to HJREF.
Right now I can right click on an npc and the shop GUI window
opens and displays the items as well as name and price.

I haven't registered a ShopSystemArea yet

I created a chat command which creates the item from spec
then does sendnodewithclasstoclient.
I have the items shown in my player inventory window and can drag and drop them.

Right now I have
ShopsClassMethos - serverside
Code: [Select]
untrusted function RequestSellItemToPlayer( rin as Class RemoteCallClientIn )
 
  item as NodeRef = rin.args["item"]
 
  // The item doesn't exist.  Either the client has been hacked, or the client data is out of date.  Hopefully just the latter.
  if item == None
  println("TheItemIsNone")
   
    //RemoveItemFromClientStorage(rin.args["item"])
  else
    println("Tryingtobuy the itemiselse")
    var shop = $SHOPS.getShopForItem(item)
Chat window prints out "TheItemIsNone"
item as id = rin.args["item"] and it printsout Tryingtobuy the item is else
ShopClassMethods - client
Code: [Select]
method RequestSellItemToPlayer(item as ID, slot as Integer, texture as List of Class texture_pair)
 
  Debug("Attempting to purchase item (" + item + ") for " + SYSTEM.EXEC.CALLEDBYSCRIPT + ":" + SYSTEM.EXEC.CALLEDBYFUNCTION)
   
  rout as Class RemoteCallServerOut
  rout.toScript = "ShopsClassMethods"
  rout.toFunction = "RequestSellItemToPlayer"
  rout.failScript = SYSTEM.EXEC.THISSCRIPT
  rout.failFunction = "ServerRMCFail"
  rout.args["item"] = item
  rout.args["slot"] = slot
  marshal texture to rout.args["texture"]
 
  RemoteCallServer(rout)
.

37
Ok now I can type in the chat window
/henpc createfromspec 1, 1 (which creates a npccombatantspec#1 level 1)

which spawns a monkeytok at 0,0 no matter where the character is standing

chat log shows an unhandled node and a node 0
Code: [Select]
* newchar just entered the world. (11:08 pm)
[hsl_debug] 0,0: SCRIPT[E_WorldClassMethods]: Eval world override: HE_PostOnAreaRegister().
[hsl_debug] 9223372060865132781,0: SCRIPT[E_AreaClassMethods]: register the mob spawn territory junk
 * newchar has entered the area.
You have entered test3 [area #9223372060865132781 instance#0].
[hsl_error] 9223372060865132781,0: [test3] SCRIPT ERROR: In function ScriptError: unhandled type of node 9223372061038132837 (E_nonPlayerCharacter)
12/11/2012 23:09:44 UTC
Call trace:
  Script CombatantClassMethods line 238 me[id=9223372061038132837 class=E_nonPlayerCharacter,Combatant,SoloAiAgent]
  Script E_NPCClassMethods line 301 me[id=9223372061038132717 class=_npc,E_NPC]
  Script E_NPCClassMethods line 141 me[9223372061038132717]
  Script _npcClassMethods line 68 me[9223372061038132834]
  Script _CommandHandlerClassMethods line 32 me[9223372061038132834]
starting method/function _PROCESSCOMMAND
starting me[id=9223372061038132834 class=_CommandHandler]
[hsl_error] 9223372060865132781,0: [test3] SCRIPT ERROR: Node 0 not found to call method _GETLIST
12/11/2012 23:09:45 UTC
Call trace:
  Script SoloAiAgentClassMethods line 356 me[9223372061038132837]
  Script E_nonPlayerCharacterClassMethods line 339 me[9223372061038132837]
  Script E_nonPlayerCharacterClassMethods line 131 me[9223372061038132837]
starting method/function _SO_ENTERED
starting me[id=9223372061038132837 class=E_nonPlayerCharacter,Combatant,SoloAiAgent]
if I use /heinfo node
Code: [Select]
Classes, E_nonplayercharacter, Combatant, SoloAiagent
Action 0
AgenthasbeenInitialized false
Agility 0
CastingSpell false
ClickTarget 0
CombatEffectList <v> <\v>
CreatureDifficultyRating 0
DamageContributors
DetectedPlayers [ id# ] true
Dexterity 0
c
Action 0
Agility 0
Dexterity 0
E_isimmune false
E_Abilities <v><\v>
E_hitpoints 0
E_maxHP 0
E_isdead false
Edit: Turns out I didn't add SpecDerivedObject as a Parent Class of E_Nonplayercharacter on the Server
Now I am able to create the npc at the character position and the npc level and hitpoints update the TargetStatusBar

38
Well I added the HJPrivateReplicationgroup but I guess that's just for abilities.
In E_NPC I uncommented HENPCProcessCommandInput and Solo_NPC_Usage
so right now the E_NPC server class looks like this
Code: (hsl) [Select]
method HE_NPCClassUsedForInstantiation( useClass references String ) as Boolean
  useClass = "E_nonPlayerCharacter"
  return true
.
method HE_NPCVisibileClassUsedForInstantiation( useClass references String ) as Boolean
  useClass = "E_characterAppearance"
  return true
.

//shared function _OnCharacterInstantiation( npc as NodeRef of Class E_nonPlayerCharacter, type as String ) 
//  npc.name = npc.GetMyVisibleCharacter().name
//  npc.InitCommonCharacter()       //  Run init routine.
//  GlomClass( "E_AiAgent", npc )   //  Every npc will be an E_AiAgent.
//  npc._RegisterAgent()
//  npc._AgentWakeup()
//.
///////////////////////////////////////////////////////////
// NEW
///////////////////////////////////////////////////////////
method Solo_CreateCharacter(specification as String, persisted as Boolean, drawnow as Boolean) as NodeRef of Class _NonPlayerCharacter
  //----------------------------------------------------------------
  // Creates the persistent or non-persistent node for the npc class
  // and also sets up some basic features such as the appearance
  // and any quest-related data
  //----------------------------------------------------------------
  npc as NodeRef of Class _NonPlayerCharacter
  useClassForNpc as String = me._NPCClassUsedForInstantiation()
  lType as String = ToLower(specification)
 
  assert( me._IsValidCharacterType( lType ), "Unknown character type(" + specification + ") specified, you may need to add it using /henpc")
 
  //------------------------
  // Create the npc instance
  //------------------------
  if persisted and GetInstanceNumber() = 0
    npc = CreatePersistedNodeFromClass( useClassForNpc )
  else
    npc = CreateNodeFromClass( useClassForNpc )
  .
  if npc == None
    ScriptErrorAndContinue("Character Node could not be created for " + specification)
    return None
  .
 
  // it is important that the addition of the base_hard_association immediately follow the creation
  //   of the node for ghost_classes to work properly.
  me._AssociateHECharacterToNPCRoot( npc )
 
  //----------------------------------------
  // create a visible character for this npc
  //----------------------------------------
  visChar as NodeRef of Class _characterAppearance = me.Solo_CreateVisibleCharacter( lType, persisted, drawnow, npc )
  if visChar == None
    ScriptErrorAndContinue("_characterAppearance was not able to be created for " + specification)
    return None
  .
  visChar.name = me._GenerateNameByCharacterType( lType )
 
  // In order for the creature node to be loaded on the client, creature_show MUST be set to true
  //    you can then toggle it off afterwards
  npc.creature_show = drawnow

  npc._getReplicationGroup(true)
  npc._RegisterACCCWithSpatialAwareness()

  //-------------------------------
  // Load quest data for npc if any
  //-------------------------------
//  if npc is kindof Quest_Giver
//    npc.LoadQuestDataFromQuestDB()
// 
//    //---------------------------------------------
//    // Also show correct quest icon for each player
//    //---------------------------------------------
//    npc.UpdateQuestIconForAllPlayersInArea()
//  .
  return npc
.

method Solo_CreateVisibleCharacter(specification as String, persisted as Boolean, drawnow as Boolean, npc as NodeRef of Class _NonPlayerCharacter) as NodeRef of Class _characterAppearance
  visibleDummy as NodeRef of Class _characterAppearance
  useClassForVisibleCharacter as String = me._NPCVisibileClassUsedForInstantiation()
  // morph target coefficients is used for types that share a model and use morphs to accomplish
  //   racial changes such as the difference between a half-dwarf vs a human
  var MorphTargetCoefficients = me._GetMorphTargetCoefficientsForType( specification )
 
  // Some character types share a character specification, primarily used for types that use
  //   skeletal/geometry morphing
  var characterSpecification = me._GetCharacterSpecificationForType( specification )
 
  if persisted and GetInstanceNumber() = 0
    visibleDummy = CreatePersistedNodeFromClass( useClassForVisibleCharacter )
  else
    visibleDummy = CreateNodeFromClass( useClassForVisibleCharacter )
  .
  // it is important that the addition of an association immediately follow the creation
  //   of the node for ghost_classes to work properly.
  AddAssociation(npc, "base_hard_association", visibleDummy)
  visibleDummy._characterSpecification = characterSpecification
  visibleDummy.SkeletonBlendCollection = MorphTargetCoefficients
  visibleDummy.draw_character = drawnow
  return visibleDummy
.

//method HE_NPCVisibileClassUsedForInstantiation( useClass references String ) as Boolean
//  useClass = "Solovisible_character"
//  return true
//.
//
method HENPC_ProcessCommandInput( account as NodeRef, input as String ) as Boolean
  args as List of String
  Tokenize( input, args )
  if args.length < 2
    Solo_NPC_Usage( account )
    return false
  .
 
  partialMatch toLower( args[2] )
    to "scatter"
      //Scatter( account )
      return true
    .
    to "createfromspec"
      if args.length < 3
        Solo_NPC_Usage(account)
      else
        if args.length < 4
          me.CreateSoloNpcFromSpec(account, args[3], 1, false)
        else
          if args.length > 4
            partialMatch toLower( args[5] )
              to "camera"
                me.CreateSoloNpcFromSpec(account, args[3], args[4], true)
              .
              default
                me.CreateSoloNpcFromSpec(account, args[3], args[4], false)
              .
            .
          else
            me.CreateSoloNpcFromSpec(account, args[3], args[4], false)
          .
        .
      .
      return true
    .
    to "rename"
      if args.length < 4
        Solo_NPC_Usage(account)
      else
        npc as NodeRef = args[3]
        if npc == None
          $CHAT.CHATPLAYER(account, "", "Could not locate NPC with ID " + args[3])
        else
          qList as List of Association = QueryAssociation(npc, "base_hard_association", 0)
         
          foreach assoc in qList
            vChar as NodeRef = assoc.target
            where vChar is kindof _characterAppearance
              str as String = args[4]
              i as Integer = FindString(str, "$Q")
              if i > 0
                str = SubString(str, i + 1, str.length - 2)
              .
             
              $CHAT.CHATPLAYER(account, "", "Renaming $Q" + vChar.name + "$Q to $Q" + str + "$Q")
              vChar.name = str
            .
            return true
          .
         
          $CHAT.CHATPLAYER(account, "", "Unable to locate a visible_character node for NPC " + args[3])
        .
      .
    .
  .
  return false
.

//method HE_IsValidCharacterType( type as String, isValid references Boolean ) as Boolean
//  // Used by SYSTEM.NODE.NPC
//  //
//  // Determines whether a character type is know to the engine.
//  //
//  var ltype = tolower( type )
// 
//  proto as NodeRef of Class CharacterTypePathClass = getPrototype( "CharacterTypePathPrototype" )
//  if proto.CharacterTypePathField has ltype
//    isValid = true
//    return true
//  .
// 
//  return false
//.
//
//method HE_IsValidCharacterSpecification( specification as String, isValid references Boolean ) as Boolean
//  // Used by SYSTEM.NODE.NPC
//  //
//  // Determines whether or not a character specification is known to the engine
//  var lspec = tolower( specification )
//
//  proto as NodeRef of Class CharacterTypePathClass = getPrototype( "CharacterTypePathPrototype" )
//  if proto.CharacterTypePathField has lspec
//    isValid = true
//    return true
//  .
// 
//  return false
//.

//method HE_RemoveCharacterSpecificationPath( specification as String ) as Boolean
//  // Used by System.Node.Npc
//  //
//  // Removes the specification--> path mapping, unregistering a character specification as
//  //   a valid one.
//  //
//  // return true if you do not want th core npc mechanics to handle things through the
//  //   HE_NpcData prototype
// 
//  proto as NodeRef of Class CharacterTypePathClass = getPrototype( "CharacterTypePathPrototype" )
//  if proto.CharacterTypePathField has specification
//    remove specification from proto.CharacterTypePathField
//    return true
//  .
// 
//  return false 
//.
//
shared function _OnCharacterInstantiation( npc as NodeRef of Class _NonPlayerCharacter, type as String )
  // Called in all of the class method scripts of the $NPC system node
  //   provides the opportunity to composite additional behaviors via GLOMming based on "type"
  //
  if not(npc is kindof E_nonPlayerCharacter)
    GlomClass( "old_SoloNpc_class", npc )
  .
.
//
//method HE_NPCClassUsedForInstantiation( useClass references String ) as Boolean
//  useClass = "E_nonPlayerCharacter"
//  return true
//.
//
function Solo_NPC_Usage( account as NodeRef of Class _PlayerAccount )
  var msg = "Solo USAGE:"
  msg = msg + "$R  /HENPC SCATTER"
  msg = msg + "$R  - Creates 10 random NPCs from the Demo Outfits Browser and places them around your character."
  msg = msg + "$R  /HENPC CreateFromSpec <specID> [level]"
  msg = msg + "$R  - Creates an NPC from the specified NpcSpec.  Its position will be where your character is and if it has AI it will be leashed."
  msg = msg + "$R  /HENPC Rename <npcID> $Q<name>$Q"
  msg = msg + "$R  - Renames the specified NPC to the provided name"
  $CHAT.ChatPlayer( account, "", msg )
.

method CreateSoloNpcFromSpec(requestor as NodeRef of Class _PlayerAccount, specKey as ID, E_level as Integer, camera as Boolean) as NodeRef of Class E_nonPlayerCharacter
 
  //------------------
  // Spec Verification
  //------------------
  if specKey < 1
    $CHAT.ChatPlayer(requestor, "", "Invalid spec key.")
    return None
  .
 
  //--------------------
  // Get the Spec Oracle
  //--------------------
  specoracle as NodeRef = $SPECORACLEUTILS._GetOracleFromType("NPCCombatantSpecOracle")
  if specoracle == None
    $CHAT.ChatPlayer(requestor, "", "Unable to retrieve the $QNPCCombatantSpecOracle$Q from $$SPECORACLEUTILS.")
    return None
  .
 
  //-------------
  // Get the Spec
  //-------------
  spec as NodeRef of Class NpcCombatantSpec = specoracle.GetSpecByKey(specKey)
  if spec == None
    $CHAT.ChatPlayer(requestor, "", "The NPCCombatantSpecOracle did not return a spec for " + specKey + ".")
    return None
  .
 
  //---------------------------
  // Instantiate the NPC Object
  //---------------------------
  npc as NodeRef of Class E_nonPlayerCharacter = spec.CreateNonpersistedNpcFromSpec()
  if npc == None
    $CHAT.ChatPlayer(requestor, "", "The NPCCombatantSpec was unable to create a Non-Persisted NPC [" + specKey + "]")
    return None
  .
  //npc.npcSpecOraclePrototype = "NPCCombatantSpecOracle"
 
  //-------------------
  // Verify the AI data
  //-------------------
  if not (npc is kindof BaseAiAgent)
    GlomClass("SoloAIAgent", npc)
  .
  GlomClass("Combatant", npc)
 
  if HasMethod(npc, "setCombatantLevel")
    npc.setCombatantLevel(E_level)
  .


  if camera
    // remote call to the client and check for being in fly camera mode
    // if they are, then reposition the npc to under the camera
    rco as Class RemoteCallClientOut
    rco.toPlayer = requestor
    rco.toScript = "_npcClassMethods"
    rco.toFunction = "GetCameraPositionForNewNPC"
    rco.failScript = "debugUtils"
    rco.failFunction = "ClientRMCFail"
    rco.args["npc"] = npc
    RemoteCallClient( rco )
  else
    npc._TeleportCharacter(requestor.GetPosition(), requestor.GetRotation())
  .
  if npc is kindof SoloAiAgent
    $AIMASTERBRAIN.doRegisterAgent(npc)
    npc._doAgentInitialize()
  .
  npc._agentWakeup()
  return npc
.
//
//method HE_RepositionCharacterBelowCamera(npc as NodeRef of Class _NonPlayerCharacter, position as Vector3, rotation as Vector3) as Boolean
//  npc._TeleportCharacter(position, rotation)
//  if HasMethod(npc, "_AgentWakeup")
//    npc._AgentWakeup()
//  .
//  return true
//.
//
//remote function AutoPfnResponse(incoming as Class RemoteCallIn)
//  client as NodeRef of Class _PlayerAccount = incoming.args["client"]
//  pathnode as NodeRef of Class pathfindinginstance = incoming.args["pathnode"]
//  assert(pathnode != None, "pathnode passed in is invalid (" + incoming.args["pathnode"] + ")")
//  if client == None
//    //  they went away somehow so let's kill the pathfinding node
//    DestroyNode(pathnode)
//    return
//  .
//  args as List of String
//  SplitBy(pathnode.name, ":", args)
//  assert(args.length == 2, "invalid name data $Q" + pathnode.name + "$Q")
//  $NPC.CreateSoloNpcFromSpec(client, args[1], args[2], false)
//.
//
//function Scatter( account as NodeRef of Class _PlayerAccount )
//  var baseOutfitList = $DemoOutfits.KnownDemoOutfitsList()
//  if baseOutfitList.length < 1
//    $ALERT._BasicAlert( account, "No known outfits available for demoing." )
//    return
//  .
// 
//  // get valid outfits
//  outfitList as List of String
//  loop i from 1 to baseOutfitList.length
//    if $DemoOutfits.IsOutfitArt( baseOutfitList[i] )
//      continue
//    .
//    if $DemoOutfits.IsOutfitMale( baseOutfitList[i] )  or  $DemoOutfits.IsOutfitFemale( baseOutfitList[i] )
//      add back baseOutfitList[i] to outfitList
//    .
//  .
//
//  // select random ones
//  npcList as List of NodeRef of Class _NonPlayerCharacter
//  type as String
//  outfit as String
//  count as Integer
//  loop i from 1 to 10
//    while outfit == ""  and  type == ""  and  count < 50
//      count = count + 1
//      var rnd = RandomInteger( 1, outfitList.length )
//      //var rnd = 1
//      outfit = outfitList[rnd]
//      if outfit = "COMBATANT_F"
//        MsgArea( "", "ScatterNPCS: Skipping outfit: " + outfit + "because it has invalid facegen data." )
//        continue
//      .
//      if $DemoOutfits.IsOutfitMale( outfit )
//        type = "humanlike_male"
//      else
//        type = "humanlike_female"
//      .
//    .
//    if outfit != ""  and  type != ""
//      var npc = $NPC._CreateSimpleHECharacter( type, false )
//      add back npc to npcList
//      $DemoOutfits.WearDemoOutfitForNPC( npc, outfit )
//      MsgPlayer( account, "", "Creating character with the " + outfit + " outfit." )
//    .
//    count = 0
//    outfit = ""
//    type = ""
//  .
// 
//  pos as Vector3
//  rot as Vector3
//  foreach npc in npcList
//    pos = account.GetPosition()
//    rot.y = RandomInteger( 0, 359 )
//    if RandomInteger( 1, 2 ) = 1
//      pos.x = pos.x + RandomFloat()
//    else
//      pos.x = pos.x + RandomFloat() * -1
//    .
//    pos.y = pos.y + .40
//    if RandomInteger( 1, 2 ) = 1
//      pos.z = pos.z + RandomFloat()
//    else
//      pos.z = pos.z + RandomFloat() * -1
//    .
//    npc._TeleportCharacter( pos, rot )
//  .
//.

untrusted function ClientRequestAllNPCSpecifications(rin as Class RemoteCallClientIn)
 
  var specs = $REPOSITORY._GetAllCharacterSpecifications()
 
  rout as Class RemoteCallClientOut
  rout.toPlayer = me
  rout.toScript = rin.fromScript
  rout.toFunction = rin.args["returnFunction"]
  rout.args = rin.args
  marshal specs to rout.args["specs"]
 
  RemoteCallClient(rout)
.

//method EvaluateAllQuestNPCsForAccount(account as NodeRef)
//  //------------------------------------------------------------------
//  // Have each quest NPC in area do their quest evals for this account
//  //------------------------------------------------------------------
//  var npcList = $NPC._GetAllNPCS()
//  foreach npc in npcList
//    where npc is kindof Quest_Giver
//      npc.EvaluateQuestsForAccount(account)
//    .
//  .
//.
untrusted method ClientRequest_NpcSpecKeyForNpc(npc as NodeRef)
  //-------------------------------------------
  // Return the spec key for the given npc node
  //-------------------------------------------
  npcSpecKey as ID
  if npc <> None
    where npc is kindof E_nonPlayerCharacter
      npcSpecKey = npc.SpecKey
    .
    //call client SYSTEM.REMOTE.CLIENT StatusBarNpcGUIClassMethods:Receive_NpcSpecKey(npc, npcSpecKey)
  .
.


I can type in the chat window /henpc createfromspec 1, 1;
which spawns the monkeytok at the character position with 0/0 hitpoints
If I use an ability on it it dies and the impact effect keeps playing and hitpoints go up 342424/0 hitpoints

Of couse the mob spawner never actually creates the NPC yet though.

39
Yeah I was just renaming anything that started with HJ,
unless I had the class already like E_Chardriver
If it was HJ_characterappearance I would have added it to E_characterappearance
but its in there now, only had a couple references to it to change.

I have the HJPlayercharacter and HJPlayerAccount in E_playercharacter and E_playeraccount,
at the bottom of the scripts with most of it commented out,
I'll look through there and try and see if it needs
some uncommenting.

40
I guess there's a problem with the NPC system node on the server E_NPC
I couldn't spawn a character using the  hotspot CharacterSpecificationRegistry
I commented all the new stuff I added to it(from HJ_NPC) and it would work

If I change VisibleCharacterUsedforInstantiation from
E_CharacterAppearance to SOLOVisibleCharacter(same as HJVisibleCharacter)
it doesn't.

41
I'm using a NpcCombatant profile with an AiTactical Spec using the Monkeytok
No additional glasses glommed on.

Right now when I change the activator type it doesn't update the text description.
I have to save the spawn profile and reopen it after chainging the activator
to be able to edit the activator.

Edit: Ok so I had the Enum Activater Types all in Uppercase letters.
I couldn't change the enum text in the dom editor,
so I changed it in MobspawnEditor to MINCAPTIMER
and the description updates now.

No mob yet though, I saw in a script that mobspawn nodes were loaded before
their visible models and "MikeC" was implementing a server fix
Dont know what the fix was this section is commented out though.

42
I've got the drop down lists to populate by adding to the
HE_PostOnAreLoad in the server E_AreaClassMethods
Code: [Select]
$MOBSPAWNS._onMobSpawnHandlerInitialize()
$MOBSPAWNS.registerMobSpawnNpcSpecs()
It appeared to save but it was saved as an unsavedprofile
I guess 'cause I left the NPCGrouping section blank.
I can add an NPC group but the drop down list for it is blank, lol.

So I'll have to find how to populate the data for the field NpcAggroGroups now.
Then hope the Activator section works
Edit: I had to register the command /aiagent
NpcGroup drop down list shows the new npc group.

I was able to save the spawn profile and set it to active,
and can force-spawn, just no mob yet.
I'll have to look into the Activator section some
I can only save it with MINCAPTIMER
but the description is "This is some funky type the code doesn't know about"




43
I actually brought both Mongen and Mobspawns over thinking they were connected somehow,
but I'm using just the HJMobspawnBrowser only now.
Something I found out today is the Mobspawn I started creating yesterday is gone.

When I opened the browser yesterday  the list was blank, then I would hit refesh
and it showed the mobspawn i started creating after clicking the "Add" button,
(but couldn't save a spawn profile to).
Today I hit refresh and it's blank
(I'm In the same area as yesterday).

I see the method HJ_GetTerritoryData using the field MobSpawnDataMap
which I have on the server set to (R) replicate and (IS) initialset
change callback is no and the values for the field are No, Lazy, None , No, no, no, no, no,  0, 0, 0, 1

When I click on the drop down box for spawn type, wander type, pursue type
Code: [Select]
13:07:14: System:SCRIPT[SoloMobSpawnStandardProfileClassMethods]:SoloMobSpawnStandardProfileClassMethods:_onDropDownBoxSelection got item RANDOMPATH from dropdown list profileSpawnTypeList
13:07:15: System:SCRIPT[SoloMobSpawnStandardProfileClassMethods]:SoloMobSpawnStandardProfileClassMethods:SoloMobSpawnStandardProfile_UpdateSpawnData called with data "RANDOMPATH"
13:07:18: System:SCRIPT[SoloMobSpawnStandardProfileClassMethods]:SoloMobSpawnStandardProfileClassMethods:_onDropDownBoxSelection got item MANAGEDPATH from dropdown list profileSpawnTypeList
13:07:18: System:SCRIPT[SoloMobSpawnStandardProfileClassMethods]:SoloMobSpawnStandardProfileClassMethods:SoloMobSpawnStandardProfile_UpdateSpawnData called with data "MANAGEDPATH"
13:07:20: System:SCRIPT[SoloMobSpawnStandardProfileClassMethods]:SoloMobSpawnStandardProfileClassMethods:_onDropDownBoxSelection got item FIRSTPATHPOINT from dropdown list profileSpawnTypeList
13:07:20: System:SCRIPT[SoloMobSpawnStandardProfileClassMethods]:SoloMobSpawnStandardProfileClassMethods:SoloMobSpawnStandardProfile_UpdateSpawnData called with data "FIRSTPATHPOINT"
13:07:23: System:SCRIPT[SoloMobSpawnStandardProfileClassMethods]:SoloMobSpawnStandardProfileClassMethods:_onDropDownBoxSelection got item TERRITORY from dropdown list profileSpawnTypeList
13:07:23: System:SCRIPT[SoloMobSpawnStandardProfileClassMethods]:SoloMobSpawnStandardProfileClassMethods:SoloMobSpawnStandardProfile_UpdateSpawnData called with data "TERRITORY"

44
I used the territory management GUI that was already in the cleanengine version,
and created a couple names for territories

45
So now I have the Npc, AiTactical, PerceptionProfile, Groupformation, and MobSpawn oracles set up.
I'm trying to add a new spawn profile, dynamic spawns are disabled (not sure why)

So I use MobSpawnStandardProfile.
I created a couple territory names using the "TerritoryManagement" from the HotSpot and they each have a territory node and boundary node which is the region.

When I pick "Territory" under spawn type , In MobSpawnStandardProfile
the text box below it "Names" is blank.

Same thing for WanderType, and Pursue type
the text box below it is blank

I think I have all the AreaRootToRegionRoot, AreaRootToTerritoryRoot etc. associations setup
but the text box is still blank.

So I'm not sure how to populate the TerritoryNames for the MobSpawnStandardProfile.
The Scripts all seem compiled and submitted.

Pages: 1 2 [3] 4 5 6