Add something to node array in level qb

Discuss thug2 modding, post your own, share your ideas, ask questions.
Anteara
Posts: 268
Joined: Thu Oct 14, 2010 2:55 am
Contact:

Add something to node array in level qb

Postby Anteara » Fri Jan 21, 2011 7:00 pm

Hi, simple question, Is there any way to add something to the node array in a level qb? For example in au.qb

I ask this because I've tried to add/remove some things, following the same structure as everything else, yet every time I try to load the level it always crashes.

Thanks.
Morten1337
Posts: 132
Joined: Tue Jun 08, 2010 11:11 pm
Contact:

Re: Add something to node array in level qb

Postby Morten1337 » Fri Jan 21, 2011 7:43 pm

you can't remove a node in the middle of the file unless you replace it.
also if you're adding new nodes then put it at the end of the array.
Anteara
Posts: 268
Joined: Thu Oct 14, 2010 2:55 am
Contact:

Re: Add something to node array in level qb

Postby Anteara » Sat Jan 22, 2011 5:50 pm

Morten1337 wrote:you can't remove a node in the middle of the file unless you replace it.
also if you're adding new nodes then put it at the end of the array.


Thanks, it works great. I've spawned some halfpipes from Boston and cars from skatopia in Barcelona.

Just another question, and I haven't actually tried this, but I assume it would be possible - is there a way to make my own level qb (for example AntearaLevel.qb) with a custom array that would allow spawning of models in all levels from one script? I know that's worded terribly, sorry >_<.

For example, in the $Level_BA$ section of the array in levels.qb, it specifies which level qb it will run off

Code: Select all

:i $qb$ = %s(15,"levels\BA\BA.qb")


If I added another qb there with my own custom array, and set for all levels to use this qb, would it allow spawning of models on all levels from just one file?

I wouldn't be sure how to format it, I guess like this...

Code: Select all

:i $qb$ = %s(15,"levels\BA\BA.qb")
   :i $qb$ = %s(15,"levels\AntearaLevel.qb")


Sorry if this makes no sense, this reply is terribly worded >_<

Edit: I tried it, I also tried it in the extra level qbs area, but it still doesn't load the models so it crashes when I spawn them. Is it possible to do this? /Confused.
Morten1337
Posts: 132
Joined: Tue Jun 08, 2010 11:11 pm
Contact:

Re: Add something to node array in level qb

Postby Morten1337 » Sun Jan 23, 2011 12:23 am

adding two qb parameters will not load 2 files.
But you can use "NodeArrayManLoad" i think.

Code: Select all

:i $NodeArrayManLoad$%s(0,"")
Anteara
Posts: 268
Joined: Thu Oct 14, 2010 2:55 am
Contact:

Re: Add something to node array in level qb

Postby Anteara » Mon Jan 24, 2011 7:41 pm

Thanks.

This next question is related to the OP, so i Figured it would be better to post it here rather than make a new thread.

I haven't been able to figure out how to create a vehicle car mod via the thug1 vehicle qb like you suggested a few months ago, so I tried to do it myself.

Firstly, I'm trying to attach a vehicle to the skater, I've achieved this, but there is an unexpected result.

As soon as I add the vehicle to the skater, I fly in to the air, and can't control my skater. I'll add a video because it's hard to explain.

Anyway, what I did was add this to the BA.qb array

Code: Select all

   :i :s{
      :i $Name$ = $TRG_AntearaCar_01$
      :i $Class$ = $Vehicle$
      :i $Type$ = $ATV$
      :i $model$ = %s(35,"veh\Veh_ATV\veh_ATV.mdl")
      :i $SkeletonName$ = $car$
   :i :s}


and this is the function im using to add the vehicle to my skater

Code: Select all

:i function $Spawn_Try$
:i call $create$ arguments
      $name$ = $TRG_AntearaCar_01$
:i $TRG_AntearaCar_01$.call $Obj_LockToObject$ arguments
   $ObjectName$ = $skater$
:i endfunction


I have absolutely NO idea as to why it makes my skater uncontrollable and fly in the air, any ways to fix this, or any tips?

Thanks.

Here's the video. http://www.youtube.com/watch?v=U-Jk-Q67Tqo
Morten1337
Posts: 132
Joined: Tue Jun 08, 2010 11:11 pm
Contact:

Re: Add something to node array in level qb

Postby Morten1337 » Mon Jan 24, 2011 8:12 pm

My guess is that the skater always wants to be on top.
And since the origin of the vehicle is in the center of the model, then the skater will be inside the vehicle.

So then the skater "teleports" to the top of the vehicle, and then the vehicle model will move with the skater.
This will create an endless loop of making the skater be on the top.
Anteara
Posts: 268
Joined: Thu Oct 14, 2010 2:55 am
Contact:

Re: Add something to node array in level qb

Postby Anteara » Mon Jan 24, 2011 8:38 pm

Morten1337 wrote:My guess is that the skater always wants to be on top.
And since the origin of the vehicle is in the center of the model, then the skater will be inside the vehicle.

So then the skater "teleports" to the top of the vehicle, and then the vehicle model will move with the skater.
This will create an endless loop of making the skater be on the top.


Oh wow! Thank you! That is EXACTLY why it was making me fly, it's fixed now, I put the ATV at the top left of the skater (so it's not in the skater)

Thanks :D

Edit: Now I've run in to another problem, I need the model to be in the center of the skater, as that's the only way to have the model in the center of the camera... But i can't have the model in the center of the skater because it will keep going in a loop, like you said.

So I don't know what to do now, one way I think it might be able to work is if I could make the model the skater itself, as in change the skaters model, but I don't know if that's possible.

Also, sorry for all these noob questions. >:
quazz
Posts: 185
Joined: Sat May 01, 2010 5:57 pm
Contact:

Re: Add something to node array in level qb

Postby quazz » Mon Jan 24, 2011 10:30 pm

Are you just trying to implement driving as in THUG1?
Anteara
Posts: 268
Joined: Thu Oct 14, 2010 2:55 am
Contact:

Re: Add something to node array in level qb

Postby Anteara » Mon Jan 24, 2011 10:35 pm

Either that or something similar, I haven't been able to figure out how it was done in THUG1
quazz
Posts: 185
Joined: Sat May 01, 2010 5:57 pm
Contact:

Re: Add something to node array in level qb

Postby quazz » Mon Jan 24, 2011 10:39 pm

You need to take player_controlled_vehicle.qb and car_scripts.qb from THUG1, decompile them, and then replace all instances of doIf with if and doElse with else in notepad. Compile them, then put them in the THUG2 scripts folder, overwriting the old THUG2 ones.

Code: Select all

   :i call $ToggleUserControlledVehicleMode$ arguments
      $VehicleSetup$ = $customcarsetup$


Morten told me this over the summer so he deserves the credit!! :clap:
Anteara
Posts: 268
Joined: Thu Oct 14, 2010 2:55 am
Contact:

Re: Add something to node array in level qb

Postby Anteara » Mon Jan 24, 2011 10:41 pm

Alright, I'll try it, I only had player_controlled_vehicle.qb decompiled, and I noticed the different in how thug1 does doIf and thug2 does If, also, the main reason why I thought it wouldn't work was because there are a lot of functions in it that aren't defined in thug2 (i think), they must be in car_scripts.qb, I'll post here again if I can get it to work :)
quazz
Posts: 185
Joined: Sat May 01, 2010 5:57 pm
Contact:

Re: Add something to node array in level qb

Postby quazz » Mon Jan 24, 2011 10:47 pm

I had a little trouble getting it to work over the summer actually. If it doesn't seem to do anything then try "createplayervehicle" instead of "toggleusercontrolledvehicle", but only after you try that one first.

Code: Select all

   :i call $createplayervehicle$ arguments
      $VehicleSetup$ = $customcarsetup$


It should be pretty straightforward.... you can replace "customcarsetup" with any of the other setups for different cars (in player_controlled_vehicle) or make your own car setup with another vehicle in the Veh folder. Also, if you pause the game the driving gets messed up.
Anteara
Posts: 268
Joined: Thu Oct 14, 2010 2:55 am
Contact:

Re: Add something to node array in level qb

Postby Anteara » Mon Jan 24, 2011 11:02 pm

quazz wrote:I had a little trouble getting it to work over the summer actually. If it doesn't seem to do anything then try "createplayervehicle" instead of "toggleusercontrolledvehicle", but only after you try that one first.

Code: Select all

   :i call $createplayervehicle$ arguments
      $VehicleSetup$ = $customcarsetup$


It should be pretty straightforward.... you can replace "customcarsetup" with any of the other setups for different cars (in player_controlled_vehicle) or make your own car setup with another vehicle in the Veh folder. Also, if you pause the game the driving gets messed up.


Awesome, Thank you and Morten! It works :) I was actually considering doing this a little earlier, but i was skeptical as i thought it wouldnt work because i couldn't find most of the functions in these qbs anywhere in the THUG2 Qb's, they must be based off the same engine or something :D

Just one thing that's a little wierd, my skater is still "there".. So when i'm driving I can keep doing tricks and stuff >_< But that's okay, I could probably figure it out :) Thanks!
quazz
Posts: 185
Joined: Sat May 01, 2010 5:57 pm
Contact:

Re: Add something to node array in level qb

Postby quazz » Tue Jan 25, 2011 3:12 am

No problem. The skater was in my car too, but you can try using something like $skater$.$die$ I think. I'm not really sure but you've got the basic stuff down. There's a lot of bugs/quirks to work out so just try your best and you can probably make the whole thing smooth using some more functions.
Anteara
Posts: 268
Joined: Thu Oct 14, 2010 2:55 am
Contact:

Re: Add something to node array in level qb

Postby Anteara » Tue Jan 25, 2011 3:38 am

quazz wrote:No problem. The skater was in my car too, but you can try using something like $skater$.$die$ I think. I'm not really sure but you've got the basic stuff down. There's a lot of bugs/quirks to work out so just try your best and you can probably make the whole thing smooth using some more functions.


Yeah I've almost sorted out all the bugs, it seems like the way I was calling the vehicle scripts means that it was completely skipping all the functions that were designed to stop skater physics, kill skater, etc... or something.. :P, I've made a function which does that all, and it works fine now.

Thanks :D

Just going to edit this post, to show you something funny as to how I got rid of the skater appearing when I got off my board. >: I tried like every method I could think of to do it, then I had an out of the box idea that I figured would work, which it does :). The code is just a bit messy, but meh. :)

Code: Select all

:i function $CarMenu01$
:i $testfunc01$
:i $Car_Fix$
   :i call $createplayervehicle$ arguments
      $VehicleSetup$ = $CustomCarSetup$
   :i call $Vehicle_Start$ arguments
      $params$ = $riskblade_params$
      :i $Skater$.$PausePhysics$
         :i $Skater$.$Hide$
:i endfunction

Code: Select all

:i function $testfunc01$
      :i $PlayerVehicle$.$Die$
      :i $PlayerVehicleCamera$.$Die$
      :i $Skater$.$UnsetDriving$
      :i $Skater$.$ReturnBoardToSkater$
      :i $Skater$.$SkaterVehicleOff$
      :i $Skater$.$remove_all_anim_subsets$
      :i $ResetSkaters$
:i endfunction

Code: Select all

:i function $Car_Fix$
   :i $ClearAllWalkingExceptions$
   :i $ClearExceptions$
      :i $Skater$.$BashOff$
      :i $Skater$.$NollieOff$
      :i $Skater$.$PressureOff$
      :i $Skater$.$LandSkaterTricks$
      :i $Skater$.$ResetSwitched$
      :i $Skater$.$ClearTrickQueues$
      :i $Skater$.$DestroyAllSpecialItems$
      :i $Skater$.$SparksOff$
      :i $Skater$.$VibrateOff$
      :i $Skater$.$StopBalanceTrick$
      :i $Skater$.$KillExtraTricks$
      :i $Skater$.call $SetExtraTricks$ arguments
         $NoTricks$
      :i $Skater$.$PausePhysics$
      :i $Skater$.$SkaterLoopingSound_TurnOff$
      :i $Skater$.$TakeBoardFromSkater$
      :i $Skater$.$Obj_ShadowOff$
      :i $Skater$.$ResetRigidBodyCollisionRadiusBoost$
:i endfunction


LOL >_<

Anyway, I've almost fixed all bugs with it now, The only thing I still need to fix is spawnpoints and how it glitches if I go out of bounds. :P

Return to “THUG2 modding”

Who is online

Users browsing this forum: Google [Bot] and 25 guests