The Daily Click ::. Forums ::. Klik Coding Help ::. Bug with Loop spawning units
 

Post Reply  Post Oekaki 
 

Posted By Message

Rick Cameron



Registered
  11/03/2012 08:45:25
Points
  82
16th September, 2013 at 16/09/2013 15:53:23 -

Hey guys, long time creeper, first time poster.

So I've been creating a tabletop style strategy game and I'm having a weird issue with spawning units and moving them about.

In a nutshell, I run a loop X amount of times based on Alt Value P of active object Squad 1, which then say creates 10 Unit 1's. (1 per loop, and assigns Alt Values as it goes*)

Another event kicks in which then dictates if they are colliding with another Unit, they pick a random position within a radius to move to.

About half the time, and more commonly with higher population units (there are ten types, each with random pop's from 4-15), a 'ghost' unit will appear and won't stop shifting to new positions, UNTIL I move the Squad 1 object it is moving around.

I have some counters set up to retrieve data for me and such, and the D value of these 'ghost' units is usually around 500 or so. This is the Distance value, and is 'always' set as a mathematical equation that represents the distance between any given unit and it's Squad marker. It is in place so that if a Unit is too far from it's Squad, it will move.

What I think is happening is that the D value of these units is somehow not being affected by the Always command to set it's D to the ACTUAL distance. It is however triggering the command that makes it move it is outside the radius allowed.

So I have no idea what is going on, and I hope that made sense.

NOTES:

*The Loop actually doesn't pass on the command to assign values to the Unit alt values upon spawning. Is this because the event references the Active Object Squad 1, and therefore can only affect said object?

Additionally, only the first 5 Squads have the Collision stuff hooked up, and even then they don't detect collisions with other Unit's yet.







http://sdrv.ms/186KOn9

That's a link to my skydrive where I've got the file posted.

Any assistance would be of great help! You guys are genious, each and every one of you, some of the things I've seen you post on the other files are just insane! I've been toying around with this program off and on for YEARS but I still know I have a hell of a lot to learn.

Spread values and whatnot. Other things...

Anyway thanks again!


 
n/a

Rick Cameron



Registered
  11/03/2012 08:45:25
Points
  82
16th September, 2013 at 16/09/2013 16:17:01 -

Ok well I fixed the first problem, but the secondary remains...

I'm running the Loop Spawn AIU1 based on Alt Val P of active object Squad 1.

Spawn A1U1 Creates an Object Unit 1, and assigns it some values. However it seems these values aren't being assigned for some reason that I cannot find!


Cheers again!

 
n/a

hapsi



Registered
  13/11/2003
Points
  775
16th September, 2013 at 16/09/2013 19:15:57 -

"Squad 1" as in one object or multiple objects? Didn't read the fist post.

 
[Signature][/Signature]

vetmora120



Registered
  07/01/2010
Points
  273
17th September, 2013 at 17/09/2013 08:38:12 -

Is this create object action and the assigning of values in the one event line or seperate event lines? If they are in the same event line check that the assign values are below the creat object event using the event list editor.

 
n/a

Jenswa

Possibly Insane

Registered
  26/08/2002
Points
  2723
21st September, 2013 at 21/09/2013 12:58:57 -

It probably has something to do with the order of events, not only in the event editor itself, but even the order of the events (what are these called?) in the current event line. As already mentioned you should probably first create the object and assign values afterwards.

The problem seems to be that the right unit won't receive the right values. It seems that something is wrong with referencing the created object. And I haven't figured out how to get that to work yet.

Good luck coding,
Jenswa


 
Image jenswa.neocities.org

Rick Cameron



Registered
  11/03/2012 08:45:25
Points
  82
29th November, 2013 at 29/11/2013 07:38:16 -

I completely forgot I had posted here. Well bloody done.

Anyway I'm not sure what I did, probably changed some operation orders, but the issue has disappeared.

Thanks all!

 
n/a
   

Post Reply



 



Advertisement

Worth A Click