Ok, so, I have this map, there's a holographic display that tells the player whether or not they can pass through. So far, it works alright except one thing... It doesn't change texture when triggered :/ (The whole point of it)
class AuthorizationPanel expands Decoration;
Var() Bool bauthorized;
var() texture DisabledTex, EnabledTex;
Function PostBeginPlay() //This works
{
If ( bauthorized ) //This works
{
Texture = EnabledTex; //This works
}
Else If ( !bauthorized ) //This works
{
Texture = DisabledTex; //This works
}
}
function Trigger( actor Other, pawn EventInstigator ) //This won't work
{
if ( bauthorized ) //This won't work
{
bauthorized=true; //This won't work
}
Else If ( !bauthorized ) //This won't work
bauthorized = True; //This won't work
}
Any help much appreciated
Authorization Panel
-
zacman
- Adept
- Posts: 412
- Joined: Wed Apr 15, 2009 5:36 am
- Personal rank: M-M-M-MONSTER KILL
-
Feralidragon
- Godlike
- Posts: 5503
- Joined: Wed Feb 27, 2008 6:24 pm
- Personal rank: Work In Progress
- Location: Liandri
Re: Authorization Panel
First off, here's a cleaner code version of yours:
Looks better and less confusing, doesn't it?
Second, you're extending that from the Decoration class, therefore you can't just walk in within the actor radius to trigger it. You need to set up an external normal plain Trigger actor, with it's Event pointing to this actor Tag. What will activate the trigger function, is a trigger itself, or if you want to use just the Decoration class and not any external Trigger, your code should be like this:
I guess you may want to set bTriggerOnlyOnce=True. But imho using an external trigger would be better (gives you more options to set it up as you want, and it's easier for another mapper to easilly understand how it should work).
Code: Select all
var() bool bAuthorized;
var() texture DisabledTex, EnabledTex;
function PostBeginPlay()
{
UpdateTex();
}
function Trigger(actor Other, pawn EventInstigator)
{
bAuthorized = !bAuthorized;
UpdateTex();
}
function UpdateTex()
{
if (bAuthorized)
Texture = EnabledTex;
else
Texture = DisabledTex;
}Second, you're extending that from the Decoration class, therefore you can't just walk in within the actor radius to trigger it. You need to set up an external normal plain Trigger actor, with it's Event pointing to this actor Tag. What will activate the trigger function, is a trigger itself, or if you want to use just the Decoration class and not any external Trigger, your code should be like this:
Code: Select all
var() bool bAuthorized;
var() bool bTriggerOnlyOnce;
var() texture DisabledTex, EnabledTex;
var bool bTriggered;
function PostBeginPlay()
{
UpdateTex();
}
function Touch(actor Other)
{
if (bTriggered && bTriggerOnlyOnce)
return;
bTriggered = True;
bAuthorized = !bAuthorized;
UpdateTex();
}
function UpdateTex()
{
if (bAuthorized)
Texture = EnabledTex;
else
Texture = DisabledTex;
}-
zacman
- Adept
- Posts: 412
- Joined: Wed Apr 15, 2009 5:36 am
- Personal rank: M-M-M-MONSTER KILL
Re: Authorization Panel
I actually was using an external trigger XD Moar failz for me I guess
Tyvm Ferali
<<EDIT>> that one didn't work :/ But Sana from USP gave me one that did ^^
<<EDIT>> that one didn't work :/ But Sana from USP gave me one that did ^^
Code: Select all
class AuthorizationPanel expands Decoration;
var() bool bAuthorized;
var() texture DisabledTex, EnabledTex;
function PostBeginPlay()
{
If (bAuthorized) {Texture = EnabledTex;}
else {Texture = DisabledTex;}
}
function Trigger(actor Other, pawn EventInstigator)
{
bAuthorized=!bAuthorized;
if (bAuthorized) {Texture=EnabledTex;}
else {Texture=DisabledTex;}
}-
Feralidragon
- Godlike
- Posts: 5503
- Joined: Wed Feb 27, 2008 6:24 pm
- Personal rank: Work In Progress
- Location: Liandri
Re: Authorization Panel
Which one did you try and how exactly you placed it there? What Sana did there is exactly the same thing I did in the first code of my post... -.-'
although in comparision I have to say that my version is more correct "coding-wise" (avoids code redundancy and is cleaner, a good coding practise), and looking at the one that "works", it's impossible my first code not working...
Perhaps you copied my 2nd code instead... or you overrided the whole thing even the class declaration that I omitted.
Do me a small favor (just to clear this up), try this one (you can apply Sana's code afterwards again after this test):
It will work, but either ways, if you want to use Sana's version, no problem (Sana did a GJ at it as well, I just find it strange you saying mine didn't work when Sana did exactly the same aproach), it's that redundant code and excessive use of "{" and "}" leads many times to bugs (although in this case none will occur unless you change the code).
although in comparision I have to say that my version is more correct "coding-wise" (avoids code redundancy and is cleaner, a good coding practise), and looking at the one that "works", it's impossible my first code not working...
Perhaps you copied my 2nd code instead... or you overrided the whole thing even the class declaration that I omitted.
Do me a small favor (just to clear this up), try this one (you can apply Sana's code afterwards again after this test):
Code: Select all
class AuthorizationPanel expands Decoration;
var() bool bAuthorized;
var() texture DisabledTex, EnabledTex;
function PostBeginPlay()
{
UpdateTex();
}
function Trigger(actor Other, pawn EventInstigator)
{
bAuthorized = !bAuthorized;
UpdateTex();
}
function UpdateTex()
{
if (bAuthorized)
Texture = EnabledTex;
else
Texture = DisabledTex;
}-
zacman
- Adept
- Posts: 412
- Joined: Wed Apr 15, 2009 5:36 am
- Personal rank: M-M-M-MONSTER KILL
Re: Authorization Panel
I'm fairly sure I used the first one you posted :S Basicly, it compiled right, but wouldn't change in game when triggered when I used it. I'll run it thru my test map again I guess.
<<EDIT>> ok odd thing is it's working now but only about half the time I go thru the trigger. Must be some oddity with my testmap e.e
<<EDIT>> ok odd thing is it's working now but only about half the time I go thru the trigger. Must be some oddity with my testmap e.e
-
zacman
- Adept
- Posts: 412
- Joined: Wed Apr 15, 2009 5:36 am
- Personal rank: M-M-M-MONSTER KILL
Re: Authorization Panel
Ok, now I have a problem with another script, this one I thought would be so simple that it couldn't possibly fail. Basicly, I want the pawn to stop producing Light and Fog when it dies, I found I could do this through the console via Set LightType LT_None, so I tried to impliment it in the code...
class GHOSTZOMGAAAH expands Manta;
Function destroyed()
{
LightType = LT_None;
}
...And it doesn't work
Any help for this coding n00b much appreciated
class GHOSTZOMGAAAH expands Manta;
Function destroyed()
{
LightType = LT_None;
}
...And it doesn't work
Any help for this coding n00b much appreciated
-
Feralidragon
- Godlike
- Posts: 5503
- Joined: Wed Feb 27, 2008 6:24 pm
- Personal rank: Work In Progress
- Location: Liandri
Re: Authorization Panel
Well, when an actor is destroyed, its light shouldn't stay anyway, so only the fact that it "stays" is quite weird already.
Either ways, try this:
Either ways, try this:
Code: Select all
simulated event Destroyed()
{
LightType = LT_None;
Super.Destroyed();
}-
JackGriffin
- Godlike
- Posts: 3829
- Joined: Fri Jan 14, 2011 1:53 pm
- Personal rank: -Retired-
Re: Authorization Panel
Depends on how you are calling the light. Here is the code I used for a personal light:
I think you just need to restore defaults rather than destroy.
Code: Select all
if(MutateString~="light")
{
Sender.ClientMessage("Toggling personal light on");
Sender.AmbientGlow = 254;
Sender.LightEffect=LE_NonIncidence;
Sender.LightBrightness=255;
Sender.LightHue=210;
Sender.LightRadius=30;
Sender.LightSaturation=200;
Sender.LightType=LT_Steady;
}
if(MutateString~="dark")
{
Sender.ClientMessage("Toggling personal light off");
Sender.AmbientGlow = Owner.Default.AmbientGlow;
Sender.LightType = LT_None;
}So long, and thanks for all the fish
-
zacman
- Adept
- Posts: 412
- Joined: Wed Apr 15, 2009 5:36 am
- Personal rank: M-M-M-MONSTER KILL
Re: Authorization Panel
It's for an SP map, it's just a Manta that's bhidden and has light/fog set on it (To make a creepy ghost fogball) Even with Ferali's code it still doesn't work :/ The only time the fog and light vanishes is when it gets telefragged (And since the player doesn't have a translocator, kinda useless knowledge
) I would have thought it'd just dissapear on death as well :S
) I would have thought it'd just dissapear on death as well :S-
Feralidragon
- Godlike
- Posts: 5503
- Joined: Wed Feb 27, 2008 6:24 pm
- Personal rank: Work In Progress
- Location: Liandri
Re: Authorization Panel
Try this:
Code: Select all
function Died(pawn Killer, name damageType, vector HitLocation)
{
LightType = LT_None;
VolumeBrightness = 0;
VolumeRadius = 0;
VolumeFog = 0;
Super.Died( Killer, damageType, HitLocation);
}-
zacman
- Adept
- Posts: 412
- Joined: Wed Apr 15, 2009 5:36 am
- Personal rank: M-M-M-MONSTER KILL

[/url]