UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

Minecart

broken avatar :(
Created 7 years ago
by divinefury5
0 Members and 1 Guest are viewing this topic.
3,033 views
broken avatar :(
×
broken avatar :(
Location: sh
Date Registered: 4 October 2016
Last active: 7 years ago
Posts
2
Respect
Forum Rank
Fresh Corpse
Primary Group
Member
×
divinefury5's Groups
divinefury5's Contact & Social Links
Hey can someone help me with a script for a moveable minecart when you purchase you will be riding from A to B ? Like in the map Minecraft v1.2 with the  boat.
Thanks for helping
Marked as best answer by divinefury5 7 years ago
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 4 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
Signature
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Hey can someone help me with a script for a moveable minecart when you purchase you will be riding from A to B ? Like in the map Minecraft v1.2 with the  boat.
Thanks for helping

Setup a trigger multiple and target the cart model. Then target a struct where the cart will end up. Then target a script_brushmodel from the cart. Then cut that brushmodel and wrap your cart with it. Place the trigger multiple in the base of the cart, just above the script_brushmodel.


Code Snippet
Plaintext
#using scripts\shared\array_shared;
#using scripts\codescripts\struct;

/*
#####################
by: M.A.K.E C E N T S
#####################
Script:

Add to main in mapname.gsc
cart::init(  );

Add to top of mapname.gsc
#using scripts\zm\cart;

Add to zone file
scriptparsetree,scripts/zm/cart.gsc


//below > stands for autotargets
trigger_multiple at bottome of cart>
cartmodel at starting position>
brush_models wrapping the cart
struct, just one, where you want it to end
###############################################################################
*/

#namespace cart;

function init()
{
level.carttime = 10;//adjust time it takes to get to other station
level.cartloop = true;
carts = GetEntArray("carts","targetname");//triggers
array::thread_all(carts, &CartSetup);
}
function CartSetup()
{
cart = GetEnt(self.target,"targetname");
self EnableLinkTo();
self linkto(cart);
cart LinkPeices();
self thread CartMove(cart);
}
function CartMove(cart)
{
cart.a = cart.origin;
cart.b = struct::get(cart.target, "targetname").origin;
while(1)
{
self waittill("trigger");
self MoveToNext(cart);
wait(.05);
}
}
function MoveToNext(cart)
{
if(Distance(cart.origin,cart.a)<10)
{
cart MoveTo(cart.b,level.carttime);
}
else
{
cart MoveTo(cart.a,level.carttime);
}
wait(level.carttime);
wait(2);//waits so the cart doesn't go back right away
}
function LinkPeices()
{
peices = GetEntArray(self.target,"targetname");
foreach(p in peices)
{
p LinkTo(self);
}
}
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 18 February 2015
Last active: 1 month ago
Posts
63
Respect
Forum Rank
Rotting Walker
Primary Group
Member
My Contact & Social Links
More
×
Blink-420's Groups
Blink-420's Contact & Social LinksBlink-420
Setup a trigger multiple and target the cart model. Then target a struct where the cart will end up. Then target a script_brushmodel from the cart. Then cut that brushmodel and wrap your cart with it. Place the trigger multiple in the base of the cart, just above the script_brushmodel.


Code Snippet
Plaintext
#using scripts\shared\array_shared;
#using scripts\codescripts\struct;

/*
#####################
by: M.A.K.E C E N T S
#####################
Script:

Add to main in mapname.gsc
cart::init(  );

Add to top of mapname.gsc
#using scripts\zm\cart;

Add to zone file
scriptparsetree,scripts/zm/cart.gsc


//below > stands for autotargets
trigger_multiple at bottome of cart>
cartmodel at starting position>
brush_models wrapping the cart
struct, just one, where you want it to end
###############################################################################
*/

#namespace cart;

function init()
{
level.carttime = 10;//adjust time it takes to get to other station
level.cartloop = true;
carts = GetEntArray("carts","targetname");//triggers
array::thread_all(carts, &CartSetup);
}
function CartSetup()
{
cart = GetEnt(self.target,"targetname");
self EnableLinkTo();
self linkto(cart);
cart LinkPeices();
self thread CartMove(cart);
}
function CartMove(cart)
{
cart.a = cart.origin;
cart.b = struct::get(cart.target, "targetname").origin;
while(1)
{
self waittill("trigger");
self MoveToNext(cart);
wait(.05);
}
}
function MoveToNext(cart)
{
if(Distance(cart.origin,cart.a)<10)
{
cart MoveTo(cart.b,level.carttime);
}
else
{
cart MoveTo(cart.a,level.carttime);
}
wait(level.carttime);
wait(2);//waits so the cart doesn't go back right away
}
function LinkPeices()
{
peices = GetEntArray(self.target,"targetname");
foreach(p in peices)
{
p LinkTo(self);
}
}

Awesome :) Question though. Is there a way to make this go say in a circle. For example, go half around a city block, stop then when used again going back to the beginning?
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 4 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
It's a very simple script and is only setup currently to go from one point to the next, then back, in a straight line.

If your going to make turns I'd recommend learning more about vehicle nodes. I've used structs before, and it is possible. If it is the better solution for you to use structs, I would set them up as the target of each, turning them as it goes around the track. Then in script turn the cart to the next structs angle over the time it takes the cart to get there, continuing this until you have defined a kvp that says to stop. In the end you would have a loop of structs as each the target of the previous, with two of them having kvps to stop it. MoveToNext function would be edited to make this happen. I would suggest a while loop, that checks for that kvp. When defined and equal to stop, it would stop. In the while loop I would get the distance to the next struct, which would be the target of the current struct, and the angle of the next struct. Rotate to that angle and move to that struct, track the last struct, and wait the time it takes.
broken avatar :(
×
broken avatar :(
Location: nl
Date Registered: 8 November 2016
Last active: 4 years ago
Posts
6
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
×
Snprym's Groups
Snprym's Contact & Social LinksSnprymUCsYL3_WMXeE5K4sgjumgFsg
as a noob, how do i " target" a model? Do i make a new kvp target?
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 18 February 2015
Last active: 1 month ago
Posts
63
Respect
Forum Rank
Rotting Walker
Primary Group
Member
My Contact & Social Links
More
×
Blink-420's Groups
Blink-420's Contact & Social LinksBlink-420
Setup a trigger multiple and target the cart model. Then target a struct where the cart will end up. Then target a script_brushmodel from the cart. Then cut that brushmodel and wrap your cart with it. Place the trigger multiple in the base of the cart, just above the script_brushmodel.


Code Snippet
Plaintext
#using scripts\shared\array_shared;
#using scripts\codescripts\struct;

/*
#####################
by: M.A.K.E C E N T S
#####################
Script:

Add to main in mapname.gsc
cart::init(  );

Add to top of mapname.gsc
#using scripts\zm\cart;

Add to zone file
scriptparsetree,scripts/zm/cart.gsc


//below > stands for autotargets
trigger_multiple at bottome of cart>
cartmodel at starting position>
brush_models wrapping the cart
struct, just one, where you want it to end
###############################################################################
*/

#namespace cart;

function init()
{
level.carttime = 10;//adjust time it takes to get to other station
level.cartloop = true;
carts = GetEntArray("carts","targetname");//triggers
array::thread_all(carts, &CartSetup);
}
function CartSetup()
{
cart = GetEnt(self.target,"targetname");
self EnableLinkTo();
self linkto(cart);
cart LinkPeices();
self thread CartMove(cart);
}
function CartMove(cart)
{
cart.a = cart.origin;
cart.b = struct::get(cart.target, "targetname").origin;
while(1)
{
self waittill("trigger");
self MoveToNext(cart);
wait(.05);
}
}
function MoveToNext(cart)
{
if(Distance(cart.origin,cart.a)<10)
{
cart MoveTo(cart.b,level.carttime);
}
else
{
cart MoveTo(cart.a,level.carttime);
}
wait(level.carttime);
wait(2);//waits so the cart doesn't go back right away
}
function LinkPeices()
{
peices = GetEntArray(self.target,"targetname");
foreach(p in peices)
{
p LinkTo(self);
}
}

Also, I cant get this to work. I know I've set it up just like you said. I dont know if you forgot but I gave the script_multiple a targetname of carts like it says in the script and still didnt work. Any ideas why?
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 14 September 2013
Last active: 4 years ago
Posts
1,895
Respect
Forum Rank
Zombie Destroyer
Primary Group
Community Scripter
My Groups
More
My Contact & Social Links
More
Personal Quote
BE ORIGINAL
×
MakeCents's Groups
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
Community Scripter Has shown effort and knowledge in the area of scripting while being a part of the UGX-Mods community.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
Also, I cant get this to work. I know I've set it up just like you said. I dont know if you forgot but I gave the script_multiple a targetname of carts like it says in the script and still didnt work. Any ideas why?

Tested, and works fine.

Here is a prefab if you are having difficulty:
http://www.mediafire.com/file/7aw0e36jaed2qt9/cart_moving.rar


 
Loading ...