Posts tagged code
Using m25 AI in mods
Jul 13th
Since this has been asked a few times, I’m going to put it on the blog so that it’s easily findable in the future.
How do you use m25′s AI in a mod or campaign setting?
Simple, dear asker. Just follow these steps:
- Import the FFX module using the following command:
from ffx import * - Under your OnPostInit() section, add the following lines of code:
setMission(numerical value),InitScripts(), andFFX_InitMission()
- Still under OnPostInit(), add the following lines of code:
- And when you’re ready to activate the custom AI, call
SetupAI()with the appropriate character name.
heroes = getAllHeroes() for h in heroes: SetupAI(h) AIDisableCustom(h)
The completed file will look similarly to this:
# Sample
from cshelper import *
from ffx import *
def OnPostInit():
print "start"
setMission(1)
InitScripts()
FFX_InitMission()
heroes = getAllHeroes()
for h in heroes:
SetupAI(h)
AIDisableCustom(h)
def super(event):
m25ai.SetupAI('superguy')
That’s the gist of it, but if you want to know more about this process and what other commands you’re able to use, check out this thread: Using m25 AI. Hope this helps.
Coding Tip #10
Jan 5th
Wow, talk about a large hiatus, huh? Let’s say you want to make a character (girl1) follow a hero (hero_1) every 10 seconds? How, exactly, would you set that up? Well, here’s a sample code that’ll do just that. Follow along:
Coding Tip #9
May 15th
In the old days before there was an ezscript, modders had to do things the hard way and learn python. And although Ezscript is able to pull off some amazing feats, having a bit of python knowledge to round out your skill set might just be a good idea. So, sometime around 2006 or 2007, I set out and made a guide to basic scripting which I figured could help some people jump into the modding circle. Unfortunately, I don’t recall an upsurge in modders after its release, but here it is for anyone that may or may not be curious as to how to mod Freedom Force using python.
Scripting Tutorial: The Basics
The tutorial is a pdf file and unfortunately, some of the links are broken. However, if you find yourself needing those links, you can find them below.
Scripting Tutorial Example Mission/Py file
And that’s the tip for this week. Hope you enjoy it.
Coding Tip #8
Apr 23rd
The final coding tip from Jands and Lude. Hope you enjoy it.
Creating an Objective and an Item Drop
Editor issues as in Coding Tip #7
In the script you will need to call the routine for the first time, set the objective, and set an attribute to keep track of thugs ko’d:
Coding Tip #7
Apr 9th
Another Coding Tip from Jands and Lude. Enjoy!
Creating a Random Spawn
The only issue in the editor with this script is to check the level extents from the Mission tab.
Back to Business…
Apr 3rd
Pretty big update this week. You can now go grab 7 new maps from CmdrKoenig that ranges from Forestry to castles. Also up for grabs, two old school fx that were made several years ago, a new coding tip, and, if you missed it, two spotlights. One on Ultimate Evil, and one on The Beyonder. Oh, yeah, I finally put up a simple link widget.
Coding Tip #6
Apr 3rd
Today’s (quick) tip:
Well, if you have ffx enabled in a mod, you can simplify a few commands to a single line of code. Say you want to move a bunch of controllable characters to the same spot for whatever reason. Well, in FFX, you can use this code:
When it rains, it pours…
Mar 20th
This week, we have a bunch of goodies for you FF afficionados to grab. CmdrKoenig has released a whopping 5 new maps for you to play on, Conduit has returned briefly and brings with him a gift of two more maps, a lost FF1 mod–B Brigade–finds a home on the ff1 mods page, and we are proud to present our first “Spotlight” post on one of the top skinners in the FF community, Afghan Ant. Oh, and don’t forget, if you’re interested in python coding your own mods, coding tip 5 is also up. Enjoy the new toys, gang.
Coding Tip #5
Mar 20th
Today’s tip:
Let’s say you want a target to teleport to safety when his health drops to a specified point. Well, that’s simple!
Small updates…
Mar 8th
Another week, another update. This time, you can grab the mission 5 and 6 addon to the X-mod by FFjands, get three new fx, and finally, if you fancy it, read two new coding tips. Enjoy.