UGX-Mods Login

or login with an authentication provider below
Sign In with Google
Sign In with Twitter
Sign In with Discord
Sign In with Steam
Sign In with Facebook
Sign In with Twitch

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - buttkicker845

Not tracking ammo so this will create a glitch that always refills your gun

Not checking if the gun swapping is the gun he has already

If using my perks that will breakvthe inventory

The point was to give him the idea of how to do it, not write it line by line for him. There's a lot that it doesn't account for that it needs be checking.
6 years ago
These functions will handle the weapon swap but you will need to do extra stuff to ensure that the player is actually trying to swap weapons with the AI

Code Snippet
Plaintext
/*
Sets the Ai's primary weapon to the weapon passed
<Required>: player- a player to swap weapons with the AI
<Required>: AI- an AI that will swap weapons with the Player
*/
doWeaponSwap( player, AI)
{
//save the weapons
AINewWeapon = player GetCurrentWeapon();
PlayerNewWeapon = ai.weapon;

//perform the swap
setAiWeapon(AINewWeapon);
swapPlayerCurrentWeapon(PlayerNewWeapon);
}

/*
Sets the Ai's primary weapon to the weapon passed
<Required>: self- an AI
<Required>: weapon - string representing the weapon that will be given to the Ai
*/
setAiWeapon( weapon )
{

self.primaryweapon = weapon;
self animscripts\init::initWeapon( weapon, "primary" );
self gun_switchto( weapon, "right" );
}


/*
Sets the player's primary weapon to the weapon passed
<Required>: self- a player
<Required>: weapon - string representing the weapon that will be given to the player
*/
swapPlayerCurrentWeapon(weapon)
{

oldWeapon = self GetCurrentWeapon();
self TakeWeapon(oldWeapon);
self GiveWeapon(weapon);
self SwitchToWeapon(weapon);
}


NOTE: I haven't tested this but it should work properly.
6 years ago
Set all the variables to sprint.

That does work but then becomes a waste of processing power since it will still be evaluating the random function but always having the same outcome. It would be better  to either remove or comment out all of those lines and simply do
Code Snippet
Plaintext
set_run_speed()
{
       self.zombie_move_speed = "sprint";
}
6 years ago
It’s just a function

Ai setmodel( “modelname” );

Aitypes can be made in asset manager tho, doing so creates the file you found and copied

YES! You can obviously allow for a variety of character models to be selected by either manually defining the switch case inside of AiType file, but should really be done when selecting the character files in Asset manager


Also in Radiant there is a KVP called model for the actor. It is set to there default model and you can click the box with the three dots and it would bring up the xmodel folder ( if you set it to it ) and you could select a model..However it does not work at all....

The default model is set in the AiType file and can't be modified by radiant. Even if it could be modified in radiant it would only be the visual 'placement' for the AI and not the actual AI character model that is used in-game.
6 years ago
I am talking about the KVPS...bro....


And plus...im not trying to offend anyone so sorry i don't know much about scripting or anything...god. I swear it feels like i can never ask for help here.

In order to use the KVP my guess is you would have to include the model in your .csv. Although as far as I can find there isn't a KVP for changing the AI model in radiant

As for changing via script the others are correct, preCache is done via script before _load::Main() is called and the model has to be included in your .csv

So in short if you aren't specifically placing a model into the world in radiant it needs to be included in the .csv file
6 years ago
I noticed its not possible to change there model in-game

You can actually change the model via script, that's all a character file does is sets the model. You just need to preCache the model before using it.

but i noticed that there is a button to the right in the KvPs for changing the model of an actor/AI however doing so does nothing at all.

Did you include the model in your .csv?
6 years ago
Another quick question if you can assist me on this but do you know how to re add AI battle chatter for Soldiers?

The scripts for battle chatter are run on all spawned AI. The only thing you have to do is include the sounds in your ".CSV"

Code Snippet
Plaintext
sound,us_battlechatter,mak,all_sp
sound,ja_battlechatter,mak,all_sp
sound,ru_battlechatter,ber1,all_sp
sound,ge_battlechatter,ber1,all_sp

NOTE: this will add a lot of sounds to your level so be careful!
6 years ago
it probably didn't work because of this line in the zombie_spawn_init function.
Code Snippet
Plaintext
self.badplaceawareness = 0;
From the description, it won't disconnect the paths but it will help the AI avoid the area if they can.
6 years ago
you can call disconnectPaths which disconnects the AI Paths that are intersecting the entity which should keep them from walking straight through the object. I'm pretty sure the only reason the "Monster_Clip" works from radiant is because it blocks the navMesh during compiling
Code Snippet
Plaintext
entity DisconnectPaths();

AI have a slight ability to navigate off of the navMesh so it's still possible they might walk through your object depending on how big it is.
6 years ago
As far as i can tell the that should at least compile correctly, so you should try to launch your level while enabling "developer 1" in the console to find the issue.

The script does have a logic error though, A trigger radius if i remember correctly doesn't actually give the notify for "trigger" so you will need to do something closer to this
Code Snippet
Plaintext
//we can exit the loop by simply deleting the trigger
while(isDefined(self.trigger))
{
wait(.05)
players = GetPlayers();

for(i = 0; i < players.size; i++)
{
//player is touching the trigger and pressing {action}
if(is_player_valid(players[i]) && players[i] isTouching(self.trigger) && players[i] UseButtonPressed())
{
hasWeapons = player GetWeaponsListPrimaries();

//give weapons
//all this could probably be placed into its own function
if(hasweapons.size > 1)
{
curWeapon = player GetCurrentWeapon();
player TakeWeapon(curWeapon);
player GiveWeapon("tesla_gun_zm");
player GiveMaxAmmo("tesla_gun_zm");
player SwitchToWeapon("tesla_gun_zm");
level thread maps\_zombiemode_audio::do_announcer_playvox( level.devil_vox["powerup"]["random_weapon"] );
}
else if ( self HasWeapon ("tesla_gun_zm"));
player GiveMaxAmmo ("tesla_gun_zm");
player SwitchToWeapon("tesla_gun_zm");
level thread maps\_zombiemode_audio::do_announcer_playvox( level.devil_vox["powerup"]["random_weapon"] );
else
{
player GiveWeapon("tesla_gun_zm");
player GiveMaxAmmo("tesla_gun_zm");
player SwitchToWeapon("tesla_gun_zm");
level thread maps\_zombiemode_audio::do_announcer_playvox( level.devil_vox["powerup"]["random_weapon"] );
}

//delete the trigger to exit the loop
self.trigger Delete();
}
}
}


alternatively i developed a script that allowed you to use HudElements instead of trigger for interaction with objects, it helps lower the HintString limit that WAW has.
This is how you would use that system if you wanted to
Code Snippet
Plaintext
//Alternative option
//self = graveSite
//dist is how close you need to be to the grave to use
GraveTrigHintThink(dist)
{
while(isDefined(self))
{
players = GetPlayers();

for(i = 0; i < players.size; i++)
{
if(is_player_valid(players[i]) && distance(players[i].origin, self.origin) < dist)
{
self thread printDisplay(self, players[i], "Press and hold [{+action}] to pick up grave", dist);
}
}
wait(.05);
}

}

//self = graveSite
//dist is how close you need to be to the grave to use
GraveTrigUseThink(dist)
{
while(isDefined(self)
{
players = GetPlayers();

for(i = 0; i < players.size; i++)
{
if(is_player_valid(players[i]) && distance(players[i].origin, self.origin) < dist && players[i] UseButtonPressed())
{

//give weapons
//all this could probably be placed into its own function
hasWeapons = player GetWeaponsListPrimaries();
if(hasweapons.size > 1)
{
curWeapon = player GetCurrentWeapon();
player TakeWeapon(curWeapon);
player GiveWeapon("tesla_gun_zm");
player GiveMaxAmmo("tesla_gun_zm");
player SwitchToWeapon("tesla_gun_zm");
level thread maps\_zombiemode_audio::do_announcer_playvox( level.devil_vox["powerup"]["random_weapon"] );
}
else if ( self HasWeapon ("tesla_gun_zm"));
player GiveMaxAmmo ("tesla_gun_zm");
player SwitchToWeapon("tesla_gun_zm");
level thread maps\_zombiemode_audio::do_announcer_playvox( level.devil_vox["powerup"]["random_weapon"] );
else
{
player GiveWeapon("tesla_gun_zm");
player GiveMaxAmmo("tesla_gun_zm");
player SwitchToWeapon("tesla_gun_zm");
level thread maps\_zombiemode_audio::do_announcer_playvox( level.devil_vox["powerup"]["random_weapon"] );
}

//delete the graveSite to exit the useThink and hintSet loop
self Delete();
}
}
}
}

//will create a hud element for the player with the text that is passed in the parameter, will display the hud element as long as the player is close enough to see it
printDisplay(ent, player, message, dist)
{
//if the thread is called again stops the previous running thread
player notify("setting_hint");
player endon("setting_hint");

//if either the ent to display the message for or the player is undefined then stop the thread
if(!isDefined(ent) || !isDefined(player))
return;

//if there isnt a message passed then present a warning instead of the message
if(!isDefined(message))
message = "hint string for enity " + ent.targetname + " is not defined in printDisplay";

//if the destance for how close the player must be isnt set then use default distance
if(!isDefined(dist))
dist = 100;

//if the hud element isnt defined then create a new one and set its position in the middle of the screen
if(!isDefined(player.trigText))
{
player.trigText = NewClientHudElem( player );
player.trigText.alignX = "center";
player.trigText.alignY = "middle";
player.trigText.horzAlign = "center";
player.trigText.vertAlign = "middle";
player.trigText.y += 100;
player.trigText.foreground = true;
player.trigText.fontScale = 1.5;
player.trigText.alpha = 1;
player.trigText.color = ( 1.0, 1.0, 1.0 );
}

//if the element is defined then set the text to the message passed
if(isDefined(player.trigText))
{

player.trigText SetText( message );
}

//if the entity passed is a trigger of some kind then set the hint cursor to nothing
if(isDefined(ent.classname) && isSubStr(ent.classname, "trigger"))
ent SetCursorHint( "HINT_NOICON" );

//keep the hud element as long as the entity is defined, the player is valid and as long as the player is close enough
while(isDefined(ent) && isDefined(player) && is_player_valid(player) && distance(ent.origin, player.origin) < dist)
{
wait(.05);
}

//if the hud element is still defined destroy it from the screen
if(isDefined(player.trigText))
player.trigText destroy();
}//end printDisplay
6 years ago
Yes you are correct it should have had the second bracket to close the array index.

So there are a few issues with the script that i can see off hand.

First:
this
Code Snippet
Plaintext
flag_wait("all_players_connected");
should be something like this, it's possible that once the players have been connected the zones aren't initialized yet
Code Snippet
Plaintext
//wait to make sure all zones have been inited
//this is only because i can't find proof of flag_wait("zones_initialized") being a flag
while(!isDefined(level.zones))
{
wait(.05);
}

Second:
The function i gave you should be used to test if they've all been enabled
Code Snippet
Plaintext
//run until we have activated all zones
while(1)
{
//check if all the zones are active
if(IsAllZonesActive())
{
//since this isn't an infinite loop of any kind it doesn't need to be threaded
egg_start();
break;
}
wait(.05);
}


Third:
In order to use a model in script it must be preChached before the players are spawned, IE: before _load::Main() is called
Code Snippet
Plaintext
preCacheModel("zmb_dig_pile");
Finally:
You initialized the array properly but didn't populate using the correct function, setModel() must be called on a script_model and doesn't return anything
Code Snippet
Plaintext
//this will spawn a grave site at each location
spawnGraves()
{
//array of different locations to spawn the grave sits at
//this can be used to generate random locations for only a few of the graves
graveLocations = [];
graveLocations[graveLocations.size] = (0,0,0);//index = 0
graveLocations[graveLocations.size] = (100,200,0);//index = 1

//generate array
grave_spawns = [];

//populate the array with 2 script_models that are located at (0,0,0)
grave_spawns[grave_spawns.size] = spawn("script_model", graveLocations[grave_spawns.size]);// index = 0
grave_spawns[grave_spawns.size] = spawn("script_model", graveLocations[grave_spawns.size]);//index = 1

//set each script_model to the same model
for(i = 0; i < grave_spawns.size; i++)
{
grave_spawns[i] setModel("zmb_dig_pile");
}
}

hope this helps clearify some of the process for spawning scipt_models into the world
6 years ago
There isn't a notify for when all the doors have been activated, but you can count each time a door is opened and once the count is greater than or equal to the amount of doors in the world then all doors have been opened.

You can do the same thing for determining if all zones are active, but instead checking if there is a zone that is not active like this
Code Snippet
Plaintext
IsAllZonesActive()
{
//get all the zone names
zoneKeys = GetArrayKeys(level.zones);

for(i = 0; i < zoneKeys.size; i++)
{
//check if the zone is not active
if(!level.zones[zoneKeys[i].is_enabled)
{
return false;
}
}

//if we get this far then all zones are active
return true;
}

PS: I haven't done much with zones nor have i tested this so it may not be the exact way to reference the zones but the concept is correct
6 years ago
What are the KvP's for the dude in radiant?

Any AI reference can be passed into the function, as well as the turret variable

I want to point out that these functions and scripts for AI are set up to be more generic than the ones for zombieMode. They weren't designed so people can just call a beginning function and the script runs and handles everything for you, they require you to program the logic behind these supporting functions.

Than being said it maybe possible to automatically link a guy to use a turret and that be the only thing he does, but idk.
6 years ago
not positive since ive never tried to do capitalized operators but I do know in other languages the operators are case sensitive and using a capital I in an if statement would not be recognized as an operator.

try replacing your
Code Snippet
Plaintext
        If( level.start == true && level.start_two == false )
        { // Here is the error
            setmusicstate("music_one");
        }

        If( level.start == false && level.start_two == true )
        {
           
with
Code Snippet
Plaintext
        if( level.start == true && level.start_two == false )
        { // Here is the error
            setmusicstate("music_one");
        }

        if( level.start == false && level.start_two == true )
        {
6 years ago
Hi guys,

I tried the above "no cost" script modification and I get the script compile error (syntax error).
I found the cause of the problem. On line 5 the less equal relation signal is wrong.

Thank you for catching that!  :D When I wrote the documentation i re-wrote it rather than copying it straight from the script. I have updated the original post
6 years ago
Loading ...