Scripts / Let's play 'challenge the guru'. I'm probably going to regret this!

Author
Message
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 31st Dec 2017 17:10
Because I'm really really bored and stuck in tonight, I'm open to a challenge or three.

So if you have a particular scripting challenge, something you maybe think can't be done or just something you've not been able to figure out, fire away.


Been there, done that, got all the T-Shirts!
PM
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 31st Dec 2017 18:41
Hmmmm I have started another board game and I need a dice roll script A six sided die with 1 to 6 I have a model and I can roll it but I cannot get the face value ie what number is face up.

so I am now trying decals instead that should choose a number at random display it on screen and then allow the player to move that many squares.

I started this the same time I started the chess set but when it was brought to light that multiplayer won't work properly I abandoned it so I am now thinking of creating an AI to play against the player
Welcome to the real world!
Main PC - Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Test PC - Windows 10 Pro x64 - G4400 @3.3GHz - 16GB DDR3 RAM - GeForce GTX 950 2GB - 500GB SSD
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 31st Dec 2017 18:58 Edited at: 31st Dec 2017 19:00
If you have a dice model already then simply use the current angles to work out which number is 'up'.

In the utils library is a function called Rotate3D(x,y,z,xa,ya,za), let's say that with all three angles at zero the dice shows a 1 on top and that this represents the vector (0,1,0).

Now let's say the dice has been rolled and we want to find out where the '1' face is, simply call Rotate3D with the 'known' vector (0,1,0) and the Euler angles then use the resulting vector to work out where the '1' is now. With a bit of math we can work out from where the '1' is which face is actually showing 'up'.

Attach the dice and I'll write a script for this. (sounds like a cool little challenge!)
Been there, done that, got all the T-Shirts!
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 31st Dec 2017 18:59
it depends how you were planning to roll the dice but if you do it via forced rotation (i.e. not using GG physics) for the dice you can get what rotation it is to find the result, because dice must lie flat you will only get 1 result (at least in a proper, unobstructed roll).

so assuming a normal cube set at 0,0,0
x = 0, y = 0 z = 0 is the top number.
x = 90 or -90 while y = 0 and z = 0 is the forward or back number
z = 90 or -90 while y = 0 and z = 0 is the side numbers
(the above is interchangeable depending on viewing angle).
and
x = 180 or z = 180 while the other 2 are 0 is the bottom number

so as you can see Y shouldnt really matter as this just makes the number not look straight and you just use the other 2 to determine the number.
spin it around in your modelling program or GG to find what rotation you need for the others but it should be in 90 degree rotations so wouldn't be hard to find them all.

at least in theory that should be correct, i haven't actually tested it
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 31st Dec 2017 19:18
I'm just going to play some party games with the kids will fire up pc and post the die when they have gone bed
Welcome to the real world!
Main PC - Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Test PC - Windows 10 Pro x64 - G4400 @3.3GHz - 16GB DDR3 RAM - GeForce GTX 950 2GB - 500GB SSD
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 31st Dec 2017 19:19 Edited at: 31st Dec 2017 19:22
not sure how long or much time you are planning to spend on the challenge @amen but an ally partner is always something that would be a nice addition - something along the lines of RE revelations 2
so basically;
1 ally that follows you around, can shoot and/or melee, pick up or point out nearby items and use them to heal you or give you extra ammo.
if you want to be super advanced with it you can expand it to an inventory script (1 for you and 1 for the ally).
and if you want to be super, super advanced than you can expand into the character swap feature perhaps (doubt GG will like that though).

i've started on the basics a few times before but always got distracted.
p.s. it isn't for me personally, i don't really need it as i have no projects in GG but just think it'll be cool to see it done... but something to consider if you don't get any other suggestions

if you're thinking of shorter/quicker challenges than maybe something more along the lines of adding to the AI - like opening/using and locking doors, climbing ladders, jumping obstacles etc (there are animations for climbing ladders and jumping in the stock soldiers).
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 31st Dec 2017 20:03
I've started looking at the AI scripts recently (again) but can't get my head around the way Lee has put things together. I was hoping by staring at it long enough it might just suddenly come to me in a flash of revelation .. 'Aha, that's why he did x ..' but all I get is 'why is he doing it that way?'.

For me the biggest piece of the jigsaw that is missing is the physics side, at the moment it is just hopelessly unpredictable as to how physical interactions will behave, entities are as equally likely to pass through each other as they are to bounce apart from each other like a bomb going off!

Been there, done that, got all the T-Shirts!
PM
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 31st Dec 2017 20:23 Edited at: 31st Dec 2017 20:26
OO ai yummy flying, climbing, super jumping, healing, chatting toons hmm ok we can wish lol and with thier own inventory *drools* Rofl
a nice sprite inventory would be nice though wilipoldi started one and disapeared of the face of gg I have a basic one running but am completely useless at sprites etc atm
Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 31st Dec 2017 20:37 Edited at: 1st Jan 2018 01:07
Thought you were happy with the speech bubbles approach?

Healing should be easy enough for anyone to do, just add health on some trigger.

Super jumping will need physics, or at least the ability from Lua to do something with the physics engine in a more controllable way.

Climbing would need some animated hands for FP and more TP fixes, I still can't make head or tail of Lee's TP 'fixes', if anything it now seems completely useless to me.

Haven't we got enough flying scripts by now? Anyhow for TP again we need proper flying animations.
Been there, done that, got all the T-Shirts!
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 31st Dec 2017 23:03 Edited at: 31st Dec 2017 23:43


Now that's how you throw dice!

For my particular 'dice' this is the code:



I did say it was easy didn't I?
Been there, done that, got all the T-Shirts!
PM
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 31st Dec 2017 23:26 Edited at: 31st Dec 2017 23:27
yeah m8 happy with the bubbles they are cool Just need 5 mins and the teenage daughter to calm down after new year and my brain might normalise lol
Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
AMD Radeon 7570 1gb AMD Radeon HD 6670 2gb
and a well fed mouse on a wheel

I only smile because i have absolutely no idea whats going on
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 31st Dec 2017 23:42
"Normalise"? What does that mean, strange human term does not compute, main processor meltdown ... critical core failure ...
Been there, done that, got all the T-Shirts!
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 31st Dec 2017 23:58
Btw the code I posted above is an example of using 'unit vectors' in decision making logic, if you didn't understand my original 'how to do it' explanation for the dice problem examining the code might help that understanding somewhat, or not, maybe.

Deep in the bowels of all 3d engines this sort of thing goes on billions of times per second at such a low level that GPUs are specified by how many individual 'vector' processors they contain or by how many parallel vector calculations they can execute per second. If you can produce code that looks like this for things like AI decision trees or game flow state-engines then it can all eventually be farmed out to super fast GPUs. The only downside being that your brain turns to mush and the alcohol bill becomes the limiting factor to creativity. (not in my case however, I'm totally sober, honestly!)
Been there, done that, got all the T-Shirts!
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 1st Jan 2018 00:29
I'm classing this as a success. Happy New Year btw. Kept me from dying of boredom at least.

'Sprite Inventory' was mentioned so here are a few words about that:

This comes up a lot (in fact it may even still be on the voting board) but makes no sense to me at all. Any inventory is going to be extremely game specific, it is almost impossible to generalise such a generic term as 'Inventory' which let's face it is a fancy term for 'list'.

'List' or 'Table' IS the only data structure in Lua, you get them for free by virtue of the fact that we have Lua as our scripting language! So by learning Lua you intrinsically will learn how to both implement and manipulate lists/tables so asking me to script an inventory system is virtually the same as asking me to create a Lua script that does Lua!

Now adding 'Sprite' means that you want me to write a script that does 'Lua' and in addition allows handling of 'Sprites', which is a fundamental part of the engine already! Learn how to manipulate sprites in GG and also learn Lua and you can't help but be teaching yourself how to implement an inventory using sprites!

I could simply say, ok give me sprite files for all the items you want to put in the inventory, give me images for the inventory holder itself (assuming you have something in mind that's more complex than a simple panel) and lastly give me all the 'actions'/key bindings/mouse selections you want to act upon said inventory and I'll provide a generic (or as generic as I can make it) template for an inventory system.

I reckon if you can come up with all those pre-requisits yourself then you can probably also come up with the few lines of glue-code to hang it all together!
Been there, done that, got all the T-Shirts!
PM
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 1st Jan 2018 10:51 Edited at: 1st Jan 2018 11:16
Thanks for this Amen think I am being very stupid I cannot get it to work I want the player to press a key (E at the moment) and the die will roll ive tried adding your code but its crashing GG lol.

I have attached my die to this post, I am learning LUA but its more difficult than modelling


oops sorry forgot my code



This should return the numbers but its wrong I cannot code for toffee lol I just wanted to see if it would work, now you can see why I put it to one side lol
Welcome to the real world!
Main PC - Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Test PC - Windows 10 Pro x64 - G4400 @3.3GHz - 16GB DDR3 RAM - GeForce GTX 950 2GB - 500GB SSD

Attachments

Login to view attachments
Tarkus1971
Audio Media Maker
9
Years of Service
User Offline
Joined: 24th Feb 2015
Location: England, UK
Posted: 1st Jan 2018 13:37
ok, how about a pickup, carry and drop script, with the collision working and no juddering entities when it's being carried. I'm not sure if this is possible at all.
Aftershock Quad Core AMD FM2+ 3.5 GHz 8GB Motherboard and Processor, A7700k apu, Asus GT970 STRIX 4gb Nvidia gfx card.
King Korg Synth, Alesis SR18 Drum Machine, Akai MPX8 sample player, Roland Fantom XA Synth, Axus Digital AXK2 Digital Drum Kit, Novation Ultranova Synth, Waldorf Blofeld Synth, Bluedio Vicotry V Headphones, AKG K141 Studio Headphones, Lenovo Ideapad, with Windows 10 64bit, 8Gb Ram and AMD A10 7th Gen Graphics.
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 1st Jan 2018 14:47 Edited at: 1st Jan 2018 14:48


This little exercise perfectly demonstrates my frustration with GG physics. As long as I do not attempt to reposition the dice via Lua commands (SetPosition/ResetPosition) physics works reasonably well, the dice react reasonably realistically to forces applied via weaponry at least, but any attempt to use positional commands seemingly disconnects the entity from the physics engine.

I've pestered Lee on many occasions to improve the physics side or at least to present an explanation somewhere as to what the limitations currently are and if any workarounds exist but no luck, I just get told 'voting board'.

Grrr.
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 1st Jan 2018 14:53
Did that ages ago:



Should still be around here somewhere.
Been there, done that, got all the T-Shirts!
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 1st Jan 2018 16:10 Edited at: 1st Jan 2018 16:52
if you move something using SetPosition then you should call ResetPosition (and same for SetRotation and ResetRotation) to update the physics to match its new location/rotation

nice script amen

not a very good "roll" but may help point you in the right direction


lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 1st Jan 2018 16:53
Ahh, so you have to call both functions. I wondered why there were two commands that seemed to both do the same thing!

I'll have a play with that.
Been there, done that, got all the T-Shirts!
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 1st Jan 2018 17:17
Well I'll be ...




Now all we need is better control of 'friction'!
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
Solar
7
Years of Service
User Offline
Joined: 11th Apr 2017
Location: South Africa
Posted: 1st Jan 2018 17:21
Hi AmenMoses!

If you're still up for a challenge, can you perhaps make a script that allows a character to follow a waypoint and then stop at the end of the waypoint?
PM
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 1st Jan 2018 18:33
That's a simple one, take a look in module_combatcore.lua at the function module_combatcore.patrol.

Look for the line that has 'if ai_bot_pointindex[e] > ai_bot_pointmax[e] then', following this is the line that causes the character to turn around at the end of the waypoint sequence, i.e. 'ai_bot_pointdirection[e] = 0'. A few lines later is the logic for the other end of the sequence, i.e. 'if ai_bot_pointindex[e] < 1 then .... ai_bot_pointdirection[e] = 1'.

Work out which corresponds with the end of your waypoint by adding a 'Prompt("Here")' or similar instead of the 'ai_bot_pointdirection[e] =' line then insert a line to trigger whatever you want the character to do next, for example 'ai_bot_state[e] = ai_state_startidle' would cause it to just stop at that point.

Obviously making the change globally would make all characters behave the same so you might want to instead check a variable to trigger it for only a specific character.
Been there, done that, got all the T-Shirts!
PM
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 1st Jan 2018 19:35
You Guys absolutely rock that is brilliant thank you so much

I will finish the board tomorrow and post some pictures so you get the idea of my OUR next Board Game lol
Welcome to the real world!
Main PC - Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Test PC - Windows 10 Pro x64 - G4400 @3.3GHz - 16GB DDR3 RAM - GeForce GTX 950 2GB - 500GB SSD
Pirate Myke
Forum Support
13
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 1st Jan 2018 20:24
Very nice. Thank you.

smallg and AmenMoses minds together equals awesome scripts.

Great job.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit, Screen resolution 1680 x 1050.

Solar
7
Years of Service
User Offline
Joined: 11th Apr 2017
Location: South Africa
Posted: 1st Jan 2018 21:20
@AmenMoses

Thank you so much for the info, you're a genius!

I'll try it out, and thanks for the help, I really appreciate it.
PM
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 3rd Jan 2018 17:25 Edited at: 3rd Jan 2018 17:40
not sure if this would be allowed I have not used the name of the game but this is what I wanted the die for, any hints on how I can read the board numbers ? so that I can move a player to the right number on the board

the player will be a animated character I have nearly completed him

Welcome to the real world!
Main PC - Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Test PC - Windows 10 Pro x64 - G4400 @3.3GHz - 16GB DDR3 RAM - GeForce GTX 950 2GB - 500GB SSD
Bolt Action Gaming
GameGuru Tool Maker
10
Years of Service
User Offline
Joined: 24th Oct 2013
Location: Harrisburg, PA (USA)
Posted: 3rd Jan 2018 17:48
I have a bounty board here if you're interested, AmenMoses:
http://gamegurureport.blogspot.com/p/bounty-board-for-game-guru.html
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 3rd Jan 2018 18:04
@GraPhix: take a look at the chess scripts (can't recall which one) to see how to work out the square from the 3d model. I can adapt that for this board pretty easily I reckon.

@BAG: I had seen that.
Been there, done that, got all the T-Shirts!
PM
Bolt Action Gaming
GameGuru Tool Maker
10
Years of Service
User Offline
Joined: 24th Oct 2013
Location: Harrisburg, PA (USA)
Posted: 3rd Jan 2018 18:18
Amenmoses activates rambo mode?


AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 3rd Jan 2018 18:29
My scene got cut, it was just after that scene where I came in with my toolbox and fixed all the mess he made!
Been there, done that, got all the T-Shirts!
PM
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 3rd Jan 2018 18:33
Lol
I will upload the board if you wish to play with it
Welcome to the real world!
Main PC - Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Test PC - Windows 10 Pro x64 - G4400 @3.3GHz - 16GB DDR3 RAM - GeForce GTX 950 2GB - 500GB SSD
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 3rd Jan 2018 18:35
Ok, fire away.
Been there, done that, got all the T-Shirts!
PM
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 3rd Jan 2018 19:27
Thank you
Welcome to the real world!
Main PC - Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Test PC - Windows 10 Pro x64 - G4400 @3.3GHz - 16GB DDR3 RAM - GeForce GTX 950 2GB - 500GB SSD

Attachments

Login to view attachments
granada
Forum Support
21
Years of Service
User Offline
Joined: 27th Aug 2002
Location: United Kingdom
Posted: 3rd Jan 2018 19:49
Don’t often come over here ,but this is great work cooperation going on between you guys.

Dave
Windows 10 Pro 64 bit
GeForce GTX 1050 Ti
AMD FX (tm)-9590 Eight-core Processor
31.96 GB RAM
1920x1080,60 Hz
PM
Earthling45
7
Years of Service
User Offline
Joined: 3rd Sep 2016
Location: Zuid Holland Nederland
Posted: 3rd Jan 2018 19:55
After all the shooting and throwing it should look more like this

Attachments

Login to view attachments
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 3rd Jan 2018 21:46 Edited at: 3rd Jan 2018 21:49
Made a start, hopefully you can work out from the scripts how to use it.



What I'll look at tomorrow is making the piece slide up the ladders and down the snakes.
Been there, done that, got all the T-Shirts!

Attachments

Login to view attachments
PM
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 3rd Jan 2018 22:32
Awesome I will have a play with the scripts thank you
Welcome to the real world!
Main PC - Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Test PC - Windows 10 Pro x64 - G4400 @3.3GHz - 16GB DDR3 RAM - GeForce GTX 950 2GB - 500GB SSD
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 4th Jan 2018 13:08
Meet Ruby (Player 1) she likes to play games

Welcome to the real world!
Main PC - Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Test PC - Windows 10 Pro x64 - G4400 @3.3GHz - 16GB DDR3 RAM - GeForce GTX 950 2GB - 500GB SSD
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 4th Jan 2018 15:46
Very elfy looking. Obviously a Geordie going by the dress sense.
Been there, done that, got all the T-Shirts!
PM
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 4th Jan 2018 15:57
LOL I'm adding animations now, also the AI is a pig lol I need her to move to the dice throw ie throw a 5 she walks to square 5 I am looking at your scripts now, how do I pass the result of the die to the character?
Welcome to the real world!
Main PC - Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Test PC - Windows 10 Pro x64 - G4400 @3.3GHz - 16GB DDR3 RAM - GeForce GTX 950 2GB - 500GB SSD
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 4th Jan 2018 16:43 Edited at: 4th Jan 2018 16:45
In the 'piece' script which should end up attached to 'elfy' I have put a placeholder bit of code to generate a random number from 1 to 6, instead this needs to have the value passed from the dice script.

You will need 'elfy' to have states and switch between them, so 'throw dice' for example would be a state and whilst in that state the script will wait for the throw to complete (in the dice script you would need to detect when the x,y,z and rotation values are stable for a certain amount of time and class that as 'complete') and call the piece script to make the move.

Once the initial move is completed there needs to some detection code to sense whether a snake or ladder square is landed on and if so move to 'climb ladder' or 'slide snake' state.

Eventually the script should return to the 'throw dice' state and the whole think repeats.
Been there, done that, got all the T-Shirts!
PM
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 4th Jan 2018 17:25
ermmm ok I will give it a try

Ok we have 4 players now Ruby, Emerald, Sapphire and little Topaz Ruby is annoyed at me now LOL the others wont leave me alone

Welcome to the real world!
Main PC - Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Test PC - Windows 10 Pro x64 - G4400 @3.3GHz - 16GB DDR3 RAM - GeForce GTX 950 2GB - 500GB SSD
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 4th Jan 2018 19:30
So to correct my previous post: " ... if so move to 'twerk ladder' or 'shimmy snake' state."

Been there, done that, got all the T-Shirts!
PM
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 4th Jan 2018 19:35
Quote: "So to correct my previous post: " ... if so move to 'twerk ladder' or 'shimmy snake' state.""


LMAO I have added all animations now just going to tidy them up a bit then have ago at this coding malarkey thingamajick
Welcome to the real world!
Main PC - Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Test PC - Windows 10 Pro x64 - G4400 @3.3GHz - 16GB DDR3 RAM - GeForce GTX 950 2GB - 500GB SSD
Blacknyt46
8
Years of Service
User Offline
Joined: 29th Feb 2016
Location:
Posted: 4th Jan 2018 22:18
Looks Good! LoL!!!
Jim C
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 5th Jan 2018 14:50
ok think I have all the animations that I need, soooo how do I control say the 'throwing animation' 308,475 so that when 'e' is pressed Ruby does a throw animation and the dice rolls, the problem I am having is getting one script to talk to another can I control Ruby from the dice_throw script?

Welcome to the real world!
Main PC - Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Test PC - Windows 10 Pro x64 - G4400 @3.3GHz - 16GB DDR3 RAM - GeForce GTX 950 2GB - 500GB SSD
AmenMoses
GameGuru Master
8
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 5th Jan 2018 16:03
As I said earlier, you need to have a state engine, basically just a bunch of 'if state == ' checks. The game is controlled by switching states, you can either have one script call a function in another to cause it to change state or have a global variable that each script can check to figure out what the current state
is.

It depends on how you want the game to play out as to the best solution.

Personally I would have two state engines, one for each of the 'players' and another to control the overall game.

Been there, done that, got all the T-Shirts!
PM
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 5th Jan 2018 16:09 Edited at: 5th Jan 2018 16:10
I really wish I could think like you and SmallG, I have taken a lot on in the past 12 months and taught myself a bit of modelling, LUA is very complicated for me I can do basic things I really wish there was a comprehensive LUA manual just for GG, I would really love to get to grips with it, I have edited the slpiece.lua and edited the 'square = square + 4(1,6)' to see if Ruby would walk 4 squares but alas :

Welcome to the real world!
Main PC - Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Test PC - Windows 10 Pro x64 - G4400 @3.3GHz - 16GB DDR3 RAM - GeForce GTX 950 2GB - 500GB SSD

Attachments

Login to view attachments
GraPhiX
Forum Support
19
Years of Service
User Offline
Joined: 15th Feb 2005
Playing:
Posted: 5th Jan 2018 16:19 Edited at: 5th Jan 2018 16:20
I got these to help me get a basic understanding but they don't really help with GG



and no I did not get them from Australia I goofed the picture
Welcome to the real world!
Main PC - Windows 10 Pro x64 - Core i7-7700K @4.2GHz - 32GB DDR4 RAM - GeForce GTX 1060-6G 6GB - 1TB NVe SSD
Test PC - Windows 10 Pro x64 - G4400 @3.3GHz - 16GB DDR3 RAM - GeForce GTX 950 2GB - 500GB SSD

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-04-20 14:25:47
Your offset time is: 2024-04-20 14:25:47