Seriously!

Go Back   Seriously! Forums > Serious Sam Series > Serious Sam 3 > Serious Sam 3: BFE Workshop

Serious Sam 3: BFE Workshop The official forum for Serious Sam 3: BFE projects, be it maps, mods, or something else.

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
Old 12-14-2016, 09:51 PM   #1   Add To Ignore List  
ideas but no skills
 
PikaCommando's Avatar
 
Seriously! Archivist/Slave
Joined: Mar 2013
Location: In My Crawl, Crawling
 
PikaCommando is offline
Default Weapon scripting?

I thought modding weapons for SS3 was impossible, and then I saw weapon mods on the workshop. Looks like they're all done with scripting though.

So how do I get started with scripting weapons? Right now I'm just trying to make Cannonballs explode more than once.
  Reply With Quote
Old 12-14-2016, 10:56 PM   #2   Add To Ignore List  
Kleer
 
NSKuber's Avatar
 
Joined: Mar 2016
 
NSKuber is offline
Default Re: Weapon scripting?

What do you mean exactly by exploding more than once?

As for the topic, it depends on the weapon. All my recent weapons were made using World scripts, i.e., just regular scripts that somehow exploit weapon mechanism, and in every case it was individual.
I can briefly explain what is done:

Flamethrower (Freezethrower): every flame is captured by the script, then the script calculates manually (this is CPU-heavy, at least with current implementation) if it is colliding with nearby enemies and damages and ignites (freezes) them when needed. Flamethrower without the script will be just emitting flames that are passing through enemies and not damage anyone.

Chainsaw: pistol shooting 3rd person animation is throwing custom events when chainsaw should do damage, script catches these events and again calculates who should be damaged (if anyone at all) this tick. Windup animations are added using CPlayerPuppetEntity:SetCustomAnimOnRightHandWeapon () function.

Grenade launcher: when a grenade is spawned (with 0 velocity), it is teleported to nowhere and again charging animation is started by scripts. Script notes for how long do you keep your mouse button pressed, and when you release it, grenade is teleported back and is given proper speed and direction depending on your looking direction and duration of the charging.
This is the simplest one, and I like that it actually uses projectile and doesn't screw with damaging.
  Reply With Quote
Old 12-14-2016, 11:13 PM   #3   Add To Ignore List  
ideas but no skills
 
PikaCommando's Avatar
 
Seriously! Archivist/Slave
Joined: Mar 2013
Location: In My Crawl, Crawling
 
PikaCommando is offline
Default Re: Weapon scripting?

After the cannonball hits the time limit or an enemy, it explodes multiple times in the same spot.

Also, World scripts? Like, you place script entities in every single level?
  Reply With Quote
Old 12-15-2016, 01:11 AM   #4   Add To Ignore List  
Kleer
 
NSKuber's Avatar
 
Joined: Mar 2016
 
NSKuber is offline
Default Re: Weapon scripting?

Wouldn't it be enough to just change cannonball damage parameters (direct and explosion damage) for this effect? No scripting needed.
Or do you want the cannonball to "explode" when it pierces smaller enemies?

World scripts is when you make a script and save the .lua file to /Content/SeriousSam3/Scripts/CustomWorldScripts/ directory. This script will be automatically executed whenever a new level is loaded, you don't need to put a script entity anywhere.
  Reply With Quote
Old 12-15-2016, 06:09 AM   #5   Add To Ignore List  
ideas but no skills
 
PikaCommando's Avatar
 
Seriously! Archivist/Slave
Joined: Mar 2013
Location: In My Crawl, Crawling
 
PikaCommando is offline
Default Re: Weapon scripting?

Quote:
Originally Posted by NSKuber View Post
Wouldn't it be enough to just change cannonball damage parameters (direct and explosion damage) for this effect? No scripting needed.
Or do you want the cannonball to "explode" when it pierces smaller enemies?

World scripts is when you make a script and save the .lua file to /Content/SeriousSam3/Scripts/CustomWorldScripts/ directory. This script will be automatically executed whenever a new level is loaded, you don't need to put a script entity anywhere.
Continuously exploding but otherwise behaving the same as the Cannon is the main feature of the weapon though.

What do I need to do to connect the weapons and the codes together in the script? I've messed around a little bit in official levels before to change some model animations and enemy health, but nothing significant like coding cannonball explosion behavior. I still don't know things like the syntax and the variables or whatever you call it.
  Reply With Quote
Old 12-15-2016, 06:57 AM   #6   Add To Ignore List  
Kleer
 
NSKuber's Avatar
 
Joined: Mar 2016
 
NSKuber is offline
Default Re: Weapon scripting?

The first thing you should understand when writing world scripts is that you cannot make variables by linking (when you hold Ctrl+Alt+Shift and drag entity onto variables), because these links are a part of Scripts entity, and we have no Entity here. You use other methods, such as worldInfo:GetAllEntitiesOfClass("ClassName") to reach objects. For example, worldInfo:GetAllEntitiesOfClass("CGenericProjectil eEntity") will return an array of all projectiles currently existing in the world, and then you can operate on them. I think the best way to learn here is by looking at examples. You can find .gros of my weapon mods and examine scripts from them. Ryason's scripts (not surprisingly) also contain plenty of useful examples.
I have ideas about your cannonball (if I understood the idea correctly), we can discuss it in Steam if you would like.
  Reply With Quote
Old 12-16-2016, 09:00 AM   #7   Add To Ignore List  
Master of Kalamzoo
 
Captain_Russia's Avatar
 
Joined: Jun 2006
Location: Tropico
 
Captain_Russia is offline
Default Re: Weapon scripting?

This isn't impossible, Ryason did it too Pika.

It's just most people in SS don't know lua scripting and the engine well enough to pull it off.

For example, I made a little experiment that captures rockets fired and made them orbit around a Biowalker Major. There also was array that make the orbiting different per Rocket.
__________________
It's been an honor to be have been part of this site for so long
captainrussiacptnrss07@gmail.com

Last edited by Captain_Russia; 12-16-2016 at 09:02 AM.
  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
Enemy scripting mikecoon Serious Sam Classic Mods 28 10-23-2006 11:00 AM
IRC-scripting, anyone? The friendly newbie Off Topic Forum 6 04-11-2002 12:30 PM
Scripting Chimera Off Topic Forum 19 12-22-2001 09:01 PM


All times are GMT -4. The time now is 11:46 AM.