Hi all,
Does this look right:
(block Nil
(if (itmMatches (auton) "+Military;")
(setq gCost 10)
(setq gCost 0)
)
)
Thx in advance.
More auton script help
- dosbox-gamer
- Commonwealth Pilot
- Posts: 66
- Joined: Sat Apr 05, 2008 9:41 pm
- Location: Utopia Planitia Fleet Yards
"Make no little plans. They have no magic to stir men's blood and probably will not themselves be realized." -- Daniel Hudson Burnham, architect & urban planner
- dosbox-gamer
- Commonwealth Pilot
- Posts: 66
- Joined: Sat Apr 05, 2008 9:41 pm
- Location: Utopia Planitia Fleet Yards
Scratch that. How about:
; Advanced autons cost more to fix.
(objGetItems gPlayership "*+MilitaryID")
>>>>>(setq gCost (add gCost (multiply 10 (gCost))))
where >>>>> equals indent
I just need to know if the script will work.
Thanks in advance.
; Advanced autons cost more to fix.
(objGetItems gPlayership "*+MilitaryID")
>>>>>(setq gCost (add gCost (multiply 10 (gCost))))
where >>>>> equals indent
I just need to know if the script will work.
Thanks in advance.
"Make no little plans. They have no magic to stir men's blood and probably will not themselves be realized." -- Daniel Hudson Burnham, architect & urban planner
- dosbox-gamer
- Commonwealth Pilot
- Posts: 66
- Joined: Sat Apr 05, 2008 9:41 pm
- Location: Utopia Planitia Fleet Yards
Uh, no. Multiply 5 is for the cost of repairing the autons. Right?
"Make no little plans. They have no magic to stir men's blood and probably will not themselves be realized." -- Daniel Hudson Burnham, architect & urban planner
- alterecco
- Fleet Officer
- Posts: 1658
- Joined: Wed Jan 14, 2009 3:08 am
- Location: Previously enslaved by the Iocrym
dosbox-gamer wrote: ; Advanced autons cost more to fix.
(objGetItems gPlayership "*+MilitaryID")
>>>>>(setq gCost (add gCost (multiply 10 (gCost))))
You can read the above script as:dosbox-gamer wrote: Uh, no. Multiply 5 is for the cost of repairing the autons. Right?
gCost = gCost + (gCost * 10)
So, like digdug said, the item will end up costing 11 times more than the initial gCost.
Also, the way you use (objGetItems ...) is not right. The function merely returns a list, it does not iterate over it. However, it is not totally clear to me what you want to accomplish. With the above snippet, it looks more like you want to increase the items price if the player has a Military ID? Let us know more precisely what you want to do, and it will be easier to help...
.]
- dosbox-gamer
- Commonwealth Pilot
- Posts: 66
- Joined: Sat Apr 05, 2008 9:41 pm
- Location: Utopia Planitia Fleet Yards
From the AutonDealer <repairautons> code:
In this case, gCost is the cost to repair autons. It starts at 0 (setq gCost 0), then is calculated by:
(enum gList auton
>>>>>(for i 0 (subtract (shpGetArmorCount auton) 1)
>>>>>>>>>>(setq gCost (add gCost (multiply 5 (objGetArmorDamage auton i))))
>>>>>>>>>>)
>>>>>)
So multiply 5 is on the armor damage points -- for standard (light) autons.
My multiply 10 would be for military (heavy) autons. Okay?
In this case, gCost is the cost to repair autons. It starts at 0 (setq gCost 0), then is calculated by:
(enum gList auton
>>>>>(for i 0 (subtract (shpGetArmorCount auton) 1)
>>>>>>>>>>(setq gCost (add gCost (multiply 5 (objGetArmorDamage auton i))))
>>>>>>>>>>)
>>>>>)
So multiply 5 is on the armor damage points -- for standard (light) autons.
My multiply 10 would be for military (heavy) autons. Okay?
"Make no little plans. They have no magic to stir men's blood and probably will not themselves be realized." -- Daniel Hudson Burnham, architect & urban planner
- alterecco
- Fleet Officer
- Posts: 1658
- Joined: Wed Jan 14, 2009 3:08 am
- Location: Previously enslaved by the Iocrym
I see. In that case you would need to change the code a bit. What you are doing with this piece of code:dosbox-gamer wrote:My multiply 10 would be for military (heavy) autons. Okay?
Code: Select all
(objGetItems gPlayership "*+MilitaryID")
What you would want to do, is check if the auton you are getting the price for, has the Military attribute. Something like:
Code: Select all
(enum gList auton
(if (itmHasAttribute auton 'Military)
(setq gCost (multiply 10 gCost))
)
)
Okay!dosbox-gamer wrote:Okay?
.]
- dosbox-gamer
- Commonwealth Pilot
- Posts: 66
- Joined: Sat Apr 05, 2008 9:41 pm
- Location: Utopia Planitia Fleet Yards
Okay 8)
"Make no little plans. They have no magic to stir men's blood and probably will not themselves be realized." -- Daniel Hudson Burnham, architect & urban planner