Author Topic: More new stuff (and what you can do with it)  (Read 10111 times)

0 Members and 1 Guest are viewing this topic.

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
More new stuff (and what you can do with it)
Quote
Originally posted by Goober5000
:lol: They're breeding! :lol:


To be honest I think they were. As you can see from the picture there were at least 200 of them present when I took the picture and I think they were probably still spawning at 0,0,0 when I quit.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
More new stuff (and what you can do with it)
I think the problem is actually with your sexp:
Code: [Select]
when
--and
----has-time-elapsed
------3
----=
------2
------ship-create
--------Ship 2
--------GTF Hercules
--------0
--------0
--------0
--do-nothing
Why did you do it that way? :confused:

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
More new stuff (and what you can do with it)
Quote
ship-create
    ship-create
    Creates a new ship
    Returns NAN if ship couldn't be created;
    Returns 1 if the ship already existed;
    Returns 2 if the ship was created
    Takes 5 to 8 arguments...
    1: Name of new ship
    2: Class of new ship
    3: X position
    4: Y position
    5: Z position
    6: Pitch (optional)
    7: Bank (optional)
    8: Heading (optional)


It was the only way I could get it to work. (the time elapsed stuff was just there so I could see the ship get created).

From what I can see, like special-check even though this does have action operator uses you still have to use it in the conditional part of the event. If I'm wrong feel free to tell me so but the fact that it returns a value seems to indicate that I've got it in the right place (Together with the fact that it complained about a mismatch when I accidentally replaced do-nothing with it.)

Also it still doesn't explain why I got 200 of the ships. It's a non-repeating event. I should have only got one as far as I can see.
« Last Edit: October 13, 2005, 10:58:58 am by 340 »
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 

Offline StratComm

  • The POFressor
  • 212
  • Cameron Crazy
    • http://www.geocities.com/cek_83/index.html
More new stuff (and what you can do with it)
HOW did you do it that way?  The grouping's so FUBARed that I can't make heads or tails of how it's evaluating.  The important problem regardless is that Ship-create is being used as part of the test evaluation rather than the action, so it will fire once each time the SEXP is evaluated at least until the event becomes true (if it becomes true, I don't know if ship-create will ever equal 2 for equality purposes).  Thus the growth.  If you want to use the return value, set it to a variable.

EDIT: You should probably put something in the event that will notify you of its completion (a message maybe) instead of do-nothing.  Then you'll see why it's doing that.
« Last Edit: October 13, 2005, 10:58:44 am by 570 »
who needs a signature? ;)
It's not much of an excuse for a website, but my stuff can be found here

"Holding the last thread on a page comes with an inherent danger, especially when you are edit-happy with your posts.  For you can easily continue editing in points without ever noticing that someone else could have refuted them." ~Me, on my posting behavior

Last edited by StratComm on 08-23-2027 at 08:34 PM

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
More new stuff (and what you can do with it)
I think you're right about why it's creating the ships (Cause it's evaluating the SEXP and creating a new ship each time it does so) but the fact is that after it's created the first one it should be unable to create any more hercs because the name is already taken.

That seems to point to the SEXP being broken somehow regardless of how hamfisttedly I used it. Besides I still don't see how I'm supposed to use it if not in the conditional part of the event. It has a return value see. If you look at the docs only SEXPs used in the conditional part have those. The action operators aren't supposed to return anything.

As for a message.I'm predicting I'll only see it once. :) I'll go test it now.
« Last Edit: October 13, 2005, 11:07:46 am by 340 »
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
More new stuff (and what you can do with it)
Bah.  WMC's thinking too much in the C paradigm. :p

The only way that sexp will possibly work, as-is, is if you do
Code: [Select]
when
--[condition]
--set-variable
----[return-value-variable]
----ship-create
------[...]
and then evaluate the variable.

The conditional is evaluated every frame.  Action stuff should not go in the conditional part of the sexp for this reason.  (Come to think of it, that might be an interesting way to repeat events as a substitute for "every-time" that doesn't flush the sexp tree.)

Because of the prohibition on return values, the de facto paradigm for writing sexps is to have the sexp do everything correctly or else fail.  It's the mission designer's responsibility to ensure that the failure condition cannot take place.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
More new stuff (and what you can do with it)
That's pretty much what I thought.

Special-check is the only SEXP that does things this way and it's an obvious hack anyway.

That said I ran the mission again and this time counted. I had ships named GTF Hercules 2 - 245 and no sign of one called Ship 2 as I'd requested in the SEXP in the first place :D

As I said before there's something else wrong with the SEXP.

I'll try it the way you suggest though :)

EDIT: I tested it and the ship was still called GTF Hercules 2. Am I doing something wrong or is it definitly the SEXP? Here's the code

Quote

$Formula: ( when
   ( has-time-elapsed 3 )
   ( send-message
      "#Command"
      "High"
      "Test Message"
   )
   ( modify-variable @JustForShow[0] ( ship-create
   "Ship 2"
   "GTF Hercules"
   0
   0
   0 ) )
)
+Name: Create Ship
+Repeat Count: 1
+Interval: 1
+Team: 0
« Last Edit: October 13, 2005, 11:47:19 am by 340 »
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
More new stuff (and what you can do with it)
Actually it was a problem with the function. When given a ship name, it didn't actually use it. Looks like it was only called from FRED originally. (Fixed in CVS)

I can easily remove the return values if that'll make it evaluate properly. I don't get why it's evaluating every second or though...is that necessary or very hard to fix?
-C

 

Offline FireCrack

  • 210
  • meh...
More new stuff (and what you can do with it)
Can we get a 'mission-set-subspace' ?
actualy, mabye not.
"When ink and pen in hands of men Inscribe your form, bipedal P They draw an altar on which God has slaughtered all stability, no eyes could ever soak in all the places you anoint, and yet to see you all at once we only need the point. Flirting with infinity, your geometric progeny that fit inside you oh so tight with triangles that feel so right."
3.141592653589793238462643383279502884197169399375105820974944 59230781640628620899862803482534211706...
"Your ever-constant homily says flaw is discipline, the patron saint of imperfection frees us from our sin. And if our transcendental lift shall find a final floor, then Man will know the death of God where wonder was before."

 

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
More new stuff (and what you can do with it)
Evaluating consistently is necessary for conditions, and your sexp is being treated as a condition.  It needs to be treated as an action.  This is easy to fix; simply change the sexp value to OPR_NULL and the function type to void.

Though you might want to modify the function so that if the ship with the specified name already exists, it uses the incremental "GTF Hercules 1" method.

 

Offline WMCoolmon

  • Purveyor of space crack
  • 213
More new stuff (and what you can do with it)
Quote
Originally posted by Trivial Psychic
OK.  I finally tried the warpin/warpout speed thing, and it's not doing what I expect it to.

I would expect that setting them to someting like 300 for a fighter, would mean that a fighter would depart at and arrive at a speed of 300, rather than the 50 you'd have by default, and then decelerate from there.  What IS happening is the figure seems to control how long the warp effect is remaining.  The lower the figure, the longer the warp lasts.

Now, either A), I miss-interpreted what this feature is for, or B), the change to the actual warping speed hasn't been done in the code.  The second possibility might explain the effect I described.  If I set it at 300, the warp last for the duration it calculates that a ship at 300 m/s would require to warp out.   A ship at 3 m/s would require that the warp effect last for quite some time for the ship to war out at, so it stays there.


Can you determine if it's only b/c of class, or if it has something to do with length?

Also, is the speed of the ships that it isn't working properly for affected at all by the variable?
-C

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
More new stuff (and what you can do with it)
Quote
Originally posted by WMCoolmon
I don't get why it's evaluating every second or though...is that necessary or very hard to fix?


It wasn't evaulating every second. It was evaulating every frame.

By the time I'd turned around there were 200 of the buggers already. :D

What confuses me is why it stopped at 245. :)
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 

Offline StratComm

  • The POFressor
  • 212
  • Cameron Crazy
    • http://www.geocities.com/cek_83/index.html
More new stuff (and what you can do with it)
Simple, the game presumably reached a limit and couldn't create any new ships.  Thus the existance of a failure code.
who needs a signature? ;)
It's not much of an excuse for a website, but my stuff can be found here

"Holding the last thread on a page comes with an inherent danger, especially when you are edit-happy with your posts.  For you can easily continue editing in points without ever noticing that someone else could have refuted them." ~Me, on my posting behavior

Last edited by StratComm on 08-23-2027 at 08:34 PM

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
More new stuff (and what you can do with it)
I guessed it was a limit but 245 just seemed like an odd number :)
« Last Edit: October 13, 2005, 05:05:53 pm by 340 »
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 

Offline StratComm

  • The POFressor
  • 212
  • Cameron Crazy
    • http://www.geocities.com/cek_83/index.html
More new stuff (and what you can do with it)
It's apparently not always 245.  The screenshot you posted has GTF Hercules 263 targeted ;)

Presumably there's loss of ships from colissions too, if you're generating one per frame at the same point.
who needs a signature? ;)
It's not much of an excuse for a website, but my stuff can be found here

"Holding the last thread on a page comes with an inherent danger, especially when you are edit-happy with your posts.  For you can easily continue editing in points without ever noticing that someone else could have refuted them." ~Me, on my posting behavior

Last edited by StratComm on 08-23-2027 at 08:34 PM

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
More new stuff (and what you can do with it)
Actually I never saw any of the blow up :)

What I saw instead was a shoal of Hercs all swiming in the same direction :D
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 

Offline StratComm

  • The POFressor
  • 212
  • Cameron Crazy
    • http://www.geocities.com/cek_83/index.html
More new stuff (and what you can do with it)
ROFL!  Guess that shows how predictable the AI is.

But what's exploding in the earlier pic?

EDIT: And are those Hercs missing engine glows intentionally?  Or is that a bug?
who needs a signature? ;)
It's not much of an excuse for a website, but my stuff can be found here

"Holding the last thread on a page comes with an inherent danger, especially when you are edit-happy with your posts.  For you can easily continue editing in points without ever noticing that someone else could have refuted them." ~Me, on my posting behavior

Last edited by StratComm on 08-23-2027 at 08:34 PM

 

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
More new stuff (and what you can do with it)
Now do that with one of the larger ship classes. :drevil:

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
More new stuff (and what you can do with it)
Ah. I was running a test to see if ships created with the ship-create SEXP could be affected by other sexps. The idea was to have two ships. One I placed in FRED normally as a control and one created with SEXP and then self destruct the pair 20 seconds into the mission and see which ones blew up :)

I like using explosions as part of the testing procedure. It's so much more satisfying than any other SEXP and the events get logged quite nicely in the events screen so you can just press F4 and see exactly when everything blew up :)

Looks like I took the pic just as the control got destroyed. Which reminds me I need to rerun the experiment with the new CVS build redmenace just posted to see if they can be affected by SEXPs :)

As for the engine glows. Probably just a reappearance of the ongoing thruster bug.
« Last Edit: October 13, 2005, 05:31:00 pm by 340 »
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 

Offline StratComm

  • The POFressor
  • 212
  • Cameron Crazy
    • http://www.geocities.com/cek_83/index.html
More new stuff (and what you can do with it)
I just thought of something potentially important for the create-ship SEXP.  How is the IFF handled?  What's in the table?
who needs a signature? ;)
It's not much of an excuse for a website, but my stuff can be found here

"Holding the last thread on a page comes with an inherent danger, especially when you are edit-happy with your posts.  For you can easily continue editing in points without ever noticing that someone else could have refuted them." ~Me, on my posting behavior

Last edited by StratComm on 08-23-2027 at 08:34 PM