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

[User Tutorial] Adding Buildables/Crafting to your map [Update: 1.0.1]

broken avatar :(
Created 10 years ago
by DuaLVII
0 Members and 1 Guest are viewing this topic.
14,045 views
broken avatar :(
×
broken avatar :(
Location: gbComing up in the world
Date Registered: 26 November 2013
Last active: 9 years ago
Posts
325
Respect
Forum Rank
Perk Hacker
Primary Group
Community Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
I own the hat!
×
DuaLVII's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
DuaLVII's Contact & Social Linksthomas.gascoigne.7DuaLVIIDuaLVIITheProlonger
Change Log;
Code Snippet
Plaintext
v1.0.1:
*Bug fix - Correct weapons now given after adding an item to bench with knuckle crack feature (Thanks too drugynugy for finding this bug)

Hey Guys,

Just wanted to share this with you all, This is my second ever script for World at War and I hope it will be useful to at least some of you.

Just know that once players have crafted an item in game, there is no function beyond that point and you will have to add your own script to make things happen after an item has been crafted.
I placed an example script which works with the main buildable script for you's so you know where to add your own scripts.

Download is located as an attachment at the end of this post.

Tutorial - Part 1 - Installing
World at War - Adding Crafting to your map - Tutorial Part 1

Tutorial - Part 2 - Using the prefabs and editing their value's
World at War - Adding Crafting to your map - Tutorial Part 2

Edit; Something I forgot to add, Make sure that the scripts are ticked on the mod iwd list.

For configuring the buildable script I added a config area near the top of the `dvii_buildables.gsc` script
(Be sure to read all comments within the script)

Code Snippet
Plaintext
dviiBuildableConfig()
{
/*--------------------
Hint strings used on the bench trigger
----------------------*/
level.Bench_Add_Item_Hint_String = "Press & Hold &&1 too add item"; //&&1 = players interact/use key bind :: This message is shown on players screen when they have an item to add

level.Bench_Take_Item_Hint_String = "Press & Hold &&1 too take item"; //&&1 = players interact/use key bind :: This message is shown on players screen when they have finished crafting the item and can take it


/*--------------------
Pickup model and brushmodel config
----------------------*/
level.Delete_Model_After_Pickup = true; //change to false if you don't want the model deleted after pickup

level.Hide_Model_After_Pickup = false; //change to true to hide the model after pickup (Only applies if Delete_Model_After_Pickup = false; (Used in-case you want to reuse the model after)

/*--------------------
Flags that are set either when item is built or when a player takes the built item
----------------------*/

level.Send_Flag_On_Build = false; //change to true to set the flag when the item is built

level.Send_Flag_On_Take = true; //change to false if you don't want the flag to set when the player takes the finished built item

level.Flag_Message_To_Send_On_Build = "item_built"; //Once a player has finished crafting an item, this message will be sent (Refer to example script to see how it is received)

level.Flag_Message_To_Send_On_Take = "item_taken"; //Once a player has taken the crafted item, this message will be sent (Refer to example script to see how it is received)

/*--------------------
Bench models and brushmodels config
----------------------*/

level.Delete_Bench_Item_After_Pickup = true; //change to false if you don't want the crafted item to be deleted

/*--------------------
Other bench configs
----------------------*/

level.Wait_Time_On_Item_Add = 3; //seconds to wait till the bench can be used again to add another item (0 = Instant)

level.Show_Knuckles_On_Item_Add = true; //change to false if you don't want knuckle cracking to show when player adds an item to the bench

level.Allow_Take_On_Build_Finish = true; //change to false if you don't want the player to be able to take the item when finished

/*--------------------
Any scripts to work with dvii_buildables can be added here
----------------------*/
thread maps\dvii_item_built_example::dvii_Initialize(); //Refer to the dvii_item_built_example.gsc script too add function to your built item
}



Adding a function to an item once built, Refer to the `dvii_item_built_example.gsc`

Code Snippet
Plaintext
#include maps\_utility; 
#include common_scripts\utility;
#include maps\_zombiemode_utility;

dvii_Initialize()
{
thread dviiBuildFinished(); //If level.Send_Flag_On_Build = true on dvii_buildables.gsc script, we will want too use this
thread dviiBuildTaken(); //If level.Send_Flag_On_Take = true on dvii_buildables.gsc script, we will want too use this
}

dviiBuildFinished()
{
while(1)
{
flag_wait("item_built");
iPrintLn("Continue function from here");

//From here add your work to give your item a function once built

break;
}
}

dviiBuildTaken()
{
while(1)
{
flag_wait("item_taken");
iPrintLn("Continue function from here");

//From here add your work to give your item a function once built

break;
}
}

Thanks,
DuaLVII
Last Edit: January 18, 2014, 11:09:26 pm by DuaLVII
broken avatar :(
×
broken avatar :(
Location: usbuffalo
Date Registered: 16 August 2013
Last active: 11 months ago
Posts
927
Respect
Forum Rank
The Decider
Primary Group
Community Mapper
My Groups
More
My Contact & Social Links
More
Personal Quote
Giggity.
Signature
maps:
Undead Town
http://ugx-mods.com/forum/index.php?topic=2294.0 (Release)
Origins 1922
http://ugx-mods.com/forum/index.php?topic=2659.0
[WIP] mapping 39%, weapons 85%, scripts 65%
[/url]
×
RamboBadass's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
RamboBadass's Contact & Social LinksAsk merambobadassRamboDaGreat
can it be used for building a buyable ending .... like build something then once its build add a trigger-use to it ?
 
broken avatar :(
×
broken avatar :(
Location: tr
Date Registered: 1 March 2013
Last active: 3 days ago
Posts
816
Respect
Forum Rank
The Decider
Primary Group
2015 Contest Winner
My Groups
More
My Contact & Social Links
More
Personal Quote
Caw caw caw
×
johndoe's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
2015 Contest Winner
johndoe's Contact & Social Linksmyc153-johndoe
can it be used for building a buyable ending .... like build something then once its build add a trigger-use to it ?
yes it can.
Code Snippet
Plaintext
trigger = GetEnt('endgame','targetname');
trigger on
of course, you'll need to disable the trigger using
Code Snippet
Plaintext
trigger off();
just don't forget to use the correct kvps and it'll work just fine.
broken avatar :(
×
broken avatar :(
Location: usbuffalo
Date Registered: 16 August 2013
Last active: 11 months ago
Posts
927
Respect
Forum Rank
The Decider
Primary Group
Community Mapper
My Groups
More
My Contact & Social Links
More
Personal Quote
Giggity.
×
RamboBadass's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
RamboBadass's Contact & Social LinksAsk merambobadassRamboDaGreat
ok i kind of understand but how does it get turned on when built  sry im still learning
broken avatar :(
×
broken avatar :(
Location: gbComing up in the world
Date Registered: 26 November 2013
Last active: 9 years ago
Posts
325
Respect
Forum Rank
Perk Hacker
Primary Group
Community Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
I own the hat!
×
DuaLVII's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
DuaLVII's Contact & Social Linksthomas.gascoigne.7DuaLVIIDuaLVIITheProlonger
ok i kind of understand but how does it get turned on when built  sry im still learning

If you refer to the example script that comes with the download.

Code Snippet
Plaintext
#include maps\_utility; 
#include common_scripts\utility;
#include maps\_zombiemode_utility;

dvii_Initialize()
{
thread dviiBuildFinished(); //If level.Send_Flag_On_Build = true on dvii_buildables.gsc script, we will want too use this
thread dviiBuildTaken(); //If level.Send_Flag_On_Take = true on dvii_buildables.gsc script, we will want too use this
}

dviiBuildFinished()
{
while(1)
{
flag_wait("item_built");
iPrintLn("Continue function from here");

//From here add your work to give your item a function once built

break;
}
}

dviiBuildTaken()
{
while(1)
{
flag_wait("item_taken");
iPrintLn("Continue function from here");

//From here add your work to give your item a function once built

break;
}
}

I've placed 2 functions within the example, one for when an item is built, another when item is taken.

In the configuration of the main script `dvii_buildables` you can disable allowing players to take the finished item such that it runs only for a buyable ending.

I'll post more help if needed, But just made this post quickly because I'm about to head of too work.

(Quick edit; on your buyable ending script, if your triggername for the buyable ending is `end_game` then use
Code Snippet
Plaintext
ending_trig = GetEnt("end_game", "targetname");
ending_trig disable_trigger();

On example script under dviiBuildFinished() after the flag_wait add;

Code Snippet
Plaintext
ending_trig = GetEnt("end_game", "targetname");
ending_trig enable_trigger();

But like I said, I just rushed this, hope it works, if not, I'll be sure to check in when I get back)

I'll check back later.
Thanks,
DuaLVII
Last Edit: January 13, 2014, 06:12:42 am by DuaLVII
broken avatar :(
×
broken avatar :(
Location: gb
Date Registered: 6 January 2014
Last active: 7 years ago
Posts
2
Respect
Forum Rank
Fresh Corpse
Primary Group
Member
×
drugynugy's Groups
drugynugy's Contact & Social Links
i have got this working, but now i need to get it to open a door.  once ive got all the iteams  dvii_buildables sends a flag to dvii_item_built_example so what will  i have to put in to it to activate a door plus the kvps for the door in radiant. will i need any code so the door will not work until its ready.
sorry for being a noob but gotta start somewhere.
thanks and respect will be given for all help
broken avatar :(
×
broken avatar :(
Location: gbComing up in the world
Date Registered: 26 November 2013
Last active: 9 years ago
Posts
325
Respect
Forum Rank
Perk Hacker
Primary Group
Community Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
I own the hat!
×
DuaLVII's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
DuaLVII's Contact & Social Linksthomas.gascoigne.7DuaLVIIDuaLVIITheProlonger
i have got this working, but now i need to get it to open a door.  once ive got all the iteams  dvii_buildables sends a flag to dvii_item_built_example so what will  i have to put in to it to activate a door plus the kvps for the door in radiant. will i need any code so the door will not work until its ready.
sorry for being a noob but gotta start somewhere.
thanks and respect will be given for all help

AHA! Drugynugy, My star, your the first to say `This works` and most importantly didn't say `I got an error`
I'll write up something in a bit, I didn't sleep so well last night so I'll be back in a few hours.

Post Merge: January 16, 2014, 11:22:28 am
Ok, Try this (Note I haven't tested this, but I hope it works for you)

This is what I've got so far which doesn't disconnect paths and enable a new zone (Depends on where this door will lead too though)

Make a door with script_brushmodel;
kvp's;
Code Snippet
Plaintext
targetname  =  myDoor
script_vector = 100 0 0
(May want to modify the script_vector depending on door direction for opening)

Once build is finished
Code Snippet
Plaintext
dviiBuildFinished()
{
while(1)
{
myDoor = GetEnt("myDoor", "targetname");
flag_wait("item_built");
                time = 1;
myDoor MoveTo( myDoor.origin + myDoor.script_vector, time, time * 0.25, time * 0.25 );
wait(1);
myDoor delete();
//iPrintLn("Continue function from here");

//From here add your work to give your item a function once built

break;
}
}



When item is taken

Code Snippet
Plaintext
dviiBuildTaken()
{
while(1)
{
myDoor = GetEnt("myDoor", "targetname");
flag_wait("item_taken");
                time = 1;
myDoor MoveTo( myDoor.origin + myDoor.script_vector, time, time * 0.25, time * 0.25 );
wait(1);
myDoor delete();
iPrintLn("Continue function from here");

//From here add your work to give your item a function once built

break;
}
}
Last Edit: January 16, 2014, 11:25:17 am by DuaLVII
broken avatar :(
×
broken avatar :(
Location: gb
Date Registered: 6 January 2014
Last active: 7 years ago
Posts
2
Respect
Forum Rank
Fresh Corpse
Primary Group
Member
×
drugynugy's Groups
drugynugy's Contact & Social Links
one respect coming your way.
works perfect.
your a supper star
thanks drugynugy
broken avatar :(
×
broken avatar :(
Location: gbComing up in the world
Date Registered: 26 November 2013
Last active: 9 years ago
Posts
325
Respect
Forum Rank
Perk Hacker
Primary Group
Community Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
I own the hat!
×
DuaLVII's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
DuaLVII's Contact & Social Linksthomas.gascoigne.7DuaLVIIDuaLVIITheProlonger
one respect coming your way.
works perfect.
your a supper star
thanks drugynugy

broken avatar :(
×
broken avatar :(
Location: gbUnited Kingdom
Date Registered: 15 January 2014
Last active: 8 years ago
Posts
33
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
×
BishyFTW's Groups
BishyFTW's Contact & Social LinksPhilbishop4BishyFTWBishyFTW1


Post Merge: April 24, 2014, 11:22:51 pm
AHA! Drugynugy, My star, your the first to say `This works` and most importantly didn't say `I got an error`
I'll write up something in a bit, I didn't sleep so well last night so I'll be back in a few hours.

Post Merge: January 16, 2014, 11:22:28 am
Ok, Try this (Note I haven't tested this, but I hope it works for you)

This is what I've got so far which doesn't disconnect paths and enable a new zone (Depends on where this door will lead too though)

Make a door with script_brushmodel;
kvp's;
Code Snippet
Plaintext
targetname  =  myDoor
script_vector = 100 0 0
(May want to modify the script_vector depending on door direction for opening)

Once build is finished
Code Snippet
Plaintext
dviiBuildFinished()
{
while(1)
{
myDoor = GetEnt("myDoor", "targetname");
flag_wait("item_built");
                time = 1;
myDoor MoveTo( myDoor.origin + myDoor.script_vector, time, time * 0.25, time * 0.25 );
wait(1);
myDoor delete();
//iPrintLn("Continue function from here");

//From here add your work to give your item a function once built

break;
}
}



When item is taken

Code Snippet
Plaintext
dviiBuildTaken()
{
while(1)
{
myDoor = GetEnt("myDoor", "targetname");
flag_wait("item_taken");
                time = 1;
myDoor MoveTo( myDoor.origin + myDoor.script_vector, time, time * 0.25, time * 0.25 );
wait(1);
myDoor delete();
iPrintLn("Continue function from here");

//From here add your work to give your item a function once built

break;
}
}
what do u mean
//iPrintLn("Continue function from here");
//From here add your work to give your item a function once built

im getting a bad syntax error it says }, would this be whats wrong?
Last Edit: April 24, 2014, 11:23:53 pm by BishyFTW
broken avatar :(
×
broken avatar :(
Location: gbComing up in the world
Date Registered: 26 November 2013
Last active: 9 years ago
Posts
325
Respect
Forum Rank
Perk Hacker
Primary Group
Community Scripter Elite
My Groups
More
My Contact & Social Links
More
Personal Quote
I own the hat!
×
DuaLVII's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Community Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
DuaLVII's Contact & Social Linksthomas.gascoigne.7DuaLVIIDuaLVIITheProlonger
PM Me your example script.
broken avatar :(
×
broken avatar :(
Location: gbUnited Kingdom
Date Registered: 15 January 2014
Last active: 8 years ago
Posts
33
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
×
BishyFTW's Groups
BishyFTW's Contact & Social LinksPhilbishop4BishyFTWBishyFTW1
My doors not working?
Last Edit: April 29, 2014, 02:52:04 pm by BishyFTW

 
Loading ...