Author Topic: Everytime, arguments, and arrival cues  (Read 1954 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
Everytime, arguments, and arrival cues
Got back to working on a mission the other night and did a little more work on it last night.  I'm trying to think of a way to lump everything into one event instead of 36+ events.  Every-time-argument (yes this is a case where every-time is needed) seems like it might do the trick but I'm a little worried about it.  Basically I need an arrival cue based on an event with distance <.  It's a bit more complex than that but that is the general idea.  I was thinking of storing the value of <argument> to a variable and setting the arrival cue to when that variable = the ship name (or number corresponding to that ship).  Now here's where it gets hairy.  It's theoretically possible for several of these distance operations to become true at the same time or darn close to it (hence the need for every-time).  Do you think FS2 can handle that happening or should I just stick with the multiple events?  Oh did I mention this is multiplayer.  :D 

Just remembered there is a part 2 the where it gets hairy.  There would also need to be either a nested when-argument or a second similar event with a delay.  Right now I'm using a chained event with a 1 second delay for my testing. 

And it started off as such a simple concept........


« Last Edit: September 04, 2008, 04:40:08 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: Everytime, arguments, and arrival cues
I think you'd better show me the event cause I'm having a little trouble trying to figure out what you're after.
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: Everytime, arguments, and arrival cues
Well I haven't made it yet but it would start off something like this:

every-time-argument
-->any-of
----<list of objects>
--><
----->distance
-------<argument>
-------<any-friendly>
----->4000
-->self-destruct
----><argument>
-->modify-variable
----->arriveship[ship]
-----><argument>
-->invalidate-argument

Now the arrival for each ship would be something like
-->=
---->arriveship[ship]
----><name of corresponding ship that destructed>

Then I would also need something to make the arriving ship vulnerable a second or so after the object is destroyed

Right now for my simplified test I just have this

event 1
when
--> <
---->distance
------>object1
------><any-friendly>
---->4000
-->self-destruct
-->object1

event1a (chained 1 second delay)
when
-->true
-->ship-vulnerable
---->ship1

Arrival cue for ship1
-->is-event-true-delay
----event 1
----0

So I want the ship to arrive as the other is blowing up but not be damaged by the explosion or any weapon that may kill object1. 

There will be at least 18 objects and ships.  The distance won't be the only factor in if the event becomes true.  Difficulty and number of players will also factor in. 







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: Everytime, arguments, and arrival cues
If you use string-equals rather than = it should work.


There is a very small chance however that if two objects self destruct in the same frame you'll never get the ship corresponding to one of them jumping in. The problem is that the first ship will blow, modify the variable but before the game can move on to evaluating arrival cues the second one will blow and rewrite the variable contents.


It's not going to happen often but it is a possibility.
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: Everytime, arguments, and arrival cues
Well I already figured there would be a problem with string comparison.  Glad to see there is a way to do it. 

The possibility of 2 (or even more) happening at the same time was what I was wondering about.  Didn't know how that would effect the outcome.  Basically I was wondering if it could process everything fast enough to not cause a problem. 

I might have a hybrid solution.  I can do each ship arrival/object self destruct event as a separate event and possibly do the arrival stuff using a when-argument.  Cuts the events almost in half. 

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: Everytime, arguments, and arrival cues
One thing though. If you're blowing up Object1 why aren't you just using is-destroyed-delay (object1) as your cue?

Doing that would eliminate the problem.
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: Everytime, arguments, and arrival cues
In order for it to blow up immediately upon issuing the self-destruct I would need to have the kamikaze flag set which I don't want to have on.  Without the kamikaze flag wouldn't there be a delay between the SD command and the is-destroyed-delay becoming true?  Even if there isn't I don't necessarily want the ship to arrive if the object is destroyed.   
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: Everytime, arguments, and arrival cues
IIRC the self-destruct SEXP calls the self_destruct function in ship.cpp which then writes a log entry. As soon as the log entry exists the game considers the ship destroyed even if the model is still present.

That said if you have a reason why you aren't doing the easier route that's good enough for me.
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: Everytime, arguments, and arrival cues
Yea I've been thinking of getting creative with it and doing some random stuff so even though the objects are in the same place ever time the ships aren't.  You know those little extras that keep the player from being able to just follow a pattern and win.  :cool:  That plus not having some of them arrive at all on lower difficulties or say if there are only 4 players in a 12 player coop.  Kind of a pain to try that in the arrival cue of every ship.   Think I'm going to spend the night FREDing and this is on the top of the list. 
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 FUBAR-BDHR

  • Self-Propelled Trouble Magnet
  • 212
  • Master Drunk
    • 165th Beer Drinking Hell Raisers
Re: Everytime, arguments, and arrival cues
Well after placing all the ships an objects in the game it doesn't even look like I'm going to need anything as complicated.  Turns out the ships (sentry guns) can shoot through the objects (small asteroids).  This turned out to be an even better effect than I was working on.  All I really need to do is SD the ship when the corresponding object is destroyed.  The rest can be done with arrival cues based on difficulty event(s). 

So much for all that thinking. 
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