2 Questions: 1 about switching scene, 1 about delaying movement or waiting

Corerupted

  • Posts: 70
Modified Read Again

My first question is about a bug i get in my RPG game when i change scenes.
When I change the scene I told the actor to kill itself and it does because the scene first checks if actor exists before changing. But the error i have is that the actor that was killed is spawned TWICE and thus one is randomly in one of my props resulting in 2 player actors instead of just one. (attachment might help more than my explaination)

Second problem is with my AI movement. It works and moves but the delay fails meaning my mobs teleport to their end destination instead of a grid based delayed movement. Attached is an example of my coding and the code block basicly say more or less what i want to achieve. I find it strange that stencyl doesnt have a wait x seconds building block.

Hope this explains better

(I want my AI movement behaviour to cause my chosen actor to move randomly and that part is working but the actor in this case the enemy is just moving to the end position instantly instead of pausing X or N miliseconds after each displacement of 32 pixels)

My coding for Random AI Movement works with this concept:

- Calculate max distance (uses distance formula bla bla bla)
- Set times to move to a random number divided by grid block size ( this case 32 pixels)
- Repeat times to move times
   - Wait X or N seconds
   - set x or y position (x for left or right, y for up or down) to current position plus or minus 32
= Random AI movement

Bold, Underlined and Red are Atributes

Ask if u need more info but specify please

« Last Edit: December 30, 2013, 02:02:56 pm by Corerupted »
============================
Corerupted
from WorldxLink
RPG/ Strategy Gamer
============================

snake13

  • Posts: 126
My first question is about a bug i get in my RPG game. (note to self starting with RPG games as first game is very hard but fun and challenging)
When I change the scene I told the actor to kill itself but it doesnt it stays alive then in the next scene 1000 actors are created.(that part fixed) Also sometimes my map change doesnt work at all. but the error i have now is the actor that was killed is spawned in one of my collision props resulting in 2 player actors instead of just one. (attachment helps alot more than my explaination)

Second problem is with my AI movement. It works and moves but the delay fails meaning my mobs teleport to their end destination instead of a grid based delayed movement. Attached is an example of my coding and the code block basicly say more or less what i want to achieve. I find it strange that stencyl doesnt have a wait x seconds building block.

My coding works with this concept
- Calculate max distance
- Set times to move to a random number diveded by grid block size (32)
- Repeat times to move times
- Need a wait X seconds
- set x or y position (x for left or right, y for up or down) to current position plus or minus 32
= Random AI movement

Ask if u need more info but specify please
I don't get what your saying. Sorry.
Ludum Dare Game: Connected Worlds
URL:http://www.stencyl.com/game/play/27958

Corerupted

  • Posts: 70
My first question is about a bug i get in my RPG game. (note to self starting with RPG games as first game is very hard but fun and challenging)
When I change the scene I told the actor to kill itself but it doesnt it stays alive then in the next scene 1000 actors are created.(that part fixed) Also sometimes my map change doesnt work at all. but the error i have now is the actor that was killed is spawned in one of my collision props resulting in 2 player actors instead of just one. (attachment helps alot more than my explaination)

Second problem is with my AI movement. It works and moves but the delay fails meaning my mobs teleport to their end destination instead of a grid based delayed movement. Attached is an example of my coding and the code block basicly say more or less what i want to achieve. I find it strange that stencyl doesnt have a wait x seconds building block.

My coding works with this concept
- Calculate max distance
- Set times to move to a random number diveded by grid block size (32)
- Repeat times to move times
- Need a wait X seconds
- set x or y position (x for left or right, y for up or down) to current position plus or minus 32
= Random AI movement

Ask if u need more info but specify please
I don't get what your saying. Sorry.

Is it better now? I edited it.
============================
Corerupted
from WorldxLink
RPG/ Strategy Gamer
============================

snake13

  • Posts: 126
My first question is about a bug i get in my RPG game. (note to self starting with RPG games as first game is very hard but fun and challenging)
When I change the scene I told the actor to kill itself but it doesnt it stays alive then in the next scene 1000 actors are created.(that part fixed) Also sometimes my map change doesnt work at all. but the error i have now is the actor that was killed is spawned in one of my collision props resulting in 2 player actors instead of just one. (attachment helps alot more than my explaination)

Second problem is with my AI movement. It works and moves but the delay fails meaning my mobs teleport to their end destination instead of a grid based delayed movement. Attached is an example of my coding and the code block basicly say more or less what i want to achieve. I find it strange that stencyl doesnt have a wait x seconds building block.

My coding works with this concept
- Calculate max distance
- Set times to move to a random number diveded by grid block size (32)
- Repeat times to move times
- Need a wait X seconds
- set x or y position (x for left or right, y for up or down) to current position plus or minus 32
= Random AI movement

Ask if u need more info but specify please
I don't get what your saying. Sorry.

Is it better now? I edited it.
So your having a spawning issue and AI? I don't know how to make an advanced AI but I probaly can help you with spawning issue. Focus on your behavour  with the killing actor. ( If not a behavour
Focus on the panel where it shows when created ect...) See if you put any " create actor" blocks.
Umm... Sorry. That's all I can say. I don't know myself how to fix it. So again Sorry.
Ludum Dare Game: Connected Worlds
URL:http://www.stencyl.com/game/play/27958

Corerupted

  • Posts: 70
The AI isnt mainly my problem I got that to work my problem is I want to make the actor pause  a few times when moving in one direction to simulate grid based movement
============================
Corerupted
from WorldxLink
RPG/ Strategy Gamer
============================

snake13

  • Posts: 126
The AI isnt mainly my problem I got that to work my problem is I want to make the actor pause  a few times when moving in one direction to simulate grid based movement
I guess you can say [ When created, do every 0.001, set x(or y) speed to ( some number) push
self x( 0 or some number,) y( 0 or some number) at force( some number) do after ( some seconds)
set x(or y) speed to 0.] I think this I how you do it. Sorry if it doesn't work.
Ludum Dare Game: Connected Worlds
URL:http://www.stencyl.com/game/play/27958

thegenericbanana

  • *
  • Posts: 494
The AI isnt mainly my problem I got that to work my problem is I want to make the actor pause  a few times when moving in one direction to simulate grid based movement
I guess you can say [ When created, do every 0.001, set x(or y) speed to ( some number) push
self x( 0 or some number,) y( 0 or some number) at force( some number) do after ( some seconds)
set x(or y) speed to 0.] I think this I how you do it. Sorry if it doesn't work.
That wouldn't work at all, changing the x-speed every 0.001 seconds is not at all what he wants. What he can do is something among the lines of do every like 4 seconds, if (random number attribute between 1 and 2) = 2, set (waiting? (boolean local attribute)) to true, and do after like 1 second set it to false. Then, only allow the movement happen if waiting = false. That's a simpler way of doing it, there are ways to do it that are better (like making it so that it maybe waits after a random amount of time, with a timer attribute or something), but for the sake of simplicity and considering I'm leaving on a trip in around 10 minutes I'll leave it at that. snake13, you may have been posting too much useless/wrong info on the forums' help threads- try to make sure the logic makes sense before posting. You don't have to help everybody, only help when you know how to help- saying "I don't know what you mean. Sorry." is useless without saying what you don't understand so he changes it.

Edit: Seems like snake13's comment made me think it was another question. What you can do is, check if he has to go one way instead of using a repeat block (do afters inside repeats are bad), and have a boolean. Then, you can see if the player is moving and see if the boolean is false. Then, in the waiting code, set the boolean to true, set x-speed & y-speed to 0, and do after like 3 seconds set x-speed or y-speed depending on where you want him to go, with the -/+32 code. Sorry if this seems weird, I wasn't sure how to put it quickly and I wanted to help right as I just posted something wrong. :/

« Last Edit: December 31, 2013, 04:43:53 am by thegenericbanana »
Johnny Turbo's Surgery Frenzy

Corerupted

  • Posts: 70
to be honest i dont understand large masses of information unless its in coding (this case block- im too lazy to learn action script) or just simplified like i did it.
Quote
My coding works with this concept
- Calculate max distance
- Set times to move to a random number diveded by grid block size (32)
- Repeat times to move times
- Need a wait X seconds
- set x or y position (x for left or right, y for up or down) to current position plus or minus 32
= Random AI movement

To explain what I want in the easiest manner posible is when you look at the first picture attached you will see halfway down in the blocks is a Repeat loop a code block and a do after. The code block contains illegal coding but is something that would work in delphi. I want in that repeat either after or before the movement the actor to wait X seconds or in this case Delay between movement in one direction seconds.
Now that you know the background the do after block doesnt do what I want it to do because I wanted it to execute the WAIT so u can look at the block of coding without the do after and then give me some advice to cause a pause.

Edit:
Now that I think about it if i add a normal 4 directional movement behaviour to the enemy's behaviour and and repeat X times move in that direction, will it work?
============================
Corerupted
from WorldxLink
RPG/ Strategy Gamer
============================

snake13

  • Posts: 126
The AI isnt mainly my problem I got that to work my problem is I want to make the actor pause  a few times when moving in one direction to simulate grid based movement
I guess you can say [ When created, do every 0.001, set x(or y) speed to ( some number) push
self x( 0 or some number,) y( 0 or some number) at force( some number) do after ( some seconds)
set x(or y) speed to 0.] I think this I how you do it. Sorry if it doesn't
That wouldn't work at all, changing the x-speed every 0.001 seconds is not at all what he wants. What he can do is something among the lines of do every like 4 seconds, if (random number attribute between 1 and 2) = 2, set (waiting? (boolean local attribute)) to true, and do after like 1 second set it to false. Then, only allow the movement happen if waiting = false. That's a simpler way of doing it, there are ways to do it that are better (like making it so that it maybe waits after a random amount of time, with a timer attribute or something), but for the sake of simplicity and considering I'm leaving on a trip in around 10 minutes I'll leave it at that. snake13, you may have been posting too much useless/wrong info on the forums' help threads- try to make sure the logic makes sense before posting. You don't have to help everybody, only help when you know how to help- saying "I don't know what you mean. Sorry." is useless without saying what you don't understand so he changes it.

Edit: Seems like snake13's comment made me think it was another question. What you can do is, check if he has to go one way instead of using a repeat block (do afters inside repeats are bad), and have a boolean. Then, you can see if the player is moving and see if the boolean is false. Then, in the waiting code, set the boolean to true, set x-speed & y-speed to 0, and do after like 3 seconds set x-speed or y-speed depending on where you want him to go, with the -/+32 code. Sorry if this seems weird, I wasn't sure how to put it quickly and I wanted to help right as I just posted something wrong. :/
I said "guess' because I was guessing, I wasn't sure.
Ludum Dare Game: Connected Worlds
URL:http://www.stencyl.com/game/play/27958

snake13

  • Posts: 126
to be honest i dont understand large masses of information unless its in coding (this case block- im too lazy to learn action script) or just simplified like i did it.
Quote
My coding works with this concept
- Calculate max distance
- Set times to move to a random number diveded by grid block size (32)
- Repeat times to move times
- Need a wait X seconds
- set x or y position (x for left or right, y for up or down) to current position plus or minus 32
= Random AI movement

To explain what I want in the easiest manner posible is when you look at the first picture attached you will see halfway down in the blocks is a Repeat loop a code block and a do after. The code block contains illegal coding but is something that would work in delphi. I want in that repeat either after or before the movement the actor to wait X seconds or in this case Delay between movement in one direction seconds.
Now that you know the background the do after block doesnt do what I want it to do because I wanted it to execute the WAIT so u can look at the block of coding without the do after and then give me some advice to cause a pause.

Edit:
Now that I think about it if i add a normal 4 directional movement behaviour to the enemy's behaviour and and repeat X times move in that direction, will it work?
To be serious, I don't know large masses unless it's blockpicking. We're just the oppisites!:) But Sorry
I don't think I can help you:(
Ludum Dare Game: Connected Worlds
URL:http://www.stencyl.com/game/play/27958

Corerupted

  • Posts: 70
Ok i know i am a very hard person to work with but what i am saying isnt that hard "sortoff".

  • I want an NPC (Non-Playable Character), in my case the "Enemy" or "Mob" to Move.
  • The movement I have more or less worked out and it Works glitchly
  • The Enemy moves
  • But only once in each Random direction
  • I want it to move a random amount of times in each random direction
  • But between each random amount of times there must be a pause of X seconds
  • That pause of X seconds is one of the components that doesnt work that well
  • The second component is the move a random amout of times
  • The third one is the delay does not work
  • Now I need help with those components either as something that I can copy or paste into a code block
  • Or an example of a working code block structure that I can use

Attached is not one of my best pictures but should be effective in explaining all u need to know
1 = My random movement
2 = The movement for each direction (Only showing Move Left but all movements follow this structure)

Please someone help.
[/list]
============================
Corerupted
from WorldxLink
RPG/ Strategy Gamer
============================

Corerupted

  • Posts: 70
And for some reason random isnt random
============================
Corerupted
from WorldxLink
RPG/ Strategy Gamer
============================