| 07-03-2009, 10:48 PM | #1 |
A simple tree revival system. After searching I hadn't found one (no, the outdated tutorial doesn't count), so i decided to make my own. Requirements: TimerUtils, by Vexorian. IsDestructableTree by PitzerMike Code: library:library TreeRevival initializer Init requires TimerUtils, DestructableLib globals //**Configuration*********************** private constant boolean BIRTH_ANIMATION = true private constant real REVIVAL_TIME = 30. endglobals private function Conditions takes nothing returns boolean return true endfunction //************************************** globals public trigger Trigger = CreateTrigger() endglobals private struct Data destructable d endstruct private function Enum takes nothing returns nothing call TriggerRegisterDeathEvent(Trigger, GetEnumDestructable()) endfunction private function TreeFilter takes nothing returns boolean return IsDestructableTree(GetFilterDestructable()) endfunction private function ReviveTree takes nothing returns nothing local timer t = GetExpiredTimer() local Data d = GetTimerData(t) call DestructableRestoreLife(d.d, GetDestructableMaxLife(d.d), BIRTH_ANIMATION) call ReleaseTimer(t) call d.destroy() set t = null endfunction private function Actions takes nothing returns nothing local timer t = NewTimer() local Data d = Data.create() set d.d = GetDyingDestructable() call TimerStart(t, REVIVAL_TIME, false, function ReviveTree) call SetTimerData(t, d) set t = null endfunction private function Init takes nothing returns nothing call EnumDestructablesInRect(bj_mapInitialPlayableArea, Filter(function TreeFilter), function Enum) call TriggerAddAction(Trigger, function Actions) call TriggerAddCondition(Trigger, Condition(function Conditions)) endfunction endlibrary |
| 07-03-2009, 11:01 PM | #2 |
IsDestructableTree
Is this a new native in 1.24? It doesn't show in my old common.j |
| 07-03-2009, 11:06 PM | #3 |
It's included in one of the required libraries. |
| 07-03-2009, 11:30 PM | #4 |
Oh, duh, I'm brilliant. |
| 07-07-2009, 05:28 PM | #5 |
|
| 07-07-2009, 05:48 PM | #6 |
what if we dont want trees to revive if units/heroes are near by, thus traping them in...? |
| 07-07-2009, 05:57 PM | #7 |
Guess you could make the conditionfunc of the trigger a configuration condition for users to play with. Then just move the current conditionfunc to being an actionfunc. |
| 07-07-2009, 06:54 PM | #8 |
Changes made. |
| 07-07-2009, 07:07 PM | #9 |
This can't be considered a system due it doesn't use abilities or other things different of trigger editor, it's more a script. But as a script, it's nice. |
| 07-07-2009, 07:12 PM | #10 |
The difference between a script and a system is ethereal, really, but some key differences do exist. A script is something lower-end than a system, since it may be required by other libraries also in the database. Damage Detection Systems these days do not carry OE dependencies anymore either, yet because they are so high-level, they are systems. This is an end-product of scripts, nothing will ever require it. This makes it a system. Anyways, approved. |
| 07-07-2009, 08:24 PM | #11 |
I don't like the idea how trees somehow instantly grow. It should be a progressing growth little by little over time. |
| 07-07-2009, 08:45 PM | #12 |
i thought they did... |
| 07-07-2009, 09:08 PM | #13 | |
Quote:
|
| 07-09-2009, 07:09 PM | #14 |
You have to be kidding me. I have a mini-system that does exactly this sort of things in my map and it isn't half complex ... according to Cohadar systems should be hard things to make. I agree with him, IMO this should be a script ... Anyway seems a good modular work, well done... |
| 07-09-2009, 09:46 PM | #15 | |
Quote:
|
