I would like for someone to make a helper function that when passed a UNID of a weapon and ship would fire the weapon passed in. It needs to obey any velocity changes that the ship would cause to the shot due to the ship's movement.
This function also needs to return the shot.
Help me script edition
- Betelgeuse
- Fleet Officer
- Posts: 1920
- Joined: Sun Mar 05, 2006 6:31 am
Crying is not a proper retort!
You also need to provide the shot speed because there's no way to get that in script, but otherwise here you go:
Code: Select all
(setq shotmaker (lambda (unid missilespeed ship)
(block (shot objVel unitvector shotvectorcomponent)
; store the vector of the ship
(setq objVel (objGetVel ship))
; get unit vector
(setq unitvector (sysvectordivide (sysvectorpolaroffset nil (shpgetdirection ship) 1) 299792))
; set the vector the shot would receive from thegun
(setq shotvectorcomponent (sysvectormultiply unitvector missilespeed))
;fire a weapon and save the shot
(sysCreateWeaponFire unid ship (objGetPos ship) (sysvectorangle (sysvectoradd objvel shotvectorcomponent)) (sysvectorspeed
(sysvectoradd shotvectorcomponent objvel)) nil)
)
))
- alterecco
- Fleet Officer
- Posts: 1658
- Joined: Wed Jan 14, 2009 3:08 am
- Location: Previously enslaved by the Iocrym
The players current rin total is simply stored as a variable on the playership. Any time a transaction with rins is conducted, the appropriate amount is added to or subtracted from that total.
Using the same scheme it would be possible to add any number of currencies in transcendence.
Using the same scheme it would be possible to add any number of currencies in transcendence.
-
- Militia Captain
- Posts: 779
- Joined: Wed Nov 18, 2009 1:01 am
- Location: Still looking for the csc Antarctica
- Contact:
Code: Select all
(objgetdata gPlayership "rins") returns amount of rins player has
(objincdata gPlayership "rins" ##) adds/removes rins (depends on number being positive or negative
"Dash_Merc - George is a genius, in that he created this game engine that is infinitely extendable"
"<@sheepluva>Good night everybody, may the source be with you." <-- FOSG dev
"You only need THREE tools in life - WD-40 to make things go, Duct Tape to make things stop And C-4 to make things go away"
- digdug
- Fleet Admiral
- Posts: 2620
- Joined: Mon Oct 29, 2007 9:23 pm
- Location: Decoding hieroglyphics on Tan-Ru-Dorem
I would like someone to give me an example on how to handle 2 lists with different length.
I would like to iterate a list, and match every element with a second list, which is not the same length (can be longer or shorter). If the second list is shorter, then continue to iterate the elements of the first list from the beginning
example:
list1 '(1 2 3 4 5)
list2 '(a b c)
result
'((1 a) (2 b) (3 c) (4 a) (5 b))
I would like to iterate a list, and match every element with a second list, which is not the same length (can be longer or shorter). If the second list is shorter, then continue to iterate the elements of the first list from the beginning
example:
list1 '(1 2 3 4 5)
list2 '(a b c)
result
'((1 a) (2 b) (3 c) (4 a) (5 b))
- alterecco
- Fleet Officer
- Posts: 1658
- Joined: Wed Jan 14, 2009 3:08 am
- Location: Previously enslaved by the Iocrym
This is normally called a 'zip', with a small variation (the looping). Here is some code
Note, I talked to digdug on IRC about this, so the somewhat special case this works with was talked about there
Code: Select all
(setq zip-repeat (lambda (first last)
(block (len (cnt 0) (res (list)))
(setq len (count last))
(enum first el (block nil
(if (geq cnt len) (setq cnt 0))
(lnkAppend res (list el (item last cnt)))
(setq cnt (add cnt 1))
))
res
)
))
Code: Select all
(zip-repeat '(a b c d) '(1 2)) -> ((a 1) (b 2) (c 1) (d 2))
(zip-repeat '(a b) '(1 2 3 4)) -> ((a 1) (b 2))
-
- Anarchist
- Posts: 8
- Joined: Tue Jun 03, 2014 10:31 pm
Anyone know how to get the hex UNID (0xblahblahblah) of an item in your cargo hold ? Maybe with debug console or something?
-
- Anarchist
- Posts: 8
- Joined: Tue Jun 03, 2014 10:31 pm
Never mind. Got it from tech forum thx