Author Topic: variable event timing - is it possible?  (Read 2764 times)

0 Members and 1 Guest are viewing this topic.

Offline FUBAR-BDHR

  • Self-Propelled Trouble Magnet
  • 212
  • Master Drunk
    • 165th Beer Drinking Hell Raisers
variable event timing - is it possible?
Ok here's the situation.  I have a standard hull regeneration routine in a repeating event.  Every so many seconds the hull increases by 1%.  Now here's the fun part I want that time to be variable based on difficulty.  I tired setting a variable based on the difficutly level and dividing 1 by that varialbe but FS2 seems to just ignor fractional values.  Apparently a ships damage can go down by less than 1% but can't got up by 1/5% or 1/4% ect.  Can't seem to put a variable in the interval time so that's apparently out.  I could just do the opposite and add the difficulty variable to the hull but a 5% jump is not only really noticable but a bit extreme.  I'm thinking about chained events but remember pulling my hair out trying to get them to not freak out when used with repeating events.  Only other option I see right now is an event for each difficulty level.  But when you multiply that by the number of ships that's an extra 30 repeating events.  Pretty sure all those extra repeating events would cause problems with people running on older systems.  Anyone have a better idea or know a way around this?
No-one ever listens to Zathras. Quite mad, they say. It is good that Zathras does not mind. He's even grown to like it. Oh yes. -Zathras

 

Offline Turey

  • Installer dude
  • 211
  • The diminutive form of Turambar.
    • FreeSpace Open Installer Homepage
Re: variable event timing - is it possible?
If you can damage by partial percents, but not increase, why not simply add 1% to the hull, then damage by a partial percent?

For example, if you were trying to do this:
Very Easy: Increase by 1%
Easy: Increase by 1/2%
Medium: Increase by 1/3%
Hard: Increase by 1/4%
Insane: Increase by 1/5%

Do this instead:
Very Easy: Increase by 1%
Easy: Increase by 1%, damage by 1/2%
Medium: Increase by 1%, damage by 2/3%
Hard: Increase by 1%, damage by 3/4%
Insane: Increase by 1%, damage by 4/5%
Creator of the FreeSpace Open Installer.
"Calm. The ****. Down." -Taristin
why would an SCP error be considered as news? :wtf: *smacks Cobra*It's a feature.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: variable event timing - is it possible?
Set Difficulty Variable
when-argument
-any-of
--easy
--medium
--hard
--insane
-skill-level-at-least
--<argument>
-modify-variable
--RepairSpeed[1]
-- +
---RepairSpeed[1]
---1

Repair Based On Difficulty
when <----- Repeating event, interval of at least 1 second.
- =
--mod
---mission-time
---RepairSpeed[1]
--0
-repair-subsystem
-You know the rest



The first event is basically just a fancy way of setting the variable to have a range of values from 1 for very easy to 5 for insane. You can set that manually if you're not on FS2. The fancy stuff is in the second event. Basically it looks at the mission time and works out if that is exactly divisible by the repair speed. That basically means that you get the event to trigger every second on very easy and every 5 seconds on insane.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline FUBAR-BDHR

  • Self-Propelled Trouble Magnet
  • 212
  • Master Drunk
    • 165th Beer Drinking Hell Raisers
Re: variable event timing - is it possible?
That would be perfect just one small problem on my end.  I'm making the missions retail compatable.  The repeating chained events seem to work in testing so far.  At least with one ship.  Just worried about FS2 going nuts with 7 of them.  I've seen it before.

My bad Turey just pointed out that I missred your post.  I though repair-speed was a sexp.  I think what I did was along the same lines. 

Here's what I'm testing now:

$Formula: ( when
   ( true )
   ( modify-variable
      @L1[0]
      ( + @L1[0] 1 )
   )
)
+Name: Event name
+Repeat Count: 999999
+Interval: 1
+Team: 0

$Formula: ( when
   ( = @L1[0] @skill[3] )
   ( repair-subsystem
      "GTC Leviathan 1"
      "Hull"
      1
   )
   ( modify-variable @L1[0] 0 )
)
+Name: Event name
+Repeat Count: 999999
+Interval: 1
+Chained: 0
+Team: 0

skill is the skill in reverse oreder and L1 is the ship so I would have L1 through L6 and one other variable.
« Last Edit: February 02, 2007, 06:57:46 pm by FUBAR-BDHR »
No-one ever listens to Zathras. Quite mad, they say. It is good that Zathras does not mind. He's even grown to like it. Oh yes. -Zathras

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: variable event timing - is it possible?
Why do you need more than one event for the second bit? Surely you could just have one single event repair all the ships?
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline FUBAR-BDHR

  • Self-Propelled Trouble Magnet
  • 212
  • Master Drunk
    • 165th Beer Drinking Hell Raisers
Re: variable event timing - is it possible?
No actually I can't.  I have to check each ship to make sure it's damaged.  Retail didn't like adding 1 to a ship alreay at 100.

This just reminded me of another old quarky thing in retail that I'm wondering if it has been fixed.  Nested when statements. Like this


when
-->=
---->regen(1)
---->5
-->when
----->hits-left
--------><shipname>
----->hull  = hull +1 (got tired of counting arrows)

« Last Edit: February 02, 2007, 07:12:54 pm by FUBAR-BDHR »
No-one ever listens to Zathras. Quite mad, they say. It is good that Zathras does not mind. He's even grown to like it. Oh yes. -Zathras

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: variable event timing - is it possible?
In that case my solution is the better one of the two. You'll only need 4 events to set the variable and one for each ship. With yours you'll need 2 for each ship.

Mine also has the advantage that you don't have to use mission-time in every event (or that you can use mission-time+rand) which means you can have the ships repair at different times rather than having  all 6 ships repair at 5,10,15 seconds etc


Nested When events do work in FS2_Open (I've seen them used in Raider Wars for instance) but I tend to avoid them most of the time because they don't work very well with when-argument
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline FUBAR-BDHR

  • Self-Propelled Trouble Magnet
  • 212
  • Master Drunk
    • 165th Beer Drinking Hell Raisers
Re: variable event timing - is it possible?
Yours might be better but I already redid it using mine.   :D   Turned out only 6 of the 7 ships are based on skill level.  7th one regenerates fast no matter what.  Now to find a few victims eh I mean testers.
No-one ever listens to Zathras. Quite mad, they say. It is good that Zathras does not mind. He's even grown to like it. Oh yes. -Zathras

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: variable event timing - is it possible?
*sulks*

I'm still sticking my solution in the cookbook :p
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline Mobius

  • Back where he started
  • 213
  • Porto l'azzurro Dolce Stil Novo nella fantascienza
    • Skype
    • Twitter
    • The Lightblue Ribbon | Cultural Project
Re: variable event timing - is it possible?
Yours might be better but I already redid it using mine.   :D   Turned out only 6 of the 7 ships are based on skill level.  7th one regenerates fast no matter what.  Now to find a few victims eh I mean testers.

:P

*sulks*

I'm still sticking my solution in the cookbook :p

New FRED section of The FAQ? :)



Regenerating ships during a mission is quite...unusual. I did it just two times in early FREDding attempts.
The Lightblue Ribbon

Inferno: Nostos - Alliance
Series Resurrecta: {{FS Wiki Portal}} -  Gehenna's Gate - The Spirit of Ptah - Serendipity (WIP) - <REDACTED> (WIP)
FreeSpace Campaign Restoration Project
A tribute to FreeSpace in my book: Riflessioni dall'Infinito
My interviews: [ 1 ] - [ 2 ] - [ 3 ]

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: variable event timing - is it possible?
New FRED section of The FAQ? :)

I have a few answers I've read or given over the last few months bookmarked for addition to the cookbook.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline Mobius

  • Back where he started
  • 213
  • Porto l'azzurro Dolce Stil Novo nella fantascienza
    • Skype
    • Twitter
    • The Lightblue Ribbon | Cultural Project
Re: variable event timing - is it possible?
Ok here's the situation.

...The GTD Aquitaine... :)


Should you call it FREDbook or something similar?
The Lightblue Ribbon

Inferno: Nostos - Alliance
Series Resurrecta: {{FS Wiki Portal}} -  Gehenna's Gate - The Spirit of Ptah - Serendipity (WIP) - <REDACTED> (WIP)
FreeSpace Campaign Restoration Project
A tribute to FreeSpace in my book: Riflessioni dall'Infinito
My interviews: [ 1 ] - [ 2 ] - [ 3 ]

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: variable event timing - is it possible?
A cookbook is a term for examples of coding solutions for specific problems. Which is exactly what the FRED Cookbook is. It's just a little thin on recipes at the moment :)
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]

 

Offline Mobius

  • Back where he started
  • 213
  • Porto l'azzurro Dolce Stil Novo nella fantascienza
    • Skype
    • Twitter
    • The Lightblue Ribbon | Cultural Project
Re: variable event timing - is it possible?
I'm hungry...
The Lightblue Ribbon

Inferno: Nostos - Alliance
Series Resurrecta: {{FS Wiki Portal}} -  Gehenna's Gate - The Spirit of Ptah - Serendipity (WIP) - <REDACTED> (WIP)
FreeSpace Campaign Restoration Project
A tribute to FreeSpace in my book: Riflessioni dall'Infinito
My interviews: [ 1 ] - [ 2 ] - [ 3 ]

  

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: variable event timing - is it possible?
Here's one you may have missed then :D Should keep you from getting too hungry until I can get BtRL out and take a look at the FAQ.

http://www.hard-light.net/forums/index.php/topic,44483.msg908119.html#msg908119
Karajorma's Freespace FAQ. It's almost like asking me yourself.

[ Diaspora ] - [ Seeds Of Rebellion ] - [ Mind Games ]