Create an actor 1 time each actor

Non-platform specific questions.

Create an actor 1 time each actor

Postby littlekruser » Tue Apr 17, 2007 5:53 am

I would like for an actor (tree) to make an actor one time once it gets to a certain wood lvl. How can I do this so it only makes the actor one time?
littlekruser
 
Posts: 15
Joined: Wed Apr 11, 2007 6:22 am
Score: 0 Give a positive score

Postby Caaz Games » Tue Apr 17, 2007 7:04 am

you could use a wait for frame actoin, or if it's multiple actors use a create actor event.

p.s. are you making a game like the ones at http://www.eyezmaze.com/
You are welcome to join my forum. 4 active members lol but it's a cool place. active... much talking :D it's fun!
http://caaz.freeforums.org/
User avatar
Caaz Games
 
Posts: 729
Joined: Wed Feb 14, 2007 9:09 am
Location: California....knows how to party!
Score: 25 Give a positive score

Postby littlekruser » Tue Apr 17, 2007 10:10 pm

lol, it's not really like those. It's more of a village sim type of game where the people expand their village and evolve their technology from cavemen to modern day tech. Or at least that's what I'd like to do :P lol. But with the trees, I need them to make a baby tree just 1 time for each tree at a random location +/- around their x/y. ne ideas on how to do this? (don't need to know about the random position, just how to make the tree create a new tree one time) also I have the wood going up 1 time each game tick and would like to make the tree when it reaches a certain wood lvl.
littlekruser
 
Posts: 15
Joined: Wed Apr 11, 2007 6:22 am
Score: 0 Give a positive score

Postby Sgt. Sparky » Wed Apr 18, 2007 1:43 am

could you describe that a bit better so I can help you? :|
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby littlekruser » Wed Apr 18, 2007 3:06 am

k, so at the beginning of the game it starts out with about 5 trees. Then every game tick the woodlvl var for the tree goes up 1 until it reaches 60 where it maxes out. It also changes animation for the different wood lvls. the wood lvls are pretty much like the trees age, how big it is and how much wood the people will be able to get from it when they chop it down. But once the trees mature to about 40 woodlvl i want that tree to make a new tree, but only one time. ne ideas? I already have everything i need to make the tree at a random x/y location around the old tree, i just need to know how i can do it so that the tree will only make one new tree within its lifetime.
littlekruser
 
Posts: 15
Joined: Wed Apr 11, 2007 6:22 am
Score: 0 Give a positive score

Postby Sgt. Sparky » Wed Apr 18, 2007 3:15 am

make a actor var called X, one called Y,
and one called time,
if woodlvl is allready an actor var or a variable use this code on the draw actor event of the tree,
Code: Select all
if(woodlvl >= 40 && time == 0)
{
    int step;
    step = 100;
    time = 1;
    X  = - step;
    Y  = - step;
    X += rand(step*2);
    Y += rand(step*2);
    CreateActor("tree", "icon", "(none)", "(none)", X, Y, false);
}

to make the distance greater all you need to do is make step a larger number at the start of the code. :D
I hope that helps. :)
Last edited by Sgt. Sparky on Wed Apr 18, 2007 3:35 pm, edited 1 time in total.
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby Sgt. Sparky » Wed Apr 18, 2007 4:30 am

Here is a tree generator I made,
it does what it sounds like...
generates trees. :)
it just puts some more use of the rand function and generates more trees when the trees are full grown. :D
Attachments
Trees.zip
(22.1 KiB) Downloaded 137 times
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby littlekruser » Wed Apr 18, 2007 5:43 am

hey man, thanks a lot! I really appreciate it.
littlekruser
 
Posts: 15
Joined: Wed Apr 11, 2007 6:22 am
Score: 0 Give a positive score

Postby littlekruser » Wed Apr 18, 2007 6:30 am

alright, new problem lol. how can I make it so that it creates a new actor with a wood lvl of 0? cause with that code, it makes an actor with the same wood lvl as the other trees.
littlekruser
 
Posts: 15
Joined: Wed Apr 11, 2007 6:22 am
Score: 0 Give a positive score

Postby Sgt. Sparky » Wed Apr 18, 2007 3:34 pm

if the woodlvl is an actor variable use this script on the create actor event:
Code: Select all
woodlvl = 0;


:D
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby littlekruser » Fri Apr 20, 2007 9:49 pm

Then it changes all of the tree's wood lvl to 0. Do you know how I can make variables that are each independent of the other actors of the same type?
littlekruser
 
Posts: 15
Joined: Wed Apr 11, 2007 6:22 am
Score: 0 Give a positive score

Postby pixelpoop » Fri Apr 20, 2007 10:19 pm

when you create a variable using the GE menu the default is a Global Integer. You need to change it to an Actor variable Integer.
User avatar
pixelpoop
 
Posts: 276
Joined: Tue Aug 29, 2006 9:32 pm
Score: 28 Give a positive score

Postby Sgt. Sparky » Fri Apr 20, 2007 11:59 pm

I allready told em' to make it an actor variable. :P
(second time you've got here before I did. :()
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby littlekruser » Sat Apr 21, 2007 6:51 am

lol, my bad. thnx though.
littlekruser
 
Posts: 15
Joined: Wed Apr 11, 2007 6:22 am
Score: 0 Give a positive score

Postby Sgt. Sparky » Sat Apr 21, 2007 4:40 pm

you're welcome. :D
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Next

Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron