Actor Creation + Interaction

Exportforce

  • *
  • Posts: 90
Hello,

I am now trying for 3 days a simple thing and ran into some problems of which most I could fix. First off, here are 2 different versions of my approach where "RPG Test" is my more advanced  version.
https://www.dropbox.com/s/nchmk1ia2kggknr/Game-Tests.zip?dl=0

What I am trying to do:
Create an enemy out of infos from a few lists (HP, Name, Sprite ID just as an example)
The Enemy will be fully static and not fighting back. The player clicks on the enemy and the enemy loses health.
On RPG Test, the creation is running good, but no interaction possible.

On the other try I can easily create the enemy and even make it clickable but I am unable to get any attributes worked out that I can use interactively between the scene and the actor itself.

Also one error I am running into all the time is on the creation where I just let the game roll 0-1 by random, so it is selecting 0 or 1, to get an error where no error could be possibly happen. Same on the creation of the rectangle filler, I sometimes get an error when I test the scene, but that is impossible as the field always is either 0 or any other kind of number and I tried manually the sickest combinations and all worked, even if they looked weird, but no error.

So please take a look at both and give me a hint of what I am doing wrong to achieve that simple goal.

(Please note RPG Test is the major example of what I am trying)

yoplalala

  • Posts: 1502
Oh you posted your game her :). I'll try what's wonr today I don't know when ( I am not on my computer now,so cannot check it now)

Exportforce

  • *
  • Posts: 90
Yeah uploaded it in hopes anyone can help me, I bet it is something super simple...

yoplalala

  • Posts: 1502
Ok , found !

It's indeed quite simple.

You have problems with the attributes.


  • for this scene  .... from behavior "attack doesn't exist".


why ? Because you did an actor behavior not a scene behavior.


( and then it does weird things, because it gets the attributes in the actor behaviour. I think as your current_hp exist in the behaviour AND in the scene, it will do weird things).

  • then click on the behaviour , and look at the max_hp there it's 0. You can't divise by 0.



So,
  • first change your scene behaviour as an actor behaviour and put it on your actor type ennemy
  • Delete all your current hp, max hp from the scene. As you will surely have multiple ennemies, it's better to define them in the behaviour attack
  • for the rectangle two choices or you create on the scene event, and there you use the blocks  get attribute ... from behaviour .. from last created actor 
    or you can put it in you attack behaviour. and in the draw scene, put a block change to screen space before drawing


« Last Edit: July 19, 2015, 12:34:59 am by yoplalala »

Exportforce

  • *
  • Posts: 90
For which of the two example games is this ?

There is always only one enemy at a time, never more.
The RPG Test Game has everything as a scene behaviour.

edit: on RPG Test I tried to setup  a scene behaviour but that results in non interactivity... As actor behaviour I get at least the click response.

« Last Edit: July 19, 2015, 02:51:59 am by Exportforce »

yoplalala

  • Posts: 1502
I don't have my computer on hand. But tomorrow, I'l correct your game ( with two versions, the scene vresion, and the actor version) and put comments, you'll understand better

Exportforce

  • *
  • Posts: 90
I got a few steps ahead. Managing now to deduct HP when clicking, etc.
But when creating the lists Stencyl again won't let me...

When I test the Game/Scene it always  gives me this:
Quote
TypeError: Error #1009: Der Zugriff auf eine Eigenschaft oder eine Methode eines null-Objektverweises ist nicht möglich.
   at MethodInfo-5223()[Source/scripts/Design_2_2_click.hx:144]
And as you can see, the List, again, has 2 items and yet Stencyl is not able to count to two...

yoplalala

  • Posts: 1502
it 's not this. When you are npt in a behaviour, but in a scene or an actor ( is this your case). When you first use a  list, you have to set your list to create new list, then add the numbers,  don't use the palette, then it will work.  And don't forget to put ( numbers of item - 1)

Exportforce

  • *
  • Posts: 90
What do you mean by "create a new list" ?


Exportforce

  • *
  • Posts: 90
Yeah but that creates a new list, but I already HAVE a list, which I want to use.

yoplalala

  • Posts: 1502
no, you don't have it . If you're not in a behaviour, you cannot create a list with the palette. I don't know why it's not written on stencylpedia but it's the case.

Exportforce

  • *
  • Posts: 90
But this IS in a behaviour. In an actor behaviour...

yoplalala

  • Posts: 1502
This works with me. I haven't changed much ( I didn't correct your logic .. you'll see that you have to click on the rectangle for the rectangle to be filled).
I put two update events, and deactivated one. The two work on my computer.
If it doesn't work on your computer, deactivate the first one and activate the second one and see if it works

PS: Oh and don't read my comments in it , in fact it was not the case.

Exportforce

  • *
  • Posts: 90
What is this "ennemy"-actor-attribute ?
Well, you recreated the lists manually but I use the lists as attribute so I can add new enemies without fiddling in the code. else it would be totally useless to use those lists...