Data Realms Fan Forums
http://45.55.195.193/

Forcing an actor to only use a certain weapon
http://45.55.195.193/viewtopic.php?f=73&t=19556
Page 1 of 1

Author:  Awesomeness [ Fri Aug 20, 2010 5:04 pm ]
Post subject:  Forcing an actor to only use a certain weapon

This weapon already cannot be destroyed, so making new ones isn't a problem, by the way. I've tried messing with inventory-changing methods from LuaDocs/Actor on the temporary wiki to no avail... But I'm sure this has been done before. How do you do it?

Author:  411570N3 [ Fri Aug 20, 2010 5:13 pm ]
Post subject:  Re: Forcing an actor to only use a certain weapon

Why don't you just set Charheight to 0 or below and just have him unable to pick up weapons?
There's probably a Lua way to do the same thing (pickup disabling) if that's not possible.

Author:  Awesomeness [ Fri Aug 20, 2010 5:20 pm ]
Post subject:  Re: Forcing an actor to only use a certain weapon

I'd actually like it to say a message (something like "I can't use that!") each time he tries to pick up a different weapon or drop his weapon. This is tough...

Author:  Mad Alex [ Fri Aug 20, 2010 5:57 pm ]
Post subject:  Re: Forcing an actor to only use a certain weapon

self:GetController():SetState(Controller.WEAPON_PICKUP, false);

Add this line in update function.

Author:  Awesomeness [ Fri Aug 20, 2010 10:47 pm ]
Post subject:  Re: Forcing an actor to only use a certain weapon

Mad Alex wrote:
self:GetController():SetState(Controller.WEAPON_PICKUP, false);

Add this line in update function.

See my other post; that won't work for what I want.

Author:  Mad Alex [ Fri Aug 20, 2010 11:21 pm ]
Post subject:  Re: Forcing an actor to only use a certain weapon

Code:
if self:GetController():IsState(Controller.WEAPON_PICKUP)
    self:GetController():SetState(Controller.WEAPON_PICKUP, false);
    *your message*
end


What is "message"? Screen text? Or sound? (Something like "beep" error signal?)

Author:  Awesomeness [ Fri Aug 20, 2010 11:34 pm ]
Post subject:  Re: Forcing an actor to only use a certain weapon

I'm making a campaign. It's the yellow screen text.

Author:  Mad Alex [ Sat Aug 21, 2010 12:27 am ]
Post subject:  Re: Forcing an actor to only use a certain weapon

Code:
if self:GetController():IsState(Controller.WEAPON_PICKUP)
    self:GetController():SetState(Controller.WEAPON_PICKUP, false);
    FrameMan:SetScreenText("Your message", Activity.PLAYER_1, 0, 2000, true);
end

Then it looks like that.
I'm not sure about parameters.
Look here: http://drlwiki.thebunny.info/wiki/index ... ScreenText (temp wiki limk)
Quote:
SetScreenText
Sets the message to be displayed on top of each player's screen
Arguments:
* An std::string that specifies what should be displayed.
* Which screen you want to set text to.
* The interval with which the screen will be blinking, in ms. 0 means no blinking.
* The duration, in MS to force this message to display. No other message can be displayed before this expires. ClearScreenText overrides it though.
* Vertically centered on the screen
Return value:None.

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/