Author Topic: SEXP for affecting each new kill  (Read 1879 times)

0 Members and 1 Guest are viewing this topic.

SEXP for affecting each new kill

Hey all,

So I'm trying to create a mission where an event occurs each time you make a kill.  Is there any SEXP or a SEXP method for evaluating the player's number of kills, and then acting each time that number increases by one?

Thanks

killface

 
Re: SEXP for affecting each new kill

I guess another way to ask this question is, is there any to link a variable to the number of player kills?  Or perhaps is there any such variable already in existence?

 

Offline FUBAR-BDHR

  • Self-Propelled Trouble Magnet
  • 212
  • Master Drunk
    • 165th Beer Drinking Hell Raisers
Re: SEXP for affecting each new kill
Yes there is a sexp for this in 3.6.10.  num-kills.  It's in status.  Just make a repeating event that stores the value to a variable and fires again when it increases.
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

 
Re: SEXP for affecting each new kill

Sounds good, but what is "triggering" the repeated event?  Each new kill?  What sexp do I use to make that happen?  I guess I'm looking for an example.

 
Re: SEXP for affecting each new kill

Nevermind, think I got it...

[attachment deleted by evil Tolwyn]

 

Offline FUBAR-BDHR

  • Self-Propelled Trouble Magnet
  • 212
  • Master Drunk
    • 165th Beer Drinking Hell Raisers
Re: SEXP for affecting each new kill
Looks like you do but every-time might be a bit much.  Go with when and the repeat 9999999 and a delay of 1.  Should be more then enough. 
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

 
Re: SEXP for affecting each new kill

I've always had a problem distinguishing between when to use every-time and when to use when + the 99999 repeat.  What is the exact difference?

 

Offline FUBAR-BDHR

  • Self-Propelled Trouble Magnet
  • 212
  • Master Drunk
    • 165th Beer Drinking Hell Raisers
Re: SEXP for affecting each new kill
Every-time only needs to be used in special circumstances.  A repeating when is usually the way to go even if you have to do a 0 for the delay.  It's less to process for one thing and unlike a repeating when it will never be true or false.  I'm sure Kara will chime in with more detailed reasons. 
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: SEXP for affecting each new kill
The difference between every-time and when relates to SEXPs that evaluate internally to SEXP_ALWAYS_TRUE, SEXP_ALWAYS_FALSE or SEXP_NAN_FOREVER (NAN = Not A Number).

Suppose I have a mission like this.

Event 1
when (high repeat count, delay 0)
- <
--Distance
---Alpha 1
---Cancer 1
-do something

Event 2
when
-something
-self-destruct
--Cancer 1

Event 3
when
-something else
-ship-create
--Cancer 1


Using the when SEXP event 1 will trigger until event 2 becomes true. At this point the Distance SEXP will be marked NAN_FOREVER (Cancer 1 is dead so FS2 thinks that there is no point in ever checking that SEXP again) Problem is when you respawn Cancer 1 using the ship-create SEXP you may want the distance check to work again. But it never will because the game has marked the SEXP as impossible.

Every-time doesn't mark the distance SEXP in this way. Next time the SEXP is called Distance will be evaluated again.
« Last Edit: April 06, 2009, 04:13:42 am by karajorma »
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

  

Offline Goober5000

  • HLP Loremaster
  • 214
    • Goober5000 Productions
Re: SEXP for affecting each new kill
It's worth noting that spawning a new ship with the same name as an old one carries its own set of problems... ;)