Jump to content


Photo

[SOLVED] How to 'remove' blackjack and sword?


19 replies to this topic

#1 grayman

grayman

    Master Builder, Coder

  • Active Developer
  • PipPipPipPipPip
  • 11988 posts

Posted 25 July 2017 - 03:14 PM

Has anyone figured out how to make the player drop his blackjack and sword?

 

I've figured out how to 'drop' the arrows, but there are no direct scripting methods to drop the bj and the sword.

 

No joy after searching the forum and the scripting wiki and the source code.

 

Thanks.



#2 Bikerdude

Bikerdude

    Mod hero

  • Member
  • PipPipPipPipPip
  • 18894 posts

Posted 25 July 2017 - 03:41 PM

Maybe the same way you make keys droppable? - "inv_droppable" "1"



#3 Obsttorte

Obsttorte

    Scripting guru, Mapper

  • Active Developer
  • PipPipPipPipPip
  • 5300 posts

Posted 25 July 2017 - 05:30 PM

How do you let the player drop the arrows? And what are you aiming for exactly? Is it like drop your weapon at a specific spot or container (maybe for an ai to lend him your weapon)?

 

Maybe getCurrentWeapon() and remove or a change in inventory count?!

 

EDIT: There is a function for dropping a weapon in the game code, but no script function to access it. I guess the code was originally implemented for multiplayer mathces, so that a player who dies drops its weapon (unsure, never played Doom 3 mp).


FM's: Builder Roads, Old Habits, Old Habits Rebuild
WIP's: Several. Although after playing Thief 4 I really wanna make a city mission.
Mapping and Scripting: Apples and Peaches
Sculptris Models and Tutorials: Obsttortes Models
My wiki articles: Obstipedia
Let's Map TDM YouTube playlist: ObstlerTube
Texture Blending in DR: DR ASE Blend Exporter

End of shameless self promotion.

#4 grayman

grayman

    Master Builder, Coder

  • Active Developer
  • PipPipPipPipPip
  • 11988 posts

Posted 25 July 2017 - 08:05 PM

Maybe the same way you make keys droppable? - "inv_droppable" "1"

 

No joy. Weapon inventory isn't handled the same as item inventory.

 

How do you let the player drop the arrows? And what are you aiming for exactly? Is it like drop your weapon at a specific spot or container (maybe for an ai to lend him your weapon)?

 

Maybe getCurrentWeapon() and remove or a change in inventory count?!

 

EDIT: There is a function for dropping a weapon in the game code, but no script function to access it. I guess the code was originally implemented for multiplayer mathces, so that a player who dies drops its weapon (unsure, never played Doom 3 mp).

 

I'm "dropping" arrows by clearing their ammo count. (Not intuitive; it took a lot of experimentation.)

 

Since the blackjack and sword don't use ammo, they can't be handled the same way. Dropping their "ammo count" from 1 to 0 does nothing.

 

I'm aware of the multiplayer feature of dropping weapons for teammates to use, but--as you say--it's not available to scripts.

 

I could write the missing script functions, but I'm trying to rely on 2.05 and not 2.06.



#5 demagogue

demagogue

    Mod hero

  • Active Developer
  • PipPipPipPipPip
  • 5245 posts

Posted 25 July 2017 - 09:56 PM

The case for inventory items and weapons being droppable is part of the immersive sim ethos that, as much as possible, we should think of objects as actual real-world objects you can manipulate in intuitive ways to address issues like it's a real world problem and not just to solve a pre-constructed puzzle the author wants to feel clever about constructing.

 

The case against it is that the player could drop a required item (key or sword) in a way that breaks their ability to meet the objectives, if they drop it in a place they can't retrieve it (although that can be made avoidable by design), which goes against another principle of never allowing a player to enter into an unwinnable situation.

 

Generally speaking, I'm on the immersive sim side of the coin so think everything should be droppable by default.


Posted Image

#6 stumpy

stumpy

    Advanced Member

  • Member
  • PipPipPip
  • 1679 posts

Posted 25 July 2017 - 10:16 PM

instead of dropping them, could you hide them and spawn some dummy ones in so it looks as if the player has lost the weapons. Its how it was done in the half-life games and some other games, as player doesn't actually lose them or have them removed, they're just hid and the player can't use hidden items.


  • Judith likes this

#7 Destined

Destined

    Advanced Member

  • Member
  • PipPipPip
  • 1296 posts

Posted 26 July 2017 - 12:05 AM

The case for inventory items and weapons being droppable is part of the immersive sim ethos that, as much as possible, we should think of objects as actual real-world objects you can manipulate in intuitive ways to address issues like it's a real world problem and not just to solve a pre-constructed puzzle the author wants to feel clever about constructing.

 

The case against it is that the player could drop a required item (key or sword) in a way that breaks their ability to meet the objectives, if they drop it in a place they can't retrieve it (although that can be made avoidable by design), which goes against another principle of never allowing a player to enter into an unwinnable situation.

 

Generally speaking, I'm on the immersive sim side of the coin so think everything should be droppable by default.

For inventory items you havea "dropable" spawnarg, if you feel the need to prevent the player from dropping it for story purpose. So, this could also be applied to weapons, you think are needed.

Unwinnable situations can easily occur in TDM, when you create situations that need a certain item/weapon. Especially arrows (e.g. rope arrows) can always have been used already. Or maybe the player is just a bad shot and misses the target too often until he runs out of the arrow he needs. So, this argument is, in my opinion, not really a problem. Also, regarding the sword and blackjack, most mappers enable the player to ghost the mission, so dropping these weapons should not result in unwinnable situations.



#8 Obsttorte

Obsttorte

    Scripting guru, Mapper

  • Active Developer
  • PipPipPipPipPip
  • 5300 posts

Posted 26 July 2017 - 06:10 AM


I'm "dropping" arrows by clearing their ammo count. (Not intuitive; it took a lot of experimentation.)

Thought so. Do you let the player "drop" them by pressing a button or is this context-sensitive (like frobbing a container to store the arrows there or so)?


FM's: Builder Roads, Old Habits, Old Habits Rebuild
WIP's: Several. Although after playing Thief 4 I really wanna make a city mission.
Mapping and Scripting: Apples and Peaches
Sculptris Models and Tutorials: Obsttortes Models
My wiki articles: Obstipedia
Let's Map TDM YouTube playlist: ObstlerTube
Texture Blending in DR: DR ASE Blend Exporter

End of shameless self promotion.

#9 Obsttorte

Obsttorte

    Scripting guru, Mapper

  • Active Developer
  • PipPipPipPipPip
  • 5300 posts

Posted 26 July 2017 - 07:01 AM

Ok, so

string $player1.getCurrentWeapon();

returns the def name of the weapon the player is currently holding ("atdm:weapon_blackjack" or "atdm:weapon_shortsword" in your case).

void $player1.selectWeapon(string weaponname);

switches to a weapon of your choice. The string weaponname is NOT the defname but the name defined under "inv_weapon_name" (unarmed, shortsword etc...). (At least I think so ;) )

 

So if you want a player to not be able to draw a certain weapon, you can make a check whether the player currently selected that weapon and then switch back to the previously hold one. You can do this every frame or in the weapon scriptobjects, preferably in Lower() as this gets called when the player attempts to switch the weapon. Also Idle() runs every frame so you would have to alter that either, and you would have to do this for all weapon scriptobjects available in your mission. So even though the latter would be the more "clean" solution, having an infinite loop checking the status every frame is probably the easier way to go.

 

Hope that helps :)


  • Anderson likes this
FM's: Builder Roads, Old Habits, Old Habits Rebuild
WIP's: Several. Although after playing Thief 4 I really wanna make a city mission.
Mapping and Scripting: Apples and Peaches
Sculptris Models and Tutorials: Obsttortes Models
My wiki articles: Obstipedia
Let's Map TDM YouTube playlist: ObstlerTube
Texture Blending in DR: DR ASE Blend Exporter

End of shameless self promotion.

#10 Judith

Judith

    Advanced Member

  • Member
  • PipPipPip
  • 658 posts

Posted 26 July 2017 - 07:13 AM

I had blackjack to be picked up as a mission objective once, but I deleted it from player's inventory. The player had to follow an NPC, who was leaving it for another character, but all I did was two scripts: one making invisible blackjack visible in pre-determined spot when NPC was performing an animation; second one made blackjack model disappear after frobbing and the proper item was added to player inventory. That assumes you need a scripted and controlled event though. More systemic approach might be more tricky.



#11 Moonbo

Moonbo

    Advanced Member

  • Member
  • PipPipPip
  • 1061 posts

Posted 26 July 2017 - 11:44 AM

It's a bit clunky but you can look at how SteveL and I handled disabling melee weapons for A House of Locked Secrets. We had to do that since it was possible for players to have picked up the weapons in the physical world but not have picked them up in the spiritual world. If that was the case, we had to disable the use of any picked-up melee weapons when they switched realms. If you are able to duplicate that method, then having a physical object be dropped to the ground to complete the illusion (and toggle weapon use on/off) would be easy.


Edited by Moonbo, 26 July 2017 - 11:45 AM.

  • Anderson likes this
But you should walk having internal dignity. Be a wonderful person who can dance pleasantly to the rhythm of the universe.
-Sun Myung Moon


My work blog: gfleisher.blogspot.com

#12 grayman

grayman

    Master Builder, Coder

  • Active Developer
  • PipPipPipPipPip
  • 11988 posts

Posted 26 July 2017 - 03:03 PM

So if you want a player to not be able to draw a certain weapon, you can make a check whether the player currently selected that weapon and then switch back to the previously hold one. You can do this every frame ...

 

getCurrentWeapon() reports the current weapon once it's fully raised, so what I see is the weapon raising, then being lowered after it's done raising.

 

Investigating the second method.



#13 grayman

grayman

    Master Builder, Coder

  • Active Developer
  • PipPipPipPipPip
  • 11988 posts

Posted 26 July 2017 - 03:05 PM

I should clarify that I'm not trying to give the player the ability to drop his melee weapons.

 

I'm trying to take his weapons away from him, with the intent that he be able to get them back at a later time.

 

Think of someone getting tossed into jail.



#14 nbohr1more

nbohr1more

    Darkmod PR, Wordsmith

  • Development Role
  • PipPipPipPipPip
  • 8128 posts

Posted 26 July 2017 - 03:14 PM

"Target Remove Weapons" entity?

idTarget_RemoveWeapons
scriptEvent void activate(entity activator);

Activates this entity as if it was activated by a trigger.

activator: the entity that caused the action (usually the player)

https://modwiki.xnet...eapons_(entity)
Please visit TDM's IndieDB site and help promote the mod:

http://www.indiedb.c...ds/the-dark-mod

(Yeah, shameless promotion... but traffic is traffic folks...)

#15 Obsttorte

Obsttorte

    Scripting guru, Mapper

  • Active Developer
  • PipPipPipPipPip
  • 5300 posts

Posted 26 July 2017 - 04:03 PM

I should clarify that I'm not trying to give the player the ability to drop his melee weapons.

 

I'm trying to take his weapons away from him, with the intent that he be able to get them back at a later time.

 

Think of someone getting tossed into jail.

DisableWeapon() / enableWeapon (called on the player)?!

 

The script for the safe in A New Job does something similar. It temporarely disables the weapons.


FM's: Builder Roads, Old Habits, Old Habits Rebuild
WIP's: Several. Although after playing Thief 4 I really wanna make a city mission.
Mapping and Scripting: Apples and Peaches
Sculptris Models and Tutorials: Obsttortes Models
My wiki articles: Obstipedia
Let's Map TDM YouTube playlist: ObstlerTube
Texture Blending in DR: DR ASE Blend Exporter

End of shameless self promotion.

#16 grayman

grayman

    Master Builder, Coder

  • Active Developer
  • PipPipPipPipPip
  • 11988 posts

Posted 26 July 2017 - 04:12 PM

idTarget_RemoveWeapons


Close, but no cigar.

 

The code for the target is in the SDK.

 

I had to create the def file for the entity.

 

However, the target code calls this: 

void idPlayer::RemoveWeapon( const char *weap )
{
     if ( weap && *weap )
     {
     // greebo: Not yet implemented for TDM inventory
     //inventory.Drop( spawnArgs, spawnArgs.GetString( weap ), -1 );
     }
}


#17 grayman

grayman

    Master Builder, Coder

  • Active Developer
  • PipPipPipPipPip
  • 11988 posts

Posted 26 July 2017 - 04:20 PM

DisableWeapon() / enableWeapon (called on the player)?!

 

The script for the safe in A New Job does something similar. It temporarely disables the weapons.

 

Did that survive to the final version? I'm not seeing it.



#18 grayman

grayman

    Master Builder, Coder

  • Active Developer
  • PipPipPipPipPip
  • 11988 posts

Posted 26 July 2017 - 04:31 PM

$player1.disableWeapon();

 

 

TADA!!!

 

Thanks, Obs. :P


  • Bikerdude, Obsttorte and Anderson like this

#19 Obsttorte

Obsttorte

    Scripting guru, Mapper

  • Active Developer
  • PipPipPipPipPip
  • 5300 posts

Posted 27 July 2017 - 03:30 AM

You are welcome. :)


  • Bikerdude likes this
FM's: Builder Roads, Old Habits, Old Habits Rebuild
WIP's: Several. Although after playing Thief 4 I really wanna make a city mission.
Mapping and Scripting: Apples and Peaches
Sculptris Models and Tutorials: Obsttortes Models
My wiki articles: Obstipedia
Let's Map TDM YouTube playlist: ObstlerTube
Texture Blending in DR: DR ASE Blend Exporter

End of shameless self promotion.

#20 Bikerdude

Bikerdude

    Mod hero

  • Member
  • PipPipPipPipPip
  • 18894 posts

Posted 27 July 2017 - 04:30 AM

Yah! Obs to the rescue...!!! :D


  • Obsttorte likes this



Reply to this topic



  


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users