Seriously!

Go Back   Seriously! Forums > Serious Sam Series > Serious Sam HD

Serious Sam HD Discuss anything and everything about Serious Sam HD, the official remake of SS:FE on Serious Engine 3.

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 07-26-2013, 03:13 PM   #1   Add To Ignore List  
T-Mech
 
Fungus's Avatar
 
Joined: May 2008
 
Fungus is offline
Default Script entity does nothing?

I have tried various codes, after quick internet reading, but can't get anything happening.

I am trying to spawn an enemy once the player steps into a detector area.

I tried:
Code:
RunHandled(
  function()      -- handled function
    Wait(Event(Detector.Activated))
    Firecrackers:SpawnSimple()
   end
)
Tried:
Code:
Wait(Event(Detector.Activated))
Firecrackers:SpawnSimple()
The entities are linked to their script descriptions, it looks fine from the script pad, though it doesn't work.
I think I am missing some pretty obvious crap I'm unaware of, and if so, can anyone please point it out?

Since the beginning I was trying to figure it out but faced this issue, I just kept trying different stuff but they didn't work.

Last edited by Fungus; 07-26-2013 at 03:19 PM.
  Reply With Quote
Old 07-26-2013, 03:42 PM   #2   Add To Ignore List  
🐱 Kitty 💘💙💚💛💜
 
Scratch's Avatar
 
Crackshell Developer
Joined: May 2007
Location: Heiloo, Netherlands
 
Scratch is offline
Default Re: Script entity does nothing?

Code:
RunHandled(
  function() WaitForever() end,
  On(Event(Detector.Activated)),
  function()
    Firecrackers:SpawnSimple()
  end
)
Try that? I haven't worked with scripts in a while, it might be off...
__________________
I'm a cat by the way. I'm also everyone's most hated critic.
(Opinions expressed are my own)

Nimble Writer - now available on Steam, Itch.io.
CodeCat, my blog that I need to update - I also have a showcase, which I barely update.
(I do not respond to PM's about Serious Sam Revolution or Bogus Detour. Please use the appropriate community hubs for that.)
  Reply With Quote
Old 07-26-2013, 05:05 PM   #3   Add To Ignore List  
Black Star
 
Devostator's Avatar
 
Seriously! Creative Moderator
Joined: Jun 2011
Location: Germany
 
Devostator is offline
Default Re: Script entity does nothing?

Code:
Wait(Event(Detector.Activated))
Firecrackers:SpawnSimple()
That should usually already do the job
  Reply With Quote
Old 07-26-2013, 05:22 PM   #4   Add To Ignore List  
Developer Fairy
 
Solais's Avatar
 
Croteam Representative
Joined: Nov 2009
 
Solais is offline
Default Re: Script entity does nothing?

Angelo's is more correct, if the formatting is not the best. ()
__________________
Since Old Lost Age I Shine

My Serious Sam 3/HD Workshop


While I do work for Croteam, I'm first of all of this community, so my opinions are my own and do not represent Croteam's views.
  Reply With Quote
Old 07-26-2013, 05:56 PM   #5   Add To Ignore List  
🐱 Kitty 💘💙💚💛💜
 
Scratch's Avatar
 
Crackshell Developer
Joined: May 2007
Location: Heiloo, Netherlands
 
Scratch is offline
Default Re: Script entity does nothing?

Fine.

Code:
RunHandled(
  function()
    WaitForever()
  end,

  On(Event(Detector.Activated)),
  function()
    Firecrackers:SpawnSimple()
  end
)
Or, because **** you:
Code:
RunHandled(function()WaitForever();end,On(Event(Detector.Activated)),function()Firecrackers:SpawnSimple();end)
Or if you're a crazy lunatic who wants to kill himself: (Don't actually use this)
Code:
worldGlobals.a=RunHandled;worldGlobals.b=WaitForever;worldGlobals.c=Detector.Activated;worldGlobals.d=Firecrackers;worldGlobals.a(function()worldGlobals.b();end,On(Event(worldGlobals.c)),function()worldGlobals.d:SpawnSimple();end)
__________________
I'm a cat by the way. I'm also everyone's most hated critic.
(Opinions expressed are my own)

Nimble Writer - now available on Steam, Itch.io.
CodeCat, my blog that I need to update - I also have a showcase, which I barely update.
(I do not respond to PM's about Serious Sam Revolution or Bogus Detour. Please use the appropriate community hubs for that.)
  Reply With Quote
Old 07-27-2013, 05:09 AM   #6   Add To Ignore List  
Finzy Corp. CEO
 
Finzy's Avatar
 
Joined: Sep 2005
Location: Whatshisoffice
 
Finzy is offline
Default Re: Script entity does nothing?

Have you actually made the firecrackers a spawn entity? You need to set a spawner for them in their properties before they can spawn. Also, checking the console for errors would be very helpful in troubleshooting.

Use Devostator's script, it's simplest and you really don't need anything more complicated than that.
  Reply With Quote
Old 07-27-2013, 07:34 AM   #7   Add To Ignore List  
T-Mech
 
Fungus's Avatar
 
Joined: May 2008
 
Fungus is offline
Default Re: Script entity does nothing?

They had a spawner, and the console didn't let me on a single clue as to what went wrong.,
Angelo's and Devostator's scripts worked now though I still have no idea why it didn't work earlier.
What's the xxxx:GetHealth/GetCharacterClass/GetBrain/etc suffixes do?
Also, what's the difference between handled functions and functions like devostator's?
apart from the way it's written ofcourse.

Last edited by Fungus; 07-27-2013 at 08:15 AM.
  Reply With Quote
Old 07-27-2013, 08:19 AM   #8   Add To Ignore List  
🐱 Kitty 💘💙💚💛💜
 
Scratch's Avatar
 
Crackshell Developer
Joined: May 2007
Location: Heiloo, Netherlands
 
Scratch is offline
Default Re: Script entity does nothing?

RunHandled allows for multiple events over a certain span of time, while immediate calls with Wait() allow for only one event to be called.
__________________
I'm a cat by the way. I'm also everyone's most hated critic.
(Opinions expressed are my own)

Nimble Writer - now available on Steam, Itch.io.
CodeCat, my blog that I need to update - I also have a showcase, which I barely update.
(I do not respond to PM's about Serious Sam Revolution or Bogus Detour. Please use the appropriate community hubs for that.)
  Reply With Quote
Old 07-27-2013, 08:47 AM   #9   Add To Ignore List  
Developer Fairy
 
Solais's Avatar
 
Croteam Representative
Joined: Nov 2009
 
Solais is offline
Default Re: Script entity does nothing?

Aka, with RunHandled, you can make a single script for your survival level.
__________________
Since Old Lost Age I Shine

My Serious Sam 3/HD Workshop


While I do work for Croteam, I'm first of all of this community, so my opinions are my own and do not represent Croteam's views.
  Reply With Quote
Old 07-27-2013, 12:37 PM   #10   Add To Ignore List  
T-Mech
 
Fungus's Avatar
 
Joined: May 2008
 
Fungus is offline
Default Re: Script entity does nothing?

oh, so I can get just the same result if I use multiple simple scripts?
and the xx:gethealth/brain/class commands?
  Reply With Quote
Old 07-28-2013, 09:42 AM   #11   Add To Ignore List  
🐱 Kitty 💘💙💚💛💜
 
Scratch's Avatar
 
Crackshell Developer
Joined: May 2007
Location: Heiloo, Netherlands
 
Scratch is offline
Default Re: Script entity does nothing?

Not sure what you mean - you're talking about even payloads?

I think doing this will get the payload, though I'm not sure.

Code:
local payload = Wait(Event(Detector.Activated))
__________________
I'm a cat by the way. I'm also everyone's most hated critic.
(Opinions expressed are my own)

Nimble Writer - now available on Steam, Itch.io.
CodeCat, my blog that I need to update - I also have a showcase, which I barely update.
(I do not respond to PM's about Serious Sam Revolution or Bogus Detour. Please use the appropriate community hubs for that.)
  Reply With Quote
Old 07-28-2013, 11:19 AM   #12   Add To Ignore List  
T-Mech
 
Fungus's Avatar
 
Joined: May 2008
 
Fungus is offline
Default Re: Script entity does nothing?

I meant to ask, what are the "enemy:gethealth()" "enemy:getclass()" "enemy:getbrain" etc.. get commands?
What are they and what purpose they are for?
  Reply With Quote
Old 07-28-2013, 02:47 PM   #13   Add To Ignore List  
Developer Fairy
 
Solais's Avatar
 
Croteam Representative
Joined: Nov 2009
 
Solais is offline
Default Re: Script entity does nothing?

They are for very advanced scripts.
__________________
Since Old Lost Age I Shine

My Serious Sam 3/HD Workshop


While I do work for Croteam, I'm first of all of this community, so my opinions are my own and do not represent Croteam's views.
  Reply With Quote
Old 07-28-2013, 03:07 PM   #14   Add To Ignore List  
🐱 Kitty 💘💙💚💛💜
 
Scratch's Avatar
 
Crackshell Developer
Joined: May 2007
Location: Heiloo, Netherlands
 
Scratch is offline
Default Re: Script entity does nothing?

Cool, I do "very advanced" things.
__________________
I'm a cat by the way. I'm also everyone's most hated critic.
(Opinions expressed are my own)

Nimble Writer - now available on Steam, Itch.io.
CodeCat, my blog that I need to update - I also have a showcase, which I barely update.
(I do not respond to PM's about Serious Sam Revolution or Bogus Detour. Please use the appropriate community hubs for that.)
  Reply With Quote
Old 07-28-2013, 05:11 PM   #15   Add To Ignore List  
T-Mech
 
Fungus's Avatar
 
Joined: May 2008
 
Fungus is offline
Default Re: Script entity does nothing?

Quote:
Originally Posted by Solais View Post
They are for very advanced scripts.
And at some point I'll have to learn that, ya know.
What kind of advanced scripts? for what purpose?
  Reply With Quote
Old 07-28-2013, 05:21 PM   #16   Add To Ignore List  
Developer Fairy
 
Solais's Avatar
 
Croteam Representative
Joined: Nov 2009
 
Solais is offline
Default Re: Script entity does nothing?

Too advanced for me, you have to ask Ryason for that. Not such scripts that would be needed for anyone making maps and such, only for crazy people like Ryason who break the barriers of moddability. Well, at least "GetBrain". The others could be useful, but they are still quite advanced.
__________________
Since Old Lost Age I Shine

My Serious Sam 3/HD Workshop


While I do work for Croteam, I'm first of all of this community, so my opinions are my own and do not represent Croteam's views.
  Reply With Quote
Old 07-30-2013, 06:00 PM   #17   Add To Ignore List  
Kleer
 
xanaThaR's Avatar
 
Joined: May 2011
 
xanaThaR is offline
Default Re: Script entity does nothing?

I wouldn't really call these 'advanced', I mean all that GetHealth() does is give you the health of the character you call it on:

local health = someCharacter:GetHealth()

The same goes for the other getter/setter methods like GetArmor(), SetHealth() etc., the name usually speaks for itself.

If you really don't know what's going on, printing the result can sometimes give you the answer, e.g.

Code:
Wait(Event(someDetector.Activated))
local activator = someDetector:GetLastActivator()
print("The result of GetHealth: ", activator:GetHealth())
print("The result of GetClassName: ", activator:GetClassName())
-- these will only work here, if the last activator actually has the methods GetHealth() and GetClassName() availible
you will see that if a player has activated the detector, the result will be "CPlayerPuppetEntity". Try out yourself what happens if e.g. a legged character or a khnuum or a rocket activated the trigger. dont forget to set the detectorarea's sensitivity to 'everything' first.

You will find out that if you shoot a rocket into the detector area from the script above, the script will print its classname ("CRocketLauncherProjectileEntity") and then terminate with an error, because the class CRocketLauncherProjectileEntity has no method called GetHealth(). You can use GetClassName() to solve this:

Code:
Wait(Event(someDetectorArea.Activated))

local entity = someDetectorArea:GetLastActivator()

if (entity:GetClassName() == "CPlayerPuppetEntity" or entity:GetClassName() == "CLeggedCharacterEntity") then
  if (entity:GetHealth() < 100) then
    entity:SetHealth(200)
  end
end
This will set the health of a PlayerPuppetEntity or LeggedPuppetEntity to 200 if it has less than 100 when it walks into the detector.

That wasn't too advanced after all, was it?


Oh yeah, about GetBrain(): i think it might be something they are still working on, because the returned class has no unique methods and seems to be useless.
  Reply With Quote
Old 07-31-2013, 01:50 AM   #18   Add To Ignore List  
Developer Fairy
 
Solais's Avatar
 
Croteam Representative
Joined: Nov 2009
 
Solais is offline
Default Re: Script entity does nothing?

This itself is not advanced, I meant that the thing is used for more advanced scripts. I think when someone can't even really script enemy spawning just yet, it's no use to reveal more advanced functions just yet.

As for Brain, I think that's more like a leftover thing, at least I think I remember there being a "Brain" Entity existing back then that was used for puppets. It might be something such advanced that is beyond my understanding though, that's why I said that it's "too advanced" for me.
__________________
Since Old Lost Age I Shine

My Serious Sam 3/HD Workshop


While I do work for Croteam, I'm first of all of this community, so my opinions are my own and do not represent Croteam's views.
  Reply With Quote
Old 07-31-2013, 03:58 AM   #19   Add To Ignore List  
Finzy Corp. CEO
 
Finzy's Avatar
 
Joined: Sep 2005
Location: Whatshisoffice
 
Finzy is offline
Default Re: Script entity does nothing?

Quote:
Originally Posted by Fungus View Post
oh, so I can get just the same result if I use multiple simple scripts?
Yes. This is the method I use and I would recommend it too, it only takes dropping a few more script entities but it'll save you an assload of code, and as a beginner you really don't want to be worrying about correct 100% correct and professional syntax that much.

E.g you can for instance put a Wait event on two scripts that both target the same detector area, and have the other script handle the enemy battle scripting, while the other one does something else.
  Reply With Quote
Old 07-31-2013, 07:25 AM   #20   Add To Ignore List  
🐱 Kitty 💘💙💚💛💜
 
Scratch's Avatar
 
Crackshell Developer
Joined: May 2007
Location: Heiloo, Netherlands
 
Scratch is offline
Default Re: Script entity does nothing?

Afaicr, Serious Sam 3 doesn't make use of the Brain entity anymore, but it was used in Serious Sam HD, despite not having any macro functions there, either.
__________________
I'm a cat by the way. I'm also everyone's most hated critic.
(Opinions expressed are my own)

Nimble Writer - now available on Steam, Itch.io.
CodeCat, my blog that I need to update - I also have a showcase, which I barely update.
(I do not respond to PM's about Serious Sam Revolution or Bogus Detour. Please use the appropriate community hubs for that.)
  Reply With Quote
Old 07-31-2013, 10:19 AM   #21   Add To Ignore List  
T-Mech
 
Fungus's Avatar
 
Joined: May 2008
 
Fungus is offline
Default Re: Script entity does nothing?

Quote:
Originally Posted by xanaThaR View Post
~Explanation about the :getxxx commands~
let's say you use scorp:gethealth()
Is there a place where you can actually see what was the exact number it gave out?
and then maybe use that number for something else? like setting a timer or whatever.
  Reply With Quote
Old 07-31-2013, 10:32 AM   #22   Add To Ignore List  
🐱 Kitty 💘💙💚💛💜
 
Scratch's Avatar
 
Crackshell Developer
Joined: May 2007
Location: Heiloo, Netherlands
 
Scratch is offline
Default Re: Script entity does nothing?

As the name implies, it returns the puppet's health.

Code:
local fScorpsHealth = scorp:GetHealth()
-- now you can use it
if fScorpsHealth > 0 then
  print("He's still alive!")
end
__________________
I'm a cat by the way. I'm also everyone's most hated critic.
(Opinions expressed are my own)

Nimble Writer - now available on Steam, Itch.io.
CodeCat, my blog that I need to update - I also have a showcase, which I barely update.
(I do not respond to PM's about Serious Sam Revolution or Bogus Detour. Please use the appropriate community hubs for that.)
  Reply With Quote
Old 07-31-2013, 10:45 AM   #23   Add To Ignore List  
T-Mech
 
Fungus's Avatar
 
Joined: May 2008
 
Fungus is offline
Default Re: Script entity does nothing?

But is there a way to retrieve his exact health? and then use it?
let's say a script that checks it's health every minute or so, and prints it.
  Reply With Quote
Old 07-31-2013, 11:42 AM   #24   Add To Ignore List  
Developer Fairy
 
Solais's Avatar
 
Croteam Representative
Joined: Nov 2009
 
Solais is offline
Default Re: Script entity does nothing?

Sure, though "printing" only appears in the editor for testing reasons (and it is printed to the console).
__________________
Since Old Lost Age I Shine

My Serious Sam 3/HD Workshop


While I do work for Croteam, I'm first of all of this community, so my opinions are my own and do not represent Croteam's views.
  Reply With Quote
Old 07-31-2013, 12:12 PM   #25   Add To Ignore List  
T-Mech
 
Fungus's Avatar
 
Joined: May 2008
 
Fungus is offline
Default Re: Script entity does nothing?

oh, so what's the thing you use to show text in the game? [where you usually see messeges and subtitles.]
I think it's this Text Effect entity, though I have no idea what's the script to make it appear and when.
  Reply With Quote
Old 07-31-2013, 12:19 PM   #26   Add To Ignore List  
🐱 Kitty 💘💙💚💛💜
 
Scratch's Avatar
 
Crackshell Developer
Joined: May 2007
Location: Heiloo, Netherlands
 
Scratch is offline
Default Re: Script entity does nothing?

There's a macro function in worldInfo that shows some text on the HUD, if I remember correctly.

Text Effect entity is for more "advanced" (here we go with that word again ) HUD rendering.
__________________
I'm a cat by the way. I'm also everyone's most hated critic.
(Opinions expressed are my own)

Nimble Writer - now available on Steam, Itch.io.
CodeCat, my blog that I need to update - I also have a showcase, which I barely update.
(I do not respond to PM's about Serious Sam Revolution or Bogus Detour. Please use the appropriate community hubs for that.)
  Reply With Quote
Old 07-31-2013, 12:33 PM   #27   Add To Ignore List  
Developer Fairy
 
Solais's Avatar
 
Croteam Representative
Joined: Nov 2009
 
Solais is offline
Default Re: Script entity does nothing?

I don't know if the Text Effect entity even works anymore in SS3, the effects are more or less controlled by scripts only, and resources set inside the scripts.
__________________
Since Old Lost Age I Shine

My Serious Sam 3/HD Workshop


While I do work for Croteam, I'm first of all of this community, so my opinions are my own and do not represent Croteam's views.
  Reply With Quote
Old 07-31-2013, 03:15 PM   #28   Add To Ignore List  
Finzy Corp. CEO
 
Finzy's Avatar
 
Joined: Sep 2005
Location: Whatshisoffice
 
Finzy is offline
Default Re: Script entity does nothing?

Quote:
Originally Posted by Angelo View Post
There's a macro function in worldInfo that shows some text on the HUD, if I remember correctly.
Yep, and here it is:

Code:
worldInfo:ShowMessageToAll("TTRS:Example.Example1=This is an example text.")
The TTRS:Example.Example1 is there because everytime the game displays some message, it looks up translations from a translation table. If it's not explicitly specified then it will display an error message instead, so you have to make up fake translation resources for it - but it'll accept anything.

The only downsides to this approach is that you can't control how long the text will stay on screen, it only seems to stay for about 4 seconds always, but it's enough for nearly all cases when you need to display text. Personally I wouldn't bother using text effects just to display subtitles, copy pasting this line to a script and then modifying it is far faster.

Hope that helps. And btw, worldInfo doesn't need to (and can't) be dragged into the variable, just type "worldInfo" and it should work automatically.

Last edited by Finzy; 07-31-2013 at 03:17 PM.
  Reply With Quote
Old 07-31-2013, 03:32 PM   #29   Add To Ignore List  
🐱 Kitty 💘💙💚💛💜
 
Scratch's Avatar
 
Crackshell Developer
Joined: May 2007
Location: Heiloo, Netherlands
 
Scratch is offline
Default Re: Script entity does nothing?

Quote:
Originally Posted by Solais View Post
I don't know if the Text Effect entity even works anymore in SS3, the effects are more or less controlled by scripts only, and resources set inside the scripts.
I have used it in Serious Sam 3 before, I don't see why they would've broken it in the meantime.
__________________
I'm a cat by the way. I'm also everyone's most hated critic.
(Opinions expressed are my own)

Nimble Writer - now available on Steam, Itch.io.
CodeCat, my blog that I need to update - I also have a showcase, which I barely update.
(I do not respond to PM's about Serious Sam Revolution or Bogus Detour. Please use the appropriate community hubs for that.)
  Reply With Quote
Old 07-31-2013, 04:09 PM   #30   Add To Ignore List  
Developer Fairy
 
Solais's Avatar
 
Croteam Representative
Joined: Nov 2009
 
Solais is offline
Default Re: Script entity does nothing?

On the other hand, unlike Finzy's method that is hugely distracting, when it comes to subtitles, I'd rather use the original method, aka creating srt files for the sound files. That's how Croteam does it, is properly displayed like on the original levels and don't get in the way. You can also control its length. Making such is like 5 seconds.
__________________
Since Old Lost Age I Shine

My Serious Sam 3/HD Workshop


While I do work for Croteam, I'm first of all of this community, so my opinions are my own and do not represent Croteam's views.
  Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Script Problem Slayer5381 Serious Sam HD 0 06-08-2013 04:39 PM
How to activate a camera with the script entity? Devostator Serious Sam HD 1 12-13-2011 08:47 PM
Script spawn help Smsr Serious Sam HD 2 12-08-2011 02:00 PM
Serious Reference Redshirt Serious Editor 14 11-16-2001 06:18 PM


All times are GMT -4. The time now is 06:08 AM.