global dev_mode = true;
on server/private match use F (or your bind +activate) and see console
global dev_mode = true;
on server/private match use F (or your bind +activate) and see console
zyrox-tech
Position and angle are written in the console when you press F (bind +activate)
i don’t think it’s worth creating a new post for this, you could ask this in a post with a script
Mr. Android
I would like to implement this, but so far I am limited due to the lack of knowledge of many ChaiScript functions, and there is also a lack of GSC function waittill, thread (this is the most necessary), endon.
MagicBullet => crush server
BulletTrace(not working) and other functions that can return arrays do not return them
Set/Get field either have no result or crush the server
While I made the primitive logic of the movement of bots, I had to hide the model of the bot itself and move the model (otherwise I could not give animations of movement) (attached video, updated post)
Since I try to make Survival Mod, the first thing I started is the bots, or rather their logic of movement and attack.
At the moment I only implemented LookLogic (not fully)
This is just a preview, I think in the future I can give the bots full logic, but my plans are only related to Survival Mod, I do not consider other modes yet (FFA is currently working)
Send me PM, if you have any ideas for realizing
Watching logic
https://www.youtube.com/watch?v=RDlMABVC9Vw
Move logic
https://www.youtube.com/watch?v=N81LXQvNl3k
Animated move
https://www.youtube.com/watch?v=3brC8vSBS1w
Implemeted:
[this list will be updated]
Download movement animation added
Source:
// This is preview version
// This is only the beginning of creating bots with the logic of movement and attack,
// but first of all I want to create Survival mode, so do not expect bots that can play in TDM, FFA, DZ and other.
// I guess I would do it after creating this script
// AIBots by S3VDITO
// Ver 0.0.0.3
// Realized:
// 1 - watching for player function (not works now)
// 2 - move logic [not fully] [without check collision] (in progress...)
// 3 - animated movement
gsc.setDvar("testClients_doAttack", 0);
gsc.setDvar("testClients_doCrouch", 0);
gsc.setDvar("testClients_doMove", 0);
gsc.setDvar("testClients_doReload", 0);
gsc.setDvar("testClients_doWatchKillcam", 0);
gsc.setDvarIfUninitialized("testClients_doSpeed", 4);
global bot_speed = to_float(gsc.getDvar("testClients_doSpeed"));
global bots_list = [];
global player_target_list = [];
level.onNotify("connected", fun(args) {
var player = args[0];
print(player.getGuid().find("bot"));
if(player.getGuid().find("bot") != 0)
{
print("Player connected");
player_target_list.push_back_ref(player);
}
});
level.onNotify("prematch_done", fun(args) {
if(gsc.getDvar("g_gametype") == "dm") {
for(var entRef = 0; entRef < 18; ++entRef)
{
var tempEntBot = gsc.getEntByNum(entRef);
if(tempEntBot.getGuid().find("bot") == 0)
{
var animBody = gsc.spawn("script_model", tempEntBot.getOrigin());
animBody.setmodel("mp_body_delta_elite_assault_ab");
animBody.notsolid();
animBody.LinkTo(tempEntBot, "tag_origin", [-4, 0, -1], [-4, 0, -1]);
bots_list.push_back_ref(tempEntBot);
setInterval(fun[tempEntBot, animBody]() {
botMove(tempEntBot, gsc.getEntByNum(0), animBody);
}, 50);
setInterval(fun[animBody]() {
animBody.scriptModelPlayAnim("pb_stumble_pistol_walk_forward");
}, 1000);
}
}
}
});
def botMove(bot, target, animModel)
{
var bot_weapon_origin = bot.getTagOrigin("tag_weapon_left");
HideTestClientParts(bot);
if(LockSightTest(bot, target) == false)
{
// animModel.scriptModelPlayAnim("pb_stand_alert_pistol");
return;
}
else
{
var angle = gsc.vectorToAngles([target.getTagOrigin("j_helmet")[0] - bot_weapon_origin[0], target.getTagOrigin("j_helmet")[1] - bot_weapon_origin[1], target.getTagOrigin("j_helmet")[2] - bot_weapon_origin[2]]);
bot.setPlayerAngles(angle);
// Spaming field bug =(
//animModel.set("angles", bot.getPlayerAngles());
}
var moveTarget = target.getOrigin();
var distance = gsc.distanceSquared(moveTarget, bot.getOrigin());
if(gsc.distance(moveTarget, bot.getOrigin()) <= 64)
{
// bot_speed = 0;
}
else
{
bot_speed = to_float(gsc.getDvar("testClients_doSpeed"));
var normalize = gsc.vectorNormalize([moveTarget[0] - bot.getOrigin()[0], moveTarget[1] - bot.getOrigin()[1], moveTarget[2] - bot.getOrigin()[2]]);
bot.setOrigin([bot.getOrigin()[0] + normalize[0] * bot_speed, bot.getOrigin()[1] + normalize[1] * bot_speed, bot.getOrigin()[2] + normalize[2] * bot_speed]);
}
}
def HideTestClientParts(bot)
{
bot.hidepart("j_ankle_le");
bot.hidepart("j_hiptwist_le");
bot.hidepart("j_head");
bot.hidepart("j_helmet");
bot.hidepart("j_eyeball_le");
bot.hidepart("j_clavicle_le");
}
// Stolen from _stinger.gsc :)
def LockSightTest(self, target)
{
var eyePos = self.GetEye();
var passed = gsc.SightTracePassed(eyePos, target.getOrigin(), false, target);
if ( passed == 1)
{
return true;
}
var front = target.GetPointInBounds(1, 0, 0);
passed = gsc.SightTracePassed( eyePos, front, false, target );
if (passed == 1)
{
return true;
}
var back = target.GetPointInBounds(-1, 0, 0);
passed = gsc.SightTracePassed( eyePos, back, false, target );
if (passed == 1)
{
return true;
}
return false;
}
naccib
BulletTrace was an example, but thanks for this comment (I learned something new ).
There are a lot of such not working functions, i listed them above and i sure that there are many more
May be a problem in setOrigin itself, because many gsc functions work inappropriately(giveWeapon, openMenu, BulletTrace and may be others)
For example, I do not get errors when using iPrint functions(but setOrigin crush dedicate and private match(I don’t know, maybe it’s just me)):
level.onNotify("connected", fun(args) {
var player = args[0];
// Press space :)
player.onNotify("jumped", fun[player](args){
avFunction(player);
});
});
def avFunction(player)
{
var obj = gsc.spawn("script_model", player.getOrigin());
var interval = setInterval(fun[player, obj]()
{
player.iPrintLnBold("This is test");
player.iPrintLn(obj.getOrigin());
}, 1000);
}
I think this is enough to start
In C ++, it will be very difficult to create such without knowledge
// This is ChaiScript
level.onNotify("connected", fun(arguments) {
// you can make new var
// var player = arguments[0];
var hud_text = gsc.newClientHudElem(arguments[0]);
hud_text.set("x", 0);
hud_text.set("y", 0);
hud_text.set("font", "hudbig");
hud_text.set("fontscale", 0.65);
hud_text.setText("^2HELLO WORLD, THIS IS HUD!");
});
There are a few problems:
You can use command connect localhost:port
If server with password:
Open console
jeriqualy said in inf_default.dsr:
Hello,
would there be a charitable soul to give me Infect mode configured with usp without ammunition, etc.
Thanks
You can create and edit the mode settings yourself (you don’t even have to use Notepad), this is built into the game
Go to Private Match => Game Setup => Make Setups => Click on: Save Recipe To Disk => Give name (remember it) => look in folder admin(client folder) => find file with names you gave => Done
Is it possible to run the server and the game on the same computer (without using virtual machines)?
When I start the server, I can’t open game (and vice versa)
FragsAreUs said in [Release] Hight jump zone:
FragsAreUs nvm fixed it by removing the } on line 14
Thanks for the comment, I fixed the shared file
P.S. there is no such error in the source code attached to the post
I wrote a small script to diversify the infection server
At first I wanted to make MapEdit, but so far it’s unrealistic ( i don’t know C++ and how to look for the necessary offsets)
Before declaring me a thief, I’ll say that this is a piece of my code converted to ChaiScript, I just used fragments of QBots, because I don’t know the full syntax of Chai...
Script can be work on dedicate server/private match
https://www.youtube.com/watch?v=7v5MURmKecM
global dev_mode = false;
global jump_zones = [];
level.onNotify("prematch_done", fun(arguments) {
switch(gsc.getDvar("mapname")) {
case("mp_paris") {
createJumpZone([-1036.623, -739.0071, 145.1301], [0, 0, 1250]);
createJumpZone([-1888.126, 632.3943, 289.125], [-250, 0, 1150]);
break;
}
}
});
level.onNotify("connected", fun(arguments) {
var player = arguments[0];
var distance = 0;
player.notifyOnPlayerCommand("jump_action", "+activate");
player.onNotify("jump_action", fun[player](arguments) {
if(dev_mode) {
print(player.getOrigin());
print(player.getPlayerAngles());
}
for(var index = 0; index < size(jump_zones); ++index) {
if(gsc.distance(player.getOrigin(), jump_zones[index].getOrigin()) < 175 && player.isOnGround() == 1) {
// i trying create jump script, but notify damage can't return MOD_DAMAGE...,
// pluto-framework can fix it(pluto-framework can handling damage)
player.setVelocity(jump_zones[index].get("impulse"));
player.iPrintLnBold("I belive, i can fly");
break;
}
}
})
});
def createJumpZone(position, impulse) {
var zone = gsc.spawn("script_model", position);
zone.setModel("weapon_c4_bombsquad");
zone.setCursorHint("HINT_NOICON");
zone.setHintString("Press and hold ^1[{+activate}] ^7for jump");
zone.makeUsable();
zone.set("impulse", impulse);
jump_zones.push_back_ref(zone);
return zone;
}
How to install:
jump.chai
send jump.chai in "...\AppData\Local\Plutonium\storage\iw5\scripts"
How to get pos:
global dev_mode = false; // change false to true
use mode spectator and pressing F (or other button with bind +activate) for show origin and angles on console
How to add new maps:
find it:
switch(gsc.getDvar("mapname")) {
case("mp_paris") {
createJumpZone([-1036.623, -739.0071, 145.1301], [0, 0, 1250]);
createJumpZone([-1888.126, 632.3943, 289.125], [-250, 0, 1150]);
break;
}
and add new case (this is example):
case("mp_dome") { createJumpZone([0, 0, -350], [0, 0, 99999]); break; }
// origin is vector3 [X, Y, Z] (you can check needs origin with enabled dev mode)
// jump_impulse is vector3 [X, Y, Z]
createJumpZone(origin, jump_impulse);
Survival bot logic is also compiled on GSC
But there is one more problem, not all GSC functions from SP(single player) will work in MP(Multi player), so getting adequate bots from Survival to multiplayer will not easy =(
you can rewrite (or write your own, but why reinvent the wheel?) the logic of bots from the MW2 mod, but due to imperfection of scripting languages on iw5 this is not yet possible (some features are missing or poorly implemented)
Therefore now this is impossible ...
but, i believe Pluto developers will give us this opportunity!
+1 for LUA
LastDemon99 The language is good, but IS(Infinity Script) was too cut back
Rosamaha said in [Question] LUA Menu & ChaiScript:
S3VDITO that just work for private right now or? So I can‘t do that on a Server ?
Greetings Rosamaha
I achieved work only in Private Match, it will not work on a dedicated server
But you will have to make small improvements, add a small piece of code
Chai
// ChaiScript (giweWeapon not work(i getting crush))
level.onNotify("connected", fun(args) {
var player = args[0];
// Trying jump notify for check currnetly selected weapon
player.onNotify("jumped", fun(player)
{
if(gsc.getDvar("weapon") != "null")
{
player.iprintlnbold(gsc.getDvar("weapon"));
}
});
});
LUA
// Example(but add Game.SetDvar for all OnClick event)
weapon_m16a4 = Popup_AddButton_Advanced(weapons, "M16A4", -225, -40, 450,
function(menu, item) -- on click
// ADDED
Game.SetDvar("weapon", "iw5_m16a4_mp")
Game.CloseMenu("assault_class");
end,
function(menu, item) -- on focus
weapon_icon_assault:SetMaterial("weapon_m16a4")
weapon_info_assault:SetText("Short burst shot")
end,
nil,
nil,
nil)
I'll start with LUA:
Because of quarantine, I wanted to make a mod for an arms store (I wanted to repeat Survival Mod MW 2), but having made a menu for assault and sniper rifles, I asked myself: HOW TO GIVE THEM OUT ?!
After thinking a bit, I decided to add a script (about it later) and it worked!
[I used Game.SetDvar to implement this...]
So questions about LUA:
player.openMenu("menu"); // now i used it i get crush, i use default menu perk_display
ChaiScript:
Some commands crush server, so I could not use:
player.giveWeapon("weapon"); // and other it command version giveWeapon(name, variant, akimbo) (private match and dedicate server)
player.openMenu("menu"); // i getting crush server (private match and dedicate server)
//probably the list is bigger, but I wrote only those that caused the server crash
Source code menu: https://pastebin.com/raw/Nnmwt19M
How to install it(Menu):
1 - after starting the game open file common.lua (path: C:\Users\USERNAME\AppData\Local\Plutonium\storage\iw5\ui), open it with notepad, find
function Popup_AddButton_Advanced(menu, text, xpos, ypos, width, onclickcb, onfocuscb, isvisiblecb, isenabledcb)
add after menu:AddItem(button) (end function)
return button
2 - copy source and create new file(Ex: weapons.lua) in C:\Users\USERNAME\AppData\Local\Plutonium\storage\iw5\ui_mp
3 - Start private match(your can open menu in dedicate server or ingame menu)
4 - open console and write command
openmenu weapon_class_selector
Kalitos what is the bad path that is listed above?
Scripts loaded from: C:\Users\Administrator\AppData\Local\Plutonium\storage\iw5\scripts (they work)
but plugins not works on path C:\Users\Administrator\AppData\Local\Plutonium\storage\iw5\plugins
EDITS
I am an idiot... i did not notice the storage folder in the server folder
i get a problem, i can’t load the plugin, at first thought that the plugins didn’t load in private macth, starting the server on VPS did not solve the problem (i tried to run isnipe, Plutoscript Framework, and one script from the plugin creation tutorial), but the server does not see plugins
my path for plugins(on vps): C:\Users\Administrator\AppData\Local\Plutonium\storage\iw5\plugins
[ChaiScript works, not working plugins]
EDITS
I am idiot... i did not notice the storage folder in the server folder
path for plugins: C:\Program Files (x86)\Steam\steamapps\common\Call of Duty Modern Warfare 3\storage\iw5\plugins