The Daily Click ::. Forums ::. Klik Coding Help ::. Event activating despite my best efforts
 

Post Reply  Post Oekaki 
 

Posted By Message

gws923



Registered
  10/02/2009
Points
  1
10th February, 2009 at 16:28:56 -

Hello, everyone, I'm new to the forums but I've been reading articles here for years.

Please forgive my poor problem explanation, I'm using what I think to be standard MMF lingo, but who the hell knows.

I'm working on an RPG battle engine at the moment, and am creating what I'll call my "monster selection" engine, and in that engine, I have two specific events that are just driving me crazy.

The first event is, if Monster 1 is still alive, and the player selects "attack," set the cursor so that it is initially pointing at Monster 1. (and after that if you press down, it highlights monster 2, etc. that stuff works) This event works fine, until I create the next event which screws everything over:

if monster 2 is still alive, but monster 1 isn't, set the cursor to monster two initially. I specifically have in this event the condition that monster 1 must not be "activated" (it's got an alterable value that keeps track of whether it's alive or dead). And I am positive that it's not the value being screwed up. But when I run my app, the cursor always points initially to Monster 2, not Monster 1, meaning that event is running despite its conditions not being fulfilled. I have tried rearranging all my conditions for this event, and nothing works. Even though Monster 1 is activated, this event is running. I am pulling my hair out.

Any tips? I can't destroy the monsters, because i need their values after they're "dead" for determining experience, blah blah, and the party can run into groups of 1-3 monsters, so I have to account for all conditions. (If there is only 1 monster alive, or there are 3 monsters, the engine works fine. It is only when there are only 2 that this doesn't work).

Thanks for the help, if any. If no one's got any ideas, then, hi!

Oh, I'm also using MMF 1.5 if that makes any difference.

Edit: I would screencapture but I'm running windows on a mac and the drivers for my keyboard don't support it.

Edited by gws923

 
n/a

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1970

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
10th February, 2009 at 16:51:34 -

We'd need to see the source file to stand any chance of being able to help, I think.

 
n/a

easyname



Registered
  15/04/2008
Points
  450
10th February, 2009 at 17:21:09 -

When the cursor is over a dead monster, make it automatically switch to the next one?

I dont know :/

 
n/a

MBK



Registered
  07/06/2007
Points
  1578

VIP Member
11th February, 2009 at 07:14:21 -

Hmm ... try Spreading Value 1 over a group and place all enemies in the group. I think groups work in MMF right? .. they are buggy in TGF.

Well, anyway, after you spread a value in the group, set the target based upon the value.
OR
Use the distance from the character to the enemy (x(char) - x(enemy)) or use one of the more complex distance formula if ya want ... whichever is closer gets targeted .. you'll want to set it within a range though to account for how it handles movement, also might want to set a random if the positional value is the same to determine the tie breaker.
OR
Set the cursor to the first monster that appears and have the monsters appear one by one.
OR
Just test for how many enemies there are, then set the number to a counter. Then if one is "dead" meaning its alterable value gets set to inactivated event happens, subtract 1 from the how many enemies there are counter. Then if the counters' value = 1, set cursor to enemy 1 ... if 2 set to enemy 2 ... if 3 set to enemy 3 ... then if you hit up, subtract from the counter, if you hit down add to it.
And if Counter < 1 .. end the battle.
OR
Post the Source up here so we can fully understand what you mean.


 
Click Me! http://www.create-games.com/project.asp?view=main&id=1444

http://www.mediafire.com/download.php?aoo1dnnlq5i

Blood of the Ancient One, Seen only as Shadow, Faster than Lightning, Fierce as the Greatest Dragon, Nearly Invisible, Floating in a Dream, Entered through the Demon Door, Destroyer of Evil in a Realm with a Red Sky Scarred, Who could I be ?

Ruper



Registered
  11/02/2009
Points
  8
11th February, 2009 at 16:25:18 -

I'm actually working on something similar right now.

My engine is set up so that there can be multiple players on the left side, and multiple enemies on the right side.
I made a sort of targetting system that will filter out certain targets based on conditions, in your case you would want to filter out all the dead monsters. My engine is built to have a maximum of 10 enemies at once, so I used a fast loop to quickly check which monsters were alive until it found one that was. I used the spread value to give each monster a different ID value so that you can target one monster at a time.

My coding looked something like this...

Monster's ID=Target Value
and
Monster's HP=0
-Activate Group Dead Skip Loop

(Put the fastloop and all of the following code in a seperate group to prevent the fast loop from slowing your game down.)

Target Value <> 0
-Start Loop "Dead Skip" 30 times

On Loop "Dead Skip"
-Add one to Target Value (This will gradually add to the target value and will have the loop checking all monsters)

On Loop "Dead Skip"
and
Monster's ID=Target Value
and
Monster's HP>0
-Stop Loop "Dead Skip"
-Deactivate Group Dead Skip Loop

This may not be the best method, but it works in my engine. Hope this helps!

 
-Ruper
   

Post Reply



 



Advertisement

Worth A Click