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

Author Topic: [Resolved] AreaSpinUp  (Read 3284 times)

LuisTorralva

  • General Accounts
  • *
  • Posts: 15
    • View Profile
[Resolved] AreaSpinUp
« on: Jun 03, 11, 05:57:54 PM »

Hey guys,
I am still new at HSL so bare with me please   :)

My question is:

been trying to learn how to spinup an area instance.

here is what i am doing:

when new character is  created once finished creating it, then to send him to the new startup area:
so in:
E_CharacterCreationSystemClassMethods server script:
Code: [Select]
method HE_CCSSendCharacterToStartingArea( account as NodeRef of Class _PlayerAccount ) as Boolean
  $Travel._ChangeAreaRequest( account, 4611686018427847928, "1" )
  return true
................
method HE_GetStartingArea() as ID
  //  Used by $CHARACTERCREATIONSYSTEM
  return 4611686018427847928

so this tells that after creating new character to send him to area ID 4611686018427847928 instance #1
right?


ok, so when i create a new toon, it does not travel to my startup area,Chat message box  throws me an error:
Quote
[hsl_error] 0,0: SCRIPT ERROR: In function ScriptError: TravelFailure for clero area:4611686018427847928 inst: 1 reason:Instance not running

very well, so so far is trying to send new character to the specified area instance #1 but so far we dont have an instance #1 running from that area.

so been looking on how to spinup areas and make this startup area remain up.

so go to my E_WorldClassMethods script and make sure my area ID instace 1 wont be shut down:
Code: [Select]
function KeepUpList()
  KeepAreaUp( 4611686018427847928, 1 )

So far so good?

ok, but here si the part i am stucked,
so far we know how to redirect new player to our startup area and instance number, and also how to make sure that the area and instance number remains up all the time.

But my question is how do i startup the area instance #1??
i can just go to organizer AREA panel,  right click on the area and do the startup new instance.
But the deal is that it starts random number instance ie: 50 , 58 etc.., and do not start from instance 1
which is the one i need to keep always up.

is there a way to do such a thing.

or maybe i am not doing the whole process correct, hoping someone can show me some pointers to get this going.

thanks in advanced
« Last Edit: Nov 01, 12, 09:53:06 AM by HE-Cooper »
Logged

FI-ScottZ

  • General Accounts
  • *
  • Posts: 1407
    • View Profile
    • Forever Interactive, Inc.
Re: AreaSpinUp
« Reply #1 on: Jun 03, 11, 07:22:58 PM »

What I believe you are looking for is the external function LaunchAreaServerInstance, so:

LaunchAreaServerInstance(4611686018427847928, 1)

ought to do the trick for you.  It returns boolean as to whether it succeeded.
Logged
Scott Zarnke
Lead Programmer, Visions of Zosimos
CTO, Forever Interactive, Inc.

LuisTorralva

  • General Accounts
  • *
  • Posts: 15
    • View Profile
Re: AreaSpinUp
« Reply #2 on: Jun 03, 11, 11:25:30 PM »

That sounds more likely,

altho was trying to figure out how does the default setup does it,for instance in the default setup are already a few instances already active ie:
- character selection area instance #1
- character creation area instance #1

i thought that both of those areas were hard coded from the very low level since i dont see the
LaunchAreaServerInstance function spinning up those areas anywhere.

but then looked at fantasy lowlands area and from somewhere this area instance #1 is active from the getgo too.

unless all those 3 areas are hard coded to spinup from lowlevel server code?

Logged

TGSRofar

  • General Accounts
  • *
  • Posts: 153
    • View Profile
Re: AreaSpinUp
« Reply #3 on: Jun 04, 11, 07:29:24 AM »

You can do a few things in your HE_CCSSendCharacterToStartingArea override to make sure an instance is spun up if there is none already.

I think you can provide "new" as the instance parameter instead of "1" which will cause a new instance to be spun up when calling "_ChanageAreaRequest".  Of course this would spin up a new instance every time so you would only want to do this if there was no existing suitable instance up an running.

Code: [Select]
method HE_CCSSendCharacterToStartingArea( account as NodeRef of Class _PlayerAccount ) as Boolean
  $Travel._ChangeAreaRequest( account, 4611686018427847928, "new" )
  return true
................

You can also call _CSSSelectStartingAreaInstance before calling the _ChangeAreaRequest.

Code: [Select]
method HE_CCSSendCharacterToStartingArea( account as NodeRef of Class _PlayerAccount ) as Boolean
  $CHARACTERCREATIONSYSTEM._CCSSelectStartingAreaInstance( area, instance )
  $Travel._ChangeAreaRequest( account, area, instance )
  return true
................

_CCSSelectStartingAreaInstance will determine whether or not any instances are running or if a new one needs to be spun up.

« Last Edit: Jun 04, 11, 07:30:59 AM by rfarrel »
Logged
Ron Farrell
Lead Programmer
Triad Game Studios

LuisTorralva

  • General Accounts
  • *
  • Posts: 15
    • View Profile
Re: AreaSpinUp
« Reply #4 on: Jun 05, 11, 12:16:25 AM »

Thanks rfarrel,

that did the trick, it works great,

now a new instance will be spun up if there is currently none active, otherwise it will take the current active one.

thanks again
Logged

runningbird

  • General Accounts
  • *
  • Posts: 37
    • View Profile
    • Runningbird Studios
Re: AreaSpinUp
« Reply #5 on: Dec 29, 11, 09:37:10 AM »

You can also call _CSSSelectStartingAreaInstance before calling the _ChangeAreaRequest.

Code: [Select]
method HE_CCSSendCharacterToStartingArea( account as NodeRef of Class _PlayerAccount ) as Boolean
  $CHARACTERCREATIONSYSTEM._CCSSelectStartingAreaInstance( area, instance )
  $Travel._ChangeAreaRequest( account, area, instance )
  return true
................

What do you need to provide for area, instance for the _CCSSelectStartingAreaInstance()

when I put 4611686018427847928 for the area and "1" for the instance it says expression cannot be set but function parameter is reference?
Logged

TGSRofar

  • General Accounts
  • *
  • Posts: 153
    • View Profile
Re: AreaSpinUp
« Reply #6 on: Dec 30, 11, 06:27:13 AM »

It shouldn't matter what you pass in for those arguments.  They are passed as references and the method sets the value of them.  Take a look at the implementation of _CSSSelectStartingAreaInstance.  Both area and instance parameters can be unassigned.

Based on your error, it sounds like you passed in constants for the parameters.  They need to be variables since they are passed as references.
Logged
Ron Farrell
Lead Programmer
Triad Game Studios

runningbird

  • General Accounts
  • *
  • Posts: 37
    • View Profile
    • Runningbird Studios
Re: AreaSpinUp
« Reply #7 on: Dec 30, 11, 09:08:58 AM »

rfarrel thanks I will check out how that is implemented and change the values to variables.
Logged

runningbird

  • General Accounts
  • *
  • Posts: 37
    • View Profile
    • Runningbird Studios
Re: AreaSpinUp
« Reply #8 on: Dec 30, 11, 11:28:19 AM »

@rFarrel thanks that worked like a charm

For others having similar issues here is the code
Remember to change the areaID number to your starting areaID from your game the one shown is the one from my game.

Code: [Select]

method HE_CCSSendCharacterToStartingArea( account as NodeRef of Class _PlayerAccount ) as Boolean
  var area = 9223372056082664384
  var instance = "1"
  $CHARACTERCREATIONSYSTEM._CCSSelectStartingAreaInstance(area, instance)
  $Travel._ChangeAreaRequest( account, 9223372056082664384, "1" )
  return true
.
Logged