script error...

Have questions about CoD/UO mapping that aren't covered in the tutorials section? Post here!

Moderator: Core Staff

Post Reply
User avatar
Tehdisciple
CJ Wannabe
CJ Wannabe
Posts: 45
Joined: April 16th, 2007, 4:31 pm
Location: Nj

script error...

Post by Tehdisciple » September 4th, 2007, 3:13 pm

Well, here i am again with another error...I am trying to make a vending machine so when you shoot the button it will give you the weapon that you have selected. I get a script runtime error when i use this script:

Code: Select all

main()
{
maps\mp\_load::main();
thread arena_onSpawn();
thread arena_weapon1();
}

arena_onSpawn()
{
   trig = 

getent("arena_trig","targetname");

   for(;;) 
   {
      trig waittill("trigger", other);
      other thread 

arena_onPlayerSpawned();
      wait 0.05;
   }
}

arena_onPlayerSpawned()
{
      self takeAllWeapons();
      wait 0.05;
}

arena_weapon1()
{
trig = 

getent("arena_weapon1","targetna

me");
while (1)
{
trig waittill ("damage", idamage);
if(idamage > 1)
{
self giveweapon("m1garand_mp");
}
}
}
Idk what is wrong..
Last edited by Tehdisciple on September 5th, 2007, 4:25 pm, edited 1 time in total.
Image
Xfire:m00n1
" i just crashed paint -.-" - Disciple

User avatar
YaNo
CJ Worshipper
CJ Worshipper
Posts: 460
Joined: May 5th, 2005, 9:34 pm
Location: Azeroth
Contact:

Post by YaNo » September 4th, 2007, 4:02 pm

Try this :)

Code: Select all

main() 
{ 
maps\mp\_load::main(); 
thread arena_onSpawn(); 
thread arena_weapon1(); 
} 

arena_onSpawn() 
{ 
   trig = getent("arena_trig","targetname"); 

   while(1)
   { 
      trig waittill("trigger", user); 
      self takeAllWeapons(); 
      wait 0.5;
   } 
} 

arena_weapon1() 
{ 
trig = getent("arena_weapon1","targetname"); 
while (1) 
{ 
trig waittill ("damage", idamage); 
if(idamage > 1) 
{ 
self giveweapon("m1garand_mp"); 
} 
} 
}

Deadly
CJ Fan
CJ Fan
Posts: 138
Joined: July 14th, 2007, 8:53 pm
Location: New Jersey
Contact:

Post by Deadly » September 4th, 2007, 4:15 pm

trig = ?

should it be

trig = getent("arena_trig","targetname");
Image

User avatar
Tehdisciple
CJ Wannabe
CJ Wannabe
Posts: 45
Joined: April 16th, 2007, 4:31 pm
Location: Nj

Nope

Post by Tehdisciple » September 4th, 2007, 4:16 pm

no runtime error, but it didnt take the weapons or gave the weapon. =(
Image
Xfire:m00n1
" i just crashed paint -.-" - Disciple

Deadly
CJ Fan
CJ Fan
Posts: 138
Joined: July 14th, 2007, 8:53 pm
Location: New Jersey
Contact:

Post by Deadly » September 4th, 2007, 4:36 pm

lol for real im nto sure. try to re-do the whole script. and even undo the entities on the map and re name them something else
Image

User avatar
Nightmare
Core Staff
Core Staff
Posts: 2688
Joined: January 12th, 2006, 10:09 pm
Contact:

Post by Nightmare » September 4th, 2007, 8:22 pm

A couple of questions:
Is your trigger for removing the weapons a trigger/multiple?
Is your trigger for receiving the damage a trigger/damage?
How could you give damage to a trigger if your weapons are removed?
Whats the runtime error displayed? (Type in /developer 1 in console before running the map to get a detailed view of the error)

And Deadly, be nicer to others :)
Coding is Poetry. Mapping is Art.
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet

-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]

User avatar
Tehdisciple
CJ Wannabe
CJ Wannabe
Posts: 45
Joined: April 16th, 2007, 4:31 pm
Location: Nj

NM

Post by Tehdisciple » September 4th, 2007, 8:31 pm

Yes it is trigger multiple for taking away weapons
Yes it is trigger damage for giving weapons.
I have pistols after spawn.
parameter 1 does no exist: (file 'maps\mp\gametypes\_lev.gsc', line 1075 self.fpshud setValue();
thats first part of error

Thx for telling deadly. =D
Image
Xfire:m00n1
" i just crashed paint -.-" - Disciple

User avatar
Nightmare
Core Staff
Core Staff
Posts: 2688
Joined: January 12th, 2006, 10:09 pm
Contact:

Post by Nightmare » September 4th, 2007, 8:59 pm

well that error happens with the save mod when you run developer mode, it has nothing to do with the map. When testing the map, don't save and load.
Go ahead and try again
Coding is Poetry. Mapping is Art.
"Cause im the sexiest mapper ever...except for nm, that sexy man" - Soviet

-=[CoDJumper.com Movies]=-
[Ambush] || [Backlot] || [Bloc] || [Bog] || [Broadcast] || [Chinatown] || [Countdown]
[Crash] || [Creek] || [Crossfire] || [District] || [Downpour] || [Killhouse] || [Overgrown]
[Pipeline] || [Shipment & Wetwork] || [Showdown] || [Strike] || [Vacant]

User avatar
Tehdisciple
CJ Wannabe
CJ Wannabe
Posts: 45
Joined: April 16th, 2007, 4:31 pm
Location: Nj

nm

Post by Tehdisciple » September 4th, 2007, 9:02 pm

the runtime error didnt come up when i was saving/loading, it came up after i chose a weapon and was about to spawn
Image
Xfire:m00n1
" i just crashed paint -.-" - Disciple

User avatar
Drofder2004
Core Staff
Core Staff
Posts: 13313
Joined: April 13th, 2005, 8:22 pm
Location: UK, London

Post by Drofder2004 » September 6th, 2007, 3:02 pm

Deadly wrote:lol. disciple doesnt care. and if you do.... i know where you live.... mu hahahahaa.
Message deleted. This is not the "CoDJumper General chat" area, if it isnt helpful, its not welcome.

Ok, lets run through the script...

Code: Select all

arena_onSpawn()
{
   trig = getent("arena_trig","targetname");

   while(1)
   {
      trig waittill("trigger", user);
      self takeAllWeapons();
      wait 0.5;
   }
}
First problem, it above.

You tell the trigger [trig] to wait until the player [user] triggers it.
You then say SELF take all weapons.

SELF refers to the entity which CALLED the thread, because you have no entity calling the event, self becomes level.

So, what your code is asking, is that the level be removed of its weapons, (obviously this will do nothing, as a level has no weapon).

Change SELF for USER.


Ok, the next problem is the second thread, its the same problem, except it gets a little more complicated.
This time you are using a damage trigger, which measures how much damage it received [idamage], so you need to make a slight adjustment to that...

Code: Select all

trig waittill ("damage", idamage, user);
and then finally, again, change SELF for USER.
Image
Virgin Media 20Mb Broadband:
"Perfect for families going online at the same time, downloading movies, online gaming and more."
Borked internet since: 22-07-2010

Post Reply

Who is online

Users browsing this forum: No registered users and 19 guests