View unanswered posts | View active topics It is currently Sat Jan 11, 2025 11:27 pm



Reply to topic  [ 24 posts ]  Go to page 1, 2  Next
 Order dropship @ 750 oz, get 250 back when returned. 
Author Message
User avatar

Joined: Tue Apr 01, 2008 4:49 pm
Posts: 1972
Location: The Netherlands
Reply with quote
Post 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
Profile
DRL Developer
DRL Developer

Joined: Tue Aug 11, 2009 5:09 am
Posts: 395
Reply with quote
Post 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
Profile
User avatar

Joined: Tue Apr 01, 2008 4:49 pm
Posts: 1972
Location: The Netherlands
Reply with quote
Post 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
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post 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
Profile
User avatar

Joined: Fri Dec 22, 2006 4:20 am
Posts: 4772
Location: Good news everyone!
Reply with quote
Post 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
Profile WWW
User avatar

Joined: Tue Apr 01, 2008 4:49 pm
Posts: 1972
Location: The Netherlands
Reply with quote
Post Re: Order dropship @ 750 oz, get 250 back when returned.
Thanks Grif. Works like a charm. :grin: Thank you both.

Edit: And thank you as well, CrazyMLC.


Sun Apr 04, 2010 7:52 pm
Profile
User avatar

Joined: Tue Apr 01, 2008 4:49 pm
Posts: 1972
Location: The Netherlands
Reply with quote
Post 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. :oops:

Edit: Never mind for now. I think I got a solution. :)


Sun Apr 04, 2010 8:03 pm
Profile
happy carebear mom
User avatar

Joined: Tue Mar 04, 2008 1:40 am
Posts: 7096
Location: b8bbd5
Reply with quote
Post 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
Profile
DRL Developer
DRL Developer

Joined: Fri May 15, 2009 10:29 am
Posts: 4107
Location: Russia
Reply with quote
Post 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
Profile
User avatar

Joined: Tue Jun 12, 2007 11:52 pm
Posts: 13144
Location: Here
Reply with quote
Post 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
Profile
User avatar

Joined: Mon Jun 29, 2009 2:40 am
Posts: 610
Location: Deep below The Map of Mars
Reply with quote
Post 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
Profile
DRL Developer
DRL Developer

Joined: Fri May 15, 2009 10:29 am
Posts: 4107
Location: Russia
Reply with quote
Post 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
Profile
User avatar

Joined: Tue Apr 01, 2008 4:49 pm
Posts: 1972
Location: The Netherlands
Reply with quote
Post 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
Profile
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3138
Location: A little south and a lot west of Moscow
Reply with quote
Post 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
Profile WWW
User avatar

Joined: Tue Apr 01, 2008 4:49 pm
Posts: 1972
Location: The Netherlands
Reply with quote
Post 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. :oops: )
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
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 24 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.080s | 15 Queries | GZIP : Off ]