News:

Happy 20th, FFvT3R!

Main Menu

FFX Classic Seeing Double mission

Started by ChronoxDevil, September 05, 2024, 12:50:26 PM

Previous topic - Next topic

ChronoxDevil

I realized that in the double mission because of how FFVTTR works, clones will not spawn next to you when you are hit by the cloning ray so i wrote some code that solves this issue.

array set ups.
teleportedClones = []
setupNPC = []

def setUpTeleport(event):
    for others in js.Mission_GetDynamicObjects():
        if not others in ff.setupNPC:
            otherTemplate = Object_GetTemplate(others)
            if isCharacterTemplate(otherTemplate):
                for set in ffxpowerids.powerIDs:
                    powerName = set[0]
                    if powerName == 'turret_raygun_cloneray':
                        RegPowerHit('ray_gun',others,'civTeleport',set[2])
                        ff.setupNPC.append(others)

def OnRayGunFired(event):
    print "The cloning ray-gun has fired!"
    regTimer('setUpTeleport', 0.1)
    fired_count = int(Mission_GetAttr(ff.attr_fired_count)) + 1
    Mission_SetAttr(ff.attr_fired_count, fired_count)   
    next_fired_count = Mission_GetAttr(ff.attr_next_fired_count)
    regTimer('OnCheckForClones', 0.1)
    regTimer('cleanCloneTable', 0.1)

   
    # beam_fired cutscenes play every 4th fire of the ray_gun but are numbered 1-9
    # (it's done this way so I can tweak the frequency of when they play without renumbering the cs's)
    if fired_count == next_fired_count:
        cs_no = (fired_count + 2) / 3
        if (cs_no > 9): return
        exec_string = 'play(beam_fired_' + str(cs_no) + '_cs, "beam_fired_' + str(cs_no) + '_cs", 2)'
        exec exec_string
        next_fired_count = fired_count + 3
        Mission_SetAttr(ff.attr_next_fired_count, next_fired_count)

def cleanCloneTable(event):
    if len(ff.teleportedClones) > 0:
        for clone in ff.teleportedClones:
            if not Object_Exists(clone):
                if not isCharacterTemplate(Object_GetTemplate(clone)):
                    ff.teleportedClones.remove(clone)
    if len(ff.setupNPC) > 0:
        for clone in ff.setupNPC:
            if not Object_Exists(clone):
                if not isCharacterTemplate(Object_GetTemplate(clone)):
                    ff.setupNPC.remove(clone)
            if not Object_IsAlive(clone):
                ff.setupNPC.remove(clone)

under OnPostInit()
setUpTeleport()
you will need to enable FFX for FFClassic for this to work and you will need to generate powerIDs.

code belongs in mission.py

If the raygun shield never turns off you need to go into ffedit and set the raygun shields to use low power because power null will not work if the power uses no energy.

To stop the building from being destroyed when you destroy the raygun go to ff_edit and change the damage of the power "generic fire explosion raygun" to nothing.

ChronoxDevil

#1
function to teleport clones to you.
def civTeleport(event):
    clones = getAllByPrefix('mobj_')
    currentTarget = ""
    for clone in clones:
        template = Object_GetTemplate(clone)
        if isCharacterTemplate(template):
        if isCharacterTemplate(template):
            if not str(template) == "projectile_standin":
                if Object_IsAlive(clone):     
                    if not clone in ff.last_clones:
                        if not clone in ff.teleportedClones:

 

otherTemplate = Object_GetTemplate(event.object)
if otherTemplate == template:   
    #Mission_StatusText('%s'%(event.object))
    pos=Get_ObjectPos(event.object)
    pos1=(pos[0]+20, pos[1]+20, pos[2])
    teleportToPos(clone, pos1)
    ff.teleportedClones.append(clone)

add the spaces yourself for this part because the site flags spaces as spam.