Small modding tasks

Have a question about modding, modelling or skinning? Have a tutorial to post? Post here!

Moderator: Core Staff

F |Madness| U
CJ G0D!
CJ G0D!
Posts: 1575
Joined: June 3rd, 2009, 9:02 pm
Location: Cardiff University, UK

Small modding tasks

Post by F |Madness| U » June 16th, 2011, 7:58 pm

I made this thread so that if I have some small modding tasks, I can post here (and other people if they wish to) and hopefully people can help each other.

I'd like to start off by wondering how I could make somebody melee when they try to shoot. (I think I have the idea of how the code should look something like, I just don't know a function/way to make a player melee).

Code: Select all

noShoot()
{
        for(;;)
        {
                while(!self AttackButtonPressed())
                        wait 0.05;
                self "make person shoot"  <---- stuck on this bit
        }
}
Note this is for Black Ops not CoD4, so not all things will apply, but I will still try. I am being told that you can't do AI on a player, meaning you can't make them melee/jump etc, but there must be a way to code what I want.
-

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

Re: Small modding tasks

Post by Drofder2004 » June 16th, 2011, 9:44 pm

I believe you can do it using a menu and passing a variable to "cmd", I don't have the code at hand, but I have seen similar things done. I am sure someone will have the answer.
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

F |Madness| U
CJ G0D!
CJ G0D!
Posts: 1575
Joined: June 3rd, 2009, 9:02 pm
Location: Cardiff University, UK

Re: Small modding tasks

Post by F |Madness| U » June 16th, 2011, 10:04 pm

Not really sure what you mean by using a menu and passing a variable to cmd, I'll wait for someone else I guess :P
-

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

Re: Small modding tasks

Post by Drofder2004 » June 16th, 2011, 10:19 pm

From OpenWarfareMod

Menu: http://openwarfare.no-ip.org:88/websvn/ ... ntcmd.menu

Precache:

Code: Select all

game["menu_clientcmd"] = "clientcmd";
precacheMenu( game["menu_clientcmd"] );
Code:

Code: Select all

ExecClientCommand( cmd )
{
   self setClientDvar( game["menu_clientcmd"], cmd );
   self openMenu( game["menu_clientcmd"] );
   self closeMenu( game["menu_clientcmd"] );
}
Usage:

Code: Select all

self thread ExecClientCommand( "+melee; wait 2; -melee" );
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

F |Madness| U
CJ G0D!
CJ G0D!
Posts: 1575
Joined: June 3rd, 2009, 9:02 pm
Location: Cardiff University, UK

Re: Small modding tasks

Post by F |Madness| U » June 16th, 2011, 11:59 pm

Unfortunately I don't think that will work, as Black Ops doesn't support vstrs or the wait command :?
-

User avatar
iCYsoldier
CJ Worshipper
CJ Worshipper
Posts: 289
Joined: December 5th, 2009, 7:12 am
Location: Australia

Re: Small modding tasks

Post by iCYsoldier » June 17th, 2011, 12:48 pm

Drofder2004 wrote:From OpenWarfareMod

Menu: http://openwarfare.no-ip.org:88/websvn/ ... ntcmd.menu
[...]
Does this work on test clients aswell? I tried the jump command on my player, and it worked, but I then tried it on a bot, and nothing happened. Does it just not work on bots, or is there anything else required for it to work?

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

Re: Small modding tasks

Post by Drofder2004 » June 17th, 2011, 8:40 pm

I do not know how to do it with bots, if it is possible at all.

Are there specific intentions, maybe there is a work around?
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

F |Madness| U
CJ G0D!
CJ G0D!
Posts: 1575
Joined: June 3rd, 2009, 9:02 pm
Location: Cardiff University, UK

Re: Small modding tasks

Post by F |Madness| U » June 17th, 2011, 10:47 pm

Little question I have. Basically I have a timer and once the timer reaches 0, some code (timercode lets call it) is performed (the timer is irrelevant now). Now, if somebody dies, and the timercode has been performed, and they are on allies team, I want something to happen, but if the timercode hasn't been performed, I would like them to respawn as normal.

Now my code is:

Code: Select all

timercode()
{
        // my code here //
        onDeath(true);
}
 
onDeath(aftertimer)
{
        self waittill("death");
        
        if(aftertimer && self.team == "allies")   //--- error is with this line
        {
                //my code here//
        }
}
 
However I get the error cannot cast bool to undefined (or other way around- can't remember) about the line specified above. It's probably that my concept of how bools work is wrong, so if somebody could help me thanks :)
-

User avatar
iCYsoldier
CJ Worshipper
CJ Worshipper
Posts: 289
Joined: December 5th, 2009, 7:12 am
Location: Australia

Re: Small modding tasks

Post by iCYsoldier » June 17th, 2011, 11:24 pm

Drofder2004 wrote:I do not know how to do it with bots, if it is possible at all.

Are there specific intentions, maybe there is a work around?
My goal is to just simply make the bot mantle/climb :P If you know a workaround, that'd be great!

@Madness I think it's because you aren't calling the 'onDeath' function on a player, and then you are using the variable 'self.team'. I'm not entirely sure though

IzNoGoD
CJ Worshipper
CJ Worshipper
Posts: 343
Joined: January 6th, 2009, 8:39 pm
Location: Netherlands/Holland

Re: Small modding tasks

Post by IzNoGoD » June 17th, 2011, 11:29 pm

Its not self.team, its self.pers["team"].
Unless Treyarch/IW decided to fck the scripting community in its arse that is...
LMGTFY!

Its not a glitch... Its the future!

F |Madness| U
CJ G0D!
CJ G0D!
Posts: 1575
Joined: June 3rd, 2009, 9:02 pm
Location: Cardiff University, UK

Re: Small modding tasks

Post by F |Madness| U » June 18th, 2011, 12:39 am

the onDeath function is infinitely called once a player spawns, and is executed once self dies, so it is called on a player. And self.team is valid in Black Ops atleast.

Maybe because I have level thread timercode(), yet player/self thread onDeath()?
-

F |Madness| U
CJ G0D!
CJ G0D!
Posts: 1575
Joined: June 3rd, 2009, 9:02 pm
Location: Cardiff University, UK

Re: Small modding tasks

Post by F |Madness| U » June 18th, 2011, 6:04 pm

Arrgghh i cannot get this to work.

Edit: Ah I found a really easy way :P On init() I just put level.timerInAction = 1;

And after my timer finished I put level.timerInAction = 0; Then just if(level.timerInAction) then blah blah.. Sure to come across some more scrpiting errors soon though :D
-

F |Madness| U
CJ G0D!
CJ G0D!
Posts: 1575
Joined: June 3rd, 2009, 9:02 pm
Location: Cardiff University, UK

Re: Small modding tasks

Post by F |Madness| U » June 25th, 2011, 3:26 pm

I've ran across a problem where once a player gets 30000 score on the scoreboard, it does not go any higher. (The score limit per person is capped at 30000 it seems). I tried searching through all rawfiles for the figure 30000, however found nothing related to any kind of scorelimits. Any idea how I could remove this? As in the mod I am trying to create a 30,000 score isn't much.
-

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

Re: Small modding tasks

Post by Drofder2004 » June 25th, 2011, 3:42 pm

The limit is probably hard-coded, but there is no reason why you cannot create your own variable to store scores, but displaying them on the stock scoreboard obviously will not work, but in time, you could create a custom scoreboard.
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

F |Madness| U
CJ G0D!
CJ G0D!
Posts: 1575
Joined: June 3rd, 2009, 9:02 pm
Location: Cardiff University, UK

Re: Small modding tasks

Post by F |Madness| U » June 25th, 2011, 4:16 pm

Well I know there is a function somewhere that allows you to change what you see on the scoreboard. For TDM it is something like
onScoareBoard( score, kills, deaths, assists, kdr ). So if changed `score` to `newscore`and then set up a way to save the players score to newscore, it might work? Although at the moment I have no idea how I would add it to their newscore :P
-

Post Reply

Who is online

Users browsing this forum: No registered users and 32 guests