- Jul 30, 2024
- 1
- 0
Im somewhat new to vscript so I apologise if im being stupid
im trying to change the red cap icon of "cp_A" using vscript but for some reason "team_icon_2" doesnt seem to update and "retrievedPath" comes back blank. Does Vscript not allow you to change the cap icon mid game?
Heres the Code:
function SetAIconActive()
{
// Find the entity by name
local Icon = Entities.FindByName(null, "cp_A");
// Check if the entity exists
if (Icon != null)
{
// Define the filepath to the sprite
local filepath = "sprites/obj_icons/icon_obj_red";
printl("Setting team_icon_2 to: " + filepath);
// Set the property of the entity
NetProps.SetPropString(Icon, "team_icon_2", filepath);
// Retrieve and log the property to verify
local retrievedPath = NetProps.GetPropString(Icon, "team_icon_2");
printl("Retrieved team_icon_2: " + retrievedPath);
}
else
{
printl("Entity 'cp_A' not found!");
}
}
im trying to change the red cap icon of "cp_A" using vscript but for some reason "team_icon_2" doesnt seem to update and "retrievedPath" comes back blank. Does Vscript not allow you to change the cap icon mid game?
Heres the Code:
function SetAIconActive()
{
// Find the entity by name
local Icon = Entities.FindByName(null, "cp_A");
// Check if the entity exists
if (Icon != null)
{
// Define the filepath to the sprite
local filepath = "sprites/obj_icons/icon_obj_red";
printl("Setting team_icon_2 to: " + filepath);
// Set the property of the entity
NetProps.SetPropString(Icon, "team_icon_2", filepath);
// Retrieve and log the property to verify
local retrievedPath = NetProps.GetPropString(Icon, "team_icon_2");
printl("Retrieved team_icon_2: " + retrievedPath);
}
else
{
printl("Entity 'cp_A' not found!");
}
}