Scripts / play cut scene by pressing E

Author
Message
beanz
8
Years of Service
User Offline
Joined: 27th May 2015
Location:
Posted: 25th Feb 2021 22:33

hello i have a small idea for my game Murmia Moldborn but i can´t figure out how to make the script.
maybe someone can help?

the idea is to have consumables - like potions and such- that the player can eat or drink by pressing E after a small text-prompt.
but instead of an effect on health i want a small cut-scene to be played- preferably with sound.
i have my potion entities and short mp4 clips at 25 fps - with separate sound files to test it.

maybe modified health pickup?
is there a script like that here in the forum or can someone help me to make one?
any help is very much appreciated!
LIFE ON EARTH IS EXPENSIVE BUT IT INCLUDES A FREE TRIP AROUND THE SUN
PM
bluemeenie195
5
Years of Service
User Offline
Joined: 28th Oct 2018
Location:
Posted: 26th Feb 2021 01:39
This should work for an item
PM
bluemeenie195
5
Years of Service
User Offline
Joined: 28th Oct 2018
Location:
Posted: 26th Feb 2021 01:40
g_storyinzone_mode = {}

function storyinzone2_init(e)
g_storyinzone_mode[e] = 0
end

function storyinzone2_main(e)
PlayerDist = GetPlayerDistance(e)
if PlayerDist < 120 and g_PlayerHealth > 0 then
Prompt("Collected potion")
if g_storyinzone_mode[e] ~= nil then
if g_storyinzone_mode[e] == 0 then
g_storyinzone_mode[e] = 1
HideHuds()
if radar_hideallsprites ~= nil then radar_hideallsprites() end
else
if g_storyinzone_mode[e] == 1 then
PlaySound(e,0)
PlayVideo(e,1)
StopSound(e,0)
g_storyinzone_mode[e] = 2
else
if g_storyinzone_mode[e] == 2 then
if radar_showallsprites ~= nil then radar_showallsprites() end
ShowHuds()
Destroy(e)
ActivateIfUsed(e)
g_storyinzone_mode[e] = 3
end
end
end
end
end
end
PM
beanz
8
Years of Service
User Offline
Joined: 27th May 2015
Location:
Posted: 26th Feb 2021 13:03
oh wow bluemeenie195 thank you so much for this!!! i will try it out right away!
LIFE ON EARTH IS EXPENSIVE BUT IT INCLUDES A FREE TRIP AROUND THE SUN
PM
bluemeenie195
5
Years of Service
User Offline
Joined: 28th Oct 2018
Location:
Posted: 26th Feb 2021 13:51

Video goes in sound1 and audio goes in sound 0.

In the videobank folder there is a OGV video and the separate OGG audio file that goes with it to test out


PM
beanz
8
Years of Service
User Offline
Joined: 27th May 2015
Location:
Posted: 26th Feb 2021 14:58 Edited at: 26th Feb 2021 15:02
oh wow bluemeenie195 thank you so much for this!!! i will try it out right away!

edit: yes! it works - player walks into the proximity of the the "potion" video plays and the item is collected- nice! thank you very much!
only thing missing is that the player presses E to pick up instead of the auto-pick-up. the prompt should come at start- not at the end.

like "press E if you want to drink the the green potion" - player presses E and vid plays (showing the "effect" of the potion which is a small hallucination) - after that potion is gone.

maybe i can combine it with a pick-up script somehow?
LIFE ON EARTH IS EXPENSIVE BUT IT INCLUDES A FREE TRIP AROUND THE SUN
PM
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 26th Feb 2021 15:41 Edited at: 26th Feb 2021 15:43
You would need to add a keypress in there try this one I've added the keypress to bluemeenie195's script


Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
XFX R5 2gb 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

Attachments

Login to view attachments
beanz
8
Years of Service
User Offline
Joined: 27th May 2015
Location:
Posted: 26th Feb 2021 18:42
you guys are totally awesome.
thank you very much Honkeyboy!
now i can send players on small trips when they try all the moldy foods and snots of Murmia this will be an awesome feature of my game and ofc i´ll credit you guys.
will try it out right now!
LIFE ON EARTH IS EXPENSIVE BUT IT INCLUDES A FREE TRIP AROUND THE SUN
PM
beanz
8
Years of Service
User Offline
Joined: 27th May 2015
Location:
Posted: 26th Feb 2021 19:17
heyho it works very well!! except one little thing

the player approaches the entity,the prompt pops, player presses e and the vid is played- perfekt.
but the prompt and the item are still there after the cut scene is over.
they vanish correctly after E is clicked again but since atm i do not have any inventory in the game- and not sure if i will- it would be better if the item and prompt just disappears after it was used.
i figure i would have to change the order of the destroy and activate ifused command to before the video command..?


LIFE ON EARTH IS EXPENSIVE BUT IT INCLUDES A FREE TRIP AROUND THE SUN
PM
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 26th Feb 2021 19:25 Edited at: 26th Feb 2021 19:30
yes m8 try Destroy(e) at the end before the end's line 30 sry was running around when i did it here you go
Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
XFX R5 2gb 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

Attachments

Login to view attachments
beanz
8
Years of Service
User Offline
Joined: 27th May 2015
Location:
Posted: 26th Feb 2021 19:46
hey thanks for helping!!!
the item and prompt is still there after the vid played - i tried moving the Destroy(e) command up but it did not change
LIFE ON EARTH IS EXPENSIVE BUT IT INCLUDES A FREE TRIP AROUND THE SUN
PM
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 26th Feb 2021 20:01 Edited at: 26th Feb 2021 20:15
Have you got the script on an item? as from what i can see the script is set up to use a zone. That being the case you could use a zone and if the zone is used just hide the item via its number.
Here you go put this script on a storyzone just in front of your potion, hover your mouse over the potion to get its entity number, change the entity number in the script on line 4 where i have commented to the number of your entity and it should now disappear when used
p.s you will need your potion to have isimobile = yes and physics off as the player will still hit the potion if not.
Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
XFX R5 2gb 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

Attachments

Login to view attachments
beanz
8
Years of Service
User Offline
Joined: 27th May 2015
Location:
Posted: 26th Feb 2021 20:40 Edited at: 26th Feb 2021 20:41
very cool! will put it to use immediately!
and yeah i used it on an item... lol - it even says storyzone... : P
LIFE ON EARTH IS EXPENSIVE BUT IT INCLUDES A FREE TRIP AROUND THE SUN
PM
Honkeyboy
3D Media Maker
8
Years of Service
User Offline
Joined: 16th Sep 2015
Location: Doesnt know half the time ;)
Posted: 26th Feb 2021 21:01
np If you have anything that the potion or item does e.g add health you can also add that to the script. Just bump if you need help with that.
Intel i5 4950 Quad core 3.3ghz AMD FX 6300 x6 cores 3.5ghz(unclocked)
8gb Ram 8gb Ram
XFX R5 2gb 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
bluemeenie195
5
Years of Service
User Offline
Joined: 28th Oct 2018
Location:
Posted: 26th Feb 2021 21:01
Don't know if you seen it, but I posted another one that works by pressing E on the Steam forum.
PM
beanz
8
Years of Service
User Offline
Joined: 27th May 2015
Location:
Posted: 26th Feb 2021 21:11
hey it works wonderfully.
player approaches mold-sandwich and "do you want to eat the moldy pizza?" pops up- player presses E and video plays with trippy pizza scene- after that pizza is gone.
but.. the text prompt still persists until the player clicks e again- or leaves the area. it doesnt re-appear after player left
i´m moving the little destroy command around to no avail
LIFE ON EARTH IS EXPENSIVE BUT IT INCLUDES A FREE TRIP AROUND THE SUN
PM
beanz
8
Years of Service
User Offline
Joined: 27th May 2015
Location:
Posted: 26th Feb 2021 21:13
oh wow bluemmeenie!! will test it right away!! thank you so much!!!
LIFE ON EARTH IS EXPENSIVE BUT IT INCLUDES A FREE TRIP AROUND THE SUN
PM
bluemeenie195
5
Years of Service
User Offline
Joined: 28th Oct 2018
Location:
Posted: 26th Feb 2021 21:14
Try lowering the player distance.

Honkeyboy is right. It's really made for a zone, but keep fooling with it.
PM
beanz
8
Years of Service
User Offline
Joined: 27th May 2015
Location:
Posted: 26th Feb 2021 21:35
it works perfectly! i will give good use to both scripts!!
yay!!
LIFE ON EARTH IS EXPENSIVE BUT IT INCLUDES A FREE TRIP AROUND THE SUN
PM
beanz
8
Years of Service
User Offline
Joined: 27th May 2015
Location:
Posted: 26th Feb 2021 22:57 Edited at: 26th Feb 2021 23:05
https://www.youtube.com/watch?v=JS5TfNcvvsM&feature=youtu.be

as you can see i have bluemmenie195 s script working in the game!
the small cut-scene is not final but it gives an idea. maybe i make all the maggots eatable and each has a slightly worse visual effect lol
i will make many different versions of the script for eatables like this. hehe
the other script will be good for other situations like paintings on the wall that at closer inspection also trigger a cut scene but do not vanish afterwards.

ah and as you can observe in the video there is a little side effect
once the script is done my previously hidden HUD reappears
i solved it by placing another hidehuds triggerzone
like this the HUD is visible for a moment i tried to place it on top of the other zone but it did not hide it
but i think i like this sideffect ... it could be cool if the player gets to see his stats occasionally. hm...
here i go making a custom HUD
LIFE ON EARTH IS EXPENSIVE BUT IT INCLUDES A FREE TRIP AROUND THE SUN
PM
bluemeenie195
5
Years of Service
User Offline
Joined: 28th Oct 2018
Location:
Posted: 27th Feb 2021 00:31
Awesome job !
PM
beanz
8
Years of Service
User Offline
Joined: 27th May 2015
Location:
Posted: 27th Feb 2021 02:12
https://youtu.be/0h568uc8r-M
here is the final scene with sound ! will be fun to do these !
thank you so much guys!!!
LIFE ON EARTH IS EXPENSIVE BUT IT INCLUDES A FREE TRIP AROUND THE SUN
PM
bluemeenie195
5
Years of Service
User Offline
Joined: 28th Oct 2018
Location:
Posted: 27th Feb 2021 16:15
I updated the script and added SOME AmenMoses code to the decal script so you only need one decal for multiple entities now.

I also added a new sound slot in sound slot 2 for the end of the script.

PM
bluemeenie195
5
Years of Service
User Offline
Joined: 28th Oct 2018
Location:
Posted: 27th Feb 2021 16:17
g_storyinzone_mode = {}

function collect_item_play_video_init(e)
g_storyinzone_mode[e] = 0

end
function collect_item_play_video_main(e)
local Ent = g_Entity[e]
PlayerDist = GetPlayerDistance(e)
if PlayerDist < 100 and g_PlayerHealth > 0 then
if video_ShowDecal ~= nil then
video_ShowDecal(Ent.x , Ent.y+ 20, Ent.z , g_PlayerAngX, g_PlayerAngY, g_PlayerAngZ,500)
end
PromptDuration("Press E to collect the potion ",500)
if g_storyinzone_mode[e] ~= nil then
if g_storyinzone_mode[e] == 0 then
g_storyinzone_mode[e] = 1
HideHuds()

if radar_hideallsprites ~= nil then radar_hideallsprites() end
else
if g_storyinzone_mode[e] == 1 and g_KeyPressE == 1 then
PlaySound(e,0)
PlayVideo(e,1)
StopSound(e,0)
g_storyinzone_mode[e] = 2
Hide(e)
ActivateIfUsed(e)
else
if g_storyinzone_mode[e] == 2 then
if radar_showallsprites ~= nil then radar_showallsprites() end
ShowHuds()
PlaySound(e,2)
Destroy(e)

PromptDuration("Collected ",3000)
g_storyinzone_mode[e] = 3
end
end
end
end
end
end

And here is the decal script.

function video_decal_init(e)
--Scale(e, 200)
Hide(e)
end

local timer = 0
local decal = nil

function video_ShowDecal(x, y, z, xA, yA, zA, t)
if decal then
local terrY = GetTerrainHeight(x, z)
if y < terrY + 10 then y = terrY + 10 end
ResetPosition(decal, x, y, z)
ResetRotation(decal, xA, yA, zA)
timer = g_Time + t
end
end

function video_decal_main(e)
if decal == nil then
decal = e
end
if timer ~= 0 then
Show(e)
--CollisionOn(e)
RotateToCamera(e)
if g_Time > timer then
timer = 0
Hide(e)
end
end
end
PM
beanz
8
Years of Service
User Offline
Joined: 27th May 2015
Location:
Posted: 27th Feb 2021 19:10 Edited at: 27th Feb 2021 19:12
very awesome i can´t thank you enough for your help!!
if any of you guys need an illustration please don´t hesitate to contact me.
my deviantart -- https://www.deviantart.com/vaghauk

the script works perfectly. and the decal and the final sound are the cherry on the top!
one thing that happened was that suddenly the wrong video got played in test-mode despite of me having the right paths set. but after reloading game guru and the map it worked normally.

super cool! i´m off creating more vids for all my consumables
LIFE ON EARTH IS EXPENSIVE BUT IT INCLUDES A FREE TRIP AROUND THE SUN
PM

Login to post a reply

Server time is: 2024-04-19 11:28:10
Your offset time is: 2024-04-19 11:28:10