mutator, removing items
-
- Masterful
- Posts: 550
- Joined: Fri Aug 28, 2009 3:33 pm
mutator, removing items
I want a mutator to check in the map for certain items and remove those.
only I want it to be done only 1 time, when the mutator is spawned.
so using CheckReplacement is no option because it will check all the time for these items
only I want it to be done only 1 time, when the mutator is spawned.
so using CheckReplacement is no option because it will check all the time for these items
-
- Experienced
- Posts: 81
- Joined: Mon Mar 01, 2010 10:12 pm
- Location: Brazil
Re: mutator, removing items
It is an option.Rakiayn wrote:I want a mutator to check in the map for certain items and remove those.
only I want it to be done only 1 time, when the mutator is spawned.
so using CheckReplacement is no option because it will check all the time for these items
You can set a timer at the mutator, and it arrives the time, it sets a boolean variable to true.
And on checkreplacement, set to replace only if this boolean is false. Then it'll stop replacing after the timer ticks, which will set that variable to true.
Of you can perform a foreach all at the beggining and replace them manually, if you really don't want to use the checkreplacement.
-
- Masterful
- Posts: 550
- Joined: Fri Aug 28, 2009 3:33 pm
Re: mutator, removing items
tried both.
very weird. but the actors I want to replace are still there. so now i have two items at the same place
I dont dare to destroy them. i heard it is not good to do
and when i tried the the bool thing in the checkreplacement function, only one item got replaced lol
this is what i have now
very weird. but the actors I want to replace are still there. so now i have two items at the same place
I dont dare to destroy them. i heard it is not good to do
and when i tried the the bool thing in the checkreplacement function, only one item got replaced lol
this is what i have now
Code: Select all
function tick(float deltatime)
{
removestuff();
disable('tick');
}
function removestuff()
{
local ammo other1;
foreach AllActors( class 'ammo', other1 )
{
if ( (other1 != none) && ( !other1.isa('A_MasterAmmo') )&& ( !other1.isa('A_MMAmmo')))
{
ReplaceWith( Other1, "Monstermatch.A_MMAmmo" );
}
}
}
-
- Experienced
- Posts: 81
- Joined: Mon Mar 01, 2010 10:12 pm
- Location: Brazil
Re: mutator, removing items
ReplaceWith don't remove items on its own... since the checkreplacement function only removes items if you return false there. When returning true, there'll be two spawns (the original, and the replacement).
So you'd better put something like other1.destroy() bellow the ReplaceWith.
So you'd better put something like other1.destroy() bellow the ReplaceWith.
Re: mutator, removing items
Man be careful with destroy though. One incorrect destroy can wreak havoc in your coding. I had one singular destroy miscoded in the RedeemerWorlds mod and it stopped the whole mod from functioning. Took me for-freaking-ever to find it out as the cause. I keep a mental list of my destroys now.
-
- Masterful
- Posts: 550
- Joined: Fri Aug 28, 2009 3:33 pm
Re: mutator, removing items
ok thnx .
right now i have the checkreplacement using from the beginning, until the timer stops
the timer is set to 1.
should i also be carefull with ''return false'' in checkreplacement?
right now i have the checkreplacement using from the beginning, until the timer stops
the timer is set to 1.
should i also be carefull with ''return false'' in checkreplacement?
-
- Experienced
- Posts: 81
- Joined: Mon Mar 01, 2010 10:12 pm
- Location: Brazil
Re: mutator, removing items
Only if your IF is not very well specified. Otherwise there won't be any trouble.Rakiayn wrote:ok thnx .
right now i have the checkreplacement using from the beginning, until the timer stops
the timer is set to 1.
should i also be carefull with ''return false'' in checkreplacement?
-
- Masterful
- Posts: 550
- Joined: Fri Aug 28, 2009 3:33 pm
Re: mutator, removing items
hmm. its replaces all ammo,pickups and weapons
with a few exceptions. I guess thats not specified enough right?
problem is that I dont want any pickups in the map.
just like instagib
with a few exceptions. I guess thats not specified enough right?
problem is that I dont want any pickups in the map.
just like instagib
-
- Experienced
- Posts: 81
- Joined: Mon Mar 01, 2010 10:12 pm
- Location: Brazil
Re: mutator, removing items
What's not being replaced? Check this...Rakiayn wrote:hmm. its replaces all ammo,pickups and weapons
with a few exceptions. I guess thats not specified enough right?
problem is that I dont want any pickups in the map.
just like instagib
Code: Select all
var bool bStarted, bReplaced;
function PostBeginPlay()
{
if ( bStarted )
Return;
bStarted = True;
SetTimer(1.0,false); // Whatever timer is needed, might need testing
Super.PostBeginPlay();
}
function Timer()
{
bReplaced = true;
}
function bool CheckReplacement(Actor Other, out byte bSuperRelevant)
{
local Inventory Inv;
if ( bReplaced || Other.IsA('ClassYouWannaKeepIfAnyAtAll') )
return true;
else if ( Other.IsA('Pickup') )
return false;
else
return true;
}
-
- Novice
- Posts: 9
- Joined: Thu Apr 20, 2017 12:18 am
Re: mutator, removing items
BeltDelay.uc
BeltDelay.int
Code: Select all
class BeltDelay extends Mutator;
var bool bStarted, bReplaced;
var Actor A;
function PostBeginPlay()
{
if ( bStarted )
Return;
bStarted = True;
bReplaced = False;
SetTimer(55.0,false);
Super.PostBeginPlay();
}
function Timer()
{
bReplaced = True;
Spawn(class'UT_Shieldbelt', , , A.location, A.rotation);
}
function bool CheckReplacement(Actor Other, out byte bSuperRelevant)
{
if ( Other.IsA('UT_Shieldbelt') )
{
A = Other;
if ( !bReplaced )
{
return False;
}
}
bSuperRelevant = 0;
return True;
}
Code: Select all
[Public]
Object=(Name=BeltDelay.BeltDelay,Class=Class,MetaClass=Engine.Mutator,description="Belt Delay")
You do not have the required permissions to view the files attached to this post.
-
- Godlike
- Posts: 2901
- Joined: Fri Sep 25, 2015 9:01 pm
- Location: moved without proper hashing
Re: mutator, removing items
Argl, it is still alive
What happens if there is no UT_Shieldbelt in the map? Access None.
What happens if there are multiple UT_Shieldbelts in the map? Only the last one will be treated.
Furthermore: I don't get the sense of that mutator. What happens if there is no UT_Shieldbelt in the map? Access None.
What happens if there are multiple UT_Shieldbelts in the map? Only the last one will be treated.
You do not have the required permissions to view the files attached to this post.
"If Origin not in center it be not in center." --Buggie
-
- Godlike
- Posts: 6433
- Joined: Sun May 09, 2010 6:15 pm
- Location: On the roof.
Re: mutator, removing items
I don't get the point of making a large over-thinking resulting in lousy codes with doubtful logic.
#1 Set a timer or a state for working a single time, wait a second and do replacements based on TWO lists ListOriginal[ i ], ListReplacement[ j ] with desired sanity checks. This can be subject for a server actor, you don't even need to send anything else in client than packages required by replacements.
What replacement ? A custom one, Spawn Item J at Item I location, copy some values if are needed and then simply destroy initial Item I, and stay latent after doing the task. Is not even needed CheckReplacement. If Item J is nothing, just delete Item I if is being found. - Pointing at TITLE.
Slash Cadaver Topic On
#2 A mutator using "CheckReplacement" only if Level.bStartUp = True. If Level.bStartUp is being passed just stay latent - stop touching replacements.
Here locations can be saved somewhere in whatever array and then... bring new things over there after a configured time. Here can be simulated a dynamic array by Spawning certain "guards" in each location and then using them as guide for bringing other items there with a delay which can be configured or calculated based on whatever factors.
#3 According to the topic's title - removing items is More Simple, just delete items from a configured list after one second.
Personal "private public" note: I don't see any deal "myMarker" - "markedItem" and then... I don't get this sudden revelation about a delayed shield which is not very "hunted" by plain stock A.I. A new shield spawns and that's all ?
And... Good Morning ! - after 12 years from last posting date.
#1 Set a timer or a state for working a single time, wait a second and do replacements based on TWO lists ListOriginal[ i ], ListReplacement[ j ] with desired sanity checks. This can be subject for a server actor, you don't even need to send anything else in client than packages required by replacements.
What replacement ? A custom one, Spawn Item J at Item I location, copy some values if are needed and then simply destroy initial Item I, and stay latent after doing the task. Is not even needed CheckReplacement. If Item J is nothing, just delete Item I if is being found. - Pointing at TITLE.
Slash Cadaver Topic On
Slash Cadaver Topic Off
#2 A mutator using "CheckReplacement" only if Level.bStartUp = True. If Level.bStartUp is being passed just stay latent - stop touching replacements.
Here locations can be saved somewhere in whatever array and then... bring new things over there after a configured time. Here can be simulated a dynamic array by Spawning certain "guards" in each location and then using them as guide for bringing other items there with a delay which can be configured or calculated based on whatever factors.
#3 According to the topic's title - removing items is More Simple, just delete items from a configured list after one second.
Personal "private public" note: I don't see any deal "myMarker" - "markedItem" and then... I don't get this sudden revelation about a delayed shield which is not very "hunted" by plain stock A.I. A new shield spawns and that's all ?
And... Good Morning ! - after 12 years from last posting date.
-
- Adept
- Posts: 344
- Joined: Fri Nov 06, 2015 10:12 am
- Personal rank: Curious
- Location: St. Cloud, Florida
Re: mutator, removing items
Ignoring the two bozos with nothing of merit to add: Looks fine enough.
Don't let people acting like this get in the way of you providing answers to widely unanswered dead threads.
Especially since Google links to this thread regardless of age.
Don't let people acting like this get in the way of you providing answers to widely unanswered dead threads.
Especially since Google links to this thread regardless of age.
"Woah what?! I wish I was recording that...."
-
- Godlike
- Posts: 2901
- Joined: Fri Sep 25, 2015 9:01 pm
- Location: moved without proper hashing
Re: mutator, removing items
You don't take care of quality?
Apart from topic: don't poison the atmosphere here with such insults, please.
"If Origin not in center it be not in center." --Buggie
-
- Godlike
- Posts: 6433
- Joined: Sun May 09, 2010 6:15 pm
- Location: On the roof.
Re: mutator, removing items
Not for "bozos". And no, if map has no "shield" see what it does - Nothing great, but dealing with nothing. Buzzzz... either way "mutator" is off-topic.SilverSound wrote: ↑Sat Jun 25, 2022 2:36 am Ignoring the two bozos with nothing of merit to add: Looks fine enough.
I have already something for removing items, for the moment I don't have public plans for that, exactly because of these type of "replies" having nothing to do with topic but aiming people. But... because today I'm not fully evil, I'll point direction about doing a "delayed spawn" without any corruption: See recent MH conversions with items delayed "spawned" by triggering - that is a "How To" for this case, not using "Trigger" but a timer or a state code.