Page 1 of 2
Bind/glue a jvbot into a truck?
Posted: Sat Apr 24, 2004 7:26 am
by Krane
I'm tryingto bind/glue a jvbot to a truck. I can make him move to the point, crouch and go inside the truck.
Now the problem: this truck follows a path. When it starts the thread, my bot goes straight ahead to the void, he doesn't follow the path/truck. And he goes with different speed..to the void, straight ahead...
Funny is, if I use "glue", he does not go into the truck (he stops at the entrance but he keeps running). If I use bind, he goes inside the truck, turns, holster, etc...The problem is he just...float straigt ahead, ignoring everything...
Help...

Posted: Sat Apr 24, 2004 12:08 pm
by bdbodger
You need to attach the driver or passengers to the truck try this
local.driver = spawn human/multiplayer_allied_airborne_soldier.tik
local.driver.origin = $truck.origin
$truck attachdriverslot 0 local.driver // attachpassengerslot 0
local.driver exec global/disable_ai.scr
local.driver anim opel_driver
local.driver physics_off
I am not sure at the moment how many passenger slots there are 7 or 8 I think .
Posted: Sat Apr 24, 2004 2:33 pm
by Krane
Thanks, bdb but this is not the case
1st, he's not the driver (I already have one, it's working)
2nd, he's a jvbot spawned bot, things works different w/ him...
I have try attach but works like glue (don't work, he don't even got inside the truck). Bind seems to work, as I told, he is able to go inside the truck, etc. The thing is he don't follow the truck's path. Instead, he floats straight ahead...what a trip

script
Posted: Sat Apr 24, 2004 2:48 pm
by tltrude
Hard to say without seeing the script, but you need to wait until he is in before attaching him to a passenger slot and disabling him. The bots use special handling scripts, I think, for things outside the normal bot actions.
Posted: Sat Apr 24, 2004 3:48 pm
by Krane
Of course, my General!
This is the thread that makes the stuff:
Code: Select all
crouch_bots:
$crouch_trigger waittill trigger
for(local.i = 1; local.i <= level.botlastid; local.i++)
{
local.bot = level.actualbots[local.i]
local.node = $bot_spot1
if(isalive local.bot)
{
local.bot animscript global/crouch.scr
local.bot exec global/moveto.scr anim/crouch_run.scr local.node
local.bot turnto $bots_aim
local.bot bind $faketruck_model
local.bot.enableEnemy = 0
local.bot holster
}
}
end
It's a trigger multiple, when they go inside, the thread starts.
Edit: The line "local.node" is displayed improperly here, it's in fact right after:
"...crouch_run.scr local.node"
waittill animdone
Posted: Sat Apr 24, 2004 3:57 pm
by tltrude
Something like this should work.
local.bot waittill animdone
Put it right after the turnto line.
Glue will move the bot to the trucks origin (or whatever origin you use), and make him face the same direction as the origin. Bind will attach the bot to the truck without moving him to its origin. I still don't know why the bot went off the map, unless the truck origin is out there somewhere.
Posted: Sat Apr 24, 2004 4:46 pm
by Krane
Genius, my General!
Actualy, didn't work, BUT you poited me to the problem!
The crouch_run.scr makes him run "til the end". I mean, I was telling him to turn etc, but the run were still "running". Er...not very clear, hope you understand. The waittill animdone was not working coz the anim never ends...Anyway, I used:
local.bot endactionanim
...right after the crouch_run.scr and works

!
But now I'm (the player) not geting binded to the truck

Quite strange indeed...Can you help me on that? I think the problem is the variable "truckspot" I'm using...Here's the actual script:
Code: Select all
main:
local.master=spawn ScriptMaster
local.master aliascache m4l3_truck1 sound/vehicle/Truck_m4l3.wav soundparms 1.1 0.0 1.0 0.0 300 2000 auto streamed maps "dm obj"
local.master aliascache truckdorf_start sound/vehicle/Truck_m4l22.wav soundparms 1.1 0.0 1.0 0.0 300 2000 auto streamed maps "dm obj"
local.master aliascache m4l2_truckidle sound/vehicle/veh_truck_idle.wav soundparms 1.0 0.0 1.0 0.0 300 2000 auto loaded maps "dm obj"
local.master aliascache truckdorf_move sound/vehicle/veh_truck_move.wav soundparms 1.2 0.0 1.0 0.0 300 2000 auto loaded maps "dm obj"
local.master aliascache truckdorf_terrain sound/vehicle/Truck_dorf_terrain.wav soundparms 1.0 0.0 1.0 0.0 300 2000 auto loaded maps "dm obj"
level waittill prespawn
level.script = maps/dm/truckride.scr
exec global/forceanim.scr
thread truck_prep
level waittill spawn
thread truck_enter
end
//***********************************************
truck_prep:
$faketruck_collision solid
$faketruck_collision bind $faketruck_model
$bots_aim bind $faketruck_model
$faketruck_playerspot_1 bind $faketruck_model
$faketruck_playerspot_2 bind $faketruck_model
$faketruck_playerspot_3 bind $faketruck_model
$faketruck_playerspot_4 bind $faketruck_model
$faketruck_playerspot_5 bind $faketruck_model
$faketruck_playerspot_6 bind $faketruck_model
$faketruck_playerspot_7 bind $faketruck_model
$faketruck_playerspot_8 bind $faketruck_model
$fluchtlkw_fahrer.enableEnemy = 0
$fluchtlkw_fahrer notsolid
$fluchtlkw_fahrer rendereffects "-shadow"
$fluchtlkw_fahrer anim_scripted opel_driver
$fluchtlkw_fahrer bind $faketruck_model
$fluchtlkw_fahrer show
level.truckspot = 8
level.jvbot_tasks_priority [follow] = 0
level.alliesbots = 1
level.axisbots = 2
waitthread global/jv_bots/jv_mp_ai.scr::enable 0 0 0 0
//****************************************************
truck_enter:
$fluchtlkw_trigger waittill trigger
level.intruck = 1
// iprintln "10"
// wait 2
// iprintln "8"
// wait 2
// iprintln "6"
// wait 2
// iprintln "4"
// wait 2
// iprintln "2"
wait 2
iprintln "0"
$truckhatch playsound m2l1_gate_open
$truckhatch speed 20
$truckhatch moveDown 76
$truckhatch waitmove
$truckhatch playsound door_metal_close_stop4
$truckhatch stopsound
wait 2
thread truck_sound_entry
$faketruck_model anim idlelights
$faketruck_collision notsolid
wait 1
thread intro_truck_jitter
thread truck_sound_road
$faketruck_model followpath $truck_wp01
$faketruck_model waitmove
thread truck_sound_wait
$faketruck_collision solid
level.intruck = 0
wait 3
thread truck_sound_entry
thread truck_sound_road
$faketruck_model followpath $truck_wb01
$faketruck_model waitmove
thread truck_sound_wait
$faketruck_model anim idlenolights
wait .5
$truckhatch playsound m2l1_gate_open
$truckhatch moveUp 76
$truckhatch waitmove
$truckhatch playsound door_metal_close_stop4
thread truck_sound_end
goto truck_enter
end
//***********************************************************
//the thread to glue players
truck_glue:
local.player = parm.other
local.player glue $("faketruck_playerspot_" + level.truckspot)
wait .5
level.truckspot--
local.player forcelegsstate CROUCH_IDLE
local.player physics_off
while(level.intruck == 1)
waitframe
local.player physics_on
local.player unglue
level.truckspot++
end
//*****************BOTS***************************
// Bot, got to the front of the grate (No probs here!)
bot_go1:
$botgo_trigger waittill trigger
for(local.i = 1; local.i <= level.botlastid; local.i++)
{
local.bot = level.actualbots[local.i]
if(isalive local.bot)
{
local.bot runto $crouch_position
iprintln "level.truckspot "(level.truckspot)
}
}
end
// Bot, go inside the truck (Lots of probs here...)
crouch_bots:
$crouch_trigger waittill trigger
for(local.i = 1; local.i <= level.botlastid; local.i++)
{
iprintln "1level.truckspot "(level.truckspot)
local.bot = level.actualbots[local.i]
local.node = $("faketruck_playerspot_" + level.truckspot)
if(isalive local.bot)
{
local.bot animscript global/crouch.scr
local.bot exec global/moveto.scr anim/crouch_run.scr local.node
wait 2
local.bot endactionanim
local.bot turnto $bots_aim
local.bot bind $faketruck_model
local.bot holster
level.truckspot--
iprintln "2level.truckspot "(level.truckspot)
while(level.intruck == 1)
{
iprintln "3level.truckspot "(level.truckspot)
waitframe
level.truckspot++
local.bot unbind
local.bot.enableEnemy = 1
local.bot unholster
iprintln "4level.truckspot "(level.truckspot)
}
}
}
end
I don't know if this is ok...And I'm not using the $bot_spot1 anymore...I'm tryingto use the same method the players use ($"faketruck_playerspot_" + level.truckspot)
truck_glue
Posted: Sat Apr 24, 2004 6:38 pm
by tltrude
Looks ok to me. Make sure your trigger has "setthread truck_glue". And that you have a "faketruck_playerspot_8" entitiy in the map.
Posted: Sat Apr 24, 2004 9:47 pm
by Krane
Yeah, I have a trigger setthread truck_glue...And I have a faketruck_playerspot_8 too.. I feel like I'm glued to the fake_truck and the real truck goes away...I'll texture the fake truck to check it again...
Thanks again, I'll come up w/ more...for sure

Posted: Sun Apr 25, 2004 2:32 am
by tltrude
Have you tried this.
local.player glue $("faketruck_playerspot_" + (level.truckspot))
iprintln "Player glued to faketruck_playerspot_" (level.truckspot)
Posted: Sun Apr 25, 2004 4:12 am
by Krane
No, but I should. I putted some iprintl on other places but forgot there. I will...
Meanwhile, some explanations:
1)
level.truckspot++
means the same as:
level.truckspot = ((level.truckspot) + 1)
?????
And another one:
2) How to completly stop/freeze an animation? I'd like the bot to do only the idle/crouched anim and nothing else. Seems easy, but I could spot (while the truck were going out) that, after a few seconds, the binded bot started the crouch_run animation again...

On the other hand the "local.bot endactionanim" seems to do the job...
I'm kind of confused

yes
Posted: Sun Apr 25, 2004 7:47 am
by tltrude
Yes, "++" adds one to the value, and "--" subtracts one from the value.
I don't know much about AI anumation and even less about bot animation--if there are ones just for bots. Small_Sumo might know, he has made some new animations for AI in the past.
Posted: Sun Apr 25, 2004 3:55 pm
by Krane
Thanks, my General. It's far easy this ++ -- method (save some fingerprints...what am I saying, I'm musician LOL)
I saw some summo's maps, yeah he handles animations pretty well, hope he sees this topic. Actualy, was from a
summo's topic where I learn how to get an AI thru script. But I'm affraid jv is the guy, coz there some little details in this thing that only the maker can answer.
For ex, how to completly disable the AI...The disable_ai.scr is ridiculos, it just disable the AI towards the enemy and nothing else. I want something that completly stops an animation. The "endactionanim" is not working the way I want, or I'm not using the proper way, dunno...The AI now binds to the truck but, when I shoot him, his body still goes straight ahead like I said before.
Oh, another thing: the AI glue thread (crouch_bots) is not working like the player thread (truck_glue)! They are similar threads but, in the truck_glue the level.truckspot is indeed adding/subtracting 1 to the variable. But in the crouch_bots a funny thing happen: when the bot goes inside the truck, the variable downs 6 points, from level 8 to 2

...gr...I'm affraid it's affecting the other bots in the map...
Lots of questions

...
Posted: Mon Apr 26, 2004 7:12 am
by Krane
Ok, let's make it simple:
I have this thread:
bot_go1:
$botgo_trigger waittill trigger
for(local.i = 1; local.i <= level.botlastid; local.i++)
{
local.bot = level.actualbots[local.i]
local.node = $("faketruck_playerspot_" + level.truckspot) // HERE?
if(isalive local.bot && local.bot.dmteam == axis)
{
local.bot runto $crouch_position // TRUCK ENTRANCE
local.bot waittill movedone // COOL, HE'S WAITING
local.bot holster //COOL, HE HOLSTER INDEED
local.bot exec global/moveto.scr anim/crouch_run.scr local.node //OK
level.truckspot-- // <--- IT'S LOWERING BY 3 POINTS INSTEAD OF 1
}
}
end
The level.truckspot starts at 8 and drops to 5...Why? Maybe coz there's 3 players in the map? The bots are set like:
level.alliesbots = 1
level.axisbots = 2
But, in the other hand, if I add 1 more axis like:
level.alliesbots = 1
level.axisbots = 3
the level.truckspot drops by 8 every time I run the thread (goes to 0)...and the 1st bot stops in the entrance of the truck (when the 2nd spawns)...and the 2nd bot stops too...and the level.truckspot goes to -8...
Really confused guy here

test
Posted: Mon Apr 26, 2004 8:31 am
by tltrude
I think the problem is with "level.botlastid", shouldn't it say like "level.botlastid.size" or something? Maybe moving the "level.truckspot--" outside the "if" brackets would work.