Scripts / Winitem

Author
Message
kahilo
9
Years of Service
User Offline
Joined: 4th Aug 2015
Location: France
Posted: 8th Aug 2015 13:42
Hello,

How a person can give an object when it dies ? There is a winitem.lua script, this is the one where we have to use ? And how ?

Thank you
K.
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 8th Aug 2015 14:17 Edited at: 8th Aug 2015 14:22
Take a look in the scriptbank folder for this script. I have it in mine. Might have been made on the forum by a community member.

But here it is if you dont have it.



Hope that helps.



As far as a character to give this to you, they are set up to be able to give the ammo when killed. Look in the properties panel for the character.

Passing something other then a weapon you will need to spawn that upon the death of the character and assign it the pickup script.

This will be a scripting solution and I am going to move this thread there, so it can get the attention it needs.
Thanks.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit

kahilo
9
Years of Service
User Offline
Joined: 4th Aug 2015
Location: France
Posted: 10th Aug 2015 09:18
Hello,

I do not have this script among those of the software. What name is it?

I copy / paste the script in a file in etenregistré scriptbank with loot.lua name. But it generates an error message when I run the test of the game.
How do I use this script?

Regarding the parameters of "Take Weapon Ammo's" it seems to work only with armed figures. I tried with the zombie but it does not. Or I did not understand everything (...).

Thank you
K.
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 10th Aug 2015 11:39 Edited at: 10th Aug 2015 11:54
Quote: "How a person can give an object when it dies ? "


I had tried using "Slow Zombie 1", he use "ai_zombiewalk.lua" script, and "key" .
I did some modification to the scritp as follow:



Notice IE: "Collected(2)", is because in my map the key id (number) is = 2. So if your item is = 5, then change 2 by 5, so it'll looks as follow:
Notice too the item (key) should be place on map, if you do not want player grabbing the key with out kill the zombie before, so hide it, IE: inside non wallkable house.

Quote: "Collected(5)
Destroy(5)
ActivateIfUsed(5)"


In action



hth

PS: I missed something important here: Please, make file backup, bfore do nothing. Or rename script as "ai_zombiewalk1.lua" for example.
If so, you'll need change "init" and "main" statement in script too.

3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 8.1 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM
kahilo
9
Years of Service
User Offline
Joined: 4th Aug 2015
Location: France
Posted: 12th Aug 2015 18:46
Hello,

1) I copied the code in "ai_zombiewalk.lua".
2) I have saved and renamed the file "ai_zombiewalk2.lua".
3) I put the key on the map and named "2".
4) I attributed the script "ai_zombiewalk2.lua" at zombie.

But I do not know what to do with "init" and "hand". What do I have to change?

Thank you
K.
Pirate Myke
Forum Support
14
Years of Service
User Offline
Joined: 31st May 2010
Location: El Dorado, California
Posted: 12th Aug 2015 20:35
If a script file is called winitem.lua
Then name the init and main as follows:
function winitem_init(e)

function winitem_main(e)

If the script file name is ai_zombiewalk2.lua
Then name the init and main as follows:
function ai_zombiewalk2_init(e)

function ai_zombiewalk2_main(e)

This will prevent the LUA error that you are seeing before the game starts.
Intel(R) Core(TM)2 Quad CPU Q6600 @ 2.40GHz, 2400 Mhz, 4 Core(s), 4 Logical Processor(s), 8gb RAM, Nvidia gtx660, Windows 7 Pro 64bit

kahilo
9
Years of Service
User Offline
Joined: 4th Aug 2015
Location: France
Posted: 13th Aug 2015 11:19
Hello,

So I just renamed correctly. The script file: ai_give_item.lua
Then the script I replaced the "functions like this:

ai_give_item_init function (e)
ai_give_item_main function (e)
ai_give_item_exit function (e)

The error mesage do not appears, but the zombie disappears after being killed and the key remains on the table.

Here's the code :



Thank you
K.
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 13th Aug 2015 14:08
OK, lets go step by step.

1- What zombie are you using for?
I suggest above the zombie named "Slow Zombie 1", this is a stock one, look into "Entitybank>characters>zombies", and place him onto your map.

2- Select zombie in editor, and go to his properties, once there:

a- Please refer to my video and see how I state properties, and do the same with your zombie.

this is the complete script you has to attach to you zombie.



Copy & paste into notepad or whatever you want, and save it onto your "scripbank" folder.

Properties have one field labeled "Main", click and search for script named "ai_zombiewalk2.lua" or whatever you do, and attach it to your zombie, just click ok.

I high recommended you firts follow all steps as is. When you get it working, so study step by step all the script, try to understand who is doing what, in another words what piece of code, gives the key to the player.
When you feel confortable with, so change script name, add features, or something other, if you want. Try and error, sometimes is the best here.

Please see the video slowly, so you will discover news things than perhaps you has missed before, and Voila!!!

If you've any question, feel free for do it, somebody here, even myself can answer to you.

3com


Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 8.1 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM
kahilo
9
Years of Service
User Offline
Joined: 4th Aug 2015
Location: France
Posted: 14th Aug 2015 14:51 Edited at: 14th Aug 2015 14:56
Hello,

So I generated a new map. And all worked !! Then I brought some more. Finally, here are the steps I did:

1) Copy / paste the script.
2) Sauveager scipt in the "scriptbanck" with the name "ai_zombiewalk2.lua".
3) Located on the map: the "slow zombie1", a table, a key, a door and Player Strat.
4) Parameter zombie: Main = "ai_zombiewalk2.lua".
5) Setting the key: Static Mode = Yes and Name = key1.
6) Setting the door: User Key = key1.

Result:
- I kill the zombie.
- I got the key "he had on him."
- She disappears from the table.
- I open the door.

Then I reproduces all the steps in my game ... But it did not work, it's the zombie that disappeared when I killed him and left the key on the table.

So I started the same steps on a new test map. And since I have full of anomalies during testing:

- The zombie that disappears when I kill him.
- The table does not appear in the test.
- The key is collected but does not disappear from the table.
- The collected key no longer opens the door.

I restarted my pc and even GameGuru. But it is still not working. I do not know what to do anymore. It's hopeless ...

Here's a video where everything works :
https://youtu.be/QrnbGDK-N7g

Then another where nothing works :
https://youtu.be/F-T_xMDYyA4



Thank you
K.
Inertia
9
Years of Service
User Offline
Joined: 12th Jul 2015
Location: SoCal, USA
Posted: 14th Aug 2015 15:04
kahilo wrote: "So I started the same steps on a new test map."


When you start a new map you need to determine the entity's ID number because it will likely be different now. You do this by hovering over the entity whilst in the editor and checking the number on the status bar at the bottom of your screen. Hope this helps.
Windows 7 (x64) | i5-2500K @ 3.30 GHz | 4GB RAM | GTX580 1.5 GB
PM
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 14th Aug 2015 17:38
Quote: "5) Setting the key: Static Mode = Yes "


If you want an entity running its script, it should be dynamic.

5) Setting the key: Static Mode = No

3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM
kahilo
9
Years of Service
User Offline
Joined: 4th Aug 2015
Location: France
Posted: 14th Aug 2015 17:48
OK, I begin to understand. I found the key identifier in the bar (Entity: [{70005} 5]). I changed the script with this number.



It works now.

But then the script can only be used for one Entity only? If I want to use it in another level or in another game, I have to use a copy of the script and change each time? That's it ?

Thank you
K.
3com
10
Years of Service
User Offline
Joined: 18th May 2014
Location: Catalonia
Posted: 15th Aug 2015 18:36
Right.
You have to change entity id, in any way you've to say to the engine, which entity you are refferring to.
Later, when you get better the point, learn a bit of LUA, so you can change it yourself, and perhaps bypass this statement, who knows.

3com
Laptop: Lenovo - Intel(R) Celeron(R) CPU 1005M @ 1.90GHz

OS: Windows 10 (64) - Ram: 4 gb - Hd: 283 gb - Video card: Intel(R) HD Graphics

PM
kahilo
9
Years of Service
User Offline
Joined: 4th Aug 2015
Location: France
Posted: 16th Aug 2015 08:13
Hello,

Indeed, knowing LUA greatly simplify. The only code I manipulates is the html and css (amateur) ... I started to put my nose in LUA ...

But for the moment the script is very sufficient and perfectly meets my needs to my discovery of GameGuru ...

A big thank you to all of you

Login to post a reply

Server time is: 2024-12-22 05:05:04
Your offset time is: 2024-12-22 05:05:04