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

Level switch function?

HOT
broken avatar :(
Created 13 years ago
by daedra descent
0 Members and 1 Guest are viewing this topic.
8,985 views
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 10 years ago
Posts
2,789
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
Signature
Let's keep this thread on topic from here on in. -DBZ

+1 to off-topic reply -DBZ

lmao. Too funny.

Goliath Script Placer: http://ugx-mods.com/forum/index.php/topic,11234.msg125257/topicseen.html#new

"...Christ, people. Learn C, instead of just stringing random characters
together until it compiles (with warnings)..."

-Linus Torvalds
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
There's only 3 options for that...

1) You didn't make the ent correctly in radiant/didnt give it the correct targetname
2) You didn't specify the correct targetname in your script
3) You forgot to call your level_switch_tesla() function from somewhere.

Well, i used this for the targetname, as i should have.

Code Snippet
Plaintext
trig = getent("level_switch_Tesla", "targetname");

So the only option is calling the function... I included the file in the map's .gsc file and added the level_switch_tesla under the _preload as you do with any other script...

Do i need to make a main() or init() function and then call the functions from there or no?
broken avatar :(
×
broken avatar :(
[UGX] Founder
Location: usBay Area, California
Date Registered: 24 June 2011
Last active: 3 years ago
Posts
5,544
Respect
6,646Add +1
Forum Rank
Immortal
Primary Group
UGX Administrator
My Groups
More
My Contact & Social Links
More
Signature
If Java had true garbage collection, most programs would delete themselves upon execution.
×
treminaor's Groups
UGX Administrator
UGX Team Member
UGX Site Moderator Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
Well, i used this for the targetname, as i should have.

Code Snippet
Plaintext
trig = getent("level_switch_Tesla", "targetname");

So the only option is calling the function... I included the file in the map's .gsc file and added the level_switch_tesla under the _preload as you do with any other script...

Do i need to make a main() or init() function and then call the functions from there or no?
You forgot checking to see if the ent was created correctly in Radiant - this includes making sure its actually a trigger_use brush and making sure you recompiled your map afterward.

For calling the function, main and init are just programming practice and by no means required to do anything in script.

Add an iPrintLn() somewhere in your script which will appear when you do something. That will tell you whether or not the script is being called. Don't put the iPrintLn() somewhere where it would get called before you spawn, otherwise obviously you won't see it.
broken avatar :(
×
broken avatar :(
Location: de
Date Registered: 6 August 2012
Last active: 6 years ago
Posts
277
Respect
Forum Rank
Mr. Elemental
Primary Group
Scripter Elite
My Groups
More
×
YaPh1l's Groups
Scripter Elite Has shown excellence and experience in the area of custom scripting in the UGX-Mods community.
YaPh1l's Contact & Social Links
Could you be a bit more specific on what does/doesn't work?
In Solo, it appears to work as expected. In Coop however, it will start loading the new level, but it will just crash mid-load.

- Phil.
broken avatar :(
×
broken avatar :(
[UGX] Founder
Location: usBay Area, California
Date Registered: 24 June 2011
Last active: 3 years ago
Posts
5,544
Respect
6,646Add +1
Forum Rank
Immortal
Primary Group
UGX Administrator
My Groups
More
My Contact & Social Links
More
×
treminaor's Groups
UGX Administrator
UGX Team Member
UGX Site Moderator Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
You could try writing a scriptmenu that has a level change command in the onOpen{} of itself. That way when you open the menu on the host in the game it loads the next level. Get the level command from the pc_gamelobby menu.

Again, haven't ever tried this but it could work.
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 10 years ago
Posts
2,789
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
This is starting to really make me a bit angry, i've tried everything with no luck for the trigger. I'm going to post the function,mapname.gsc,a radiant pic of the KVP's

MAPNAME.gsc
Code Snippet
Plaintext
/*
Der Frost / Nazi Zombie Sniperbolt Tutorial Version 2.0
Scripter: Sparks
Tutorial: Sniperbolt

Version 1.0 (9/24/2009 7:51:18 PM)
-- Initial Release Of Source Files
*/

// Tutorial From Sniperbolt!

// Utilities
#include common_scripts\utility;
#include maps\_utility;
#include maps\_zombiemode_utility;
#include maps\_zombiemode_zone_manager;
#include maps\_music;
#include maps\sumpf_ammo_box;
#include maps\level_switch;

// DLC3 Utilities
#include maps\dlc3_code;
#include maps\dlc3_teleporter;

main()
{
level.DLC3 = spawnStruct(); // Leave This Line Or Else It Breaks Everything

// Must Change These To Your Maps
level.DLC3.createArt = maps\createart\Intel_art::main;
level.DLC3.createFX = maps\createfx\Intel_fx::main;
// level.DLC3.myFX = ::preCacheMyFX;

/*--------------------
FX
----------------------*/
DLC3_FX();

/*--------------------
LEVEL VARIABLES
----------------------*/

// Variable Containing Helpful Text For Modders -- Don't Remove
level.modderHelpText = [];

//
// Change Or Tweak All Of These LEVEL.DLC3 Variables Below For Your Level If You Wish
//

// Edit The Value In Mod.STR For Your Level Introscreen Place
level.DLC3.introString = &"nazi zombie tes";

// Weapons. Pointer function automatically loads weapons used in Der Riese.
level.DLC3.weapons = maps\dlc3_code::include_weapons;

// Power Ups. Pointer function automatically loads power ups used in Der Riese.
level.DLC3.powerUps =  maps\dlc3_code::include_powerups;

// Adjusts how much melee damage a player with the perk will do, needs only be set once. Stock is 1000.
level.DLC3.perk_altMeleeDamage = 1000;

// Adjusts barrier search override. Stock is 400.
level.DLC3.barrierSearchOverride = 400;

// Adjusts power up drop max per round. Stock is 3.
level.DLC3.powerUpDropMax = 3;

// _loadout Variables
level.DLC3.useCoopHeroes = true;

// Bridge Feature
level.DLC3.useBridge = false;

// Hell Hounds
level.DLC3.useHellHounds = false;

// Mixed Rounds
level.DLC3.useMixedRounds = false;

// Magic Boxes -- The Script_Noteworthy Value Names On Purchase Trigger In Radiant
boxArray = [];
boxArray[ boxArray.size ] = "start_chest";
boxArray[ boxArray.size ] = "chest1";
boxArray[ boxArray.size ] = "chest2";
boxArray[ boxArray.size ] = "chest3";
boxArray[ boxArray.size ] = "chest4";
boxArray[ boxArray.size ] = "chest5";
level.DLC3.PandoraBoxes = boxArray;

// Initial Zone(s) -- Zone(s) You Want Activated At Map Start
zones = [];
zones[ zones.size ] = "initial_zone";
level.DLC3.initialZones = zones;

// Electricity Switch -- If False Map Will Start With Power On
level.DLC3.useElectricSwitch = true;

// Electric Traps
level.DLC3.useElectricTraps = true;

// _zombiemode_weapons Variables
level.DLC3.usePandoraBoxLight = true;
level.DLC3.useChestPulls = true;
level.DLC3.useChestMoves = true;
level.DLC3.useWeaponSpawn = true;
level.DLC3.useGiveWeapon = true;

// _zombiemode_spawner Varibles
level.DLC3.riserZombiesGoToDoorsFirst = true;
level.DLC3.riserZombiesInActiveZonesOnly = true;
level.DLC3.assureNodes = true;

// _zombiemode_perks Variables
level.DLC3.perksNeedPowerOn = true;

// _zombiemode_devgui Variables
level.DLC3.powerSwitch = true;

/*--------------------
FUNCTION CALLS - PRE _Load
----------------------*/
level thread DLC3_threadCalls();

/*--------------------
ZOMBIE MODE
----------------------*/
[[level.DLC3.weapons]]();
[[level.DLC3.powerUps]]();
maps\_zombiemode::main();

/*--------------------
FUNCTION CALLS - POST _Load
----------------------*/
level.zone_manager_init_func = ::dlc3_zone_init;
level thread DLC3_threadCalls2();
initammobox();
level_switch_tesla();
}

dlc3_zone_init()
{

add_adjacent_zone( "initial_zone", "sw", "sw" );
add_adjacent_zone( "zone1", "zone2", "enter_zone2" );
/*
=============
///ScriptDocBegin
"Name: add_adjacent_zone( <zone_1>, <zone_2>, <flag>, <one_way> )"
"Summary: Sets up adjacent zones."
"MandatoryArg: <zone_1>: Name of first Info_Volume"
"MandatoryArg: <zone_2>: Name of second Info_Volume"
"MandatoryArg: <flag>: Flag to be set to initiate zones"
"OptionalArg: <one_way>: Make <zone_1> adjacent to <zone_2>. Defaults to false."
"Example: add_adjacent_zone( "receiver_zone", "outside_east_zone", "enter_outside_east" );"
///ScriptDocEnd
=============
*/

// Outside East Door
//add_adjacent_zone( "receiver_zone", "outside_east_zone", "enter_outside_east" );
}

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

level_switch_tesla()
{
trig = getent("level_switch_tesla", "targetname");
// trig.is_available = 1;
trig.zombie_cost = 01; //doesn't cost anything... for now
// trig.in_use = 0;
trig sethintstring(&"Press & hold &&1 to play Tesla [Cost: 1]");
trig setCursorHint( "HINT_NOICON" );

while(1)
{
trig waittill( "trigger", who );
{
if( is_player_valid( who ) )
{
if( who.score >= trig.zombie_cost )
{
iPrintLn("testing....");
who maps\_zombiemode_score::minus_to_player_score( who.score );
wait(1);
changelevel( "Tesla", true );
}
}
}
}
}

Radiant pic:

Last Edit: November 04, 2013, 11:22:19 pm by daedra descent
broken avatar :(
×
broken avatar :(
Former UGX Lead Asset Creator
Location: ca
Date Registered: 17 August 2012
Last active: 7 years ago
Posts
1,932
Respect
Forum Rank
Zombie Destroyer
Primary Group
UGX V.I.P.
My Groups
More
My Contact & Social Links
More
Personal Quote
Eh?
Signature

(Click to enter portfolio)
×
SajeOne's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
UGX V.I.P.
UGX V.I.P.
no reason for your sethintstring to look like this:
Code Snippet
Plaintext
sethintstring(&"Press &&1 to Play Telsa [Cost: 1]");
I don't know if it will actually fix anything but there is no reason for it to be there, this is fine:
Code Snippet
Plaintext
sethintstring("Press &&1 to Play Telsa [Cost: 1]");
I'm guessing that's the character to tell if you want the string literal, which in this case you don't want. I know in C# it uses @, but in COD that symbolizes the string is defined somewhere else such as an STR file.
broken avatar :(
×
broken avatar :(
[UGX] Founder
Location: usBay Area, California
Date Registered: 24 June 2011
Last active: 3 years ago
Posts
5,544
Respect
6,646Add +1
Forum Rank
Immortal
Primary Group
UGX Administrator
My Groups
More
My Contact & Social Links
More
×
treminaor's Groups
UGX Administrator
UGX Team Member
UGX Site Moderator Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
Does your iPrintLn work?
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 10 years ago
Posts
2,789
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
no reason for your sethintstring to look like this:
Code Snippet
Plaintext
sethintstring(&"Press &&1 to Play Telsa [Cost: 1]");
I don't know if it will actually fix anything but there is no reason for it to be there, this is fine:
Code Snippet
Plaintext
sethintstring("Press &&1 to Play Telsa [Cost: 1]");
I'm guessing that's the character to tell if you want the string literal, which in this case you don't want. I know in C# it uses @, but in COD that symbolizes the string is defined somewhere else such as an STR file.

It doesn't work either way, i tried it.

Does your iPrintLn work?

No, because the trigger isn't working and i have it set to show after i use the hintstring

If it helps any, i tried also calling the script from _zombiemode and it resulted in the game resetting the "zombiemode" dvar, so the game thought i was playing campaign or something, and the trigger didn't even show up...
broken avatar :(
×
broken avatar :(
[UGX] Founder
Location: usBay Area, California
Date Registered: 24 June 2011
Last active: 3 years ago
Posts
5,544
Respect
6,646Add +1
Forum Rank
Immortal
Primary Group
UGX Administrator
My Groups
More
My Contact & Social Links
More
×
treminaor's Groups
UGX Administrator
UGX Team Member
UGX Site Moderator Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
It doesn't work either way, i tried it.

No, because the trigger isn't working and i have it set to show after i use the hintstring

If it helps any, i tried also calling the script from _zombiemode and it resulted in the game resetting the "zombiemode" dvar, so the game thought i was playing campaign or something, and the trigger didn't even show up...
You're making this harder than it needs to be for yourself.

The problem is your initammobox() calll in your mapname.gsc. You didn't thread it, which pauses code execution. Thread that call and your level_switch_tesla call - then everything will be fixed.

In response to your testing, put the iPrintLn() somewhere in the script BEFORE the part that doesn't work. Obviously if your trigger isnt working then you will never see the code get to that block... which makes the test completely useless.

Putting '&' before a string denotes that what follows is a localizedstring defined in a .str file. If you try to set a hintstring to a nonexistant localizedstring like you were doing in the above code example, it will just be blank. It won't break your trigger or cause the hand to show, and it's not the source of your problem at the moment.
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 10 years ago
Posts
2,789
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
You're making this harder than it needs to be for yourself.

The problem is your initammobox() calll in your mapname.gsc. You didn't thread it, which pauses code execution. Thread that call and your level_switch_tesla call - then everything will be fixed.

In response to your testing, put the iPrintLn() somewhere in the script BEFORE the part that doesn't work. Obviously if your trigger isnt working then you will never see the code get to that block... which makes the test completely useless.

Putting '&' before a string denotes that what follows is a localizedstring defined in a .str file. If you try to set a hintstring to a nonexistant localizedstring like you were doing in the above code example, it will just be blank. It won't break your trigger or cause the hand to show, and it's not the source of your problem at the moment.
that helped a lot.

though i'm getting weird side affects with the game thinking the second map is a campaign mission instead of a zombiemode, in other words, zombies don't spawn and campaign assets are loaded into the game, even though the map works just fine by itself.
Last Edit: November 05, 2013, 07:25:37 am by daedra descent
broken avatar :(
×
broken avatar :(
[UGX] Founder
Location: usBay Area, California
Date Registered: 24 June 2011
Last active: 3 years ago
Posts
5,544
Respect
6,646Add +1
Forum Rank
Immortal
Primary Group
UGX Administrator
My Groups
More
My Contact & Social Links
More
×
treminaor's Groups
UGX Administrator
UGX Team Member
UGX Site Moderator Has the ability to issue warnings to users, edit and remove posts from the forum and to move topics to other boards. Upholds the rules of the forum. Moderates Chat Rooms.
that helped a lot. the game thinks the second map is a campaign mission instead of a zombiemode, in other words, zombies don't spawn and campaign assets are loaded into the game, even though the map works just fine by itself.

I'm sure i just need to re-set the dvar, but how?
Does your second map have a nazi_zombie_ prefix?

If so then I would guess the second level needs _load called on it again to call all the spawning and zombiemode.

Before bothering I would make sure the level switch works in coop.
broken avatar :(
×
broken avatar :(
☭ Soviet Commander ☭
Location: us
Date Registered: 13 August 2012
Last active: 10 years ago
Posts
2,789
Respect
Forum Rank
King of the Zombies
Primary Group
Community Daedra
My Groups
More
My Contact & Social Links
More
×
daedra descent's Groups
Community Daedra
Community Daedra
daedra descent's Contact & Social LinksBlueSoviet
Does your second map have a nazi_zombie_ prefix?

If so then I would guess the second level needs _load called on it again to call all the spawning and zombiemode.

Before bothering I would make sure the level switch works in coop.

I don't really have anyone to test with me ATM, unless you would.

 
Loading ...