collection to warehouse max question

the fuel that runs some weapons can be collected to a max amt based on where the warehouse lvl is at. what is the easiest way to do this ? I have tried using interpolate up to a warehouse max ( attribute) and if game.currentamt is less than warehouse amt, run again, but i cant seem to get all the logic to work correctly. It stops at the warehouse max. Please help. thanks in advance
Best Answers
-
lukey5227 Posts: 111
We're going to use actors "Weapon" as well as "Ammo" and "Player".
Have an attribute that knows what level it is.
Make an equation for the ammo max (such as Game.Level * 5 + 7 or something)
Ammo Actor:
{
Now, when Player collides with Ammo and Game.Ammo < (Game.Ammo_Max-(Game.Ammo_Given-1))
Change Attribute "Game.Ammo" to "Game.Ammo+Game.Ammo_Given"
Destroy this actor.
}
**Game.Ammo_Given is the amount of ammo given per collectable. If you get 1, take out the whole "Game.Ammo_Given-1" thing.
Weapon Actor:
{
When Mouse is Clicked
Create Actor "Bullet" at _____ and ______
Change Attribute "Game.Ammo" to "Game.Ammo-1"
}
Overcap:
Ammo Actor checks to see if getting more bullets is okay and actor is touching. Then it gives ammo and disappears.
Weapon Actor takes one ammo away when shooting bullets.
Hope this helped!
-
lukey5227 Posts: 111
Well, you'll need to have new attributes: Second, Minute, Hour, Day
We're going to pretend that none of your stuff will take more than a day (because it would take forever to calculate how many days were in that specific month. If its the 31 of a month, would you want to save?)
Anyway... You're going to need to constrain these attributes:
Constrain Attribute:
Second to Game.Clock.Second
Minute to (Game.Clock.Minute)*60
Hour to (Game.Clock.Hour)*60*60
Day to (Game.Clock.Day)*60*60*24
Basically, you are going to need to save all these attributes every second. Yes, every second, while your ammo is generating. Then, save the amount of ammo you have.
When you load the game, you're going to add up Second, Minute, Hour, and Day to find out how many seconds its been. Just add the up since we already converted them all into seconds. That should tell you how much ammo to give the player. That way, just keep the "every ___ seconds" thing.
Answers
thanks I was able to use able to make ammo function for my actor s gun
Now if fuel ( ammo generation ) based on system timer instead of picking it up. Like a resource build up in the warehouse up to the max amt. How would u go about it differently than above?
Do an "Every ___ Seconds" and set it as... whatever you want. Then, inside of that, put this:
If Game.Ammo < Game.Max_Ammo (to check that you don't have the max ammo possible)
Change Attribute "Game.Ammo" to "Game.Ammo+1" to increase the ammo up 1.
You can have the "every" whatever you want so always during the level, it will gradually build.
-I have created one actor whose job is to save the time attributes.
timer-->every 1 sec ..change sec to device_sec. etc like you mentioned.
-Also I will create another attribute starttime_res1 ( for when the player clicks on upgrade button) it will save the current time by adding all the above mentioned attributes.
-From here I can use it to make the per second change based on the starting time.
just wanted to know if this is the correct way of doing things?
Also if I were to need to calculate for longer than a day, how would I go about that? thanks