Scripts / Animation script issue

Author
Message
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 30th Sep 2014 11:20
Hi everyone
I had done a mobile barrier model, it Works fine, but keep looping in Reloaded, Although I have set in 3ds max to play only once.

Basically the idea is as follow:
a- Mobile barrier go up
b- The jeep passes
c- the barrier go down.

my script... (does not work as expected)




video...



Thanks in advance!

3com
PM
AuShadow
GameGuru TGC Backer
11
Years of Service
User Offline
Joined: 2nd Dec 2013
Location: Australia
Posted: 30th Sep 2014 12:54
On your code there is nothing to stop the code from going through over and over again basically it will continually cycle the code so it see's player not in zone do this code and cycle code again, player still not in zone let's run this code again

PC Specs: Windows 7 home 64-bit, Amd 7900 3gb DDR5 graphics, 8gb DDR3 Ram, Intel i7 3.4ghz

Feel free to visit and edit the public FPSCR resource wiki page: http://fpscrresource.wikispaces.com/home
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 30th Sep 2014 14:12
AuShadow thanks for the tip.
Do you mean, Destroy(e) ???

I Had use it, but nothing change here.

3com
PM
AuShadow
GameGuru TGC Backer
11
Years of Service
User Offline
Joined: 2nd Dec 2013
Location: Australia
Posted: 30th Sep 2014 16:01
Nope I mean you have your code block saying to play a set animation if player is not in zone, that code block will cycle continuously whilest player is out of zone hence the reason why it is doing so now and destroy(e) would destroy the barrier which is not what you want here so you need another variable there like gateup or gatedown, (bear in mind I'm typing this on my phone) so then you would have if gateup == 0 and playerinzone == 1 then, and have it set gateup to = 1 after it plays the gateup animation so that it won't cycle the animation again until after you set gateup = 0 again, let me know how u go with that, would do a script up for you but not so easy on my phone

PC Specs: Windows 7 home 64-bit, Amd 7900 3gb DDR5 graphics, 8gb DDR3 Ram, Intel i7 3.4ghz

Feel free to visit and edit the public FPSCR resource wiki page: http://fpscrresource.wikispaces.com/home
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 30th Sep 2014 18:06
Quote: "bear in mind I'm typing this on my phone"



This is that I've so far (does not work yet)



I missed to mention above the following: (my fault, am sorry)

The meant goal here is not if the player is in zone, but the entity (in this case the jeep). But because I do know how do it, I decided focused it to the player in zone, Temporarily.

a- barriere go up ( play animation from frame 0 to 50)
b- jeep passed
c- barriere go down ( play animation from frame 51 to 100) and stop animation, until some entity ( some vehicle) being nearest to the barrier.

I hope to explaint well this time, if not, please let me know.
Thanks in advance !

3com
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 30th Sep 2014 19:02 Edited at: 30th Sep 2014 19:05
i would suggest something like this







for doing it based purely on the jeep and not the player you would need to use a distance check between the barrier and the jeep (disx = g_Entity["jeep"]['x'] - g_Entity["barrier"]['x'] etc) instead of the plrinzone



also im no modeller so maybe im missing something but why not just reverse the original animation?

i.e. frames 0,50 and then 50,0

life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
AuShadow
GameGuru TGC Backer
11
Years of Service
User Offline
Joined: 2nd Dec 2013
Location: Australia
Posted: 30th Sep 2014 19:07
Smallg is master of helping people with lua for reloaded. You will get this working some things just take a bit of time then you'll go dam how didn't I see that ,

PC Specs: Windows 7 home 64-bit, Amd 7900 3gb DDR5 graphics, 8gb DDR3 Ram, Intel i7 3.4ghz

Feel free to visit and edit the public FPSCR resource wiki page: http://fpscrresource.wikispaces.com/home
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 30th Sep 2014 21:27
Quote: "for doing it based purely on the jeep and not the player you would need to use a distance check between the barrier and the jeep (disx = g_Entity["jeep"]['x'] - g_Entity["barrier"]['x'] etc) instead of the plrinzone"

Yeah, that's the idea.
Thanks for the script smallg

Unfortunatelly still I've problems with, as pic bellow poin to.



Quote: "Smallg is master of helping people with lua for reloaded"

Totally agree.

3com
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 30th Sep 2014 22:39
yes because jeep from my example would need to be replaced with the entity number of the actual jeep (likewise for the barrier)
i.e.
g_Entity["jeep"]['x'] - g_Entity["barrier"]['x']
would be
g_Entity[3]['x'] - g_Entity[4]['x']
if the jeep is object/entity number 3 and the barrier is number 4 (or vice versa as it doesnt really matter if only doing 1 comparison)
you can find the number by holding the mouse over the object in the map editor and looking at the status bar.

and same for all the x/y/z and final distance calculation (you can use the original playerdistance code as an example)

life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 3rd Oct 2014 21:58
Well guys, I had tried all the formulas I can guess without positive results, before comes here, but nothing change here.

I had wrote an script based in the smallg¡s guidelines, as follow...




jepp in editor...



Error message...



It looks like Reloaded does not take the number 7 as ID of the entity (in this case the jeep one), and I do not understand why?.

Perhaps I missed something, but I assume than Reloaded knows all the entities's positions/coodinates, when the game launch (ingame), and the entities's IDs too. Then why it is not able to identify 7 as jeep ID number?.

There is a funtion than loop all the entities in the map and hold all the position/id in any sort of array/table for later use.
Then, why this happens????

Reloaded knows the jeep and barrier ids and coordinates, why does not make a simple matemathical calculations and thrown the results.???

As I said above, I should missed something here.


3com
PM
Jerry Tremble
GameGuru TGC Backer
12
Years of Service
User Offline
Joined: 5th Nov 2012
Location: Sonoran Desert
Posted: 4th Oct 2014 14:20
Wouldn't it be easier to put an "out of order" sign in front of the gate and just drive around it? Just kidding, wish I could help, good luck!

MAME Cab PC: i7 4770@3.4Ghz (passmark 9945), 12GB RAM, Win 8.1/64, GeForce GTX645 (passmark 1898); Shiny new laptop: i7 4800MQ@2.7Ghz (passmark 8586), 16GB RAM, Win 8.1/64, GeForce GTX870M (passmark 3598); Old laptop: i5@2.3Ghz, 8GB RAM, Win 7/64, Intel 3000 graphics
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 4th Oct 2014 17:44
Quote: "Wouldn't it be easier to put an "out of order" sign in front of the gate and just drive around it?"



Sometimes I think so.

3com
PM
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 4th Oct 2014 20:14
after a lot of trial of error (far more than such a simple thing should need) i finally got some sort of code running

firstly i needed to turn off physics for my car to get it to move correctly - this sucked as i could no longer use collision to get it to wait at the gate (however i could still code/force it in by hand if i wanted to but that's more work which i really shouldn't need to do)
but that's why i went with the gate opening early - it does however work ok apart from that (but the car will always go through objects now)
@Lee the new physics are really bad, things refuse to move or just fly / tumble for no reason... hope we get a working version soon

other than that all i did was add back the object check u commented out (plus change a few lines - notably the "else" & "StopAnimation(e) " - along with the animation but that was to make it work with a gate instead of your model however i also replaced the frames so it should work for yours again?)





life's one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 5th Oct 2014 19:23
Done!!

Using PirateMike's models, Cosmic Prophet's models, Reloaded stuff ad my own too, for illustrate pourpose.
Thanks to boths for their amazing models and for share em.

@ smallg
Nice video, you take the point faster!!, thanks for scrips guidelines.

The jeep do a pause, while the Bond1's amazing monitor is scaning it. Thanks Bond1

I need work with textures+ uv wrapping and so on. That's like nighmare for me, but I'll try.




Result:




3com
PM
Old Larry
GameGuru TGC Backer
12
Years of Service
User Offline
Joined: 26th Apr 2012
Location: Bucharest, Romania
Posted: 6th Mar 2015 18:56
Cool those 2 scripts !
One quest : this "mobilebarrier.lua" must use at "main" of both entities (jeep and barrier), or at Jeep only ?
Smile today, tomorrow could be worse

http://bestradiolarry.ro/fpsarea/

"The best forum, game software, operating system or web platform, it's that software which can give you most of the features and speed, not just amazing graphics."
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 6th Mar 2015 20:09
Quote: "Cool those 2 scripts !
One quest : this "mobilebarrier.lua" must use at "main" of both entities (jeep and barrier), or at Jeep only ?"


you would use the script on the barrier and then change this number in this line
Quote: "if g_Entity[113] ~= nil then"
to match the entity number of the jeep (the jeep needs a script to move it)
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
Old Larry
GameGuru TGC Backer
12
Years of Service
User Offline
Joined: 26th Apr 2012
Location: Bucharest, Romania
Posted: 7th Mar 2015 09:58 Edited at: 7th Mar 2015 09:59
Full thanks Smallg !
Now I want to stop the car after she pass the gate (like in your video example, I use a gate).
Here is carmoving.lua what I've use for jeep but still I have no clue how to stop moving after he pass the gate

Smile today, tomorrow could be worse

http://bestradiolarry.ro/fpsarea/

"The best forum, game software, operating system or web platform, it's that software which can give you most of the features and speed, not just amazing graphics."
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 7th Mar 2015 12:49
you have multiple choices

- make it follow a path and stop the path after the barrier (maybe not the easiest to set up though)
- time the movement and make it stop after said time (not perfect as frame rate may cause an inconsistent result)
- set another object at the stop point and stop the car once it reaches this object (easiest solution)
- do a couple checks on distance to the barrier (once it reaches the barrier (closer than the stopping point) set a variable to say 1, then once it reaches a value around the distance you want it to stop check the value is already met (1 in this case) and then stop - this will avoid it stopping before it is past the barrier as the stopping distance alone will be true on both approaching the barrier and passing the barrier - hope that makes sense)

likely other solutions but those are a good start
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
Old Larry
GameGuru TGC Backer
12
Years of Service
User Offline
Joined: 26th Apr 2012
Location: Bucharest, Romania
Posted: 7th Mar 2015 15:12 Edited at: 7th Mar 2015 15:39
Can't make it the truck is g_Entity[1] and the gate is g_Entity[2], the gate work fine, but the truck refuse to pass the gate.
Something it's wrong in my truck script

The code is truncated after edit, appear just the begin and the finish of them !!!!
I put the script in the Attachment
Smile today, tomorrow could be worse

http://bestradiolarry.ro/fpsarea/

"The best forum, game software, operating system or web platform, it's that software which can give you most of the features and speed, not just amazing graphics."

Attachments

Login to view attachments
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 7th Mar 2015 15:58 Edited at: 7th Mar 2015 16:00
almost but you don't want to link the 2

edit, seems the snippets are getting more issues for me too so i'll attach the new script
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11

Attachments

Login to view attachments
Old Larry
GameGuru TGC Backer
12
Years of Service
User Offline
Joined: 26th Apr 2012
Location: Bucharest, Romania
Posted: 7th Mar 2015 17:58 Edited at: 7th Mar 2015 18:06
Working, but have a speed like a fly fight plane

Smile today, tomorrow could be worse

http://bestradiolarry.ro/fpsarea/

"The best forum, game software, operating system or web platform, it's that software which can give you most of the features and speed, not just amazing graphics."
smallg
Community Leader
19
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 7th Mar 2015 18:01
haha just lower the value in the moveforward call
life\'s one big game

windows vista ultimate

i5 @3.3ghz, 4gb ram, geforce gtx460, directx 11
Old Larry
GameGuru TGC Backer
12
Years of Service
User Offline
Joined: 26th Apr 2012
Location: Bucharest, Romania
Posted: 7th Mar 2015 18:35 Edited at: 7th Mar 2015 20:26
Good one, but the truck still have CollisionOff after stop.
HINT for the truck: use Physics on ? = Yes, and Always active ? = Yes (at entity options in the map editor), to put back the CollisionOn after the truck is stop.



See the Attached files with both scripts used in this video
Smile today, tomorrow could be worse

http://bestradiolarry.ro/fpsarea/

"The best forum, game software, operating system or web platform, it's that software which can give you most of the features and speed, not just amazing graphics."

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-12-21 15:01:31
Your offset time is: 2024-12-21 15:01:31