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

Wonderfizz script help

broken avatar :(
Created 12 years ago
by daedra descent
0 Members and 1 Guest are viewing this topic.
3,193 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
Been working on a Wonderfizz script for people who want the wonderfizz in their map, but i've been getting a few bad syntax errors. If anyone could help me find it or any others that show up that i can't figure out, and once i get it completely finished(not complete in its current form), i'll make a tutorial or something so people can add it to their map.

And before anyone asks, yes i did take majority of the code for the mystery box and changed a few things. The wonderfizz practically is the Mystery box besides a few things, and creating an entirely new script for it would be time consuming and stupid.

the issue is on line 282 according to World at War.

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

main()
{
level thread wonder_init();
level thread wonder_trig_think();
}

add_wonder_perk( bottle_name, hint, weight)
{
PrecacheItem( bottle_name );
PrecacheString( hint );

if( !IsDefined( bottle_name ) )
{
level.bottle_name = [];
}

level.bottle_name[bottle_name.size] = bottle_name;

if( !isDefined( weight ) )
{
level.weapon_weighting_funcs[weapon_name] = maps\_zombiemode_weapons::default_weighting_func;
}
else
{
level.weapon_weighting_funcs[weapon_name] = weighting_func;
}

}

wonder_init()
{
flag_init("moving_wonder_enabled");
flag_init("moving_wonder_now");

level.chest_index = 0;

level.wonder = getEntarray("wonder_org", "targetname");

if (level.wonder.size > 1)
{

flag_set("moving_wonder_enabled");

while ( 1 )
{
level.wonder_random = array_randomize(level.wonder);

    if(isdefined(level.wonder.script_noteworthy == "start_station") )
{
break;
}

level.chest_index++; 

anchor = GetEnt(level.wonder[level.wonder_index].target, "targetname");
anchorTarget = GetEnt(anchor.target, "targetname");

level.wonder_light = Spawn( "script_model", anchorTarget.origin );
level.wonder_light.angles = anchorTarget.angles + (-90, 0, 0);
level.wonder_light SetModel( "tag_origin" );
playfxontag(level._effect["lght_marker"], level.wonder_light, "tag_origin");
}
//determine wonder starting location at random or normal
init_wonder_start_location();
}
array_thread( level.wonder, ::wonder_trig_think );
}
init_wonder_start_location()
{

for( i = 0; i < level.chests.size; i++ )
{
if( isdefined(level.wonder[0].script_noteworthy == "start_station") )
{
if( i == 0 )
{
level.wonder_trigs[i].is_available = 1;
}
else
{
level.wonder_trigs[i].is_available = 0;
}
}
else
{
level.wonder_index = i;
}
}
}
wonder_trig_think()
{
level.wonder_trigs = getEntarray("wonder_trig", "targetname");

flag_wait( "electricity_on" );

while(1)
{

if(isdefined(wonder_trigs.zombie_cost) )
{
zombie_cost = wonder_trigs.zombie_cost;
}
else
{
zombie_cost = 2000;
}

level.wonder_trigs sethintstring("Press F to buy a random perk[cost: +zombie_cost]");

players = get_players();

if(players.score >= zombie_cost)
{
maps\_zombiemode_score::minus_to_player_score( who.score );
begin_wonder_effect();
}
}
}
begin_wonder_affect()
{
model = spawn( "script_model", level.wonder.origin );
model.angles = self.angles +( 0, 90, 0 );

floatHeight = 40;

player = get_players();

modelname = undefined;
rand = undefined;
number_cycles = 40;
for( i = 0; i < number_cycles; i++ )
{

if( i < 20 )
{
wait( 0.05 );
}
else if( i < 30 )
{
wait( 0.1 );
}
else if( i < 35 )
{
wait( 0.2 );
}
else if( i < 38 )
{
wait( 0.3 );
}

if( i+1 < number_cycles )
{
rand = wonder_ChooseRandomWeapon( player );
}
else
{
rand = wonder_ChooseRandomWeapon( player );
}


modelname = GetWeaponModel( rand );
model setmodel( modelname );
}


self.perk_string = rand; // here's where the org get it's weapon type for the give function

// random change of getting the joker that moves the wonderfizz
random = Randomint(100);

if( !isdefined( level.chest_min_move_usage ) )
{
level.chest_min_move_usage = 4;
}

if(level.chest_accessed < level.chest_min_move_usage)
{
// PI_CHANGE_BEGIN - JMA - RandomInt(100) can return a number between 0-99.  If it's zero and chance_of_joker is zero
// we can possibly have a teddy bear one after another.
chance_of_joker = -1;
// PI_CHANGE_END
}
else
{
chance_of_joker = level.chest_accessed + 20;

// make sure teddy bear appears on the 8th pull if it hasn't moved from the initial spot
if( (!isDefined(level.magic_box_first_move) || level.magic_box_first_move == false ) && level.chest_accessed >= 8)
{
chance_of_joker = 100;
}

// pulls 4 thru 8, there is a 15% chance of getting the teddy bear
// NOTE:  this happens in all cases
if( level.chest_accessed >= 4 && level.chest_accessed < 8 )
{
if( random < 15 )
{
chance_of_joker = 100;
}
else
{
chance_of_joker = -1;
}
}

// after the first magic box move the teddy bear percentages changes
if( isDefined(level.magic_box_first_move) && level.magic_box_first_move == true )
{
// between pulls 8 thru 12, the teddy bear percent is 30%
if( level.chest_accessed >= 8 && level.chest_accessed < 13 )
{
if( random < 30 )
{
chance_of_joker = 100;
}
else
{
chance_of_joker = -1;
}
}

// after 12th pull, the teddy bear percent is 50%
if( level.chest_accessed >= 13 )
{
if( random < 50 )
{
chance_of_joker = 100;
}
else
{
chance_of_joker = -1;
}
}
}
}

if (random <= chance_of_joker)
{
model SetModel("zombie_teddybear");

//wait(1);
model.angles = self.angles;
wait 1;
flag_set("moving_wonder_now");
self notify( "move_imminent" );
level.chest_accessed = 0;

player maps\_zombiemode_score::add_to_player_score( 2000 );

//allow power weapon to be accessed.
level.wonder_moved = true;
}
self notify( "randomization_done" );

if (flag("moving_chest_now") )
{
wait .5; // we need a wait here before this notify
level notify("weapon_fly_away_start");
wait 2;
model MoveZ(500, 4, 3);
model waittill("movedone");
model delete();
self notify( "box_moving" );
level notify("weapon_fly_away_end");
}

level.wonder_moved = false;

model thread timer_til_despawn(floatHeight);
self waittill( "weapon_grabbed" );

if( !level.wonder.timedOut )
{
model Delete();
}
}
}
wonder_give_perk( perk_string )
{

self waittill("weapon_grabbed");
current_weapon = undefined;
players = get_players();

if(players !hasperk(perk_string) )
{
continue;
}

perk = undefined;

switch(perk_string)
{
case "zombie_perk_bottle_jugg":
perk = "specialty_armorvest";
break;

case "":
//empty case
break;
}

gun = player perk_give_bottle_begin( perk );
player.is_drinking = 1;
player waittill_any( "fake_death", "death", "player_downed", "weapon_change_complete" );

// restore player controls and movement
player perk_give_bottle_end( gun, perk );
player.is_drinking = undefined;

player SetPerk( perk );
player thread perk_vo(perk);
player setblur( 4, 0.1 );
wait(0.1);
player setblur(0, 0.1);
earthquake (0.4, 0.2, self.origin, 100);

players takeweapon("perk_string");


if(perk == "specialty_armorvest")
{
player.maxhealth = level.zombie_vars["zombie_perk_juggernaut_health"];
player.health = level.zombie_vars["zombie_perk_juggernaut_health"];
}
}
treasure_chest_ChooseRandomWeapon( player )
{

keys = GetArrayKeys( level.bottle_name );

// Filter out any perks the player already has
filtered = [];
for( i = 0; i < keys.size; i++ )
{
if( IsDefined( keys[i] ) )
{
continue;
}

filtered[filtered.size] = keys[i];
}

return filtered[RandomInt( filtered.size )];
}



Last Edit: February 03, 2014, 02:43:14 am by daedra descent
broken avatar :(
×
broken avatar :(
Location: usYork, SC
Date Registered: 30 March 2013
Last active: 12 years ago
Posts
24
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
Personal Quote
Coder
Signature
PROxFTW
×
blackbird431's Groups
blackbird431's Contact & Social LinksPROxFTWiso4lif3PROxFTWJTAGxHACKER
Well on line 282 if I am correct you have an extra }.
broken avatar :(
×
broken avatar :(
Donator <3
Location: auAustralia
Date Registered: 20 August 2012
Last active: 6 years ago
Posts
337
Respect
Forum Rank
Perk Hacker
Primary Group
Mapper
My Groups
More
My Contact & Social Links
More
×
Chunkdogg9's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Mapper Has released one or more maps to the UGX-Mods community.
Chunkdogg9's Contact & Social LinksChunkdogg00Chunkdogg9Chunkdogg9
does this have fx with it? i just make a new gsc for this to?
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 this have fx with it? i just make a new gsc for this to?

It does have an FX that plays, however its the original wonderfizz FX ,and there are alot of things that i need to fix or add still...

Yes, if it was complete you would just create a new GSC and call the script. it also requires you to define each wonderfizz location as of now, just like the Mystery box.

EDIT: Correction, it requires you to define the bottle like the Mystery box requires you to define weapons.
Last Edit: February 03, 2014, 03:20:08 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
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.
You should be able to catch your own syntax errors by now. WaW gives you the line location of the error and with a basic knowledge of syntax and some critical thinking you should be able to identify the problem without 5 extra sets of eyes on the forum.

Use a program with syntax highlighting such as Notepad++, Sublime Text 2, or UltraEdit.
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 should be able to catch your own syntax errors by now. WaW gives you the line location of the error and with a basic knowledge of syntax and some critical thinking you should be able to identify the problem without 5 extra sets of eyes on the forum.

Use a program with syntax highlighting such as Notepad++, Sublime Text 2, or UltraEdit.

Normally i do, but with this function being so long i had a hard time figuring out what was wrong. Figured it out now but i still have another syntax error and Notepad++ isn't helping at finding it anymore than normal Notepad.
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.
Normally i do, but with this function being so long i had a hard time figuring out what was wrong. Figured it out now but i still have another syntax error and Notepad++ isn't helping at finding it anymore than normal Notepad.
With proper indentation and use of the +/- fold buttons in code-friendly text editors you should be able to find inconsistent { } bracket placement when you fold the code blocks. If the brackets are mismatched, the code will not fold properly. Also if you place your cursor next to the closing bracket of a code block, the editor will highlight, underline, or otherwise point-out the matching bracket. You then check to see if it matches the indent of the bracket your cursor is next to.



 
Loading ...