help with bad syntax

broken avatar :(
Created 683 days ago
by zombiedestroy29
0 Members and 1 Guest are viewing this topic.
1,470 views
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 13 May 2017
Last active: 262 days ago
Posts
7
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
×
zombiedestroy29's Contact & Social Linkszombiedstroyer29shawnald67Gavin Rolls
when I run my mod i get a bad syntax error and it is saying it is on line 56 and {

#include maps\_zombiemode_score;

init()
{
precachemodel("zombie_perk_bottle_ads");//deadshot
precachemodel("zombie_perk_bottle_jugg");//juggernog
precachemodel("zombie_perk_bottle_marathon");//stamin-up
precachemodel("zombie_perk_bottle_revive");//quick revive
precachemodel("zombie_perk_bottle_sleight");//speed cola
precachemodel("zombie_perk_bottle_doubletap");//doubletap
precachemodel("zombie_perk_bottle_nuke");//phd flopper
precachemodel("zombie_perk_bottle_three_gun");//mule kick

w_location = (181.263, -347.03, -2.875);
w_trigger = Spawn( "trigger_radius_use", w_location + (0 , 0, 30), 0, 20, 70 );
w_trigger.targetname = "wonderfizz";
w_trigger.target = "none";
w_trigger SetCursorHint( "HINT_NOICON" );
w_trigger sethintstring( "You must turn on the power!" );

trigger = GetEnt("w_trigger", "Targetname");
w_cost = (1500);
trigger watchtrigger();

flag_wait( "power_on" );
w_trigger sethintstring( "Press ^3&&1 ^7to buy Der Wonderfizz for 1500 points." );
}

WatchTrigger()//the trigger,score system,and logic
{
while(1)
{
while(1)
{
self waittill("trigger", player);

if(player.score >= level.w_cost)
{
player maps\_zombiemode_score::minus_to_player_score(level.w_cost);
self playsound("zm_cha-ching");
break;
}
}
//perk code
wait 5.00;

model_origin = (level.w_location + 25, 0, 0);
model_angles = (0, 0, 0);

perk_bottle = Spawn("script_model", model_origin );
perk_bottle.angles = model_angles;
perk_bottle.targetname = "random_bottle";

entity_num = (self.zm_random_char);

Random_Perk(entity_num)
{
if( IsDefined( self.zm_random_char ) )
{
entity_num = (self.zm_random_char);
}

switch( entity_num )
{
case 0:
perk_bottle SetModel("zombie_perk_bottle_revive");//quick revive
level.w_trigger sethintstring( "Press ^3&&1 ^7to get revive soda!" );
self waittill("trigger", player);
player GiveWeapon( "zombie_perk_bottle_revive" );
player SwitchToWeapon( "zombie_perk_bottle_revive" );

wait 3.00;

player TakeWeapon( "zombie_perk_bottle_revive" );
break;
case 1:
perk_bottle SetModel("zombie_perk_bottle_jugg");//jugg
level.w_trigger sethintstring( "Press ^3&&1 ^7to get Juggernog!" );
self waittill("trigger", player);
player GiveWeapon( "zombie_perk_bottle_jugg" );
player SwitchToWeapon( "zombie_perk_bottle_jugg" );

wait 3.00;

player TakeWeapon( "zombie_perk_bottle_jugg" );
break;
case 2:
perk_bottle SetModel("zombie_perk_bottle_doubletap");//doubletap
level.w_trigger sethintstring( "Press ^3&&1 ^7to get ze Root Beer!" );
self waittill("trigger", player);
player GiveWeapon( "zombie_perk_bottle_doubletap" );
player SwitchToWeapon( "zombie_perk_bottle_doubletap" );

wait 3.00;

player TakeWeapon( "zombie_perk_bottle_doubletap" );
break;
case 3:
perk_bottle SetModel("zombie_perk_bottle_sleight");//speed cola
level.w_trigger sethintstring( "Press ^3&&1 ^7to get Speed Cola!" );
self waittill("trigger", player);
player GiveWeapon( "zombie_perk_bottle_sleight" );
player SwitchToWeapon( "zombie_perk_bottle_sleight" );

wait 3.00;

player TakeWeapon( "zombie_perk_bottle_sleight" );
break;
}
}
}
}
broken avatar :(
×
broken avatar :(
Location: fi
Date Registered: 25 June 2013
Last active: 9 days ago
Posts
3,997
Respect
Forum Rank
Eviscerator
Primary Group
UGX V.I.P.
My Groups
More
My Contact & Social Links
More
×
HitmanVere'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.
Community Mapper Has released one or more maps to the UGX-Mods community which have been added to the UGX Map Manager.
BO3 Modtools Alpha
BO3 Modtools Alpha
This user has access to the Black Ops 3 Modtools Alpha
It is cos of this:
Random_Perk(entity_num)

Instead of:
		entity_num = (self.zm_random_char);

Random_Perk(entity_num)
{
if( IsDefined( self.zm_random_char ) )
{
entity_num = (self.zm_random_char);
}

switch( entity_num )
{
case 0:
perk_bottle SetModel("zombie_perk_bottle_revive");//quick revive
level.w_trigger sethintstring( "Press ^3&&1 ^7to get revive soda!" );
self waittill("trigger", player);
player GiveWeapon( "zombie_perk_bottle_revive" );
player SwitchToWeapon( "zombie_perk_bottle_revive" );

wait 3.00;

player TakeWeapon( "zombie_perk_bottle_revive" );
break;
case 1:
perk_bottle SetModel("zombie_perk_bottle_jugg");//jugg
level.w_trigger sethintstring( "Press ^3&&1 ^7to get Juggernog!" );
self waittill("trigger", player);
player GiveWeapon( "zombie_perk_bottle_jugg" );
player SwitchToWeapon( "zombie_perk_bottle_jugg" );

wait 3.00;

player TakeWeapon( "zombie_perk_bottle_jugg" );
break;
case 2:
perk_bottle SetModel("zombie_perk_bottle_doubletap");//doubletap
level.w_trigger sethintstring( "Press ^3&&1 ^7to get ze Root Beer!" );
self waittill("trigger", player);
player GiveWeapon( "zombie_perk_bottle_doubletap" );
player SwitchToWeapon( "zombie_perk_bottle_doubletap" );

wait 3.00;

player TakeWeapon( "zombie_perk_bottle_doubletap" );
break;
case 3:
perk_bottle SetModel("zombie_perk_bottle_sleight");//speed cola
level.w_trigger sethintstring( "Press ^3&&1 ^7to get Speed Cola!" );
self waittill("trigger", player);
player GiveWeapon( "zombie_perk_bottle_sleight" );
player SwitchToWeapon( "zombie_perk_bottle_sleight" );

wait 3.00;

player TakeWeapon( "zombie_perk_bottle_sleight" );
break;
}
}

Have:
		if( IsDefined( self.zm_random_char ) )
{
entity_num = (self.zm_random_char);
}

switch( entity_num )
{
case 0:
perk_bottle SetModel("zombie_perk_bottle_revive");//quick revive
level.w_trigger sethintstring( "Press ^3&&1 ^7to get revive soda!" );
self waittill("trigger", player);
player GiveWeapon( "zombie_perk_bottle_revive" );
player SwitchToWeapon( "zombie_perk_bottle_revive" );

wait 3.00;

player TakeWeapon( "zombie_perk_bottle_revive" );
break;

case 1:
perk_bottle SetModel("zombie_perk_bottle_jugg");//jugg
level.w_trigger sethintstring( "Press ^3&&1 ^7to get Juggernog!" );
self waittill("trigger", player);
player GiveWeapon( "zombie_perk_bottle_jugg" );
player SwitchToWeapon( "zombie_perk_bottle_jugg" );

wait 3.00;

player TakeWeapon( "zombie_perk_bottle_jugg" );
break;

case 2:
perk_bottle SetModel("zombie_perk_bottle_doubletap");//doubletap
level.w_trigger sethintstring( "Press ^3&&1 ^7to get ze Root Beer!" );
self waittill("trigger", player);
player GiveWeapon( "zombie_perk_bottle_doubletap" );
player SwitchToWeapon( "zombie_perk_bottle_doubletap" );

wait 3.00;

player TakeWeapon( "zombie_perk_bottle_doubletap" );
break;

case 3:
perk_bottle SetModel("zombie_perk_bottle_sleight");//speed cola
level.w_trigger sethintstring( "Press ^3&&1 ^7to get Speed Cola!" );
self waittill("trigger", player);
player GiveWeapon( "zombie_perk_bottle_sleight" );
player SwitchToWeapon( "zombie_perk_bottle_sleight" );

wait 3.00;

player TakeWeapon( "zombie_perk_bottle_sleight" );
break;
}

I suggest adding default case as well in switch in case entity_num goes undefined
broken avatar :(
×
broken avatar :(
Location: us
Date Registered: 13 May 2017
Last active: 262 days ago
Posts
7
Respect
Forum Rank
Legless Crawler
Primary Group
Member
My Contact & Social Links
More
×
zombiedestroy29's Contact & Social Linkszombiedstroyer29shawnald67Gavin Rolls
thank you i'm just new to scripting
broken avatar :(
×
broken avatar :(
Location: usSouth Florida
Date Registered: 10 July 2016
Last active: 117 days ago
Posts
106
Respect
Forum Rank
Pack-a-Puncher
Primary Group
Donator ♥
My Groups
More
Signature
Let he who has not sinned cast the first stone.
×
Archaicvirus's Groups
Donator ♥ Benevolent Soul who has our eternal gratitude and exclusive access to betas and the donator section of the forum.
Archaicvirus's Contact & Social Links
In your switch/case code, there's no need to have so much code in each "case" when you're calling the same functions in each, but only changing the variables (perk bottle, hintstring, and weapon). Just use a variable for each string, and then after all the case declarations run the functions once, then insert correct variables. Here's an example.

	switch(entity_num)
{
case 0;
perk = "zombie_perk_bottle_revive";    //The bottle & weapon have the same name, only 1 var needed.
hint = "revive soda";
break;
case 1;
perk = "zombie_perk_bottle_jug";
hint = "Juggernog";
break;
case 2;
perk = "zombie_perk_bottle_doubletap";
hint = "ze Root Beer";
break;
case 3;
perk = "zombie_perk_bottle_sleight";
hint = "Speed Cola";
break;
}

perk_bottle SetModel(perk);
level.w_trigger SetHintString("Press ^3&&1 ^7to get " + hint + "!");
self waittill("trigger", player);
player GiveWeapon(perk);
player SwitchToWeapon(perk);
wait(3);
player TakeWeapon(perk);

Makes code a lot shorter, easier to read, and it looks clean. Just my opinion.

 

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 Twitch
Loading ...