Stanley Sathler Posted December 15, 2014 Share Posted December 15, 2014 Hello guys, Can I change default animation of slothbot when they (bots) are chasing? I mean: by default, the bots walks normally. Since I'm using it on a zombie server, I would like to change it to WALK_drunk animation. Tried to learn the slothboth's code, but didn't find anything. Thanks a lot, Stanley Sathler. Link to comment
Buffalo Posted December 15, 2014 Share Posted December 15, 2014 Well it needs a slight rewrite, as it doesn't use animations currently, only control states. Someone may have already changed it and might share that code. Link to comment
-Blaze- Posted December 15, 2014 Share Posted December 15, 2014 It doesen't need a rewrite . All you have to do is use setPedWalkingStyle when you create the ped. Link to comment
Stanley Sathler Posted December 15, 2014 Author Share Posted December 15, 2014 Yo guys, Didn't know about setPedWalkingStyle() (never heard about before). I'm trying to insert it into the code, but doesn't work properly yet. When the ped (zombie) starts to follow us, on the first second, the animation works, but then changes to normal again. Seems the code is "refreshing" the animation. Maybe I could use a setTimer(), but I'm trying to use the function just one time first. Any idea? By the way, if I get something, I'll back to tell you guys. Link to comment
Ahmed Abo-elezz Posted December 15, 2014 Share Posted December 15, 2014 setPedWalkingStyle Link to comment
Stanley Sathler Posted December 15, 2014 Author Share Posted December 15, 2014 Masry P.S, -Blaze already told the same. As I said, it doesn't work properly. The problem was described above. Link to comment
-Blaze- Posted December 15, 2014 Share Posted December 15, 2014 I made some zombies with it and it worked just fine. use a timer to set the walking style. Example : when the ped is created setTimer(setPedWalkingStyle, 2000, 1, thePed, the ID) Link to comment
manawydan Posted December 15, 2014 Share Posted December 15, 2014 you can try change setPedControlState(in walk) to setPedAnmation(i make my own ai and work) Link to comment
Stanley Sathler Posted December 15, 2014 Author Share Posted December 15, 2014 That's the problem: where? Already tried to add it into the spawn function, including with a tmer, but nothing happens. I'm still having the problem with "refresh" walk animation. Manawydan, did you try? Where you put the function? I already tried to insert it in a lot of functions, and nothing. I really don't know what is happening. Link to comment
MTA Team 0xCiBeR Posted December 15, 2014 MTA Team Share Posted December 15, 2014 I have the same problem, it starts walking as it should, then it changes back to normal. Not sure, but maybe a MTA bug. Link to comment
manawydan Posted December 15, 2014 Share Posted December 15, 2014 try change the event: addEvent( "bot_Forwards", true ) function Bforward () if (isElement(source)) then setPedControlState( source, "forwards", true ) end end addEventHandler( "bot_Forwards", getRootElement(), Bforward ) instead setPedControlState try put setPedAnimation(source,arguments..) and in : addEvent( "bot_Stop", true ) function Bstop ( ) if (isElement(source)) then setPedControlState( source, "forwards", false ) end end addEventHandler( "bot_Stop", getRootElement(), Bstop ) try this: addEvent( "bot_Stop", true ) function Bstop ( ) if (isElement(source)) then setPedControlState( source, "forwards", false ) setPedAnimation(source) end end addEventHandler( "bot_Stop", getRootElement(), Bstop ) Link to comment
manawydan Posted December 15, 2014 Share Posted December 15, 2014 i think setPedControlState and setPedAnimation are not "friends" Link to comment
Stanley Sathler Posted December 15, 2014 Author Share Posted December 15, 2014 We're almost there, manawydan. What occurs at the moment: when they spawn, they're with animation. If you punch them, the animation is stopped and they starts to walk normally again. Also, they don't attack us too when they're with animation. I'll see what I can do about this. Don't want to bother you again, cannot make you read all the code for help me with one thing that I can do by myself (read code). You gave me the first step. Thank you alot. Not only you, but also Blaze, Masry and Buffalo. Link to comment
Anubhav Posted December 16, 2014 Share Posted December 16, 2014 Ok guyz, I figured this. It's realy easy! Go to zombie_server.lua Replace line 6 - 18 with this: if ZombieSpeed == 0 then --super slow zombies (goofy looking) chaseanim = "WALK_drunk" checkspeed = 2000 elseif ZombieSpeed == 1 then -- normal speed chaseanim = "WALK_drunk" checkspeed = 1000 elseif ZombieSpeed == 2 then -- rocket zombies (possibly stressful on server) chaseanim = "WALK_drunk" checkspeed = 680 else -- defaults back to normal chaseanim = "WALK_drunk" checkspeed = 1000 end Link to comment
MTA Team 0xCiBeR Posted December 16, 2014 MTA Team Share Posted December 16, 2014 Anubhav said: Ok guyz, I figured this. It's realy easy!Go to zombie_server.lua Replace line 6 - 18 with this: if ZombieSpeed == 0 then --super slow zombies (goofy looking) chaseanim = "WALK_drunk" checkspeed = 2000 elseif ZombieSpeed == 1 then -- normal speed chaseanim = "WALK_drunk" checkspeed = 1000 elseif ZombieSpeed == 2 then -- rocket zombies (possibly stressful on server) chaseanim = "WALK_drunk" checkspeed = 680 else -- defaults back to normal chaseanim = "WALK_drunk" checkspeed = 1000 end Did you even read the first post? SLOTHBOT, not ZOMBIES resource. Link to comment
.:HyPeX:. Posted December 16, 2014 Share Posted December 16, 2014 Try to set the walking style on every movement action on the clientside, that might work. Link to comment
Stanley Sathler Posted December 17, 2014 Author Share Posted December 17, 2014 Anubhav, you're almost right: yes, I'm trying to modify a DayZ resource. However, use your code won't work properly. Chaseanim was declared, but where it will be used? There is not any occurrence of chaseanim in my zombies.lua. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now