Hard Light Productions Forums
Modding, Mission Design, and Coding => The FRED Workshop => Topic started by: darkmaster on January 21, 2009, 12:03:30 pm
-
Hello,
Currently I am making a campaign for TBP and I ran into some logical problems. So if anyone can help me it will be very great.
First problem :
In my campaign I want to include the "health regeneration" feature but unable to do it.
So far I created a variable named "regen" (initial value = 1)
and an event :
Event 1 :
everytime
"regen" = 1
do
"repaire hull 1%"
"regen" = 0
So I want another "event 2" that must be activated 10s after "regen" has been turned to 0, which will assign "regen" the value 1.
(I have no idea how to make it).
Thanks in advance.
-
First, don't use every-time. That's a highly specialized sexp that's only needed for a very small number of things.
You probably don't need variables either. Why not make a sexp with a very high repeat count (like 9999), and a repeat delay of 10, that repairs the hull by 1% each time?
-
every-time ... every-time...
I'm not too confident I can help for I avoid using "every-time" - but now to your problem:
I suppose you are using "is-event-true-delay" to tigger "Event 2" - that does not work with every-time events (or has that changed?)
maybe you could change it to a simpler system:
Regen-Event
-every-time
+"ture"
-set-subsystem-strengh
+ "Alpha 1"
+ "+"
"hit-left"
"Alpha 1"
"1"
Repeat Count: 9999
Intervall Time: 1500 (that's ms, isn't it?)
EDIT:
That is nearly the same as what Goober suggested
-
Thanks both of you for the idea. It is simple and practical.
-
Another solution to your problem is the mod and mission-time SEXPs. Mission time is obviously the current time in the mission. Mod divides one number by the other and works out what the remainder is. This makes it easy to use for mission timing.
when (repeat count, 1 seconf
- =
--mod
---Mission-time
---10
--0
-do-something
Creates an event that triggers at t = 0 and every 10 seconds after that. It is possible to use a variation of this event to do everything you want it to do. However if this isn't enough, my suggestion would be to have a second variable. In the first event add this
modify-variable
-SecondVar
-Mission-Time
Your second event then does this
when (high repeat count, 1 second repeat delay
-and
-- =
--- 0
--- mod
---- -
-----MissionTime
-----SecondVar
----10
-- >
---SecondVar
---Missiontime
-Set your variable to 1 here
The first bit checks that Mission time - the variable is divisible by 10. The second one checks that the two aren't the same value since otherwise it would trigger immediately after the first event does.
EDIT : Just seen the other two posts. You've now got three possible levels of sophistication for your system. :)
-
Problem 2 : Quick question : Which SEXP to detect the current difficulty level ?
-
You can't actually detect the level directly. But you can detect if it is at least something using the skill-level-at-least. Which is more useful most of the time. You can get the actual level by a is at least x but is not at least x + 1
This picture shows how to add or subtract to something depending on the skill level.
(http://homepage.ntlworld.com/karajorma/FAQ/FAQ-Images/FRED-Tutorial/DradisSetup.jpg)
-
Thank you very much Kara. I will edit this post for Problem 3 ( if there is one)