noob needs help modding a vehicle mod

Post » Tue Jun 08, 2010 9:26 am

Hi. I've been working on making a mod to modernize vvardenfell but i'm not really a modder (just learning as I go along, slapping together other mods really for the most part)

everything's been going pretty smoothly except for cars. I found a pretty good working one http://www.elricm.com/nuke/html/modules.php?op=modload&name=Downloads&file=index&req=viewdownloaddetails&lid=3305 and after some alterations to the roads it works really well. unfortunatly, I like to use companion mods and of course also come across the ocasional npc that needs an escort somewhere which is where i come to the problem: they all end up having to run behind me the whole time because the car only holds one person.

I was wondering if anyone could help me with mabe some kind of a script (scripting's all jibberish to me for the most part) that could say, transport like up to 4 companions (i'm intending on using a different car mesh because i'm just not really a porsche guy in case you're wondering how 5 passengers would realisticly fit) to like some otherwise unused cell once i get in the car and then come back once i exit it.

any help would be greatly appreaciated.
User avatar
Tasha Clifford
 
Posts: 3295
Joined: Fri Jul 21, 2006 7:08 am

Post » Tue Jun 08, 2010 6:18 am

With the script extender, what you're talking about should actually be quite feasible.

The first step is to go through NPCs in the current cell (using xFirstNPC and xNextNPC) and figure out which ones are following the player. Once you've found them, you can simply use xSetRef and PositionCell to send them to a temporary storage cell. That all runs when the player gets in the car. When they get out, go through the temporary cell (with xFirstNPC and xNextNPC again, or if you have a known number of possible passengers, use storage variables for the references) and teleport them back to the player. I'm not sure how to find out if they're following, but you have something like:
short inCarlong npcAlong npcBlong npcClong npcDlong tCelllong thisNPCif ( onActivate )    if ( inCar )        Setx tCell To xPCCell        xSetRef npcA        xPositionCell playerCell 0 0 0        xSetRef npcB        ...        Set inCar To 0    else        Setx thisNPC to xFindFirstNPC        whilex ( thisNPC )            if ( GetAIPackage AI_Follow )                Setx npcA To thisNPC                xSetRef npcA                PositionCell "temp cell" 0 0 0                Setx thisNPC to xFindNextNPC            endif        endwhile    endifendif


Obviously just pseudo-code, but it gives the idea. You'll be looking at 3 or 4 times that length, to account for different numbers of NPCs and all, but it should generally work.
User avatar
Terry
 
Posts: 3368
Joined: Mon Jul 09, 2007 1:21 am


Return to III - Morrowind