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

Author Topic: Few points that I am having trouble understanding  (Read 1120 times)

wallace_balaniuc

  • Developer
  • *
  • Posts: 9
    • View Profile
Few points that I am having trouble understanding
« on: Aug 20, 13, 04:14:48 PM »

Greetings again,

I am in the process of making a game in which two teams battle each other for control of 3 towers in a map. That's the general overview of the game as a whole.

I'm having trouble wrapping my head around some of the systems in the engine and thus hoping for some help.

  • When placing a model / asset into the game world, what is the best way to reference that item? For example, we currently have a trigger encompassing the tower. Currently the tower is a simple arch provided by clean engine. If I want to change the colour of this item, I currently create a noderef of class HBNode (client side) and make that equal to it's GUID. Is there is more correct way of doing this? Should items such a tower reside on the server rather than the client?
  • I have noticed in the HJRef world several triggers that do not have a script set in the callback property. I've read here http://wiki.heroengine.com/wiki/Triggers that you can have a class GLOMmed onto the trigger node but I am having trouble understanding how to do that?
  • I understand that _playerCharacter is a base class that should be extended using our own class. How exactly is this done? Should I create the class X_playerCharacter and GLOM it to _playerCharacter?
  • What script handles arrival paths? What we'd like to do is define starting locations for each team.

Appreciate any help that can be given.
« Last Edit: Aug 20, 13, 04:58:56 PM by wallace_balaniuc »
Logged
Lead Programmer - Gallium Gaming

Tarra2012

  • General Accounts
  • *
  • Posts: 113
    • View Profile
Re: Few points that I am having trouble understanding
« Reply #1 on: Aug 20, 13, 06:46:46 PM »

1. You can loop through all exisiting Assets.
There are mutliple ways to do this in HSL.
Below an example, how to loop through all instances of a "FQN Trigger"

Code: [Select]
  //General GET Asset
  areaasset as NodeRef of Class AreaAsset
  areaasset=$EDIT._FindAreaAssetByFQN("\engine\trigger.trg")
   
  if areaasset <> 0 
    //GET all instances of TriggerAsset in Area
    li as List of NodeRef of Class Instance = areaasset._getAllInstancesOfAreaAsset()
 
     foreach d in li   
      // do whatever you like with the instance
    .

   .



2. Glomming a class on a Trigger:
You need to get your hands in HSL. And create a function that creates your trigger.
Once created you can easily modify the trigger via the "Scale/Movement/Property" Tools of HE.

Code: [Select]
untrusted remote function createTrigger(position as Vector3)
  newT as NodeRef of Class TriggerInstance = $EDIT._CreateTriggerInstance("default")
  println(newT._GetMyRoom())
  newT.Active=true
  newT.Enter=true
  newT.Depth=0.7
  newT.Height=0.4
  newT.Width=0.55
  newT.IgnoreForNPCCollision=false
  newT.IgnoreForPlayerCollision=false
  newT.name="newtrigger"
  newT.PlayerSensitive=true
  newT.Period= 0.8                               //refresh in secs
  newT.Viewability = WORLD_AND_MAP
  newT.Position = position
  $EDIT._SetInstanceCreated( newT, 0 )
  glomclass("MY_Area_Trigger",newT)
.
[\code]


The class used for glomming needs the method::
method TriggerEnter( triggeredBy as NodeRef )


Logged

keeperofstars

  • General Accounts
  • *
  • Posts: 998
    • View Profile
    • StarKeeper Online
Re: Few points that I am having trouble understanding
« Reply #2 on: Aug 20, 13, 07:11:20 PM »

I wouldn't loop through all the assets, but would probably attach a class to the tower nodes, and search for node byClass that way you will only get the towers / tower triggers. Pretty much similar to what you are looking at doing Tarra2012, but really want to narrow down the search, and skip going through all assets. Also you don't want to search through every assets and instances that could get to be a long search, and loop.

Also you could have 900 triggers and only want the one trigger for the towers.

In regards to Glomming read the wiki entry, but there are a few ways to do it. Glomming is a sorta inheritance setup.

For arrival Paths, are you looking to dynamically create and load them, or just setup some base ones and have players tagged to them based on which side they are on? Like blue team, red team options?
Logged
[img]http://screencast.com/t/x7btcSSyp3h0[\img]

wallace_balaniuc

  • Developer
  • *
  • Posts: 9
    • View Profile
Re: Few points that I am having trouble understanding
« Reply #3 on: Aug 21, 13, 08:08:59 AM »

Thanks for the responses.

keeperofstars - The arrival paths do not have to be set dynamically. We're looking at 2 points at opposite ends of the map where  each team spawns.


In terms of the trigger, I understand I can make the trigger dynamically in code. The confusion comes from knowing when will the creation piece of code actually run? Would it be called from the overridden system nodes such as $AREA?

Thanks again,
Logged
Lead Programmer - Gallium Gaming

keeperofstars

  • General Accounts
  • *
  • Posts: 998
    • View Profile
    • StarKeeper Online
Re: Few points that I am having trouble understanding
« Reply #4 on: Aug 22, 13, 10:00:37 PM »

You can then set the name of the arrival points, and then look for arrival point nodes, and do a simple case to figure out which one to return or start the person start on.

So for example name one RedArrival and the other BlueArrival.

When the person loads into area do a quick, lookup for the arrival nodes based on player.
So if player.team is "Red" find RedArrival set player.position = RedArrival.position.

Sorry I don't have the code to look up the arrival point, but it's a node so pretty simple to figure out.
Logged
[img]http://screencast.com/t/x7btcSSyp3h0[\img]