View unanswered posts | View active topics It is currently Fri May 17, 2024 12:41 pm



Reply to topic  [ 140 posts ]  Go to page Previous  1 ... 5, 6, 7, 8, 9, 10  Next
 Quick Console Commands 
Author Message
User avatar

Joined: Tue Nov 06, 2007 6:58 am
Posts: 2054
Reply with quote
Post Re: Quick Console Commands
Isn't it possible to check if an MO is an attachable?


Wed Jan 14, 2009 5:15 am
Profile
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3138
Location: A little south and a lot west of Moscow
Reply with quote
Post Re: Quick Console Commands
Code:
if x.ClassName = "Attachable"...

That should pretty much do it. I don't see what that would help with though.


Wed Jan 14, 2009 5:21 am
Profile WWW
Data Realms Elite
Data Realms Elite
User avatar

Joined: Wed Sep 05, 2007 4:14 am
Posts: 3966
Location: Canadida
Reply with quote
Post Re: Quick Console Commands
Is it possible to change your current actor's value.

Like you change a Dummy with a Pistol, into a 50 foot long Laser Tiger Dragon... with Pistol ( keeps the Pistol ) .


Wed Jan 14, 2009 7:55 am
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: Quick Console Commands
No, because your current actor cannot be modified.

Traditional modding exists that would enable you to switch from one to the other, but the original in such a switch would have to be killed/deleted. You cannot simply "upgrade" an actor midgame.


Sat Jan 17, 2009 12:55 am
Profile
Data Realms Elite
Data Realms Elite
User avatar

Joined: Wed Sep 05, 2007 4:14 am
Posts: 3966
Location: Canadida
Reply with quote
Post Re: Quick Console Commands
Grif wrote:
No, because your current actor cannot be modified.

Traditional modding exists that would enable you to switch from one to the other, but the original in such a switch would have to be killed/deleted. You cannot simply "upgrade" an actor midgame.

Well, just add some more pixie dust and then it'll work.

Now to wait for the next build ( 23 is it? )


Sat Jan 17, 2009 5:00 am
Profile
User avatar

Joined: Fri Mar 02, 2007 6:59 am
Posts: 1726
Location: NSW, Australia
Reply with quote
Post Re: Quick Console Commands
When pasting in code, have it appear in the type area (so you have to hit enter) instead of just running it straight away.


Sat Jan 24, 2009 7:39 am
Profile

Joined: Sat Feb 03, 2007 7:11 pm
Posts: 1496
Reply with quote
Post Re: Quick Console Commands
Code:
    if (self.GameStart == 0) and MovableMan:IsActor(Starter) then
        self.GameStart = 1;
        SwitchToActor(Starter, Starter, self:GetTeamOfPlayer(Starter));
    end


I try doing this in the middle of the game, but it won't do the switch.

I'm not entirely sure how the "Switch to Actor" thing works, so if that could be explained, thanks.


Wed Jan 28, 2009 12:59 am
Profile WWW
User avatar

Joined: Fri Apr 27, 2007 4:55 pm
Posts: 1178
Location: America!
Reply with quote
Post Re: Quick Console Commands
I would try messing around with "ActivityMan:GetActivity():SetViewState(something)"

Alternatively:

ActivityMan:GetActivity():GetControlledActor(0):SetControllerMode(Controller.CPU)

In combinating with SwitchToActor


Wed Jan 28, 2009 2:26 am
Profile
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3138
Location: A little south and a lot west of Moscow
Reply with quote
Post Re: Quick Console Commands
zalo wrote:
Code:
    if (self.GameStart == 0) and MovableMan:IsActor(Starter) then
        self.GameStart = 1;
        SwitchToActor(Starter, Starter, self:GetTeamOfPlayer(Starter));
    end


I try doing this in the middle of the game, but it won't do the switch.

I'm not entirely sure how the "Switch to Actor" thing works, so if that could be explained, thanks.

Two things that might help:
First of all, SwitchToActor should be self:SwitchToActor.
Secondly, for whatever reason, the lua engine doesn't like to let you do things involving actors until 5-10 frames into the game. Try checking if the game is 10 frames in before doing that.


Wed Jan 28, 2009 4:52 am
Profile WWW

Joined: Sat Feb 03, 2007 7:11 pm
Posts: 1496
Reply with quote
Post Re: Quick Console Commands
You can take a look at the scene yourself. I don't know what all this "self" business is about, but I tried it.

The game is supposed to start and you are switched to the Robot 1. When the Robot 2 dies it is supposed to switch you to a coalition guy who is spawned somewhere off screen.

Only the switching and the Gibbing does not work. :(


Wed Jan 28, 2009 4:18 pm
Profile WWW

Joined: Sat Jun 16, 2007 8:04 pm
Posts: 42
Reply with quote
Post Re: Quick Console Commands
zalo wrote:
You can take a look at the scene yourself. I don't know what all this "self" business is about, but I tried it.

The game is supposed to start and you are switched to the Robot 1. When the Robot 2 dies it is supposed to switch you to a coalition guy who is spawned somewhere off screen.

Only the switching and the Gibbing does not work. :(


I PM'd you fix for your code with all the details, since it was kinda offtopic. In case you didn't get it, i put the whole script here: http://pastebin.com/m4bd0ea07

Back to topic:
Did people run out of ideas for fun console commands? Here is my rather boring contribution compared to the other scripts, attached. It adds X number of items to actor's inventory that you are currently controlling. The items are randomly selected from HDFirearms, TDExplosives and HeldDevices (vanilla stuff) (biased towards HDFirearms, TDExplosives and then the shield, in that order from highest chance to lowest chance).

How quick this is to use, depends on how you use it. I don't recommend pasting or typing :)
To use, put the txt file into your Cortex Command directory and then type into console: gri=loadfile("giverandomitem.txt"). It loads the contents of the file as a function with variable number of arguments. You can then call it like this for example, type into console: gri(3)

Simple, right? This command then adds 3 randomly selected items to your actors inventory that you are controlling. You don't have to give the argument, in which case it defaults to giving 2 items. So it's also possible to use it by typing into console: dofile("giverandomitem.txt"). But you have to do this every time you want to use it. Loadfile needs to be done only once, and has the benefit that you can choose how many items you want.
This might be useful if you want to use this in your own scene scripts or something else, saves you the typing of item tables ;)
(If you paste this into your script, and call the function from inside the script, just remember to remove the comment hyphens from function definition and the last "end", as well as add your argument variables into function definition and replace the variable argument table (args={...}) with your defined argument variables if you don't use it as a vararg function).

Keep those fun scripts coming. This is a great thread.


Thu Feb 12, 2009 9:46 am
Profile

Joined: Sat Feb 03, 2007 7:11 pm
Posts: 1496
Reply with quote
Post Ok, I think this is the last request... Maybe...
Thanks, that worked great! Just as I had expected!

Ok, here's my second problem.

Code:
    SpawnTimer = Timer();
    Round1 = 0

function Round1()
        if SpawnTimer == 300 then
        ship = CreateACRocket("DropShip MK1");
   Enemy = CreateAHuman( "Soldier Light" , "Base.rte" )
    local gun = CreateHDFirearm("Pistol");
   Enemy:AddInventoryItem(gun);
   Enemy.Team = 0
   Enemy.Health = 25
   Enemy:AddAIWaypoint(Fighter1.Pos)
   Enemy.AIMODE = 3
   ship:AddInventoryItem(Enemy);
   ship.Team = 0
   Shipos = Vector();
   Shipos:SetXY((math.random(Fighter1.Pos - 640, Fighter1.Pos + 640)),-500);
   ship.Pos = Shipos;
   MovableMan:AddActor(ship);
   SpawnTimer:Reset()
        end
end

    if (self.GameStart == 0) and (not (MovableMan:IsActor(Activator))) then
        Round1 = 1;
    end

    if Round1 == 1 then
   function Round1()
    end


I removed all the unnecessary code in between to shorten the post. What have I done wrong?
The function never executes even after I killed the activator. The battle never starts :( .

I'm trying to make some sort of fun Arena. Like when you kill your opponent(s)
it instantly teleports you to another part of the map, and a new battle.


Thu Feb 12, 2009 5:00 pm
Profile WWW
DRL Developer
DRL Developer
User avatar

Joined: Wed Dec 13, 2006 5:27 am
Posts: 3138
Location: A little south and a lot west of Moscow
Reply with quote
Post Re: Quick Console Commands
Try replacing (not (MovableMan:IsActor(Activator))) with MovableMan:IsActor(Activator) == false.
On another note, there are still plenty of other fun console commands I can think of.
Code:
for actor in MovableMan.Actors do if actor.Team == 1 then x = actor end end; ActivityMan:GetActivity():SwitchToActor(x,0,1);

Impersonation is fun :D


Thu Feb 12, 2009 6:41 pm
Profile WWW

Joined: Sat Feb 03, 2007 7:11 pm
Posts: 1496
Reply with quote
Post Re: Quick Console Commands
Thanks for trying TheLastBanana, but it doesn't seem to work.

Man, I'm so bad at Lua that I can't even write a simple console command.
Code:
side = Vector(); do side:SetXY(-100,0) end; SceneMan.Scene.GlobalAcceleration = Side;


Last edited by zalo on Sat Feb 14, 2009 1:37 am, edited 1 time in total.



Fri Feb 13, 2009 1:47 am
Profile WWW
User avatar

Joined: Sun May 18, 2008 8:30 am
Posts: 732
Reply with quote
Post Re: Quick Console Commands
That reminds me. I want a command that makes all actors zero gravity.


Fri Feb 13, 2009 2:02 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 140 posts ]  Go to page Previous  1 ... 5, 6, 7, 8, 9, 10  Next

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.026s | 12 Queries | GZIP : Off ]