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

Author Topic: [] FPS Register Events on Default Build  (Read 810 times)

nocake

  • General Accounts
  • *
  • Posts: 404
    • View Profile
    • BlightMMO
[] FPS Register Events on Default Build
« on: Nov 16, 12, 06:32:18 PM »

So I brought over FPS_EventPlayerHit from the FPS reference. I have created FPS_Event, FPS_EventSystem, and FPS_EventReverseReplicate as well.

My current problem is getting my client to register for the events.

In the FPS reference $FPS_EVENT.FPS_RegisterGameEntityForEvents(entity) is called in FPS_GameSystemClassMethods. This call is started from a remote untrusted call from the client after the client has  EventRaised() in FPS_TempPlayerAccountClassMethods.


Code: [Select]
method FPS_RegisterGameEntityForEvents(gameEntity as NodeRef)
  if gameEntity != None
    $FPS_EVENT.FPS_AddEntityToGameEntityObjectMap(gameEntity)
    where gameEntity
      is kindof E_playerCharacter
        $FPS_EVENT.FPS_RegisterEntityForAllEvents(gameEntity)
      .
      is kindof E_nonPlayerCharacter
        $FPS_EVENT.FPS_RegisterEntityForAllEvents(gameEntity)
      .
    .
    if HasMethod(gameEntity, "FPS_OnRegisteredForEvents")
      gameEntity.FPS_OnRegisteredForEvents()
    .
  .
.



From what I can tell  $FPS_EVENT.FPS_RegisterGameEntityForEvents(entity) is the point where the user is registered for the events contained in FPS_TempPlayerAccount.FPS_OnRegisteredForEvents().

Currently I am not sure where I should interject the event registration code on the default HE build. This is causing 
Code: [Select]
event_object as NodeRef of Class FPS_EventPlayerHit = $FPS_EVENT.FPS_GetOwnedEventByType( "FPS_EventPlayerHit" ) to return 0.

I have tried adding $FPS_EVENT.FPS_RegisterGameEntityForEvents(theAccount) to HE_PreEnteredArea in E_AccountClassMethods (same block as the modern oil refinery code)

Code: [Select]
method HE_PreEnteredArea( theAccount as NodeRef )
  Debug( "LoginProcess", "Using default HeroEngine HE_PreEnteredArea()." )
  $FPS_EVENT.FPS_RegisterGameEntityForEvents(theAccount.GetMyAccount())
  modern_oil_refinery_area_id as ID = 4611686018513387949
  if GetAreaNumber() = modern_oil_refinery_area_id
    var current_character_appearance = theAccount.GetMyVisibleCharacter()
    glomclass( "_extendedeventobject",  current_character_appearance )
    where current_character_appearance is kindof _extendedEventObject
      current_character_appearance._extendedEventLookup["_characterSpecification"] = current_character_appearance._characterSpecification
      marshal current_character_appearance.geometry_list to current_character_appearance._extendedEventLookup["geometry_list"]
    .
   
    current_character_appearance._characterSpecification = "Supervisor"
   
    clear current_character_appearance.geometry_list
    geometry_pair as Class geometry_pair
    geometry_pair.geometry_part_string = "hard hat"
    geometry_pair.geometry_slot_string = "headwear"
    add back geometry_pair to current_character_appearance.geometry_list
   
    geometry_pair.geometry_part_string = "the supervisor"
    geometry_pair.geometry_slot_string = "personel"
    add back geometry_pair to current_character_appearance.geometry_list
  .

.

I have also tried adding it to JayClassMethods under enactCommand() "area/register" right under chat "registration successful."

Code: [Select]
     is "register"
          $WORLD._RegisterSystemArea(PLAYER)
          $WORLD._RegisterSystemArea(AREA)
          $CHAT.ChatPlayer(accountID, "System", "Registration Successful.")
          $FPS_EVENT.FPS_RegisterGameEntityForEvents(accountID)
         
        .


My main problem is I do not fully understand game mode/area fully yet in the default build. I hope this problem will shed some light on what I am missing. I have read the wiki up and down for the past couple of weeks and I am still unable to wrap my head around this part. There is also a possibility that when i call to FPS_RegisterGameEntityForEvents that i am not giving it proper information. For Example in JayClassMethods I pass it
Code: [Select]
accountid as ID instead of
Quote
accountID as noderef to E_playerAccount

Any points in the right direction or assistance is greatly appreciated.
Also hello everyone! it has been some time since I have posted.
« Last Edit: Nov 25, 12, 04:54:52 PM by HE-Cooper »
Logged