• Welcome to Freedom Reborn Archive.
 

how to spawn at selected hero's location

Started by bearded, April 29, 2007, 09:40:32 AM

Previous topic - Next topic

bearded

def Call_BatSignal(spawnName, dude):
heronum = len(heroesList)
if heronum == 1:
heroList = GetBatList()
randMarker = randint(1, 4)
gotoMarker = "hero_" + `randMarker`
dude = heroList.pop(randint(0, len(heroList)-1))
spawnName = "hero_"+`dude` 
Object_Spawn(spawnName, dude, gotoMarker)
Campaign_AddHero(dude)

this code works perfectly.  if i can't get a spawn at the hero's spot, how to get the spawn at the police station?
i can't open the  mission in ffedit due to sp2, so i don't know the exact name of the building.  if my system has winxp with sp2 preinstalled, what's the best way to be rid of it?  i have a cd with winxp pre sp2, but it won't let me install over, without deleting windows first, which it will not let me do.

Epimethee

To know the name of the building without using FFEdit, you could use Mission_GetStartingObjects() from Stumpy's DATFiles module from either the in-game console or a external Python editor.

As for XP SP1, maybe virtualisation? Either SoftWindows or VMWare Something.

bearded

for anyone looking for non sp2 windows, the thing to do is a parallel install, if you have the drive space.

as for spawning;  i'm still somewhat lost.  now i have old xp, i can open missions, so i can actually make new markers, but what if i want to spawn at the hero?  is it possible to have markers that move and follow the hero?
i think it has something to do with 'get object position' and event object, but i'm confused by the python logic.  how many variables can exist when i def something?  do i need to call a new def with each variable?
i appreciate the help.
by the way, batman, or one of the bat family, now spawns on top of the police station when you click on the station!  the only thing that would make it perfect would be a batsignal fx.
i did this with the xmen and the school as well, and angel appeared on top of the school!

Epimethee

> is it possible to have markers that move and follow the hero?
In FFvsTTR, it is. Example (not tested):

#spawn a character at the same position as the target (!)
def spawnAtCharPos(char, template, target):
    marker = 'marker_%s' % char
    pos = Get_ObjectPos(target)
    orientation = Object_GetOrientation(target)
    if Marker_Exists(marker):
        Marker_SetPos(marker, pos, orientation)
    else:
        Marker_Spawn(marker, pos, orientation)
    Object_Spawn(char, template, marker)


> how many variables can exist when i def something?  do i need to call a new def with each variable?
The short answer: each "def ...():" (they're referred to as "functions" or, in specific circumstances, as "methods") can hold as many variables as you want.

However, if you need a variable outside of a function, you need to either pass it to another function directly (using return variablename), through an event (those regTimer() parameters), declare the variable as being global (which is problematic with saving/loading games, as loading resets global variables) or save it usng Mission_SetAttr(), Object_SetAttr() (or its safer variant FFX_ObjectSetAttr()) or Stumpy's missionobjvar module functions.

A good answer would be way outside the scope of a forum post and of my capabilities. I'd suggest having a glance at one or two of the the various Python tutorials available on the Web. My personal choice would be the first few chapters of "How to Think Like a Computer Scientist: Learning with Python" at http://www.ibiblio.org/obp/thinkCSpy/ (HTML) or http://greenteapress.com/thinkpython/thinkCSpy.pdf