Author Topic: Kill ship = fill up bank account  (Read 3931 times)

0 Members and 1 Guest are viewing this topic.

Kill ship = fill up bank account
Hey I ran into a problem.

I wanted to make a mission where when Player kills a ship the Variable BankAccount gets filled up + 100. I don't want to make 50 events for every enemy ship that's maybe killable by the player, so I want it to be in one event.

What I did:
    when
        any of
          Enemy 1
          Enemy 2...

        was destroyed by
          0
          Alpha 1
         <Argmument>
        modify-variable
         BankAccount
         +
         BankAccount
         100

I test the mission and after killing several ships the counter is at 100 (because it became true only once, that's logical for me)... But I don't seem to find out which conditional (or is it about repeat count/trigger count?) I need to use to "reset" the event to look if I kill another of the ships under argument. So the goal is: 12 enemies, kill all 12 of them, BankAccount = 1200...
Yeah I could make 12 different events to check, but I'm lazy :P And I think there's a smarter solution, but what am I missing here?

In short: How do I reset the event to check again if there is one of the arguments killed by the player and NOT become true directly because the one ship was already destroyed by the player?

Thanks, guys!

 

Offline 0rph3u5

  • 211
  • Oceans rise. Empires fall.
Re: Kill ship = fill up bank account
Hey,

You are on the right track. You have to set a repeat count (or trigger count? - I keep forgeting which is which) on the event, otherwise it will only run once.

For the second problem you add a "invalidate-argument" to the event so it discards an argument that already checked as detroyed.
"As you sought to steal a kingdom for yourself, so must you do again, a thousand times over. For a theft, a true theft, must be practiced to be earned." - The terms of Nyrissa's curse, Pathfinder: Kingmaker

==================

"I am Curiosity, and I've always wondered what would become of you, here at the end of the world." - The Guide/The Curious Other, Othercide

"When you work with water, you have to know and respect it. When you labour to subdue it, you have to understand that one day it may rise up and turn all your labours into nothing. For what is water, which seeks to make all things level, which has no taste or colour of its own, but a liquid form of Nothing?" - Graham Swift, Waterland

"...because they are not Dragons."

 
Re: Kill ship = fill up bank account
It's working with the trigger count set equal to the max. number of ships to be destroyed perfectly!

And

Quote
For the second problem you add a "invalidate-argument" to the event so it discards an argument that already checked as detroyed.

That was what I was looking for! Now the "used" argument gets deleted so it doesn't trigger permanently :)

Thanks!

Now you can save money to your Bank Account and go shopping with it during the next missions ;)
« Last Edit: June 05, 2017, 03:16:25 pm by bomb3rman »

 

Offline Axem

  • 211
Re: Kill ship = fill up bank account
I've got an idea for possible alternative that might be more "portable".

Instead of making a huge argument list, there's a sexp that tracks the player's kills. So you'd have a variable that tracks playerKills and compare it to the actual kills returned by the sexp. If they are different, then increase the bank account by the difference (and update that playerKills variable to equal the real kills). That way you could just copy and paste the single event without needing to populate the argument list.

But if you got what works and you like it, then that's cool. :)

 
Re: Kill ship = fill up bank account
This might work as well, though I don't understand completely what you're saying :)

I'm probably going to increase the BankAccount differently if you kill bombers, transports or fighters. So the simple Playerkills = something alone wouldn't help.

The other version would work for me in that case, I just need to make maybe 3 or 4 events and put every ship in the right sexp to give the right amount of money...

 

Offline 0rph3u5

  • 211
  • Oceans rise. Empires fall.
Re: Kill ship = fill up bank account
Isn't there a "percent-ship-type-destroyed" SEXP that could shorten this? - You would have to limit the number of ships to one that gives workable percentages (1,2,4,5,10,20,25,50,100) and set "ignore for counting goal" to all other ships

I know there is one for "percent-ships-destroyed" of a defined group which I used to use for arrival cues in hositle wing as it als counted waves of wings in total percentage...

EDIT: It's called "ship-type-destroyed"....

EDIT2: however the help text says it doesn't distinguish between fighters and bombers and then the eligible types include "Fighter", "Bomber" and "Fighter/Bomber". Since this is an SEXP from the age when we FREDed onto clay tablets, I guess it was modified to make that distinction?
(I mean there is a grammar error left in the help text; it says "types" but the SEXP doesn't take additional arguments besides a percentage and a single ship type)
« Last Edit: June 05, 2017, 04:01:29 pm by 0rph3u5 »
"As you sought to steal a kingdom for yourself, so must you do again, a thousand times over. For a theft, a true theft, must be practiced to be earned." - The terms of Nyrissa's curse, Pathfinder: Kingmaker

==================

"I am Curiosity, and I've always wondered what would become of you, here at the end of the world." - The Guide/The Curious Other, Othercide

"When you work with water, you have to know and respect it. When you labour to subdue it, you have to understand that one day it may rise up and turn all your labours into nothing. For what is water, which seeks to make all things level, which has no taste or colour of its own, but a liquid form of Nothing?" - Graham Swift, Waterland

"...because they are not Dragons."

 

Offline Axem

  • 211
Re: Kill ship = fill up bank account
This might work as well, though I don't understand completely what you're saying :)

I'm probably going to increase the BankAccount differently if you kill bombers, transports or fighters. So the simple Playerkills = something alone wouldn't help.

The other version would work for me in that case, I just need to make maybe 3 or 4 events and put every ship in the right sexp to give the right amount of money...

Okay, I figured it was something like that then. Then that is probably your best bet then (outside of lua scripting).

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Kill ship = fill up bank account
Now you can save money to your Bank Account and go shopping with it during the next missions ;)

Just out of interest, how do you plan to handle that?
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 
Re: Kill ship = fill up bank account
I know there is one for "percent-ships-destroyed" of a defined group which I used to use for arrival cues in hositle wing as it als counted waves of wings in total percentage...

EDIT: It's called "ship-type-destroyed"....

I remember having problems with percent-ships destroyed/departed etc... Some time ago I asked something here and karajorma told me to use this sexp, but it didn't work for me. (the sexp itself didn't work) so I think I won't go further this way, especially when the other version is working (I tested it in a small 3 mission campaign, it does).

Quote from: Axem
Okay, I figured it was something like that then. Then that is probably your best bet then (outside of lua scripting).

Since I have no clue about scripting, I stay with this way :P Though I remember a mission in BP where you had to call reinforcements and had some limited points available. Maybe it's possible (for someone else, not me :P) to connect the BankAccount to the script that has been used there to make a more "smooth" way to buy the ships. Otherwise:

Quote from: karajorma
Just out of interest, how do you plan to handle that?

Well I have to rethink a few things but what is working right now:

M 1 you kill ships and collect money (campaign-persistent-variable)

M 2 (some kind of small mission in-between) you fly around a "mercenary market". Using GTNB Pharos buoys and distance-checks, you get messages about certain ships waiting around the market. Once you have enough money and the distance to the ship/buoy becomes smaller than X, the ship jumps out, triggering an event like "Ship XY bought". Congratulations, you bought the mercenery ship for the next mission to aid you and your BankAccount goes down a certain amount of money.

M 3: Several ships appear (right from the start is working, other conditions have to be tested, but should as well) for example when the event "Ship XY bought" became true in M 2.

It's still just a mindgame, but it could lead to some interesting tactical choices you could make before a mission. A script would make that easier (like in BP and mentioned above), but I think my version would work in a more "physical" way by flying around, reading the messages and deciding what to buy for the next mission (or maybe the whole campaign, you could do this with "allow ship/allow weapon" sexps as well). so you can decide how to increase the flyable ships (need a bomber? Go for it, buy one!)

I'm thinking about a part of a campaign where you have a contract with a group of scavengers. They pay you for every ship you shoot (because they'll jump in later and scavenge the debris) or maybe even the police, when you go bounty hunting.
« Last Edit: June 06, 2017, 12:42:37 am by bomb3rman »

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Kill ship = fill up bank account
Oh I see, you're letting the player buy wingmen for the mission rather than upgrading his own ship. As cool as that is, I thought for a bit you were using my team loadout stuff to allow the player to alter his own ship or weapons.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 
Re: Kill ship = fill up bank account
I didn't know there was this stuff  :lol:

But it sounds interesting, where can I find it? Maybe I have a closer look, too.

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Kill ship = fill up bank account
The wiki section on the feature is a little old. But it should give you an idea how things work.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 
Re: Kill ship = fill up bank account
Thanks  :yes: :yes:

 

Offline HLD_Prophecy

  • PVD_Hope in a former life
  • 29
Re: Kill ship = fill up bank account

Quote from: karajorma
Just out of interest, how do you plan to handle that?

Well I have to rethink a few things but what is working right now:

M 1 you kill ships and collect money (campaign-persistent-variable)

M 2 (some kind of small mission in-between) you fly around a "mercenary market". Using GTNB Pharos buoys and distance-checks, you get messages about certain ships waiting around the market. Once you have enough money and the distance to the ship/buoy becomes smaller than X, the ship jumps out, triggering an event like "Ship XY bought". Congratulations, you bought the mercenery ship for the next mission to aid you and your BankAccount goes down a certain amount of money.

M 3: Several ships appear (right from the start is working, other conditions have to be tested, but should as well) for example when the event "Ship XY bought" became true in M 2.

It's still just a mindgame, but it could lead to some interesting tactical choices you could make before a mission. A script would make that easier (like in BP and mentioned above), but I think my version would work in a more "physical" way by flying around, reading the messages and deciding what to buy for the next mission (or maybe the whole campaign, you could do this with "allow ship/allow weapon" sexps as well). so you can decide how to increase the flyable ships (need a bomber? Go for it, buy one!)

I'm thinking about a part of a campaign where you have a contract with a group of scavengers. They pay you for every ship you shoot (because they'll jump in later and scavenge the debris) or maybe even the police, when you go bounty hunting.

Hey, just happened to notice this. It sounds pretty darn awesome - nice job!

 
Re: Kill ship = fill up bank account
Thank you  :D Let's see if I can integrate this in a meainingful way in a campaign :)

 

Offline gershom

  • 24
Re: Kill ship = fill up bank account
Couldn't you just use your player score as currency?

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Kill ship = fill up bank account
I'd be reluctant to alter a player's score since many of us have pilots we've been using for months or years which we wouldn't want to see dicked about. But as long as you only read the changes in the ship score from the start of mission 1 into a variable, and don't use inflated values for ship kills and goals achieved, it could work quite well as a currency.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 

Offline gershom

  • 24
Re: Kill ship = fill up bank account
Can you not make a variable that increases as your score does? That way you can spend credits without altering your score, and you wouldn't have to worry about players starting with a huge bank account due to points previously earned. Changing a ship's score value in the editor would be easier and more efficient than having to make multiple events. I'm just speculating, as I'm still trying to learn how to use events and variables myself, but with my limited knowldege on the subject, it seems like this should be possible.
« Last Edit: August 09, 2017, 05:49:19 am by gershom »

 

Offline karajorma

  • King Louie - Jungle VIP
  • Administrator
  • 214
    • Karajorma's Freespace FAQ
Re: Kill ship = fill up bank account
Oh it's definitely possible. All you'd have to do is read the player's score into a campaign or player persistent variable at the start of mission 1 (Which one you choose would depend on how you wanted money to work in your campaign). Then you can just subtract that value from the current player score to figure out how much cash the player had made so far. If the player actually spent the cash, you could add the amount spent onto the variable so that the money would be subtracted from the balance left.
Karajorma's Freespace FAQ. It's almost like asking me yourself.

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

 

Offline gershom

  • 24
Re: Kill ship = fill up bank account
Does that mean there's no way to update the bank account in real-time based on score?