[mod idea+work help] Hive behavior

A place to discuss mods in development and concepts for new mods.
Drako Slyith
Fleet Officer
Fleet Officer
Posts: 1036
Joined: Wed Feb 03, 2010 4:28 am
Location: Researching how to make St. Kats star go supernova.
Contact:

Ok sorry about the formating. I fixed it http://paste.neurohack.com/view/YMP3X/
Image
Image
Play in over 100 systems in a network. Play the 2011 Mod Of the Year
and the highest rated mod on Xelerus, The Network.
Play the July Mod of the Month, Fellow Pilgrims!
Play My other mods as well
(Drako Slyith)* I am a person
(Eliza chatbot)> Do you believe it is normal to be a person?
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

OK, that is more readable :)

Your switch in the OnDestroy has some issues. Sorry, I can not make concrete fixes atm. I suggest you read up on the xelerus pages on blocks and switches. Basically, you need to make sure that all code you want to run per case is wrapped in a block.

I have to go now, but I will try to give a fuller answer soetime tomorrow if you don't reach a solution.

.] alterecco
Drako Slyith
Fleet Officer
Fleet Officer
Posts: 1036
Joined: Wed Feb 03, 2010 4:28 am
Location: Researching how to make St. Kats star go supernova.
Contact:

Thanks. It works really well now. There's just 1 more bug I need to fix, which is completely stumping me. Sometimes the ships just stop, and coast away. They don't even just gate, they just coast out of the system forever.

But now that the code is working correctly, I can focus on getting the other parts of this I want working.
Image
Image
Play in over 100 systems in a network. Play the 2011 Mod Of the Year
and the highest rated mod on Xelerus, The Network.
Play the July Mod of the Month, Fellow Pilgrims!
Play My other mods as well
(Drako Slyith)* I am a person
(Eliza chatbot)> Do you believe it is normal to be a person?
RPC
Fleet Admiral
Fleet Admiral
Posts: 2876
Joined: Thu Feb 03, 2011 5:21 am
Location: Hmm... I'm confused. Anybody have a starmap to the Core?

Sometimes they stop and coast away
I've had the same problem with my wingmanbases as well. You tell them to wait, but they don't stop at one location... If you still being escorted they match velocity and just keep drifting off to space... It seems like they go brain- dead...
I think the problem has something to do with how the orders are handled by the ship. Maybe we forgot to cancel orders somewhere in the code?
Tutorial List on the Wiki and Installing Mods
Get on Discord for mod help and general chat
Image
Image
Der Tod ist der zeitlose Frieden und das leben ist der Krieg
Wir müssen wissen — wir werden wissen!
I don't want any sort of copyright on my Transcendence mods. Feel free to take/modify whatever you want.
Drako Slyith
Fleet Officer
Fleet Officer
Posts: 1036
Joined: Wed Feb 03, 2010 4:28 am
Location: Researching how to make St. Kats star go supernova.
Contact:

Perhaps, a lot of this is escorting, and I have seen ships turn, while the rest of the swarm continues. I don't think I forgot to cancel any orders though.
Image
Image
Play in over 100 systems in a network. Play the 2011 Mod Of the Year
and the highest rated mod on Xelerus, The Network.
Play the July Mod of the Month, Fellow Pilgrims!
Play My other mods as well
(Drako Slyith)* I am a person
(Eliza chatbot)> Do you believe it is normal to be a person?
Drako Slyith
Fleet Officer
Fleet Officer
Posts: 1036
Joined: Wed Feb 03, 2010 4:28 am
Location: Researching how to make St. Kats star go supernova.
Contact:

Never mind, I fixed the problem. I forgot a block, so it just knew to cancel the orders. But for some reason (probably just a glitch) they didn't gate, they just drifted. I also fixed a lot of errors, and wow it works well now.

EDIT: My finished(ish) code is here: http://paste.neurohack.com/view/YdwKp/ this isn't all my code, because I have some code worked out for the "natural selection" section. That code is here:http://paste.neurohack.com/view/YBeax/
The problem with this is it won't enhance the item. The messages are how I know this, and a few code-checkers I haven't deleted yet.

Anyone who wants to use it is free to.
Image
Image
Play in over 100 systems in a network. Play the 2011 Mod Of the Year
and the highest rated mod on Xelerus, The Network.
Play the July Mod of the Month, Fellow Pilgrims!
Play My other mods as well
(Drako Slyith)* I am a person
(Eliza chatbot)> Do you believe it is normal to be a person?
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

uuuuuse shpEnhanceItem instead
Drako Slyith
Fleet Officer
Fleet Officer
Posts: 1036
Joined: Wed Feb 03, 2010 4:28 am
Location: Researching how to make St. Kats star go supernova.
Contact:

I do:

Code: Select all

(shpEnhanceItem Offspring instWeap 0x0101)
Image
Image
Play in over 100 systems in a network. Play the 2011 Mod Of the Year
and the highest rated mod on Xelerus, The Network.
Play the July Mod of the Month, Fellow Pilgrims!
Play My other mods as well
(Drako Slyith)* I am a person
(Eliza chatbot)> Do you believe it is normal to be a person?
Drako Slyith
Fleet Officer
Fleet Officer
Posts: 1036
Joined: Wed Feb 03, 2010 4:28 am
Location: Researching how to make St. Kats star go supernova.
Contact:

Nevermind, I fixed that (modified a copy of the lambda from weapon optimizer rom) and now I have to fix the passing of enhancements down the generations.
Image
Image
Play in over 100 systems in a network. Play the 2011 Mod Of the Year
and the highest rated mod on Xelerus, The Network.
Play the July Mod of the Month, Fellow Pilgrims!
Play My other mods as well
(Drako Slyith)* I am a person
(Eliza chatbot)> Do you believe it is normal to be a person?
Drako Slyith
Fleet Officer
Fleet Officer
Posts: 1036
Joined: Wed Feb 03, 2010 4:28 am
Location: Researching how to make St. Kats star go supernova.
Contact:

Ok I tried several things, but finally found a way to make the enhancements be passed down. It works well now. It works, but it isn't really efficient. I need to know if there is a function that lets you run a string of code a certain number of times.
Image
Image
Play in over 100 systems in a network. Play the 2011 Mod Of the Year
and the highest rated mod on Xelerus, The Network.
Play the July Mod of the Month, Fellow Pilgrims!
Play My other mods as well
(Drako Slyith)* I am a person
(Eliza chatbot)> Do you believe it is normal to be a person?
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

Sure.... there are several options... Paste your relevant code.... If you want to highlight a line you can put "@h@" at the beginning of that line (in the pastebin).
Drako Slyith
Fleet Officer
Fleet Officer
Posts: 1036
Joined: Wed Feb 03, 2010 4:28 am
Location: Researching how to make St. Kats star go supernova.
Contact:

Ok yeah, here's my code (it's a lambda to pass the enhancement, and the only way I could get it to work)
http://paste.neurohack.com/view/YDfWy/

BTW. Google translator says that the code is written in Filipino :lol: :lol: :lol:
Image
Image
Play in over 100 systems in a network. Play the 2011 Mod Of the Year
and the highest rated mod on Xelerus, The Network.
Play the July Mod of the Month, Fellow Pilgrims!
Play My other mods as well
(Drako Slyith)* I am a person
(Eliza chatbot)> Do you believe it is normal to be a person?
User avatar
alterecco
Fleet Officer
Fleet Officer
Posts: 1658
Joined: Wed Jan 14, 2009 3:08 am
Location: Previously enslaved by the Iocrym

OK. I am not entirely sure about the best way to simplify that code, but you
can start with a for loop:

Code: Select all

(for i 1 10 (mutEnhanceWeapon target 0x0101 nil))
The above code will run 10 times.

You can compact the first half of your function even more by using the
enhancement level:

Code: Select all

(for i 1 (objGetDataSource gSource "enhancementLevel)
    (mutEnhanceWeapon target 0x0101 nil)
)
The above would of course only work for levels up to 15... otherwise
you would have it repeating 51 times (not that i know how you make the
jump in enhancement levels from 15 to 51)

You could also put the handling of the enhancement into the mutEnhanceWeapon
function. That would look something like this:

Code: Select all

;; note... i don't know what your third argument is
(setq mutEnhanceWeapon (lambda (target enhancement cnt xxx)
    (for i 1 cnt
        ;; run the code you already had in this function
    )
))

;; now you can just call it like this:

(mutEnhanceWeapon target 0x0101 15 nil)
Let me know if that makes sense.
Drako Slyith
Fleet Officer
Fleet Officer
Posts: 1036
Joined: Wed Feb 03, 2010 4:28 am
Location: Researching how to make St. Kats star go supernova.
Contact:

about the enhancement level, that's just for keeping track of the level. For negative enhancements I just added 50 to the data. Not really any reason, actually. Thanks for the help. I didn't know what the loop function was.
Image
Image
Play in over 100 systems in a network. Play the 2011 Mod Of the Year
and the highest rated mod on Xelerus, The Network.
Play the July Mod of the Month, Fellow Pilgrims!
Play My other mods as well
(Drako Slyith)* I am a person
(Eliza chatbot)> Do you believe it is normal to be a person?
Drako Slyith
Fleet Officer
Fleet Officer
Posts: 1036
Joined: Wed Feb 03, 2010 4:28 am
Location: Researching how to make St. Kats star go supernova.
Contact:

Ok so I finished(ish) the code for the natural selection. Here: http://paste.neurohack.com/view/YeFvv/It can now enhance the weapon of the ship from -150% to 150% by increments of 10%. The enhancements are passed down from parent to offspring with a probability of 90%. It doesn't change much in Eridani, because there isn't anything to keep the bad enhancement from canceling the good, but if they were in a higher level system, good genes will help them survive, and so it will spread. This is to be used with my behavior code, here: http://paste.neurohack.com/view/YdwKp/.

Now I just have to finish my code on the food and population control.
Image
Image
Play in over 100 systems in a network. Play the 2011 Mod Of the Year
and the highest rated mod on Xelerus, The Network.
Play the July Mod of the Month, Fellow Pilgrims!
Play My other mods as well
(Drako Slyith)* I am a person
(Eliza chatbot)> Do you believe it is normal to be a person?
Post Reply