UGX-Mods

Call of Duty 5: World at War => Help Desk => Scripting => Topic started by: zombie madness on March 23, 2014, 06:29:57 pm

Title: 1 problem with my script
Post by: zombie madness on March 23, 2014, 06:29:57 pm
this is my script:

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

main()
{
string = "lol";
iprintln ("get the power turned on");
iprintln (string);

trig = getEnt ("use_power_switch","targetname");
trig setHintString ("press &&1 to turn on power");
trig setCursorHint ("HINT_NOICON");
trig UseTriggerRequireLookAt();

trig waittill ("trigger");
trig Delete();
iprintln ("congrats the power is now on");
iprintln ("nothing to see here");
}
but for some reason its messing with the zombie spawns the zombies wont spawn untill i turn on the power

any ideas?
Title: Re: 1 problem with my script
Post by: jjbradman on March 23, 2014, 06:48:29 pm
first of all use codeboxed, second, do you want the trigger to display that text or just do a print? also do you want the trigger to turn on the power?

anyways it seemed that you tried to do this, try it out ;)

just add

Code Snippet
Plaintext
thread maps\_script::main();
after maps\zombiemode in your map.gsc

and put this code in a gsc calles "_script" inside your mod maps folder

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

main()
{
players = get_players();

   for( i=0; i<players.size; i++ )
  {
  wait 2;
  players[i] iprintln ("get the power turned on");
  players[i] iprintln ("lol");
  }
 
   flag_wait( "electricity_on" );
 
   for( i=0; i<players.size; i++ )
  {
  players[i] iprintln ("congrats the power is now on");
  wait 1;
  players[i] iprintln ("nothing to see here");
  }
}
Title: Re: 1 problem with my script
Post by: zombie madness on March 23, 2014, 06:49:52 pm
first of all use codeboxed, second, do you want the trigger to display that text or just do a print? also do you want the trigger to turn on the power?
i want the trigger to turn on the power and display the text but zombies wont spawn untill the power is on
Title: Re: 1 problem with my script
Post by: jjbradman on March 23, 2014, 07:04:26 pm
i want the trigger to turn on the power and display the text but zombies wont spawn untill the power is on
you can use the code i posted that will print on screen what you wanted when the power is turned on, if you want the power trigger to display the text only when the player is looking at the trigger you would need to edit dlc3.gsc or zombiemode, i dont remember which managed the power switch :L
Title: Re: 1 problem with my script
Post by: zombie madness on March 23, 2014, 07:19:43 pm
it didnt work
Title: Re: 1 problem with my script
Post by: jjbradman on March 23, 2014, 07:23:14 pm
it didnt work
id gave bad syntax or didnt printed anything?
Title: Re: 1 problem with my script
Post by: YaPh1l on March 23, 2014, 07:24:35 pm
zombies wont spawn untill the power is on
That is because you are calling your script like this:
Code Snippet
Plaintext
maps\_file::main();
while you should be calling it as a thread, as jjbradman said:
Code Snippet
Plaintext
thread maps\_file::main();
But also, this
Code Snippet
Plaintext
#include common_scripts\utility; 
#include maps\_utility;
#include maps\_zombiemode_utility;

main()
{
players = get_players();

   for( i=0; i<players.size; i++ )
  {
  wait 2;
  players[i] iprintln ("get the power turned on");
  players[i] iprintln ("lol");
  }
 
   flag_wait( "electricity_on" );
 
   for( i=0; i<players.size; i++ )
  {
  players[i] iprintln ("congrats the power is now on");
  wait 1;
  players[i] iprintln ("nothing to see here");
  }
}
Is not necessary and badly overcomplicates the whole script. iPrintLn() will print on the screen of all players by default (= if not called on a specific player). So the original script was perfectly fine in that regard.
Anyway, you might be best off just editing the power switch code in dlc3_code.gsc

- Phil.
Title: Re: 1 problem with my script
Post by: zombie madness on March 23, 2014, 07:24:48 pm
id gave bad syntax or didnt printed anything?
no the printing of the text is fine works and everything but the zombies do not spawn untill the power is turned on the script is messing with the zombies spawn somehow

Post Merge: March 23, 2014, 07:27:13 pm
That is because you are calling your script like this:
Code Snippet
Plaintext
maps\_file::main();
while you should be calling it as a thread, as jjbradman said:
Code Snippet
Plaintext
thread maps\_file::main();
But also, thisIs not necessary and badly overcomplicates the whole script. iPrintLn() will print on the screen of all players by default (= if not called on a specific player). So the original script was perfectly fine in that regard.
Anyway, you might be best off just editing the power switch code in dlc3_code.gsc

- Phil.
everything is fine to do with the iprintln but the zombies is my only problem they will not spawn unless the power is on which is located in another room
Title: Re: 1 problem with my script
Post by: YaPh1l on March 23, 2014, 07:36:41 pm
Would you post your mapname.gsc code?

- Phil.
Title: Re: 1 problem with my script
Post by: zombie madness on March 23, 2014, 07:37:52 pm
Would you post your mapname.gsc code?

- Phil.
yeah shure and wait a sec i mis read the other post you put
Title: Re: 1 problem with my script
Post by: jjbradman on March 23, 2014, 07:38:18 pm
lol yaphil slapped me again with my fails  :-X haha
but then the real problem must be other script not this one
Title: Re: 1 problem with my script
Post by: zombie madness on March 23, 2014, 07:44:26 pm
lol yaphil slapped me again with my fails  :-X haha
but then the real problem must be other script not this one
its fixed now i was putting in maps instead of thread lol not bad considering its my first ever script
Title: Re: 1 problem with my script
Post by: daedra descent on March 23, 2014, 08:49:49 pm
You can have more than one power system. Just make a basic trig, edit the prefab's KVP's, and notify the level for the perks and "electricity on".  Just make sure that you have the original DLC3 power switch hidden in your map somewhere.
Title: Re: 1 problem with my script
Post by: zombie madness on March 24, 2014, 02:35:22 am
You can have more than one power system. Just make a basic trig, edit the prefab's KVP's, and notify the level for the perks and "electricity on".  Just make sure that you have the original DLC3 power switch hidden in your map somewhere.
then i woud of had the problem of xmodel limit im not too far from it all ready and it seems i dont have a lot in my map but im pretty shure pathnodes are classed as xmodel well thats what it says in my map info
Title: Re: 1 problem with my script
Post by: YaPh1l on March 24, 2014, 11:26:51 am
I'm pretty certain that pathnodes do not count as models.

- Phil.
Title: Re: 1 problem with my script
Post by: zombie madness on March 24, 2014, 02:02:20 pm
I'm pretty certain that pathnodes do not count as models.

- Phil.
it says entities 768 in raidiant lol but idk