inventory without bisplayer?
inventory without bisplayer?
as the title says.
Is it posible to make a scriptedpawn that can carry an inventory item without bisplayer is true?
I thought first of the skaarjtrooper, who can carry a weapon. but after looking at the code , i think a skaarjtrooper has bisplayer set to true temporarely
Is it posible to make a scriptedpawn that can carry an inventory item without bisplayer is true?
I thought first of the skaarjtrooper, who can carry a weapon. but after looking at the code , i think a skaarjtrooper has bisplayer set to true temporarely
- Shadow
- Masterful
- Posts: 743
- Joined: Tue Jan 29, 2008 12:00 am
- Personal rank: Mad Carpenter
- Location: Germany
- Contact:
Re: inventory without bisplayer?
Looking at Engine\Classes\Inventory.uc I found the following line in state 'Pickup', function ValidTouch, which controls if the Item is allowed to be added to inventory:
So if you want to "hack" around that, subclass your own Inventory Base Class and rewrite the Pickup State and ValidTouch Function without Pawn(Other).bIsPlayer
Code: Select all
if( Other.bIsPawn && Pawn(Other).bIsPlayer && (Pawn(Other).Health > 0) && Level.Game.PickupQuery(Pawn(Other), self) )
Re: inventory without bisplayer?
you can try and force a weapon on the ScriptedPawn like this:
local SniperRifle Weapon;
local ScriptedPawn SP;
ForEach(class'ScriptedPawn', SP) {
if (SP.IsA('WhatEverScriptedPawnClass')) {
Weapon.GiveTo(SP); } }
This should give a sniper rifle to the monsterclass you define.
I haven't tested it but maybe it'll work? I'm sry i cant be more helpfull, but i'm on vacation and have no UT present.
local SniperRifle Weapon;
local ScriptedPawn SP;
ForEach(class'ScriptedPawn', SP) {
if (SP.IsA('WhatEverScriptedPawnClass')) {
Weapon.GiveTo(SP); } }
This should give a sniper rifle to the monsterclass you define.
I haven't tested it but maybe it'll work? I'm sry i cant be more helpfull, but i'm on vacation and have no UT present.
Retired.
- Shadow
- Masterful
- Posts: 743
- Joined: Tue Jan 29, 2008 12:00 am
- Personal rank: Mad Carpenter
- Location: Germany
- Contact:
Re: inventory without bisplayer?
yes, could, didn't think of that ^^TheDane wrote:you can try and force a weapon on the ScriptedPawn like this:
local SniperRifle Weapon;
local ScriptedPawn SP;
ForEach(class'ScriptedPawn', SP) {
if (SP.IsA('WhatEverScriptedPawnClass')) {
Weapon.GiveTo(SP); } }
This should give a sniper rifle to the monsterclass you define.
I haven't tested it but maybe it'll work? I'm sry i cant be more helpfull, but i'm on vacation and have no UT present.
small tip: when iterating through pawns, it's unrecommended to use actor-iterators using the foreach-loop, use the faster for-loop instead:
Code: Select all
local scriptedpawn PawnList;
local weapon YourWeapon;
for(PawnList=level.pawnlist;PawnList.isa('WhatEverScriptedPawnClass');PawnList=PawnList.nextpawn)
YourWeapon.GiveTo(WhatEverScriptedPawnClass(PawnList));
Re: inventory without bisplayer?
true it's faster, I just ran into some bad checks in the Survival mod so i reverted back to the ForEach check because then the check was successfull every time.
Retired.
Re: inventory without bisplayer?
coool thanx.
Ill try them both out. the inventory i want to give to the monsters is custom anyway.
@shadow
in what script do I have to add that? gametype or mutator i guess?
and I want to give a custom kind of shieldbelt. does that also work with your code? , because its not a weapon
Ill try them both out. the inventory i want to give to the monsters is custom anyway.
@shadow
in what script do I have to add that? gametype or mutator i guess?
and I want to give a custom kind of shieldbelt. does that also work with your code? , because its not a weapon
Re: inventory without bisplayer?
thanx that worked great!Shadow wrote:Looking at Engine\Classes\Inventory.uc I found the following line in state 'Pickup', function ValidTouch, which controls if the Item is allowed to be added to inventory:
So if you want to "hack" around that, subclass your own Inventory Base Class and rewrite the Pickup State and ValidTouch Function without Pawn(Other).bIsPlayerCode: Select all
if( Other.bIsPawn && Pawn(Other).bIsPlayer && (Pawn(Other).Health > 0) && Level.Game.PickupQuery(Pawn(Other), self) )
- Shadow
- Masterful
- Posts: 743
- Joined: Tue Jan 29, 2008 12:00 am
- Personal rank: Mad Carpenter
- Location: Germany
- Contact:
Re: inventory without bisplayer?
simply create your new item class, then write a mutator that replaces the original item with yoursRakiayn wrote:coool thanx.
Ill try them both out. the inventory i want to give to the monsters is custom anyway.
@shadow
in what script do I have to add that? gametype or mutator i guess?
and I want to give a custom kind of shieldbelt. does that also work with your code? , because its not a weapon
hehe you're welcomeRakiayn wrote:thanx that worked great!Shadow wrote:Looking at Engine\Classes\Inventory.uc I found the following line in state 'Pickup', function ValidTouch, which controls if the Item is allowed to be added to inventory:
So if you want to "hack" around that, subclass your own Inventory Base Class and rewrite the Pickup State and ValidTouch Function without Pawn(Other).bIsPlayerCode: Select all
if( Other.bIsPawn && Pawn(Other).bIsPlayer && (Pawn(Other).Health > 0) && Level.Game.PickupQuery(Pawn(Other), self) )
Re: inventory without bisplayer?
Be sure to watch ammo classes though if your item is weaponry subclassed. As far as I know there is no good way around the buggy dropped weapon glitch you get from scripted pawns dropping them. This is due to the monsters (skaarj subclass) accessing the ammo count to decide fire mode. When scripted pawns hold a weapon it loses it's ammo count reference, so when dropped and recovered by a player it will mess up the HUD in MH, along with many of the mods (like doublejump).
Re: inventory without bisplayer?
i have tried to make a weapon ad give it to a skaarjtrooper, but it didnt work.
I also discovered that the armor that I gave to the scripted pawn doesnt function as an armor anymore, it cant absorb damage anymore. I tried searching through 'inventory', 'armor' and 'pickup' but i couldnt find any code that I think was the cause
I also discovered that the armor that I gave to the scripted pawn doesnt function as an armor anymore, it cant absorb damage anymore. I tried searching through 'inventory', 'armor' and 'pickup' but i couldnt find any code that I think was the cause
Re: inventory without bisplayer?
In short, monsters function only as "partial" players. Many of the subroutines are incomplete, especially in the area of inventory and weapons. It's been a pet project of mine for quite some time to make a bot-code based replacement for the default monster classes so this isn't a problem any longer.
Feel free to email me if you get stuck on something.
Feel free to email me if you get stuck on something.
Re: inventory without bisplayer?
thax, I will do that
the mod im working on is basicly the same.
My monsters attack eachother, other scripted pawns,can follow orders etc...
oh. and i managed the monster to be able to wear armor
I am still working on the core file. I will send it to you soon. you might find it interresting
the mod im working on is basicly the same.
My monsters attack eachother, other scripted pawns,can follow orders etc...
oh. and i managed the monster to be able to wear armor
I am still working on the core file. I will send it to you soon. you might find it interresting
Re: inventory without bisplayer?
Cool, I'm very interested! One of the areas that really holds the various monster games back is better AI and inventory for the scripted pawn.