• Welcome to Freedom Reborn Archive.
 

FFX 3.2: VECHILE & DRIVER Attribute

Started by crimsonquill, February 12, 2007, 04:04:25 PM

Previous topic - Next topic

crimsonquill

I'm still a little lost on the whole Vehicle & Driver attribute... so would someone explain it to me in the "Coding For Idiots" format?

I'd like to create an Iron Man body armor that Tony Stark wears upon his arrival to a mission. Then if the armor is destroyed it shatters and reveals old Stark inside just wearing his underware until he gains enough energy to summon another suit of armor (i.e. use the Summon attribute to make my Vehicle appear on the map which he then can reenter and transform back into Iron Man).

Is this possible using that Attribute? I remember that in FFX 3 it started off with the demo Catman character showing up in his car and you could get in and out of it just by selecting the right menu item.

- CrimsonQuill

yell0w_lantern

My basic understanding is that you need the following things:
vehicle as object
vehicle as character
and character with driver attribute

Can't tell you exactly how to set it up though.
I can tell you that it might be more feasible to use plasma scultor rather than summoner since summoner bring things with a character template and plasma sculptor spawns object template things.

crimsonquill


JKCarrier

Not sure if this would work, but it might be a better match for what you're trying to do:

Give Iron Man the "Russian Doll" attribute, and make his secondary form Tony Stark.
Give Tony Stark "Slow Starter" (so he starts out with no energy) and "Accidental Change" with the trigger "is at full energy". Make Iron Man his accidental form.

That way, if Iron Man gets k.o.'d, he turns into Stark. And then if Stark can stay alive long enough for his energy to fill back up, he automatically changes back into Iron Man.

Urthman

Quote from: JKCarrier on February 13, 2007, 07:10:43 PM
Give Iron Man the "Russian Doll" attribute, and make his secondary form Tony Stark.
Give Tony Stark "Slow Starter" (so he starts out with no energy) and "Accidental Change" with the trigger "is at full energy". Make Iron Man his accidental form.

That way, if Iron Man gets k.o.'d, he turns into Stark. And then if Stark can stay alive long enough for his energy to fill back up, he automatically changes back into Iron Man.

Oh, I like that!  That gives me a really fun idea for a different Iron Man thing I was working on.  Thanks!

BentonGrey

Hey guys, how do you customize this?  I can't find anything to change in the FFXEdit program.  I'm a little bit confused.  I've got Batman with a 'driver' attribute, and the Batwing with a 'vehicle' attribute.  Or is it simply a matter of putting the vehicle into a mission?

Mystik

check the ffx.py and search for the driver and vechile atrribute

BentonGrey

Alright, I found it, but I'm not quite sure what to do with it.

Epimethee

The current code is

FFX_DRIVER_CUSTOM=[
["default","cat jalopy","",""],
]

You need to add a line for your character:
FFX_DRIVER_CUSTOM=[
["default","cat jalopy","",""],
["bentongrey","bentonmobile","",""],
]


Note: That well-hidden list has been moved to ffxcustom2.py in the upcoming FFX 3.2 final release.

BentonGrey

Thanks Em, that is exactly what I needed to know!  Can you have multiple entries for a single character?  So, if I have Batman and Batmobile, can I also have Bats and the Batwing?

Epimethee

Sorry, multiple entries are not possible; that would have been nice, though. Would a randomly selected vehicle from your choice of three do?

BentonGrey

Perfectly, that would work great, Em.

Epimethee

You can try to replace the existing def getVehicle() function and the code belonging to it (ending with return temp) by this new version:

def getVehicle(char):
    templates = []
    for i in range(1,4):
        temp = getByTemplate(char, FFX_DRIVER_CUSTOM, i)
        if temp != '':
            templates.append(temp)
    return templates[ randint(0, len(templates)-1) ]


Then, you can test it by having more than one vehicle template in the list:
FFX_DRIVER_CUSTOM=[
["default","cat jalopy","",""],
["bentongrey","bentonmobile","bentonflier","bentoncruiser"],
]


Either or both two last entries can be kept empty. You can also list the same vehicle twice and another once to get twice as many chances of the first one appearing.

Let me know if it works. :)

BentonGrey

Awesome Em, I'll try that right away.

BentonGrey

Alright Em, here's what happened.  I set up a 'mobile and 'wing, with the 'mobile holding two of the positions.  I start an RR section with 'ol Bats, and the first time, it works alright, the vehicle appears and I can control it, but my game is running at a SUPER slow rate, and really just chugging along.  I got a message telling me that I needed to run FFXEdit (forgot to do it after I add the vehicles).  So, I go back into the game, turn my graphics settings down a bit (they go screwy every once in a while, don't ask me why), and do the exact same thing.  It starts, Bats is standing there for a moment, the he is replaced by the batmobile, HOWEVER, the portrait doesn't come back, and I can't select the car.  Bummer.  I run it again, same thing, a third time, and the game crashes after changing into the batwing because I accidentally had the batwing set as a vehicle instead of a character.  Any ideas?

Here's the script.log:

[spoiler]>>> system/init.py executed
>>> system/localinit.py executed
>>> system\tredir.py executed
Starting ffx.py v. 3.2.0 build 10; branch = Public Beta 2
Loading m25ai.py v. 3.2.0 build 8; branch = m25 branch 1
Loading m25event.py v.3.2.0 build 6; branch = m25 branch 2
importing missionobjvar.py v1.18
loading datfiles version 0.251000
importing MLOG Reader 1.0 alpha 17
missionobjvar(FixLongs): Fixing overflow issue with <SCSTATE_BUOYANT>
missionobjvar defining functions for Campaign play.
Loading m25report.py v.3.2.0 build 6; branch = m25 branch 2
Loading m25timestamp.py v.3.2.0 build 6; branch = m25 branch 2
Loading m25getset.py v.3.2.0 build 6; branch = m25 branch 2
Loading m25string.py v.3.2.0 build 6; branch = m25 branch 2
Loading m25distance.py v.3.2.0 build 6; branch = m25 branch 2
Loading m25template.py v.3.2.0 build 6; branch = m25 branch 2
Loading m25missionover.py v.3.2.0 build 6; branch = m25 branch 2
Loading m25energy.py v.3.2.0 build 6; branch = m25 branch 2
Loading m25generateai.py v.3.2.0 build 6; branch = m25 branch 2
Loading m25aigeneratedata.py v.3.2.0 build 6; branch = m25 branch 2
Loading m25team.py v.3.2.0 build 6; branch = m25 branch 2
Loading m25custompowers.py v.3.2.0 build 6; branch = m25 branch 2
Loading m25cutscene.py v.3.2.0 build 6; branch = m25 branch 2
Loading m25gametype.py v.3.2.0 build 6; branch = m25 branch 2
Loading m25freeroamdata.py v.3.2.0 build 6; branch = m25 branch 2
Loading m25customheads.py v.3.2.0 build 6; branch = m25 branch 2
CustomHeadCurrentTime 1175443573.562000
Starting Height Check module 1.4
Starting System Utilities 1.3
Starting General Utilities 1.0
OBJECTS_HEIGHT: 604 entries
NIF_OBJECTS: 482 entries
BUILDINGS_IN_OBJECTS_DAT: 30 entries
BUILDING_DIMENSIONS: 30 entries
Starting skXMapInfo.py  v 0.79 beta
skXMapInfo: m25ai available
Loading m25aiopt.py v.3.2.0 build 6; branch = m25 branch 2
Loading m25aiconstants.py v.3.2.0 build 6; branch = m25 branch 2
FFX Mission Plugin 'firehydrant' imported
FFX Mission Plugin 'zombie' imported
Loading freeroam_keepbuildingdamage.py v.1.0.0 build 0; branch = main
FREEROAM_KBD: initialized
FFX Mission Plugin 'freeroam_keepbuildingdamage' imported
FFX Mission Plugin 'm25ai_lowjumper' imported
FFX Mission Plugin 'm25ai_realitymanipulation' imported
Loading     m25enc_simplechoice.py v.1.0.0 build 0; branch = main
Loading m25enc.py v.3.2.0 build 8; branch = m25 branch 1
Loading m25name.py v.3.2.0 build 6; branch = m25 branch 2
Loading m25randomenc.py v.3.2.0 build 6; branch = m25 branch 2
Loading m25objective.py v.3.2.0 build 6; branch = m25 branch 2
Loading m25freeroamally.py v.3.2.0 build 6; branch = m25 branch 2
Loading m25spawn.py v.3.2.0 build 6; branch = m25 branch 2
FFX Mission Plugin 'm25enc_simplechoice' imported
Starting Built-In Function Wrapper 1.5
('Object_CalcPrestige', 'js')
>>> C:\Documents and Settings\Owner\Local Settings\Application Data\Irrational Games\Freedom Force vs the 3rd Reich\temp\battle.py executed
>>> C:\Documents and Settings\Owner\Local Settings\Application Data\Irrational Games\Freedom Force vs the 3rd Reich\temp\danger.py executed
>>> C:\Documents and Settings\Owner\Local Settings\Application Data\Irrational Games\Freedom Force vs the 3rd Reich\temp\battle.py executed
>>> OnReceiveSelectedEnemies(('thug_with_bat', 'thug_with_bat', 'thug_with_bat', 'thug_with_bat', 'thug_with_bat', ))
try to spawn thug_with_bat
try to spawn thug_with_bat
try to spawn thug_with_bat
try to spawn thug_with_bat
try to spawn thug_with_bat
MLOG_Init(keepRunningModules=0): starting up
mlogreader.MLOG_Init: current mission = 'MP_PARK'
initialising FFX: skirmish=1
numberStr=93
storing hero_0: id_1,-93
TIME: 0.006504 for GetMissionVar
! GetMapInfo
AI: SetupAI() - setting ai for _skthug_with_bat01 ('thug_with_bat')
AI: SetupAI() - setting ai for _skthug_with_bat02 ('thug_with_bat')
AI: SetupAI() - setting ai for _skthug_with_bat03 ('thug_with_bat')
AI: SetupAI() - setting ai for _skthug_with_bat05 ('thug_with_bat')
AI: SetupAI() - setting ai for hero_0 ('batman')
AI: SetupAI() - setting ai for _skthug_with_bat04 ('thug_with_bat')
initialising FFQ_initialiseExtras()
FFX_UpdateSun: getting default sun
FFX_UpdateSun: setting = (-140.0, 70.0, 1.0, 0.800000011921, (0.699999988079, 0.600000023842, 0.600000023842))
addArrow _sk_arrow _skthug_with_bat01 0 0
---- TIME: 0.015779 for AI_UpdateMapInfoStatic
AI: _skthug_with_bat01:'thug_with_bat' hunting 'hero_0'
=====================================
Code for _skthug_with_bat01
-----
energy=js.Object_GetAttr(char,"energyPoints")
target=Target_GetCurrentTarget(char)
range=Target_GetDistance(char)
done=0
reserve=0
if js.Object_GetSecondaryStates(char) & js.SCSTATE_POWER_NULLIFICATION: energy=0
if (not done):
   if (not done):
       done = ff.AIGenericFleeOpt(tactic_id,event.object,event.string,event.float,event.user, pct = 60, type = "any", energy = 0, maxdist = 200, time = 0.87, mindist = 50, subtype = 1)
if (not done) and range >= 61 and range <= 105:
   if (not done):
       done = ff.AIGenericPowerOnTarget(tactic_id,event.object,event.string,event.float,event.user, pct = 100, energy = 0, time = 4.03, power = "thug with bat Club", subtype = 2, carrier = -1, mindist = 0, maxdist = 70)
elif (not done) and range <= 60:
   if (not done):
       done = ff.AIGenericPowerOnTarget(tactic_id,event.object,event.string,event.float,event.user, pct = 100, energy = 0, time = 4.03, power = "thug with bat Club", subtype = 2, carrier = -1, mindist = 0, maxdist = 70)
else: pass
if (not done):
   if (not done):
       done = ff.AIGenericMoveOpt(tactic_id,event.object,event.string,event.float,event.user, pct = 100, energy = 0, maxdist = 400, time = 0.87, mindist = 50, subtype = 3)

=====================================
####################### TIME: 0.250542 for ai for thug_with_bat
AI: _skthug_with_bat02:'thug_with_bat' hunting 'hero_0'
TIME: 0.006915 for ai for thug_with_bat
AI: _skthug_with_bat03:'thug_with_bat' hunting 'hero_0'
TIME: 0.006835 for ai for thug_with_bat
AI: _skthug_with_bat05:'thug_with_bat' hunting 'hero_0'
TIME: 0.007289 for ai for thug_with_bat
AI: AISetRunning hero_0 to 0
AI: _skthug_with_bat04:'thug_with_bat' hunting 'hero_0'
TIME: 0.006658 for ai for thug_with_bat
initAttribsForChar: working on _skthug_with_bat01 (thug_with_bat)
initAttribsForChar (thug_with_bat): looking at attribute timid
initAttribsForChar (thug_with_bat): looking at attribute weak minded
initAttribsForChar: working on _skthug_with_bat02 (thug_with_bat)
initAttribsForChar (thug_with_bat): looking at attribute timid
initAttribsForChar (thug_with_bat): looking at attribute weak minded
initAttribsForChar: working on _skthug_with_bat03 (thug_with_bat)
initAttribsForChar (thug_with_bat): looking at attribute timid
initAttribsForChar (thug_with_bat): looking at attribute weak minded
initAttribsForChar: working on _skthug_with_bat05 (thug_with_bat)
initAttribsForChar (thug_with_bat): looking at attribute timid
initAttribsForChar (thug_with_bat): looking at attribute weak minded
initAttribsForChar: working on hero_0 (batman)
initAttribsForChar (batman): looking at attribute heroic
initAttribsForChar (batman): looking at attribute wall climbing
initAttribsForChar (batman): looking at attribute danger sense
initAttribsForChar (batman): looking at attribute driver
execInitAttrib: init driver attribute
    on hero_0 of template custom_template_93 (batman)
initAttribsForChar: working on _skthug_with_bat04 (thug_with_bat)
initAttribsForChar (thug_with_bat): looking at attribute timid
initAttribsForChar (thug_with_bat): looking at attribute weak minded
AI: SetupAI() - setting ai for form_1 ('batmobile')
Plugin 'firehydrant' OnPostInit() called
Plugin 'zombie' has no OnPostInit()
Plugin 'freeroam_keepbuildingdamage' OnPostInit() called
Plugin 'm25ai_lowjumper' has no OnPostInit()
Plugin 'm25ai_realitymanipulation' has no OnPostInit()
Plugin 'm25enc_simplechoice' has no OnPostInit()
initAttribsForChar: working on form_1 (batmobile)
initAttribsForChar (batmobile): looking at attribute vehicle
execInitAttrib: init vehicle attribute
    on form_1 of template batmobile (batmobile)
initAttribsForChar (batmobile): looking at attribute armoured
TIME: 0.004462 for ai for batmobile
AI: _skthug_with_bat05:'thug_with_bat' hunting 'form_1'[/spoiler]

Epimethee

Hmm, it seems Driver/Vehicle was one of these attributes Dr Mike warned weren't quite finished. I'll try to have a look, but it may be postponed a while.

BentonGrey

Curses!  Haha, I have been really excited about this, but I suppose I've waited all this time, I can wait a little longer.   ^_^

Mystik

this is only a work in progress
but tell me if it works, first make an atribute called batwave
then give the attribute to batman  (it only works for him right now)
then create a character called batwing and give it the vechile attribute
then paste this:
#################### Batmobile and Bats ##########################

def initbatwave(char,update=0):
    if isMP():
        return
    if update==0:
        Mission_CustomAction('CUSTOM_BATWING',char,char,'OnBATWING',5,0)

def OnBATWING(target,char):
    #find their vehicle
    template=getVehicle(char)
    name=getFormName()
    FFX_Spawn(name,template,char)
    Mission_CustomAction('CUSTOM_ENTERVEHICLE',name,name,'OnEnterVehicle',5,0)
    Mission_RemoveCustomAction('CUSTOM_BATWING',name,name,'OnBATWING',5,0)
    Mission_CustomAction('CUSTOM_EXITVEHICLE',name,name,'OnExitVehicle',5,0)
    Object_SetVar(name,'driver',char)

def OnEnterVehicle(target,char):
    #make the driver dissappear
    Object_SetPrimaryState(char,PCSTATE_EXILE,10000,0)
    Object_SetSecondaryState(char,SCSTATE_INVISIBLE,10000,0)
    FFX_AdjustPortrait(char,0)
    RegTimer('OnEnterVehicle2',1,0,target)
    regDeath(target,'OnVehicleDie')

def OnEnterVehicle2(event):
    target=event.object
    FFX_AdjustPortrait(target,1)
    Mission_SelectHero(target)
    AIEnable(target) ###!Ep 2006-02-12: bug corrected

def OnVehicleDie(event):
    vehicle=event.object ###!Ep 2006-07-10: vehicle wasn't definedz
    driver=Object_GetVar(vehicle,'driver') ###!Ep 2006-07-10: changed char to vehicle
    Mission_RemoveCustomAction('CUSTOM_ENTERVEHICLE',driver,vehicle)
    if FFX_HasPortrait(vehicle):
        OnExitVehicle('',vehicle)

def OnExitVehicle(dummy,char):
    #figure out who our driver is...
    driver=Object_GetVar(char,'driver')
    pos=Get_ObjectPos(char)
    FFX_Teleport(driver,pos)
    alignWith(driver,char)
    Object_SetPrimaryState(driver,PCSTATE_EXILE,0,REMOVE_STATE)
    Object_SetSecondaryState(driver,SCSTATE_INVISIBLE,0,REMOVE_STATE)
    FFX_AdjustPortrait(char,0)
    AIDisable(char)
    RegTimer('OnEnterVehicle2',0.5,0,driver)

FFX_DRIVER_CUSTOM=[
["batman","batwing","",""],
]

def getVehicle(char):
    temp=getByTemplate(char,FFX_DRIVER_CUSTOM,1)
    return temp
  in the ffx.py

BentonGrey

Alright TR, I'll give that a try, should i remove the driver attribute from Bats?


CF Kane

Shouldn't this be worked into the FFX 3.0 editor? This seems way too complicated for me to pull off.

Epimethee

Quote from: CF Kane on April 02, 2007, 09:43:40 PM
Shouldn't this be worked into the FFX 3.0 editor? This seems way too complicated for me to pull off.
We wish it could! The problem is that the FFX Control Centre Editor has reached its max number of attributes limit. Fixing the Control Centre isn't going to happen overnight, since we don't have the source code. So, that means writing a new Control Centre from scratch.

BentonGrey

Okay, I finally got a chance to test this, and I added that code, made the attribute, but nothing happened.  I went into the RR, but nothing happened, I had no custom command, nothing.