The Daily Click ::. Forums ::. Klik Coding Help ::. So ive got another question about objects...
 

Post Reply  Post Oekaki 
 

Posted By Message

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
4th January, 2011 at 21:06:13 -

So basically ive been working on a gun generator for my most recent game Celestia.
Its relatively simple as to how it works.
- 1 out of 100 chances
- When alterable Value Health of enemy reaches zero
Set internal flag 1 of Dummy On

- If Internal Flag 1 of dummy is on
Set Created Type (alterable value a) Rare to random(+1 (Monkey the rat did this line of coding, along with a few others so im not 100% sure on how it works)
Set internal Flag 1 off

- Only one action when event loops
- Created type Rare of dummy = 1 (- 8, each one represents a different category of guns)
-Alterable value of Enemy = 0
Create Combat rifle Rare = to position of enemy.
Add 0.5 to Created type of Dummy
Destroy enemy


thats how the guns are created. as for the titles and the prefix of the gun its simple too. there are 2 string objects (theres 1 prefix string, and 1 title string for each category of gun), each with a different paragraph for each different possible title. when the gun is created, the paragraph is set to random, than it sets the alterable string A to the current text of the prefix, and then sets alterable string B to the current text of the correct string. (it also sets the alterable value A and B to the current number of the paragraph)

Than to set the company it reads which animation of the gun is playing and then sets the alterable string C to the correct company. than, when the characters detector is overlapping a gun i have it set to read the guns alterable string A B and C, than it sets 2 different strings of text to the current text of the appropriate alterable string. (So string[prefix] is set to alterable string A[prefix], and same thing for the title.) than of coarse depending on the text of alterable value C (or company) set the active object Companies to the correct animation.

to pick up a gun all the character has to do is be overlapping a gun, and press A.
example...
-Flag 1 of gun is on
-A key is pressed
-Animation 1 of Combat Rifle is playing
Change animation of Gun Displayed to combat rifle 1

This works almost 100% of the time, but every once in a while a gun is created. the prefix and the title are set correctly, but the company displayed wont match the animation of the gun, and you cant pick up the gun. Anyone have any idea what im doing wrong?
(btw, i have a counter set to show the number of the animation thats playing when your overlapping a gun, when this glitch occurs, the counter is at 0, which i think that means its set to the objects default Stopped Movement)

if anyone needs source code lemme know.

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

Mark McCauley



Registered
  18/02/2009
Points
  291

Has Donated, Thank You!VIP Member
5th January, 2011 at 10:31:37 -

set value a 1+random( rather than random(+1

1st way makes values 1,2,3,4,5,6,7,8 second way can still generate a 0
because the computer will treat it as random(9) 0,1,2,3,4,5,6,7,8

hope this helps

 
http://www.reddwarf.co.uk/forum/messages.cfm?threadid=44227736-C46F-AC56-02EBA05285818C14

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
5th January, 2011 at 22:51:39 -

oh ok, ill give that a try. thanks!

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

Post Reply



 



Advertisement

Worth A Click