Author |
Message |
Gotcha!
Joined: Tue Apr 01, 2008 4:49 pm Posts: 1972 Location: The Netherlands
|
Order dropship @ 750 oz, get 250 back when returned.
Hello people, Would it be possible for someone to create a script that does the following: I'd like, upon ordering a specific dropship (UniTec Mammoth) for 750 oz, to only get 250 oz back when it returns to orbit. Is this possible, and if so, is anyone up for it?
|
Sun Apr 04, 2010 5:56 pm |
|
|
Abdul Alhazred
DRL Developer
Joined: Tue Aug 11, 2009 5:09 am Posts: 395
|
Re: Order dropship @ 750 oz, get 250 back when returned.
Code: function Update(self) if self.Pos.Y < -75 and self.Vel.Y < 0 then self.Health = -33.333 self.Vel.Y = -100 end end
A craft with health -100 return zero gold, so -100/3 will return ~250 gold for a 750 gold craft. This script will return the same amount no matter how damaged the craft is.
|
Sun Apr 04, 2010 6:21 pm |
|
|
Gotcha!
Joined: Tue Apr 01, 2008 4:49 pm Posts: 1972 Location: The Netherlands
|
Re: Order dropship @ 750 oz, get 250 back when returned.
Thanks. The problem is though, it should give 250 on return at full health. I'll try to explain; I have a dropship (250 oz) which delivers a mech from its inventory (500 oz), but right now it delivers the mech for free. So I made the dropship 750 oz but am looking for a way to substract the 500 oz for the mech when the dropship disappears into orbit.
|
Sun Apr 04, 2010 6:32 pm |
|
|
Grif
REAL AMERICAN HERO
Joined: Sat Jan 27, 2007 10:25 pm Posts: 5655
|
Re: Order dropship @ 750 oz, get 250 back when returned.
Code: function Update(self) if self.Pos.Y < -75 and self.Vel.Y < 0 then self.Health = self.Health -133.333 self.Vel.Y = -100 end end
|
Sun Apr 04, 2010 6:40 pm |
|
|
CrazyMLC
Joined: Fri Dec 22, 2006 4:20 am Posts: 4772 Location: Good news everyone!
|
Re: Order dropship @ 750 oz, get 250 back when returned.
Couldn't you just do something like this... Code: function Create(self) self.Creation = Timer() end
function Update(self) if self.Pos.Y < 1 and self.Creation:IsPastSimMS(5000) then self.Health = self.Health/3 self.Vel.Y = 100 end end ?
|
Sun Apr 04, 2010 7:50 pm |
|
|
Gotcha!
Joined: Tue Apr 01, 2008 4:49 pm Posts: 1972 Location: The Netherlands
|
Re: Order dropship @ 750 oz, get 250 back when returned.
Thanks Grif. Works like a charm. Thank you both. Edit: And thank you as well, CrazyMLC.
|
Sun Apr 04, 2010 7:52 pm |
|
|
Gotcha!
Joined: Tue Apr 01, 2008 4:49 pm Posts: 1972 Location: The Netherlands
|
Re: Order dropship @ 750 oz, get 250 back when returned.
Oh crap, I forgot something. The money can't be deducted when the dropship disappears, because people would crash the dropship instead after getting the 'free' mech. If anyone has a brilliant idea, I'd love to hear it. Edit: Never mind for now. I think I got a solution.
|
Sun Apr 04, 2010 8:03 pm |
|
|
Duh102
happy carebear mom
Joined: Tue Mar 04, 2008 1:40 am Posts: 7096 Location: b8bbd5
|
Re: Order dropship @ 750 oz, get 250 back when returned.
Why not just make it cost 250 but subtract 500 (if possible, and if not, return the dropship) when it appears on the map?
|
Sun Apr 04, 2010 9:09 pm |
|
|
Lizardheim
DRL Developer
Joined: Fri May 15, 2009 10:29 am Posts: 4107 Location: Russia
|
Re: Order dropship @ 750 oz, get 250 back when returned.
If not the subtracting is possible, have it spawn an invisible craft that flies upwards with the cost being -500.
|
Sun Apr 04, 2010 9:17 pm |
|
|
CaveCricket48
Joined: Tue Jun 12, 2007 11:52 pm Posts: 13144 Location: Here
|
Re: Order dropship @ 750 oz, get 250 back when returned.
I got it. Have 2 dropships exactly the same except in cost. When you order the DS, you order the more expensive one, which will be instanly deleted and replaced by the cheaper copy.
|
Sun Apr 04, 2010 9:18 pm |
|
|
PhantomAGN
Joined: Mon Jun 29, 2009 2:40 am Posts: 610 Location: Deep below The Map of Mars
|
Re: Order dropship @ 750 oz, get 250 back when returned.
Can you order the mech by itself? The mech's Create function could subtract this money. The one you order separate would be a version without this code.
Buy craft > fly around > open doors > get mech, lose money > fly craft away, and it returns at "full" price of 250.
CC48's method looks good too.
|
Sun Apr 04, 2010 9:25 pm |
|
|
Lizardheim
DRL Developer
Joined: Fri May 15, 2009 10:29 am Posts: 4107 Location: Russia
|
Re: Order dropship @ 750 oz, get 250 back when returned.
CC's way is the best, cause you can't get your money below 0 with it.
|
Sun Apr 04, 2010 9:36 pm |
|
|
Gotcha!
Joined: Tue Apr 01, 2008 4:49 pm Posts: 1972 Location: The Netherlands
|
Re: Order dropship @ 750 oz, get 250 back when returned.
I almost got it, but this doesn't go right; Code: function Update(self) if self.Pos.Y < -75 and self.Vel.Y < 0 then self.CurrentF = ActivityMan:GetActivity():GetTeamFunds(self.Team); ActivityMan:GetActivity():SetTeamFunds(self.CurrentF - 500), self.Team); self.Vel.Y = -100 end end It doesn't substract 500 oz for some reason, but sets the amount to 500? If this script would work then I can add a sequence that if the dropship dies before leaving the screen that it will cost 750 oz. Can anyone see what I am doing wrong?
|
Sun Apr 04, 2010 9:43 pm |
|
|
TheLastBanana
DRL Developer
Joined: Wed Dec 13, 2006 5:27 am Posts: 3138 Location: A little south and a lot west of Moscow
|
Re: Order dropship @ 750 oz, get 250 back when returned.
Code: function Update(self) if self.Pos.Y < -75 and self.Vel.Y < 0 then self.CurrentF = ActivityMan:GetActivity():GetTeamFunds(self.Team); ActivityMan:GetActivity():SetTeamFunds(self.CurrentF - 500, self.Team); self.Vel.Y = -100 end end You had an extra bracket.
|
Sun Apr 04, 2010 9:45 pm |
|
|
Gotcha!
Joined: Tue Apr 01, 2008 4:49 pm Posts: 1972 Location: The Netherlands
|
Re: Order dropship @ 750 oz, get 250 back when returned.
Sorry, it was a mistake in that post. Copied it from my notepad. My script doesn't have that bracket. (Yeah, I am very chaotic. ) This script sets the amount of money to 500, no matter what. So the final script would look like something like this: Code: function Update(self) if self.Pos.Y < -75 and self.Vel.Y < 0 then self.CurrentF = ActivityMan:GetActivity():GetTeamFunds(self.Team); ActivityMan:GetActivity():SetTeamFunds(self.CurrentF - 500, self.Team); self.Vel.Y = -100 end if actor:IsDead() == true then self.CurrentF = ActivityMan:GetActivity():GetTeamFunds(self.Team); ActivityMan:GetActivity():SetTeamFunds(self.CurrentF - 750, self.Team); end end Making sure 500 oz is removed when the dropship escapes and 750 oz is removed when it dies. (If it worked.) Edit: Further testing: I have 5000 I buy the dropship with included mech for 750 I have 4250 left Dropship drops mech and returns and I end up with 4000 It should have returned 750 and substracted 500 through this script, adding 250 to the 4250 that I had, instead of substracting an extra 250.
|
Sun Apr 04, 2010 10:09 pm |
|
|
|