small gametype/mod question/problem

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

Moderator: Core Staff

Post Reply
creator
CJ Worshipper
CJ Worshipper
Posts: 492
Joined: July 6th, 2006, 11:37 pm
Location: The Netherlands
Contact:

small gametype/mod question/problem

Post by creator » December 14th, 2006, 4:27 pm

im trying to make a small mod that will explode people when they die,
i made these folders:
maps/mp/gametypes/explode.gsc
there isnt a error but it aint working.

Code: Select all

main()
{
	thread testfield();
}
testfield()
{
origin = self getorigin();
		range = 300;
		maxdamage = 2000;
		mindamage = 50;

if(user.health > 1)
playfx ( level._effect["mine_explosion"], origin);
}
}
can anyone tell me why? and if im doing it wrong pls tell me what im doing wrong

creator
Last edited by creator on December 14th, 2006, 6:56 pm, edited 1 time in total.
Cod 1 Mapper&Modder&Moddeler

steveuk
CJ G0D!
CJ G0D!
Posts: 1330
Joined: November 21st, 2006, 12:51 pm

Post by steveuk » December 14th, 2006, 5:04 pm

If ya get it working let me know so a can send me a copy, this sound fun and intresting.. :lol:

SteveUK 8)

creator
CJ Worshipper
CJ Worshipper
Posts: 492
Joined: July 6th, 2006, 11:37 pm
Location: The Netherlands
Contact:

Post by creator » December 14th, 2006, 5:44 pm

will do :) if.. i ever get it to work :(
Cod 1 Mapper&Modder&Moddeler

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

Post by Drofder2004 » December 15th, 2006, 3:03 pm

where have you threaded the script from?
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

creator
CJ Worshipper
CJ Worshipper
Posts: 492
Joined: July 6th, 2006, 11:37 pm
Location: The Netherlands
Contact:

Post by creator » December 15th, 2006, 5:38 pm

what u mean? and new script is:

Code: Select all

main()
{
	maps\mp\_load::main();
	level._effect["mine_explosion"] = loadfx ("fx/impacts/newimps/minefield.efx");
	thread testfield();
}
testfield()
origin = self getorigin();
{

if(user.health <= 1)
iprintlnbold("^2Working");
playfx ( level._effect["mine_explosion"], origin);
}
}
but still not working
Cod 1 Mapper&Modder&Moddeler

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

Post by Drofder2004 » December 15th, 2006, 7:26 pm

Code: Select all

main()
{
   maps\mp\_load::main();
   level._effect["mine_explosion"] = loadfx ("fx/impacts/newimps/minefield.efx");
   thread testfield();
}

testfield()
{
   players = getentarray("players","targetname");
   for(i=0;i<players.size;i++)
   {
      players[i] thread healthcheck();
   }
}

healthcheck()
{
   while(1)
   {
      if(self.health <= 1)
      {
         iprintlnbold("^2Working");
         playfx ( level._effect["mine_explosion"], self.origin);
         wait 5;
      }
      wait 0.05;
   }
}
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

creator
CJ Worshipper
CJ Worshipper
Posts: 492
Joined: July 6th, 2006, 11:37 pm
Location: The Netherlands
Contact:

Post by creator » December 15th, 2006, 11:45 pm

tested it but wont work and i cant see the green text,
but i can only test if i /kill or kill my self with nade will it only work if other kills other guy?
Cod 1 Mapper&Modder&Moddeler

creator
CJ Worshipper
CJ Worshipper
Posts: 492
Joined: July 6th, 2006, 11:37 pm
Location: The Netherlands
Contact:

Post by creator » December 17th, 2006, 1:56 am

do i maybe need to change dm/sd and other .gsc's and add it to my pk3 to make it work?
cause i saw alot of mods who do this.
and if yes wot i need to add?
Cod 1 Mapper&Modder&Moddeler

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

Post by Drofder2004 » December 17th, 2006, 3:21 am

Is this a map gsc or a mod gsc?

If its a map, this sorta thing will be hard to do, if its a mod (ie, it goes into DM/SD etc then it will be easier).
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

creator
CJ Worshipper
CJ Worshipper
Posts: 492
Joined: July 6th, 2006, 11:37 pm
Location: The Netherlands
Contact:

Post by creator » December 17th, 2006, 2:51 pm

its a mod, so how do i need to insert it and where?
Cod 1 Mapper&Modder&Moddeler

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

Post by Drofder2004 » December 17th, 2006, 5:01 pm

Ok, we can use a method were we take over a thread.
Basically, inside all gametypes, there is a thread called "Callback_PlayerKilled", this is also referenced by the variable 'level.callbackPlayerKilled'.
what we want to do is take over this callback and use our own...

First create the following code inside mymod.gsc (if you want a different name, you will need to change all instances of 'mymod'). This will be used to call our own version of the playerKilled thread...

myMod.gsc

Code: Select all

playerKilled(eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, psOffsetTime, deathAnimDuration)
{
   self endon ("disconnect");

   //Now we need to call the original thread first, to play all the death animations and register the death.
   [[level.default_CallbackPlayerKilled]](eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, psOffsetTime, deathAnimDuration);

   //Now for our code
   playFx(level._effect["mine_explosion"], self.origin);
   // Because this thread was called on the player who died, we do not need any thing but the FX.
}
So that is how to take over the function, but first we need to thread this in EVERY gametype.
First open dm.gsc

Scroll down until you find

Code: Select all

   level.callbackStartGameType = ::Callback_StartGameType;
   level.callbackPlayerConnect = ::Callback_PlayerConnect;
   level.callbackPlayerDisconnect = ::Callback_PlayerDisconnect;
   level.callbackPlayerDamage = ::Callback_PlayerDamage;
   level.callbackPlayerKilled = ::Callback_PlayerKilled;

   maps\mp\gametypes\_callbacksetup::SetupCallbacks();
Now straight after this line you will need to add the first code we created... you need to change the level.callbackPlayerKilled. It is very important that it comes after the "_callbacksetup::SetupCallback();" part, as this is the part that is created to save all the default callbacks

So, add this code...

Code: Select all

   level.callbackPlayerKilled = mymod::playerKilled;
You should now have....

Code: Select all

   level.callbackStartGameType = ::Callback_StartGameType;
   level.callbackPlayerConnect = ::Callback_PlayerConnect;
   level.callbackPlayerDisconnect = ::Callback_PlayerDisconnect;
   level.callbackPlayerDamage = ::Callback_PlayerDamage;
   level.callbackPlayerKilled = ::Callback_PlayerKilled;

   maps\mp\gametypes\_callbacksetup::SetupCallbacks();

   level.callbackPlayerKilled = mymod::playerKilled;
Give me any errors you get....

Becareful copying this code, the forum width is small and some things have gone down a line but should be 1 full line
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

creator
CJ Worshipper
CJ Worshipper
Posts: 492
Joined: July 6th, 2006, 11:37 pm
Location: The Netherlands
Contact:

Post by creator » December 17th, 2006, 7:02 pm

ok im a little confused,
is this good?
[dm.gsc]

Code: Select all

	level.callbackStartGameType = ::Callback_StartGameType;
	level.callbackPlayerConnect = ::Callback_PlayerConnect;
	level.callbackPlayerDisconnect = ::Callback_PlayerDisconnect;
	level.callbackPlayerDamage = ::Callback_PlayerDamage;
	level.callbackPlayerKilled = ::Callback_PlayerKilled;

	maps\mp\gametypes\_callbacksetup::SetupCallbacks();
playerKilled(eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, psOffsetTime, deathAnimDuration) 
{ 
   self endon ("disconnect"); 

   //Now we need to call the original thread first, to play all the death animations and register the death. 
   [[level.default_CallbackPlayerKilled]](eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, psOffsetTime, deathAnimDuration); 

   //Now for our code 
   playFx(level._effect["mine_explosion"], self.origin); 
   // Because this thread was called on the player who died, we do not need any thing but the FX. 
}
level.callbackPlayerKilled = explode::playerKilled;
[explode.gsc]

Code: Select all

playerKilled(eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, psOffsetTime, deathAnimDuration) 
{ 
   self endon ("disconnect"); 

   //Now we need to call the original thread first, to play all the death animations and register the death. 
   [[level.default_CallbackPlayerKilled]](eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, psOffsetTime, deathAnimDuration); 

   //Now for our code 
   playFx(level._effect["mine_explosion"], self.origin); 
   // Because this thread was called on the player who died, we do not need any thing but the FX. 
}
if not can u please change it?
Cod 1 Mapper&Modder&Moddeler

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

Post by Drofder2004 » December 18th, 2006, 12:50 am

I'm not sure what you have done?

In your first code box you have...

Code: Select all

   level.callbackStartGameType = ::Callback_StartGameType;
   level.callbackPlayerConnect = ::Callback_PlayerConnect;
   level.callbackPlayerDisconnect = ::Callback_PlayerDisconnect;
   level.callbackPlayerDamage = ::Callback_PlayerDamage;
   level.callbackPlayerKilled = ::Callback_PlayerKilled;

   maps\mp\gametypes\_callbacksetup::SetupCallbacks();
playerKilled(eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, psOffsetTime, deathAnimDuration)
{
   self endon ("disconnect");

   //Now we need to call the original thread first, to play all the death animations and register the death.
   [[level.default_CallbackPlayerKilled]](eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, psOffsetTime, deathAnimDuration);

   //Now for our code
   playFx(level._effect["mine_explosion"], self.origin);
   // Because this thread was called on the player who died, we do not need any thing but the FX.
}
level.callbackPlayerKilled = explode::playerKilled; 
What is all that in there for?
All that you change in dm.gsc is the single line...

Code: Select all

   level.callbackStartGameType = ::Callback_StartGameType;
   level.callbackPlayerConnect = ::Callback_PlayerConnect;
   level.callbackPlayerDisconnect = ::Callback_PlayerDisconnect;
   level.callbackPlayerDamage = ::Callback_PlayerDamage;
   level.callbackPlayerKilled = ::Callback_PlayerKilled;

   maps\mp\gametypes\_callbacksetup::SetupCallbacks();

   level.callbackPlayerKilled = mymod::playerKilled; // This is the only thing added!
Then in your seperate file.

Code: Select all

playerKilled(eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, psOffsetTime, deathAnimDuration)
{
   self endon ("disconnect");

   //Now we need to call the original thread first, to play all the death animations and register the death.
   [[level.default_CallbackPlayerKilled]](eInflictor, attacker, iDamage, sMeansOfDeath, sWeapon, vDir, sHitLoc, psOffsetTime, deathAnimDuration);

   //Now for our code
   playFx(level._effect["mine_explosion"], self.origin);
   // Because this thread was called on the player who died, we do not need any thing but the FX.
}
The second file must be placed inside the gametypes folder with the dm.gsc
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

creator
CJ Worshipper
CJ Worshipper
Posts: 492
Joined: July 6th, 2006, 11:37 pm
Location: The Netherlands
Contact:

Post by creator » December 18th, 2006, 4:15 pm

ow oke :P gonna test in a second
should the fx also play when i kill my self?
Cod 1 Mapper&Modder&Moddeler

creator
CJ Worshipper
CJ Worshipper
Posts: 492
Joined: July 6th, 2006, 11:37 pm
Location: The Netherlands
Contact:

Post by creator » December 18th, 2006, 4:24 pm

i tested but no errors or fx be showed...
here is the link to download it.
http://www.creator-mapper.com/downloads/explode.pk3 press here
cod1
Cod 1 Mapper&Modder&Moddeler

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests