The Daily Click ::. Forums ::. Klik Coding Help ::. Curious question about fast loops
 

Post Reply  Post Oekaki 
 

Posted By Message

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
12th February, 2014 at 12/02/2014 01:37:38 -

So ive got a kinda noob question here. say you have an event that spawns an object, after the object is spawned there is a fast loop that when run it alters an objects value (say, alterable value A for example). the question is, is there a way to make it select ONLY the object just created? because as of right now this question applies to an issue im having with a gun generator. the way it works is a weapon is spawned and it grabs a random text from a group of Prefixes and a group of Titles and a group of Company Textures to make up the Name of the gun and the company that made it. so for example... Combat Rifle (Earth). Combat is the prefix, Rifle is the title, and earth is the manufacturer. after the weapon is created and names are applied, it then runs a fast loop to apply the company to the weapon in one of its alterable strings, then starts another loop that causes the texture to change depending on the title and the company, and then it runs another fast loop that applies the base stats of the weapon (the title RIFLE has set stats, as do all titles) then another fast loop is run that applies the company texture stats (Earth adds to damage, but takes away from clip size) and then yet another loop is run that applies the prefix's stats (prefix's slightly alter the stats of the already stated weapon, such as combat increases damage) and then finally another loop is run that applies the level to it. the level of character only changes the amount of damage done, nothing else, i think it reads something like Set Alterable value(Damage) of GUN to Alterable Value(Damage) xCurrent Level x0.5.
So yeah im sure thats all real confusing... But the reason all the loops are split up like that are so that the effects are done in that EXACT ORDER so that no gun is over powered etc.
The glitch goes as this... if a gun is already spawned and a new gun is spawned, the old gun and its stats still have the stat loops applied to it. so say a gun does 10 damage, and somewhere in the stats mathmatics it says add 2 damage, every single time a new gun is spawned and that gun remains on the ground, it will add 2 to its damage, eventually making it incredibly over powered, especially if you leveled up before a new gun was spawned, because then it takes the stats and multiplies them again and again. anybody got any ideas? sorry for the incredibly long post.

 
[Game design makes my brain feel like its gonna explode.]

s-m-r

Slow-Motion Riot

Registered
  04/06/2006
Points
  1078

Candle
12th February, 2014 at 12/02/2014 02:08:43 -

Use flags to sort out this problem. It's what I would do.

For example...

IF Flag 0 of Active Object "Gun" = Off
THEN [put your stuff about setting different Alterable Values here]
AND THEN Set Flag 0 of Active Object "Gun" = On

That makes sure this whole thing happens only once per object. And it doesn't require a fastloop to make it work.

 
n/a

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
12th February, 2014 at 12/02/2014 02:32:04 -

i had tried this while still using fast loops and it wouldnt work, im guessing thats because its a fast loop. also, if i cram all of those things into one even that does not require a fast loop and order them correctly, it will do the same as making loops that link wont it? ill give this a try and let you know if it works. thanks for the feedback

 
[Game design makes my brain feel like its gonna explode.]

Pan-tosser



Registered
  24/10/2008
Points
  520

Has Donated, Thank You!
12th February, 2014 at 12/02/2014 03:13:42 -

their an extension called preset array. That might come in handy for something like your implementing here

 
https://www.facebook.com/nathon.brown.7

Riptide



Registered
  26/07/2013 21:07:20
Points
  101
12th February, 2014 at 12/02/2014 08:09:32 -

Hi, i dont think you must use fastloops, the flag method is good because it will pretty much do this action in one frame, unless youre spawning multiple weapons, you will not have problems. But if you spawn 2 at the same time theyll be selected and their text would be the same i think.
As pan tosser mentionned you can use a string array and your y axis are the different prefixes, captions whatever and you pick a random value on each desired y axis then you extract the text using its index number.


 
Working on some engines, working for the fun !

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
12th February, 2014 at 12/02/2014 23:27:16 -

@pantosser ive not messed around with arrays very much, so im not exactly sure what im doing. i did have it in mind that ill have to use an array to be able to store all the data for holding multiple guns, but im not to the point of needing to do that yet.

@s-m-r i added the if flag 1 is off thing to all the commands and it fixed it. thanks!

@Riptide fastloops is a must for this current project because there are more than 200,000 possible combinations of guns, the reason for using fast loops is because i can link them together. i dont have to have an event for each possible combination, i can have one event that links to the next, so that title is applied, then prefix and so on. i may be wrong but it seems like linking fast loops is the only glitchless way to do this.

also, im curious... i know ive asked this question before but i forgot the answer because i never implemented it because i never needed to... is there a way to randomly select a Paragraph of text from string text object? because right now i just have it set on a timer to change the text to the next paragraph and when it gets to the last paragraph stall for a sec and then restart. id like to get away from using the time based selection because its not random enough for my taste.

 
[Game design makes my brain feel like its gonna explode.]

Pan-tosser



Registered
  24/10/2008
Points
  520

Has Donated, Thank You!
13th February, 2014 at 13/02/2014 02:39:59 -

for random strings that aren't timer based. i have had some success with using queues. Pop the top item and into the text object when text is equal to lets say "null", because that is pretty standard.

Then objects are always watching the text object and react when commands relevant to them are displayed in the text object. After they read the data they set the text to null which will pop another item out of the queue.

Once the queue is empty i would use a fastloop to fill it back up. Then though the objects are always looking for commands. The delay can be between actions can be different every time if each object randomly picks when to set the string back to "null"

The queue extension object is a simple one to use, and i find this method with it. To often be the easier than sorting index values of paragraphs.

 
https://www.facebook.com/nathon.brown.7

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
14th February, 2014 at 14/02/2014 00:18:13 -

Interesting.. ill have to look in to that some. ive not messed around with too many of the extra extensions, i mostly just work with actives and a few others. though it seems some of these other extensions are pretty great for some things that would normally be complicated or stupid to work with. this is off subject, but is it possible to make your own extension that gives an object an enemy AI? would be cool. a buddy of mine mentioned something similar quite a long time ago but i never saw it in action.

 
[Game design makes my brain feel like its gonna explode.]
   

Post Reply



 



Advertisement

Worth A Click