Welcome, Guest. Please login or register.

What openbor you prefer: Double dragon,battletoads or final fight !? by lirexpatrio
[December 07, 2012, 07:15:27 pm]


what are your favorite games OpenBOR?! by lirexpatrio
[December 07, 2012, 07:09:46 pm]


Post Some Awesome Videos by maxman
[December 07, 2012, 05:51:39 pm]


Can @cmd playmusic "aaaa" 1 also increse music sound ? by BeasTie
[December 07, 2012, 05:24:38 pm]


Streets of Rage: Silent Storm by mtrain
[December 07, 2012, 03:45:05 pm]


Site will be down for maintenance on 12/8/2012 thru 12/10/2012 by Damon Caskey
[December 07, 2012, 07:42:42 am]


Cancelled SOR 3d Remake by riccochet
[December 07, 2012, 03:58:33 am]


Dungeon Fighter: B.O.R. by msmalik681
[December 07, 2012, 03:24:27 am]


[TUTORIAL] How to create 4 Games of OpenBOR in 1 CD (650 MB) by magggas
[December 06, 2012, 09:46:25 pm]


custknife by Bloodbane
[December 06, 2012, 09:34:09 pm]


blockfx help by B.Kardi
[December 06, 2012, 04:09:14 pm]


street of age 4 hd by corradlo
[December 06, 2012, 01:41:36 pm]


ClaFan - Classic Fantasy ver 1.17 by soniczxblade
[December 06, 2012, 05:01:20 am]


Bug Archive by Bloodbane
[December 06, 2012, 02:00:44 am]


"Bio-Doom" and "Gears of Doom" by BulletBob
[December 05, 2012, 10:07:21 pm]


Contra Locked 'N' Loaded v2 by Bloodbane
[December 05, 2012, 09:39:43 pm]


Downloadable OpenBoR Manual by BeasTie
[December 05, 2012, 08:31:24 pm]


Having trouble testing changes by B.Kardi
[December 05, 2012, 03:05:53 pm]


DragonBall Absalon by msmalik681
[December 05, 2012, 02:52:13 pm]


[Hi-Res] Swamp by Vibrant
[December 05, 2012, 10:47:14 am]


  • Dot Guests: 177
  • Dot Hidden: 0
  • Dot Users: 0

There aren't any users online.



Author Topic: (Solved)Weapon Changed via script bug!  (Read 920 times)

0 Members and 1 Guest are viewing this topic.

Offline MatMan

  • Hero Member
  • *****
  • Posts: 1320
(Solved)Weapon Changed via script bug!
« on: June 08, 2012, 05:53:55 pm »
Got a strange bug regarding weapon change via script.

When I pick up weapon number 2 the change (via item) works as expected but when I run the script below which set it back to the default weapon everything works fine however then the player can not pick anything up anymore then if I force a weapon change back to weapon 2 via script the player changes weapon mode but then looses all keyboard control and just stands still, any clues on this?

Code: [Select]
void changeweaponnext(void d)
{
  void self = getlocalvar("self");
  if ( self != NULL() )
  {
    changeentityproperty(self, "weapon", 0);
  }
}
« Last Edit: June 09, 2012, 11:38:48 am by MatMan »

Offline MatMan

  • Hero Member
  • *****
  • Posts: 1320
Re: Weapon Changed via script bug!
« Reply #1 on: June 08, 2012, 06:31:18 pm »
The keyboard loss happened because the command "modelflag 1" was located in the entities main file and also in the weapon file. It only needs to be located in the main file (not in weapon files).

Edit...
However, I'm still having the can't pick up weapon bug.
« Last Edit: June 08, 2012, 06:33:11 pm by MatMan »

Offline utunnels

  • Developer
  • Hero Member
  • *****
  • Posts: 2713
Re: Weapon Changed via script bug!
« Reply #2 on: June 08, 2012, 08:26:57 pm »
Hmm, can't pick up weapons, or can't pick up anything for example food?

Offline MatMan

  • Hero Member
  • *****
  • Posts: 1320
Re: Weapon Changed via script bug!
« Reply #3 on: June 08, 2012, 08:30:48 pm »
Hmm, can't pick up weapons, or can't pick up anything for example food?

Weapons only.

The minute I take out these command from the weapon item file.. "subtype   weapon", "weapnum #" and "weaploss #" then I can pick it up.

Offline utunnels

  • Developer
  • Hero Member
  • *****
  • Posts: 2713
Re: Weapon Changed via script bug!
« Reply #4 on: June 08, 2012, 09:27:38 pm »
Hmm, then things go complicated.

BTW as for the loss of control problem, it is because the character get stuck in his idle animation.

Add an extra parameter like below if both the 2 models have the same animation, or add a spawn/respawn animation should do the trick.

changeentityproperty(self, "weapon", 0, 1);

Offline MatMan

  • Hero Member
  • *****
  • Posts: 1320
Re: Weapon Changed via script bug!
« Reply #5 on: June 08, 2012, 09:33:29 pm »
Quote
Hmm, then things go complicated.
I thought so but I landed up writing a complete new weapon system, has tags for if you have picked up a weapon, each weapons ammo, auto selects previous weapon (from list) when ammo is out, select next/previous weapon via button etc. It's for beastie's doom mod so you can imagine the type of system you might need.

Quote
BTW as for the loss of control problem, it is because the character get stuck in his idle animation.
Thanx, will keep that in mind.

Offline utunnels

  • Developer
  • Hero Member
  • *****
  • Posts: 2713
Re: Weapon Changed via script bug!
« Reply #6 on: June 08, 2012, 10:03:14 pm »
I haven't tried myself.

But there's a new function maybe you want to test.


pickup(ent, item);


It mimics the way you pickup an item and applies the bonus.  For example, you can spawn a gun and immediately call this function to give it to your player.

The good aspect of this is you can also simulate the weapon drop logic. The bad is you have to create a bunch of items.

Offline MatMan

  • Hero Member
  • *****
  • Posts: 1320
Re: Weapon Changed via script bug!
« Reply #7 on: June 08, 2012, 10:03:24 pm »
Just came accrross another interesting problem.

When you pick up a item (by clicking attack over it) the didhitscript fires and then I can do my script.

but when you have the item as a "subtype touch" then the didhitscript does not fire, anywork around for this?

Offline utunnels

  • Developer
  • Hero Member
  • *****
  • Posts: 2713
Re: Weapon Changed via script bug!
« Reply #8 on: June 08, 2012, 10:11:08 pm »
Maybe you can try an itembox type attack for the item?


Offline MatMan

  • Hero Member
  • *****
  • Posts: 1320
Re: Weapon Changed via script bug!
« Reply #9 on: June 08, 2012, 10:16:22 pm »
Maybe you can try an itembox type attack for the item?
Sorry, don't know what you mean?

Just to re-explain from my side, weapons you have to pick up (by standing over them and clicking attack) the bullets on the other hand you just walk over them and the player automatically gets them (like the original doom games) , but the didhitscript doesn't fire with the bullets.

Offline utunnels

  • Developer
  • Hero Member
  • *****
  • Posts: 2713
Re: Weapon Changed via script bug!
« Reply #10 on: June 08, 2012, 10:23:38 pm »
There a attack type for items called itembox (I forgot who added that).
It is used to simulate subtype touch and the usage is like a normal attack command, except you don't need to set the damage value.

Offline MatMan

  • Hero Member
  • *****
  • Posts: 1320
Re: Weapon Changed via script bug!
« Reply #11 on: June 08, 2012, 10:28:13 pm »
How do I use it?

Offline utunnels

  • Developer
  • Hero Member
  • *****
  • Posts: 2713
Re: Weapon Changed via script bug!
« Reply #12 on: June 08, 2012, 10:32:34 pm »
Just replace a bbox of your item with itembox and try.
You can manually set candamage for that item if you only want it to affect your players.

Offline BeasTie

  • Hero Member
  • *****
  • Posts: 760
Re: Weapon Changed via script bug!
« Reply #13 on: June 08, 2012, 11:26:05 pm »
Ahh this must be why my didhitscript wasn't working either, because of subtype touch.

Offline Bloodbane

  • Hero Member
  • *****
  • Posts: 7113
  • Dark Dragon
Re: Weapon Changed via script bug!
« Reply #14 on: June 10, 2012, 01:03:38 am »
But there's a new function maybe you want to test.

pickup(ent, item);

It mimics the way you pickup an item and applies the bonus.  For example, you can spawn a gun and immediately call this function to give it to your player.

 Interesting. Does item refers to entity or item name? The former also means that we have to acquire it while the latter means mentioning name is enough

Quote
The good aspect of this is you can also simulate the weapon drop logic. The bad is you have to create a bunch of items.

 What do you mean with the last? I thought it's normal to have items, or you mean different kind of items?

Quote
There a attack type for items called itembox (I forgot who added that)

 kbandressen added that
OpenBoR Manual

Basic OpenBoR Tutorials

OpenBoR Tricks & Tutorials

"The more often enemies attack, the more open they are to counter attacks"

 



 0%




SimplePortal 2.3.3 © 2008-2010, SimplePortal